]> git.sesse.net Git - vlc/commitdiff
Disabled frame threaded decoding when ffmpeg-hw is enabled and might be used.
authorLaurent Aimar <fenrir@videolan.org>
Sat, 4 Jun 2011 20:59:49 +0000 (22:59 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 5 Jun 2011 14:25:21 +0000 (16:25 +0200)
It allows to use hw decoding (whereas it was always disabled).
It workaround a bug in ffmpeg/libav.

modules/codec/avcodec/video.c

index 38e79643e8cc2bfc319d67253cd0cb42d832e88a..5b13a5ad8bf941251e1e219d6371614cbc22679b 100644 (file)
@@ -343,13 +343,18 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
 
 #ifdef HAVE_AVCODEC_VA
     const bool b_use_hw = var_CreateGetBool( p_dec, "ffmpeg-hw" );
-    if( b_use_hw )
+    if( b_use_hw &&
+        (i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO ||
+         i_codec_id == CODEC_ID_MPEG4 ||
+         i_codec_id == CODEC_ID_H264 ||
+         i_codec_id == CODEC_ID_VC1 || i_codec_id == CODEC_ID_WMV3) )
     {
-#ifdef HAVE_AVCODEC_MT
-        msg_Err( p_dec, "ffmpeg-hw is not compatible with ffmpeg-mt" );
-#else
+        if( p_sys->p_context->thread_type & FF_THREAD_FRAME )
+        {
+            msg_Warn( p_dec, "threaded frame decoding is not compatible with ffmpeg-hw, disabled" );
+            p_sys->p_context->thread_type &= ~FF_THREAD_FRAME;
+        }
         p_sys->p_context->get_format = ffmpeg_GetFormat;
-#endif
     }
 #endif