[FFmpeg-devel] [PATCH v7] VideoToolbox H.264 Encoder
Richard Kern
kernrj at gmail.com
Mon Feb 29 16:59:31 CET 2016
> On Feb 29, 2016, at 11:19 PM, Clément Bœsch <u at pkh.me> wrote:
>
> On Mon, Feb 29, 2016 at 11:14:17PM +0800, Rick Kern wrote:
> [...]
>> + if (!profile) {
>> + //VideoToolbox auto-selects profile and level.
>> + return true;
>> + } else if (!av_strcasecmp("baseline", profile)) {
>> + if (!strcmp("auto", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_AutoLevel;
>> + else if (!strcmp("1.3", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_1_3;
>> + else if (!strcmp("3.0", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_3_0;
>> + else if (!strcmp("3.1", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_3_1;
>> + else if (!strcmp("3.2", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_3_2;
>> + else if (!strcmp("4.0", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_4_0;
>> + else if (!strcmp("4.1", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_4_1;
>> + else if (!strcmp("4.2", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_4_2;
>> + else if (!strcmp("5.0", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_5_0;
>> + else if (!strcmp("5.1", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_5_1;
>> + else if (!strcmp("5.2", level)) *profile_level_val = kVTProfileLevel_H264_Baseline_5_2;
>> + else {
>> + av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", vtctx->level);
>> + return false;
>> + }
>> + } else if (!av_strcasecmp("main", profile)) {
>> + if (!strcmp("auto", level)) *profile_level_val = kVTProfileLevel_H264_Main_AutoLevel;
>> + else if (!strcmp("3.0", level)) *profile_level_val = kVTProfileLevel_H264_Main_3_0;
>> + else if (!strcmp("3.1", level)) *profile_level_val = kVTProfileLevel_H264_Main_3_1;
>> + else if (!strcmp("3.2", level)) *profile_level_val = kVTProfileLevel_H264_Main_3_2;
>> + else if (!strcmp("4.0", level)) *profile_level_val = kVTProfileLevel_H264_Main_4_0;
>> + else if (!strcmp("4.1", level)) *profile_level_val = kVTProfileLevel_H264_Main_4_1;
>> + else if (!strcmp("4.2", level)) *profile_level_val = kVTProfileLevel_H264_Main_4_2;
>> + else if (!strcmp("5.0", level)) *profile_level_val = kVTProfileLevel_H264_Main_5_0;
>> + else if (!strcmp("5.1", level)) *profile_level_val = kVTProfileLevel_H264_Main_5_1;
>> + else if (!strcmp("5.2", level)) *profile_level_val = kVTProfileLevel_H264_Main_5_2;
>> + else {
>> + av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", vtctx->level);
>> + return false;
>> + }
>> + } else if (!av_strcasecmp("high", profile)) {
>> + if (!strcmp("auto", level)) *profile_level_val = kVTProfileLevel_H264_High_AutoLevel;
>> + else if (!strcmp("3.0", level)) *profile_level_val = kVTProfileLevel_H264_High_3_0;
>> + else if (!strcmp("3.1", level)) *profile_level_val = kVTProfileLevel_H264_High_3_1;
>> + else if (!strcmp("3.2", level)) *profile_level_val = kVTProfileLevel_H264_High_3_2;
>> + else if (!strcmp("4.0", level)) *profile_level_val = kVTProfileLevel_H264_High_4_0;
>> + else if (!strcmp("4.1", level)) *profile_level_val = kVTProfileLevel_H264_High_4_1;
>> + else if (!strcmp("4.2", level)) *profile_level_val = kVTProfileLevel_H264_High_4_2;
>> + else if (!strcmp("5.0", level)) *profile_level_val = kVTProfileLevel_H264_High_5_0;
>> + else if (!strcmp("5.1", level)) *profile_level_val = kVTProfileLevel_H264_High_5_1;
>> + else if (!strcmp("5.2", level)) *profile_level_val = kVTProfileLevel_H264_High_5_2;
>> + else {
>> + av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", vtctx->level);
>> + return false;
>> + }
>> + } else {
>> + av_log(avctx, AV_LOG_ERROR, "Unrecognized profile %s\n", vtctx->profile);
>> + return false;
>> + }
>
> Can't you use AV_OPT_TYPE_CONST for those?
No, doesn’t look like it. The VideoToolbox constants aren’t 1-to-1 with the command line options.
>
> [...]
>
> --
> Clément B.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list