[vlc-devel] [PATCH] vaapi: use ffmpeg context to read the codec profile

Mathieu Velten matmaul at gmail.com
Tue Dec 26 15:21:43 CET 2017


Sometimes the profile is not available in the container metadatas (WebM).
---
 modules/codec/avcodec/vaapi.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index ee7fdf8..ffe537e 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -87,9 +87,9 @@ static int GetVaProfile(AVCodecContext *ctx, const es_format_t *fmt,
         count = 18;
         break;
     case AV_CODEC_ID_HEVC:
-        if (fmt->i_profile == FF_PROFILE_HEVC_MAIN)
+        if (ctx->profile == FF_PROFILE_HEVC_MAIN)
             i_profile = VAProfileHEVCMain;
-        else if (fmt->i_profile == FF_PROFILE_HEVC_MAIN_10)
+        else if (ctx->profile == FF_PROFILE_HEVC_MAIN_10)
         {
             i_profile = VAProfileHEVCMain10;
             i_vlc_chroma = VLC_CODEC_VAAPI_420_10BPP;
@@ -103,11 +103,14 @@ static int GetVaProfile(AVCodecContext *ctx, const es_format_t *fmt,
         count = 5;
         break;
     case AV_CODEC_ID_VP9:
-        if (fmt->i_profile == FF_PROFILE_VP9_0)
+        if (ctx->profile == FF_PROFILE_VP9_0)
             i_profile = VAProfileVP9Profile0;
 #if VA_CHECK_VERSION( 0, 39, 0 )
-        else if (fmt->i_profile == FF_PROFILE_VP9_2)
+        else if (ctx->profile == FF_PROFILE_VP9_2)
+        {
             i_profile = VAProfileVP9Profile2;
+            i_vlc_chroma = VLC_CODEC_VAAPI_420_10BPP;
+        }
 #endif
         else
             return VLC_EGENERIC;
-- 
2.14.3



More information about the vlc-devel mailing list