Go to the documentation of this file.
42 #define AVERROR_PS_NOT_FOUND FFERRTAG(0xF8,'?','P','S')
45 1, 1, 1, 2, 2, 3, 3, 2, 3
50 h->recovery_point.recovery_frame_cnt = -1;
52 h->picture_timing.dpb_output_delay = 0;
53 h->picture_timing.cpb_removal_delay = -1;
55 h->picture_timing.present = 0;
56 h->buffering_period.present = 0;
57 h->frame_packing.present = 0;
58 h->film_grain_characteristics.present = 0;
59 h->display_orientation.present = 0;
63 for (
int i = 0;
i <
h->unregistered.nb_buf_ref;
i++)
65 h->unregistered.nb_buf_ref = 0;
76 if (
sps->nal_hrd_parameters_present_flag ||
77 sps->vcl_hrd_parameters_present_flag) {
81 if (
sps->pic_struct_present_flag) {
82 unsigned int i, num_clock_ts;
92 for (
i = 0;
i < num_clock_ts;
i++) {
95 unsigned int full_timestamp_flag;
96 unsigned int counting_type, cnt_dropped_flag;
100 full_timestamp_flag =
get_bits(&gb, 1);
102 cnt_dropped_flag =
get_bits(&gb, 1);
103 if (cnt_dropped_flag && counting_type > 1 && counting_type < 7)
106 if (full_timestamp_flag) {
112 tc->seconds =
tc->minutes =
tc->hours =
tc->full = 0;
123 if (
sps->time_offset_length > 0)
125 sps->time_offset_length);
130 h->ct_type,
h->pic_struct);
141 int size = (size_bits + 7) / 8;
147 if (
size >
sizeof(
h->payload)) {
153 h->payload_size_bits = size_bits;
173 h->active_format_description =
get_bits(gb, 4);
191 void *logctx,
int size)
193 int country_code, provider_code;
200 if (country_code == 0xFF) {
208 if (country_code != 0xB5) {
210 "Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d)\n",
218 switch (provider_code) {
220 uint32_t user_identifier;
227 switch (user_identifier) {
228 case MKBETAG(
'D',
'T',
'G',
'1'):
230 case MKBETAG(
'G',
'A',
'9',
'4'):
235 "Unsupported User Data Registered ITU-T T35 SEI message (atsc user_identifier = 0x%04x)\n",
243 "Unsupported User Data Registered ITU-T T35 SEI message (provider_code = %d)\n",
252 void *logctx,
int size)
258 if (size < 16 || size >= INT_MAX - 1)
276 h->buf_ref[
h->nb_buf_ref++] = buf_ref;
278 e = sscanf(
user_data + 16,
"x264 - core %d", &build);
279 if (e == 1 && build > 0)
280 h->x264_build = build;
281 if (e == 1 && build == 1 && !strncmp(
user_data+16,
"x264 - core 0000", 16))
292 av_log(logctx,
AV_LOG_ERROR,
"recovery_frame_cnt %u is out of range\n", recovery_frame_cnt);
296 h->recovery_frame_cnt = recovery_frame_cnt;
313 if (sps_id > 31 || !ps->
sps_list[sps_id]) {
315 "non-existing SPS %d referenced in buffering period\n", sps_id);
321 if (
sps->nal_hrd_parameters_present_flag) {
322 for (sched_sel_idx = 0; sched_sel_idx <
sps->cpb_cnt; sched_sel_idx++) {
323 h->initial_cpb_removal_delay[sched_sel_idx] =
329 if (
sps->vcl_hrd_parameters_present_flag) {
330 for (sched_sel_idx = 0; sched_sel_idx <
sps->cpb_cnt; sched_sel_idx++) {
331 h->initial_cpb_removal_delay[sched_sel_idx] =
347 h->present = !
h->arrangement_cancel_flag;
352 h->content_interpretation_type =
get_bits(gb, 6);
356 h->current_frame_is_frame0_flag =
get_bits1(gb);
360 if (!
h->quincunx_sampling_flag &&
h->arrangement_type != 5)
379 h->anticlockwise_rotation =
get_bits(gb, 16);
389 h->green_metadata_type =
get_bits(gb, 8);
391 if (
h->green_metadata_type == 0) {
394 if (
h->period_type == 2)
396 else if (
h->period_type == 3)
399 h->percent_non_zero_macroblocks =
get_bits(gb, 8);
400 h->percent_intra_coded_macroblocks =
get_bits(gb, 8);
401 h->percent_six_tap_filtering =
get_bits(gb, 8);
402 h->percent_alpha_point_deblocking_instance =
get_bits(gb, 8);
404 }
else if (
h->green_metadata_type == 1) {
416 h->preferred_transfer_characteristics =
get_bits(gb, 8);
426 memset(
h, 0,
sizeof(*
h));
428 h->separate_colour_description_present_flag =
get_bits1(gb);
429 if (
h->separate_colour_description_present_flag) {
431 h->bit_depth_chroma =
get_bits(gb, 3) + 8;
434 h->transfer_characteristics =
get_bits(gb, 8);
439 for (
int c = 0;
c < 3;
c++)
441 for (
int c = 0;
c < 3;
c++) {
442 if (
h->comp_model_present_flag[
c]) {
443 h->num_intensity_intervals[
c] =
get_bits(gb, 8) + 1;
445 if (
h->num_model_values[
c] > 6)
447 for (
int i = 0;
i <
h->num_intensity_intervals[
c];
i++) {
448 h->intensity_interval_lower_bound[
c][
i] =
get_bits(gb, 8);
449 h->intensity_interval_upper_bound[
c][
i] =
get_bits(gb, 8);
450 for (
int j = 0; j <
h->num_model_values[
c]; j++)
548 if (
h->arrangement_cancel_flag == 0) {
549 switch (
h->arrangement_type) {
551 if (
h->content_interpretation_type == 2)
552 return "checkerboard_rl";
554 return "checkerboard_lr";
556 if (
h->content_interpretation_type == 2)
557 return "col_interleaved_rl";
559 return "col_interleaved_lr";
561 if (
h->content_interpretation_type == 2)
562 return "row_interleaved_rl";
564 return "row_interleaved_lr";
566 if (
h->content_interpretation_type == 2)
571 if (
h->content_interpretation_type == 2)
576 if (
h->content_interpretation_type == 2)
584 }
else if (
h->arrangement_cancel_flag == 1) {
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
@ SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS
#define AVERROR_PS_NOT_FOUND
void ff_h264_sei_uninit(H264SEIContext *h)
Reset SEI values at the beginning of the frame.
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
@ SEI_TYPE_GREEN_METADATA
static int get_se_golomb_long(GetBitContext *gb)
uint8_t * data
The data buffer.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_count(const GetBitContext *s)
@ SEI_TYPE_RECOVERY_POINT
@ H264_SEI_FPA_TYPE_CHECKERBOARD
#define AV_LOG_VERBOSE
Detailed information.
@ SEI_TYPE_BUFFERING_PERIOD
@ SEI_TYPE_USER_DATA_UNREGISTERED
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const uint8_t sei_num_clock_ts_table[9]
int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb, const H264ParamSets *ps, void *logctx)
@ SEI_TYPE_FRAME_PACKING_ARRANGEMENT
static int decode_recovery_point(H264SEIRecoveryPoint *h, GetBitContext *gb, void *logctx)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int ff_h264_sei_process_picture_timing(H264SEIPictureTiming *h, const SPS *sps, void *logctx)
Parse the contents of a picture timing message given an active SPS.
@ H264_SEI_FPA_TYPE_SIDE_BY_SIDE
@ H264_SEI_FPA_TYPE_INTERLEAVE_TEMPORAL
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
@ H264_SEI_FPA_TYPE_TOP_BOTTOM
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
@ SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVBufferRef * sps_list[MAX_SPS_COUNT]
int ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size)
Parse a data array for ATSC A53 Part 4 Closed Captions and store them in an AVBufferRef.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h, GetBitContext *gb, void *logctx, int size)
static unsigned int get_bits1(GetBitContext *s)
@ SEI_TYPE_FILM_GRAIN_CHARACTERISTICS
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
const char * ff_h264_sei_stereo_mode(const H264SEIFramePacking *h)
Get stereo_mode string from the h264 frame_packing_arrangement.
static int decode_film_grain_characteristics(H264SEIFilmGrainCharacteristics *h, GetBitContext *gb)
#define MKBETAG(a, b, c, d)
static int FUNC() user_data(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawUserData *current)
static int decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *gb, void *logctx, int size)
static int decode_registered_user_data(H264SEIContext *h, GetBitContext *gb, void *logctx, int size)
#define MAX_LOG2_MAX_FRAME_NUM
@ H264_SEI_FPA_TYPE_INTERLEAVE_COLUMN
static void skip_bits1(GetBitContext *s)
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
static int decode_green_metadata(H264SEIGreenMetaData *h, GetBitContext *gb)
static int decode_alternative_transfer(H264SEIAlternativeTransfer *h, GetBitContext *gb)
size_t size
Size of data in bytes.
@ H264_SEI_PIC_STRUCT_FRAME_TRIPLING
8: frame tripling
#define i(width, name, range_min, range_max)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb, void *logctx)
@ H264_SEI_FPA_TYPE_INTERLEAVE_ROW
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
static int decode_frame_packing_arrangement(H264SEIFramePacking *h, GetBitContext *gb)
A reference to a data buffer.
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
static int decode_buffering_period(H264SEIBufferingPeriod *h, GetBitContext *gb, const H264ParamSets *ps, void *logctx)
static int decode_registered_user_data_afd(H264SEIAFD *h, GetBitContext *gb, int size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int decode_display_orientation(H264SEIDisplayOrientation *h, GetBitContext *gb)
@ SEI_TYPE_DISPLAY_ORIENTATION