[FFmpeg-devel] [PATCH v7] VideoToolbox H.264 Encoder

Clément Bœsch u at pkh.me
Mon Feb 29 16:19:51 CET 2016


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?

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160229/bbcc3d29/attachment.sig>


More information about the ffmpeg-devel mailing list