[vlc-devel] [RFC PATCH 03/10] avcodec: don't use va if hwaccel is disabled

Thomas Guillem thomas at gllm.fr
Thu Apr 21 11:53:37 CEST 2016


---
 modules/codec/avcodec/video.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index a97fec2..d102d03 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1188,17 +1188,20 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
     enum PixelFormat swfmt = avcodec_default_get_format(p_context, pi_fmt);
     bool can_hwaccel = false;
 
-    for( size_t i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++ )
+    if( decoder_ShouldHWAccel( p_dec ) )
     {
-        const AVPixFmtDescriptor *dsc = av_pix_fmt_desc_get(pi_fmt[i]);
-        if (dsc == NULL)
-            continue;
-        bool hwaccel = (dsc->flags & AV_PIX_FMT_FLAG_HWACCEL) != 0;
-
-        msg_Dbg( p_dec, "available %sware decoder output format %d (%s)",
-                 hwaccel ? "hard" : "soft", pi_fmt[i], dsc->name );
-        if (hwaccel)
-            can_hwaccel = true;
+        for( size_t i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++ )
+        {
+            const AVPixFmtDescriptor *dsc = av_pix_fmt_desc_get(pi_fmt[i]);
+            if (dsc == NULL)
+                continue;
+            bool hwaccel = (dsc->flags & AV_PIX_FMT_FLAG_HWACCEL) != 0;
+
+            msg_Dbg( p_dec, "available %sware decoder output format %d (%s)",
+                     hwaccel ? "hard" : "soft", pi_fmt[i], dsc->name );
+            if (hwaccel)
+                can_hwaccel = true;
+        }
     }
 
     /* If the format did not actually change (e.g. seeking), try to reuse the
-- 
2.8.0.rc3



More information about the vlc-devel mailing list