aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-12-14 00:09:08 +0100
committerLynne <dev@lynne.ee>2023-05-29 00:41:30 +0200
commitd13b1c42f6a0fb835ad1f2b7db3397cd72e30db7 (patch)
tree76c97c9b70fe73b62ec8dd9f9e09d9fecd4ce445
parentde6fce727cb8e9e4998a8ed1f13f03c88a0a6a4d (diff)
downloadffmpeg-d13b1c42f6a0fb835ad1f2b7db3397cd72e30db7.tar.gz
h264_ps: expose bit rate and CPB size fields
-rw-r--r--libavcodec/h264_ps.c9
-rw-r--r--libavcodec/h264_ps.h4
2 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index d9df570718..c71330089d 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -113,12 +113,13 @@ static inline int decode_hrd_parameters(GetBitContext *gb, void *logctx,
return AVERROR_INVALIDDATA;
}
- get_bits(gb, 4); /* bit_rate_scale */
+ sps->cpr_flag = 0x0;
+ sps->bit_rate_scale = get_bits(gb, 4);
get_bits(gb, 4); /* cpb_size_scale */
for (i = 0; i < cpb_count; i++) {
- get_ue_golomb_long(gb); /* bit_rate_value_minus1 */
- get_ue_golomb_long(gb); /* cpb_size_value_minus1 */
- get_bits1(gb); /* cbr_flag */
+ sps->bit_rate_value[i] = get_ue_golomb_long(gb) + 1; /* bit_rate_value_minus1 + 1 */
+ sps->cpb_size_value[i] = get_ue_golomb_long(gb) + 1; /* cpb_size_value_minus1 + 1 */
+ sps->cpr_flag |= get_bits1(gb) << i;
}
sps->initial_cpb_removal_delay_length = get_bits(gb, 5) + 1;
sps->cpb_removal_delay_length = get_bits(gb, 5) + 1;
diff --git a/libavcodec/h264_ps.h b/libavcodec/h264_ps.h
index 906bab7214..8adfbd710f 100644
--- a/libavcodec/h264_ps.h
+++ b/libavcodec/h264_ps.h
@@ -89,6 +89,10 @@ typedef struct SPS {
int pic_struct_present_flag;
int time_offset_length;
int cpb_cnt; ///< See H.264 E.1.2
+ int bit_rate_scale;
+ uint32_t bit_rate_value[32]; ///< bit_rate_value_minus1 + 1
+ uint32_t cpb_size_value[32]; ///< cpb_size_value_minus1 + 1
+ uint32_t cpr_flag;
int initial_cpb_removal_delay_length; ///< initial_cpb_removal_delay_length_minus1 + 1
int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1
int dpb_output_delay_length; ///< dpb_output_delay_length_minus1 + 1