avcodec/videotoolboxenc: add H264 Extended profile and level

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
This commit is contained in:
Limin Wang 2019-08-20 19:04:29 +08:00 committed by Rick Kern
parent 6966548c1b
commit 57951f3019
1 changed files with 14 additions and 0 deletions

View File

@ -80,6 +80,8 @@ static struct{
CFStringRef kVTProfileLevel_H264_High_5_1; CFStringRef kVTProfileLevel_H264_High_5_1;
CFStringRef kVTProfileLevel_H264_High_5_2; CFStringRef kVTProfileLevel_H264_High_5_2;
CFStringRef kVTProfileLevel_H264_High_AutoLevel; CFStringRef kVTProfileLevel_H264_High_AutoLevel;
CFStringRef kVTProfileLevel_H264_Extended_5_0;
CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel; CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel; CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
@ -137,6 +139,8 @@ static void loadVTEncSymbols(){
GET_SYM(kVTProfileLevel_H264_High_5_1, "H264_High_5_1"); GET_SYM(kVTProfileLevel_H264_High_5_1, "H264_High_5_1");
GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2"); GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2");
GET_SYM(kVTProfileLevel_H264_High_AutoLevel, "H264_High_AutoLevel"); GET_SYM(kVTProfileLevel_H264_High_AutoLevel, "H264_High_AutoLevel");
GET_SYM(kVTProfileLevel_H264_Extended_5_0, "H264_Extended_5_0");
GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel, "H264_Extended_AutoLevel");
GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel, "HEVC_Main_AutoLevel"); GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel, "HEVC_Main_AutoLevel");
GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel, "HEVC_Main10_AutoLevel"); GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel, "HEVC_Main10_AutoLevel");
@ -154,6 +158,7 @@ typedef enum VT_H264Profile {
H264_PROF_BASELINE, H264_PROF_BASELINE,
H264_PROF_MAIN, H264_PROF_MAIN,
H264_PROF_HIGH, H264_PROF_HIGH,
H264_PROF_EXTENDED,
H264_PROF_COUNT H264_PROF_COUNT
} VT_H264Profile; } VT_H264Profile;
@ -708,6 +713,14 @@ static bool get_vt_h264_profile_level(AVCodecContext *avctx,
compat_keys.kVTProfileLevel_H264_High_5_2; break; compat_keys.kVTProfileLevel_H264_High_5_2; break;
} }
break; break;
case H264_PROF_EXTENDED:
switch (vtctx->level) {
case 0: *profile_level_val =
compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
case 50: *profile_level_val =
compat_keys.kVTProfileLevel_H264_Extended_5_0; break;
}
break;
} }
if (!*profile_level_val) { if (!*profile_level_val) {
@ -2535,6 +2548,7 @@ static const AVOption h264_options[] = {
{ "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" }, { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
{ "main", "Main Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_MAIN }, INT_MIN, INT_MAX, VE, "profile" }, { "main", "Main Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_MAIN }, INT_MIN, INT_MAX, VE, "profile" },
{ "high", "High Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_HIGH }, INT_MIN, INT_MAX, VE, "profile" }, { "high", "High Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_HIGH }, INT_MIN, INT_MAX, VE, "profile" },
{ "extended", "Extend Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
{ "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, VE, "level" }, { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, VE, "level" },
{ "1.3", "Level 1.3, only available with Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" }, { "1.3", "Level 1.3, only available with Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },