diff options
author | Janne Grunau <janne-ffmpeg@jannau.net> | 2011-01-28 22:15:47 +0100 |
---|---|---|
committer | Janne Grunau <janne-ffmpeg@jannau.net> | 2011-02-01 20:37:02 +0100 |
commit | fe9a3fbe42ebe5debd57550313ed4c3a065f1770 (patch) | |
tree | 81adc33f70bf1030ef3cea4e3abe3e99ab4ec2c4 /libavcodec/h264.c | |
parent | e86e858111501650bb9ce8e39282e20c57bac913 (diff) | |
download | ffmpeg-fe9a3fbe42ebe5debd57550313ed4c3a065f1770.tar.gz |
h264: Add Intra and Constrained Baseline profiles to avctx.profile
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 2a3357b05c..774e97dae9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1678,6 +1678,33 @@ static void clone_slice(H264Context *dst, H264Context *src) } /** + * computes profile from profile_idc and constraint_set?_flags + * + * @param sps SPS + * + * @return profile as defined by FF_PROFILE_H264_* + */ +int ff_h264_get_profile(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; +} + +/** * decodes a slice header. * This will also call MPV_common_init() and frame_start() as needed. * @@ -1756,7 +1783,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ } h->sps = *h0->sps_buffers[h->pps.sps_id]; - s->avctx->profile = h->sps.profile_idc; + s->avctx->profile = ff_h264_get_profile(&h->sps); s->avctx->level = h->sps.level_idc; s->avctx->refs = h->sps.ref_frame_count; |