[FFmpeg-devel] [PATCH 1/4] avcodec/proresdec2: change profile only if it is unknown

Paul B Mahol onemda at gmail.com
Wed Dec 5 22:22:48 EET 2018


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/proresdec2.c | 51 ++++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 8581d797fb..80a76bbba1 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -140,32 +140,35 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     avctx->bits_per_raw_sample = 10;
 
-    switch (avctx->codec_tag) {
-    case MKTAG('a','p','c','o'):
-        avctx->profile = FF_PROFILE_PRORES_PROXY;
-        break;
-    case MKTAG('a','p','c','s'):
-        avctx->profile = FF_PROFILE_PRORES_LT;
-        break;
-    case MKTAG('a','p','c','n'):
-        avctx->profile = FF_PROFILE_PRORES_STANDARD;
-        break;
-    case MKTAG('a','p','c','h'):
-        avctx->profile = FF_PROFILE_PRORES_HQ;
-        break;
-    case MKTAG('a','p','4','h'):
-        avctx->profile = FF_PROFILE_PRORES_4444;
-        avctx->bits_per_raw_sample = 12;
-        break;
-    case MKTAG('a','p','4','x'):
-        avctx->profile = FF_PROFILE_PRORES_XQ;
-        avctx->bits_per_raw_sample = 12;
-        break;
-    default:
-        avctx->profile = FF_PROFILE_UNKNOWN;
-        av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", avctx->codec_tag);
+    if (avctx->profile == FF_PROFILE_UNKNOWN) {
+        switch (avctx->codec_tag) {
+        case MKTAG('a','p','c','o'):
+            avctx->profile = FF_PROFILE_PRORES_PROXY;
+            break;
+        case MKTAG('a','p','c','s'):
+            avctx->profile = FF_PROFILE_PRORES_LT;
+            break;
+        case MKTAG('a','p','c','n'):
+            avctx->profile = FF_PROFILE_PRORES_STANDARD;
+            break;
+        case MKTAG('a','p','c','h'):
+            avctx->profile = FF_PROFILE_PRORES_HQ;
+            break;
+        case MKTAG('a','p','4','h'):
+            avctx->profile = FF_PROFILE_PRORES_4444;
+            break;
+        case MKTAG('a','p','4','x'):
+            avctx->profile = FF_PROFILE_PRORES_XQ;
+            break;
+        default:
+            av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", avctx->codec_tag);
+        }
     }
 
+    if (avctx->profile == FF_PROFILE_PRORES_XQ ||
+        avctx->profile == FF_PROFILE_PRORES_4444)
+        avctx->bits_per_raw_sample = 12;
+
     if (avctx->bits_per_raw_sample == 10) {
         av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 10b decoding based on codec tag");
     } else { /* 12b */
-- 
2.17.1



More information about the ffmpeg-devel mailing list