summaryrefslogtreecommitdiff
path: root/libavcodec/h264_parse.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2016-06-19 12:43:21 +0200
committerClément Bœsch <u@pkh.me>2016-06-19 12:50:24 +0200
commit0ed14bba12328cc8d85ef4aaf6916f15528830b5 (patch)
tree1c8cb1dfde91cbeb259bb6fac6a9e267acd7c820 /libavcodec/h264_parse.c
parent34ec084b84817ca0b00544ca8e1029e6073c1e51 (diff)
parent72da8d9bb24d1b1bf74c2f1108650c0da0054d2e (diff)
Merge commit '72da8d9bb24d1b1bf74c2f1108650c0da0054d2e'
* commit '72da8d9bb24d1b1bf74c2f1108650c0da0054d2e': h264_parser: remove the remaining dependencies on the h264 decoder Merged-by: Clément Bœsch <u@pkh.me>
Diffstat (limited to 'libavcodec/h264_parse.c')
-rw-r--r--libavcodec/h264_parse.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index 4d2cacb8fd..58ca58a133 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -468,3 +468,30 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps,
}
return size;
}
+
+/**
+ * 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;
+}