]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/video.c
Try to fix compilation with older ffmpeg version.
[vlc] / modules / codec / avcodec / video.c
index 2c9c8313bc93a762c3ce7b05826432e6fc319d47..1c2a2efc8eaa73d6279458041dcf17e0cfe0d206 100644 (file)
@@ -228,6 +228,9 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     if( val.i_int > 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY;
     if( val.i_int > 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL;
 
+    bool b_fast = var_CreateGetBool( p_dec, "ffmpeg-fast" );
+    if( b_fast ) p_sys->p_context->flags2 |= CODEC_FLAG2_FAST;
+
     /* ***** ffmpeg frame skipping ***** */
     var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Get( p_dec, "ffmpeg-hurry-up", &val );
@@ -292,6 +295,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
         p_sys->p_context->pix_fmt != PIX_FMT_YUV422P &&
         /* H264 uses too many reference frames */
         p_sys->i_codec_id != CODEC_ID_H264 &&
+        /* No idea why ... but this fixes flickering on some TSCC streams */
+        p_sys->i_codec_id != CODEC_ID_TSCC &&
         !p_sys->p_context->debug_mv )
     {
         /* Some codecs set pix_fmt only after the 1st frame has been decoded,
@@ -500,8 +505,13 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
     }
     else if( !b_drawpicture )
     {
-        p_sys->p_context->skip_frame = __MAX( p_sys->p_context->skip_frame,
-                                              AVDISCARD_NONREF );
+        /* It creates broken picture
+         * FIXME either our parser or ffmpeg is broken */
+#if 0
+        if( p_sys->b_hurry_up )
+            p_sys->p_context->skip_frame = __MAX( p_sys->p_context->skip_frame,
+                                                  AVDISCARD_NONREF );
+#endif
     }
 
     /*
@@ -936,10 +946,7 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
     p_ff_pic->linesize[2] = p_pic->p[2].i_pitch;
     p_ff_pic->linesize[3] = 0;
 
-    if( p_ff_pic->reference != 0 )
-    {
-        decoder_LinkPicture( p_dec, p_pic );
-    }
+    decoder_LinkPicture( p_dec, p_pic );
 
     /* FIXME what is that, should give good value */
     p_ff_pic->age = 256*256*256*64; // FIXME FIXME from ffmpeg
@@ -1003,7 +1010,6 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
                                     AVFrame *p_ff_pic )
 {
     decoder_t *p_dec = (decoder_t *)p_context->opaque;
-    picture_t *p_pic;
 
     if( !p_ff_pic->opaque )
     {
@@ -1011,17 +1017,13 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
         return;
     }
 
-    p_pic = (picture_t*)p_ff_pic->opaque;
+    picture_t *p_pic = (picture_t*)p_ff_pic->opaque;
+    decoder_UnlinkPicture( p_dec, p_pic );
 
     p_ff_pic->data[0] = NULL;
     p_ff_pic->data[1] = NULL;
     p_ff_pic->data[2] = NULL;
     p_ff_pic->data[3] = NULL;
-
-    if( p_ff_pic->reference != 0 )
-    {
-        decoder_UnlinkPicture( p_dec, p_pic );
-    }
 }
 
 static void ffmpeg_NextPts( decoder_t *p_dec )