]> git.sesse.net Git - x264/commitdiff
Fix spurious "stream properties changed" with --seek option on some inputs
authorAnton Mitrofanov <BugMaster@narod.ru>
Thu, 14 Jul 2011 13:02:43 +0000 (17:02 +0400)
committerFiona Glaser <fiona@x264.com>
Mon, 18 Jul 2011 16:16:35 +0000 (09:16 -0700)
filters/video/resize.c

index 1917f67b70d476ff241981f33525157deb826237..daed2d656973341fad4618491692d4263b489c97 100644 (file)
@@ -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 )