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.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to