[FFmpeg-devel] [PATCH v3 8/9] lavc/libopenh264enc: allow specifying the profile through AVCodecContext

Linjie Fu linjie.fu at intel.com
Sat Apr 11 13:03:38 EEST 2020


Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 libavcodec/libopenh264enc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 3a205b7..df2d6ee 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -119,6 +119,22 @@ static av_cold int svc_encode_init_profile(AVCodecContext *avctx, SEncParamExt *
 {
     SVCContext *s = avctx->priv_data;
 
+    /* Allow specifying the libopenh264 profile through AVCodecContext. */
+    if (FF_PROFILE_UNKNOWN == s->profile &&
+        FF_PROFILE_UNKNOWN != avctx->profile)
+        switch (avctx->profile) {
+        case FF_PROFILE_H264_CONSTRAINED_BASELINE:
+            s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
+            break;
+        case FF_PROFILE_H264_HIGH:
+            s->profile = FF_PROFILE_H264_HIGH;
+            break;
+        default:
+            av_log(avctx, AV_LOG_WARNING,
+                   "Unsupported avctx->profile: %d.\n", avctx->profile);
+            break;
+        }
+
     if (s->profile == FF_PROFILE_UNKNOWN)
         s->profile = s->cabac ? FF_PROFILE_H264_HIGH :
                                 FF_PROFILE_H264_CONSTRAINED_BASELINE;
-- 
2.7.4



More information about the ffmpeg-devel mailing list