From 7fcf1cffae45b0dd614a9b8a1b17f4d8f44a823e Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Thu, 14 Jul 2011 17:02:43 +0400 Subject: [PATCH] Fix spurious "stream properties changed" with --seek option on some inputs --- filters/video/resize.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/filters/video/resize.c b/filters/video/resize.c index 1917f67b..daed2d65 100644 --- a/filters/video/resize.c +++ b/filters/video/resize.c @@ -65,6 +65,7 @@ typedef struct 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; @@ -395,13 +396,13 @@ static int x264_init_sws_context( resizer_hnd_t *h ) 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 ) @@ -502,7 +503,7 @@ static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x2 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; } @@ -524,8 +525,9 @@ static int get_frame( hnd_t handle, cli_pic_t *output, int frame ) 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 ) -- 2.47.3