int pre_swap_chroma;
int post_swap_chroma;
int variable_input; /* input is capable of changing properties */
+ int working; /* we have already started working with frames */
frame_prop_t dst; /* desired output properties */
frame_prop_t scale; /* properties of the SwsContext input */
} resizer_hnd_t;
return sws_init_context( h->ctx, NULL, NULL ) < 0;
}
-static int check_resizer( resizer_hnd_t *h, cli_pic_t *in, int frame )
+static int check_resizer( resizer_hnd_t *h, cli_pic_t *in )
{
frame_prop_t input_prop = { in->img.width, in->img.height, convert_csp_to_pix_fmt( in->img.csp ) };
if( !memcmp( &input_prop, &h->scale, sizeof(frame_prop_t) ) )
return 0;
/* also warn if the resizer was initialized after the first frame */
- if( h->ctx || frame )
+ if( h->ctx || h->working )
x264_cli_log( NAME, X264_LOG_WARNING, "stream properties changed at pts %"PRId64"\n", in->pts );
h->scale = input_prop;
if( !h->buffer_allocated )
if( !h->variable_input )
{
cli_pic_t input_pic = {{info->csp, info->width, info->height, 0}, 0};
- if( check_resizer( h, &input_pic, 0 ) )
+ if( check_resizer( h, &input_pic ) )
return -1;
}
resizer_hnd_t *h = handle;
if( h->prev_filter.get_frame( h->prev_hnd, output, frame ) )
return -1;
- if( h->variable_input && check_resizer( h, output, frame ) )
+ if( h->variable_input && check_resizer( h, output ) )
return -1;
+ h->working = 1;
if( h->pre_swap_chroma )
XCHG( uint8_t*, output->img.plane[1], output->img.plane[2] );
if( h->ctx )