Message ID | 20200611044312.38981-2-rcombs@rcombs.me |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/5] lavf/dashdec: fix 'adaption' typo | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 6/11/2020 1:43 AM, rcombs wrote: > --- > libavcodec/h264_parse.c | 21 +++++++++++++++++---- > libavcodec/h264_parse.h | 2 ++ > libavcodec/version.h | 2 +- > 3 files changed, 20 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c > index 352ffea948..3069579926 100644 > --- a/libavcodec/h264_parse.c > +++ b/libavcodec/h264_parse.c > @@ -528,18 +528,31 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, > */ > int ff_h264_get_profile(const SPS *sps) > { > - int profile = sps->profile_idc; > + return avpriv_h264_get_profile(sps->profile_idc, sps->constraint_set_flags); > +} > + > +/** > + * Compute profile from profile_idc and constraint_set?_flags. > + * > + * @param profile_idc profile_idc field from SPS > + * @param constraint_set_flags constraint_set_flags field from SPS > + * > + * @return profile as defined by FF_PROFILE_H264_* > + */ > +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags) > +{ > + int profile = profile_idc; > > - switch (sps->profile_idc) { > + switch (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; > + profile |= (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; > + profile |= (constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0; > break; > } > > diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h > index 4d01620125..a1462ad8fd 100644 > --- a/libavcodec/h264_parse.h > +++ b/libavcodec/h264_parse.h > @@ -90,4 +90,6 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, > */ > int ff_h264_get_profile(const SPS *sps); > > +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags); > + > #endif /* AVCODEC_H264_PARSE_H */ > diff --git a/libavcodec/version.h b/libavcodec/version.h > index 60c0f2460d..03593026b3 100644 > --- a/libavcodec/version.h > +++ b/libavcodec/version.h > @@ -28,7 +28,7 @@ > #include "libavutil/version.h" > > #define LIBAVCODEC_VERSION_MAJOR 58 > -#define LIBAVCODEC_VERSION_MINOR 92 > +#define LIBAVCODEC_VERSION_MINOR 93 avpriv functions are not public, so this is not needed. > #define LIBAVCODEC_VERSION_MICRO 100 > > #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ >
diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c index 352ffea948..3069579926 100644 --- a/libavcodec/h264_parse.c +++ b/libavcodec/h264_parse.c @@ -528,18 +528,31 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, */ int ff_h264_get_profile(const SPS *sps) { - int profile = sps->profile_idc; + return avpriv_h264_get_profile(sps->profile_idc, sps->constraint_set_flags); +} + +/** + * Compute profile from profile_idc and constraint_set?_flags. + * + * @param profile_idc profile_idc field from SPS + * @param constraint_set_flags constraint_set_flags field from SPS + * + * @return profile as defined by FF_PROFILE_H264_* + */ +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags) +{ + int profile = profile_idc; - switch (sps->profile_idc) { + switch (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; + profile |= (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; + profile |= (constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0; break; } diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h index 4d01620125..a1462ad8fd 100644 --- a/libavcodec/h264_parse.h +++ b/libavcodec/h264_parse.h @@ -90,4 +90,6 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, */ int ff_h264_get_profile(const SPS *sps); +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags); + #endif /* AVCODEC_H264_PARSE_H */ diff --git a/libavcodec/version.h b/libavcodec/version.h index 60c0f2460d..03593026b3 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 92 +#define LIBAVCODEC_VERSION_MINOR 93 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \