aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-ffmpeg@jannau.net>2011-01-28 22:15:47 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-02-02 03:40:50 +0100
commit94e3e83f13bcf45a6447c007ba06da1a3b896605 (patch)
tree416719ae1649399facd1c9eb5801601fa1511a60 /libavcodec/h264.c
parent8a92ec71b3dfc42ce4f34be79facade397db0f70 (diff)
downloadffmpeg-94e3e83f13bcf45a6447c007ba06da1a3b896605.tar.gz
h264: Add Intra and Constrained Baseline profiles to avctx.profile
(cherry picked from commit fe9a3fbe42ebe5debd57550313ed4c3a065f1770)
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c29
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;