From 72da8d9bb24d1b1bf74c2f1108650c0da0054d2e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 29 Mar 2016 04:19:50 +0200 Subject: h264_parser: remove the remaining dependencies on the h264 decoder --- libavcodec/h264_parse.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libavcodec/h264_parse.c') diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c index 1fc8f41b31..7211c9d34c 100644 --- a/libavcodec/h264_parse.c +++ b/libavcodec/h264_parse.c @@ -449,3 +449,30 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, } return 0; } + +/** + * Compute profile from profile_idc and constraint_set?_flags. + * + * @param sps SPS + * + * @return profile as defined by FF_PROFILE_H264_* + */ +int ff_h264_get_profile(const SPS *sps) +{ + int profile = sps->profile_idc; + + switch (sps->profile_idc) { + case FF_PROFILE_H264_BASELINE: + // constraint_set1_flag set to 1 + profile |= (sps->constraint_set_flags & 1 << 1) ? FF_PROFILE_H264_CONSTRAINED : 0; + break; + case FF_PROFILE_H264_HIGH_10: + case FF_PROFILE_H264_HIGH_422: + case FF_PROFILE_H264_HIGH_444_PREDICTIVE: + // constraint_set3_flag set to 1 + profile |= (sps->constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0; + break; + } + + return profile; +} -- cgit v1.2.3