[FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define

Zhao Zhili quinkblack at foxmail.com
Fri Jun 9 14:14:54 EEST 2023


From: Zhao Zhili <zhilizhao at tencent.com>

Use FF_PROFILE_UNKNOWN as auto mode.
---
 libavcodec/videotoolboxenc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 26485a3dea..9f65519700 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -206,7 +206,6 @@ static void loadVTEncSymbols(void){
     GET_SYM(kVTCompressionPropertyKey_MinAllowedFrameQP, "MinAllowedFrameQP");
 }
 
-#define AUTO_PROFILE 0
 #define H264_PROFILE_CONSTRAINED_HIGH (FF_PROFILE_H264_HIGH | FF_PROFILE_H264_CONSTRAINED)
 
 typedef enum VTH264Entropy{
@@ -737,7 +736,7 @@ static bool get_vt_h264_profile_level(AVCodecContext *avctx,
     VTEncContext *vtctx = avctx->priv_data;
     int profile = vtctx->profile;
 
-    if (profile == AUTO_PROFILE && vtctx->level) {
+    if (profile == FF_PROFILE_UNKNOWN && vtctx->level) {
         //Need to pick a profile if level is not auto-selected.
         profile = vtctx->has_b_frames ? FF_PROFILE_H264_MAIN : FF_PROFILE_H264_BASELINE;
     }
@@ -745,7 +744,7 @@ static bool get_vt_h264_profile_level(AVCodecContext *avctx,
     *profile_level_val = NULL;
 
     switch (profile) {
-        case AUTO_PROFILE:
+        case FF_PROFILE_UNKNOWN:
             return true;
 
         case FF_PROFILE_H264_BASELINE:
@@ -869,7 +868,7 @@ static bool get_vt_hevc_profile_level(AVCodecContext *avctx,
     *profile_level_val = NULL;
 
     switch (profile) {
-        case AUTO_PROFILE:
+        case FF_PROFILE_UNKNOWN:
             return true;
         case FF_PROFILE_HEVC_MAIN:
             *profile_level_val =
@@ -2891,7 +2890,7 @@ static const enum AVPixelFormat prores_pix_fmts[] = {
 
 #define OFFSET(x) offsetof(VTEncContext, x)
 static const AVOption h264_options[] = {
-    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" },
+    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, INT_MAX, VE, "profile" },
     { "baseline",             "Baseline Profile",             0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE             }, INT_MIN, INT_MAX, VE, "profile" },
     { "constrained_baseline", "Constrained Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_CONSTRAINED_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
     { "main",                 "Main Profile",                 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN                 }, INT_MIN, INT_MAX, VE, "profile" },
@@ -2948,7 +2947,7 @@ const FFCodec ff_h264_videotoolbox_encoder = {
 };
 
 static const AVOption hevc_options[] = {
-    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" },
+    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, INT_MAX, VE, "profile" },
     { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_HEVC_MAIN    }, INT_MIN, INT_MAX, VE, "profile" },
     { "main10",   "Main10 Profile",   0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, VE, "profile" },
 
-- 
2.40.1



More information about the ffmpeg-devel mailing list