diff mbox series

[FFmpeg-devel,09/10] lavc/libopenh264enc: allow specifying the profile through AVCodecContext

Message ID 1586171693-7836-10-git-send-email-linjie.fu@intel.com
State Superseded
Headers show
Series Patch set for the enhancement of libopenh264 encoder | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Fu, Linjie April 6, 2020, 11:14 a.m. UTC
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavcodec/libopenh264enc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index d331cfd..70ded55 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -111,6 +111,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;