Commit ce53bc5975 for ffmpeg
commit ce53bc5975c47d9c57416dad8f8d0309dbfc0666
Author: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Date: Thu Nov 12 16:59:47 2026 -0800
avformat/avc: parse the VUI video signal type
Signed-off-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
diff --git a/libavformat/avc.c b/libavformat/avc.c
index 84a3c3d0f4..00df03fcc2 100644
--- a/libavformat/avc.c
+++ b/libavformat/avc.c
@@ -299,6 +299,19 @@ int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size)
sps->sar = avc_sample_aspect_ratio[aspect_ratio_idc];
}
}
+ if (get_bits1(&gb)) // overscan_info_present_flag
+ skip_bits1(&gb); // overscan_appropriate_flag
+ sps->video_signal_type_present_flag = get_bits1(&gb);
+ if (sps->video_signal_type_present_flag) {
+ skip_bits(&gb, 3); // video_format
+ sps->video_full_range_flag = get_bits1(&gb);
+ sps->colour_description_present_flag = get_bits1(&gb);
+ if (sps->colour_description_present_flag) {
+ sps->colour_primaries = get_bits(&gb, 8);
+ sps->transfer_characteristics = get_bits(&gb, 8);
+ sps->matrix_coefficients = get_bits(&gb, 8);
+ }
+ }
}
if (!sps->sar.den) {
diff --git a/libavformat/avc.h b/libavformat/avc.h
index e36108afce..56a64f4794 100644
--- a/libavformat/avc.h
+++ b/libavformat/avc.h
@@ -39,6 +39,12 @@ typedef struct {
uint8_t bit_depth_chroma;
uint8_t frame_mbs_only_flag;
AVRational sar;
+ uint8_t video_signal_type_present_flag;
+ uint8_t video_full_range_flag;
+ uint8_t colour_description_present_flag;
+ uint8_t colour_primaries;
+ uint8_t transfer_characteristics;
+ uint8_t matrix_coefficients;
} H264SPS;
int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size);