FFmpeg
cbs_sei.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVCODEC_CBS_SEI_H
20 #define AVCODEC_CBS_SEI_H
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #include "cbs.h"
26 #include "sei.h"
27 
28 
29 typedef struct SEIRawFillerPayload {
30  uint32_t payload_size;
32 
33 typedef struct SEIRawUserDataRegistered {
36  uint8_t *data; ///< RefStruct reference
37  size_t data_length;
39 
41  uint8_t uuid_iso_iec_11578[16];
42  uint8_t *data; ///< RefStruct reference
43  size_t data_length;
45 
65 
66 typedef struct SEIRawDecodedPictureHash {
69  uint8_t dph_sei_picture_md5[3][16];
70  uint16_t dph_sei_picture_crc[3];
72 
75 
77  uint16_t display_primaries_x[3];
78  uint16_t display_primaries_y[3];
79  uint16_t white_point_x;
80  uint16_t white_point_y;
84 
89 
93 
96  uint16_t ambient_light_x;
97  uint16_t ambient_light_y;
99 
100 typedef struct SEIRawMessage {
101  uint32_t payload_type;
102  uint32_t payload_size;
103  void *payload;
104  void *payload_ref; ///< RefStruct reference
105  uint8_t *extension_data; ///< RefStruct reference
107 } SEIRawMessage;
108 
109 typedef struct SEIRawMessageList {
114 
115 
116 typedef struct SEIMessageState {
117  // The type of the payload being written.
118  uint32_t payload_type;
119  // When reading, contains the size of the payload to allow finding the
120  // end of variable-length fields (such as user_data_payload_byte[]).
121  // (When writing, the size will be derived from the total number of
122  // bytes actually written.)
123  uint32_t payload_size;
124  // When writing, indicates that payload extension data is present so
125  // all extended fields must be written. May be updated by the writer
126  // to indicate that extended fields have been written, so the extension
127  // end bits must be written too.
130 
131 struct GetBitContext;
132 struct PutBitContext;
133 
135  struct GetBitContext *rw,
136  void *current,
138 
140  struct PutBitContext *rw,
141  void *current,
143 
144 typedef struct SEIMessageTypeDescriptor {
145  // Payload type for the message. (-1 in this field ends a list.)
146  int type;
147  // Valid in a prefix SEI NAL unit (always for H.264).
148  uint8_t prefix;
149  // Valid in a suffix SEI NAL unit (never for H.264).
150  uint8_t suffix;
151  // Size of the decomposed structure.
152  size_t size;
153  // Read bitstream into SEI message.
155  // Write bitstream from SEI message.
158 
159 // End-of-list sentinel element.
160 #define SEI_MESSAGE_TYPE_END { .type = -1 }
161 
162 
163 /**
164  * Find the type descriptor for the given payload type.
165  *
166  * Returns NULL if the payload type is not known.
167  */
169  int payload_type);
170 
171 /**
172  * Allocate a new payload for the given SEI message.
173  */
176 
177 /**
178  * Allocate a new empty SEI message in a message list.
179  *
180  * The new message is in place nb_messages - 1.
181  */
183 
184 /**
185  * Free all SEI messages in a message list.
186  */
188 
189 /**
190  * Add an SEI message to an access unit.
191  *
192  * Will add to an existing SEI NAL unit, or create a new one for the
193  * message if there is no suitable existing one.
194  *
195  * If set, payload_ref must be a RefStruct reference backing payload_data.
196  * This function creates a new reference to payload_ref in this case.
197  * If payload_ref is NULL, the new message will not be reference counted.
198  */
201  int prefix,
202  uint32_t payload_type,
203  void *payload_data,
204  void *payload_ref);
205 
206 /**
207  * Iterate over messages with the given payload type in an access unit.
208  *
209  * Set message to NULL in the first call. Returns 0 while more messages
210  * are available, AVERROR(ENOENT) when all messages have been found.
211  */
214  uint32_t payload_type,
216 
217 /**
218  * Delete all messages with the given payload type from an access unit.
219  */
222  uint32_t payload_type);
223 
224 #endif /* AVCODEC_CBS_SEI_H */
SEIRawFramePackingArrangement::fp_frame0_grid_position_y
uint8_t fp_frame0_grid_position_y
Definition: cbs_sei.h:59
SEIRawMasteringDisplayColourVolume::display_primaries_x
uint16_t display_primaries_x[3]
Definition: cbs_sei.h:77
SEIRawFramePackingArrangement::fp_arrangement_type
uint8_t fp_arrangement_type
Definition: cbs_sei.h:49
SEIRawFramePackingArrangement::fp_upsampled_aspect_ratio_flag
uint8_t fp_upsampled_aspect_ratio_flag
Definition: cbs_sei.h:63
SEIRawUserDataRegistered
Definition: cbs_sei.h:33
SEIMessageTypeDescriptor::size
size_t size
Definition: cbs_sei.h:152
ff_cbs_sei_find_message
int ff_cbs_sei_find_message(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, uint32_t payload_type, SEIRawMessage **message)
Iterate over messages with the given payload type in an access unit.
Definition: cbs_sei.c:314
SEIRawDecodedPictureHash::dph_sei_hash_type
uint8_t dph_sei_hash_type
Definition: cbs_sei.h:67
SEIRawAmbientViewingEnvironment
Definition: cbs_sei.h:94
message
Definition: api-threadmessage-test.c:47
SEIRawMessage::extension_bit_length
size_t extension_bit_length
Definition: cbs_sei.h:106
SEIRawFramePackingArrangement::fp_content_interpretation_type
uint8_t fp_content_interpretation_type
Definition: cbs_sei.h:51
SEIRawFramePackingArrangement::fp_frame0_self_contained_flag
uint8_t fp_frame0_self_contained_flag
Definition: cbs_sei.h:56
SEIRawDecodedPictureHash::dph_sei_picture_md5
uint8_t dph_sei_picture_md5[3][16]
Definition: cbs_sei.h:69
SEIRawMessage
Definition: cbs_sei.h:100
SEIRawAmbientViewingEnvironment::ambient_light_x
uint16_t ambient_light_x
Definition: cbs_sei.h:96
SEIRawFramePackingArrangement::fp_current_frame_is_frame0_flag
uint8_t fp_current_frame_is_frame0_flag
Definition: cbs_sei.h:55
SEIRawFramePackingArrangement::fp_arrangement_id
uint32_t fp_arrangement_id
Definition: cbs_sei.h:47
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:219
SEIRawDecodedPictureHash::dph_sei_picture_crc
uint16_t dph_sei_picture_crc[3]
Definition: cbs_sei.h:70
SEIRawAlternativeTransferCharacteristics
Definition: cbs_sei.h:90
SEIMessageState::payload_type
uint32_t payload_type
Definition: cbs_sei.h:118
cbs.h
SEIRawFramePackingArrangement::fp_frame1_self_contained_flag
uint8_t fp_frame1_self_contained_flag
Definition: cbs_sei.h:57
SEIMessageTypeDescriptor::suffix
uint8_t suffix
Definition: cbs_sei.h:150
SEIMessageReadFunction
int(* SEIMessageReadFunction)(CodedBitstreamContext *ctx, struct GetBitContext *rw, void *current, SEIMessageState *sei)
Definition: cbs_sei.h:134
SEIRawDecodedPictureHash::dph_sei_single_component_flag
uint8_t dph_sei_single_component_flag
Definition: cbs_sei.h:68
SEIRawMessage::payload_size
uint32_t payload_size
Definition: cbs_sei.h:102
SEIRawContentLightLevelInfo
Definition: cbs_sei.h:85
SEIRawFramePackingArrangement::fp_quincunx_sampling_flag
uint8_t fp_quincunx_sampling_flag
Definition: cbs_sei.h:50
SEIRawUserDataUnregistered::data
uint8_t * data
RefStruct reference.
Definition: cbs_sei.h:42
SEIRawFramePackingArrangement::fp_frame0_flipped_flag
uint8_t fp_frame0_flipped_flag
Definition: cbs_sei.h:53
GetBitContext
Definition: get_bits.h:108
SEIRawMasteringDisplayColourVolume::max_display_mastering_luminance
uint32_t max_display_mastering_luminance
Definition: cbs_sei.h:81
SEIRawMessage::extension_data
uint8_t * extension_data
RefStruct reference.
Definition: cbs_sei.h:105
SEIRawUserDataUnregistered
Definition: cbs_sei.h:40
ff_cbs_sei_list_add
int ff_cbs_sei_list_add(SEIRawMessageList *list)
Allocate a new empty SEI message in a message list.
Definition: cbs_sei.c:66
ff_cbs_sei_add_message
int ff_cbs_sei_add_message(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, int prefix, uint32_t payload_type, void *payload_data, void *payload_ref)
Add an SEI message to an access unit.
Definition: cbs_sei.c:267
SEIRawUserDataRegistered::itu_t_t35_country_code
uint8_t itu_t_t35_country_code
Definition: cbs_sei.h:34
SEIMessageWriteFunction
int(* SEIMessageWriteFunction)(CodedBitstreamContext *ctx, struct PutBitContext *rw, void *current, SEIMessageState *sei)
Definition: cbs_sei.h:139
CodedBitstreamFragment
Coded bitstream fragment structure, combining one or more units.
Definition: cbs.h:122
SEIRawMessageList::nb_messages
int nb_messages
Definition: cbs_sei.h:111
SEIRawFillerPayload
Definition: cbs_sei.h:29
SEIRawMasteringDisplayColourVolume::white_point_y
uint16_t white_point_y
Definition: cbs_sei.h:80
SEIMessageState::payload_size
uint32_t payload_size
Definition: cbs_sei.h:123
SEIRawMessageList::nb_messages_allocated
int nb_messages_allocated
Definition: cbs_sei.h:112
SEIRawMessageList
Definition: cbs_sei.h:109
SEIRawUserDataUnregistered::data_length
size_t data_length
Definition: cbs_sei.h:43
ctx
AVFormatContext * ctx
Definition: movenc.c:49
SEIRawFramePackingArrangement::fp_frame1_grid_position_y
uint8_t fp_frame1_grid_position_y
Definition: cbs_sei.h:61
PutBitContext
Definition: put_bits.h:50
SEIRawMessage::payload_type
uint32_t payload_type
Definition: cbs_sei.h:101
SEIRawMasteringDisplayColourVolume::min_display_mastering_luminance
uint32_t min_display_mastering_luminance
Definition: cbs_sei.h:82
SEIRawFramePackingArrangement::fp_spatial_flipping_flag
uint8_t fp_spatial_flipping_flag
Definition: cbs_sei.h:52
SEIMessageTypeDescriptor
Definition: cbs_sei.h:144
SEIRawMasteringDisplayColourVolume
Definition: cbs_sei.h:76
sei.h
list
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 list
Definition: filter_design.txt:25
sei
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
Definition: cbs_h264_syntax_template.c:858
SEIRawMessage::payload_ref
void * payload_ref
RefStruct reference.
Definition: cbs_sei.h:104
SEIRawFramePackingArrangement::fp_field_views_flag
uint8_t fp_field_views_flag
Definition: cbs_sei.h:54
ff_cbs_sei_alloc_message_payload
int ff_cbs_sei_alloc_message_payload(SEIRawMessage *message, const SEIMessageTypeDescriptor *desc)
Allocate a new payload for the given SEI message.
Definition: cbs_sei.c:40
SEIRawFillerPayload::payload_size
uint32_t payload_size
Definition: cbs_sei.h:30
SEIRawUserDataRegistered::data
uint8_t * data
RefStruct reference.
Definition: cbs_sei.h:36
SEIMessageTypeDescriptor::type
int type
Definition: cbs_sei.h:146
SEIMessageTypeDescriptor::write
SEIMessageWriteFunction write
Definition: cbs_sei.h:156
SEIRawUserDataRegistered::data_length
size_t data_length
Definition: cbs_sei.h:37
SEIRawAmbientViewingEnvironment::ambient_light_y
uint16_t ambient_light_y
Definition: cbs_sei.h:97
SEIRawFramePackingArrangement::fp_frame1_grid_position_x
uint8_t fp_frame1_grid_position_x
Definition: cbs_sei.h:60
SEIRawUserDataRegistered::itu_t_t35_country_code_extension_byte
uint8_t itu_t_t35_country_code_extension_byte
Definition: cbs_sei.h:35
SEIRawMasteringDisplayColourVolume::white_point_x
uint16_t white_point_x
Definition: cbs_sei.h:79
SEIRawMessageList::messages
SEIRawMessage * messages
Definition: cbs_sei.h:110
SEIMessageTypeDescriptor::read
SEIMessageReadFunction read
Definition: cbs_sei.h:154
SEIRawMasteringDisplayColourVolume::display_primaries_y
uint16_t display_primaries_y[3]
Definition: cbs_sei.h:78
SEIRawContentLightLevelInfo::max_content_light_level
uint16_t max_content_light_level
Definition: cbs_sei.h:86
SEIRawAlternativeTransferCharacteristics::preferred_transfer_characteristics
uint8_t preferred_transfer_characteristics
Definition: cbs_sei.h:91
SEIRawMessage::payload
void * payload
Definition: cbs_sei.h:103
SEIMessageState
Definition: cbs_sei.h:116
SEIRawDecodedPictureHash::dph_sei_reserved_zero_7bits
uint8_t dph_sei_reserved_zero_7bits
Definition: cbs_sei.h:73
ff_cbs_sei_find_type
const SEIMessageTypeDescriptor * ff_cbs_sei_find_type(CodedBitstreamContext *ctx, int payload_type)
Find the type descriptor for the given payload type.
Definition: cbs_h2645.c:2313
SEIRawDecodedPictureHash::dph_sei_picture_checksum
uint32_t dph_sei_picture_checksum[3]
Definition: cbs_sei.h:71
SEIRawDecodedPictureHash
Definition: cbs_sei.h:66
SEIRawAmbientViewingEnvironment::ambient_illuminance
uint32_t ambient_illuminance
Definition: cbs_sei.h:95
SEIRawFramePackingArrangement
Definition: cbs_sei.h:46
desc
const char * desc
Definition: libsvtav1.c:79
ff_cbs_sei_delete_message_type
void ff_cbs_sei_delete_message_type(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, uint32_t payload_type)
Delete all messages with the given payload type from an access unit.
Definition: cbs_sei.c:367
SEIRawContentLightLevelInfo::max_pic_average_light_level
uint16_t max_pic_average_light_level
Definition: cbs_sei.h:87
ff_cbs_sei_free_message_list
void ff_cbs_sei_free_message_list(SEIRawMessageList *list)
Free all SEI messages in a message list.
Definition: cbs_sei.c:91
SEIRawFramePackingArrangement::fp_arrangement_cancel_flag
uint8_t fp_arrangement_cancel_flag
Definition: cbs_sei.h:48
SEIRawUserDataUnregistered::uuid_iso_iec_11578
uint8_t uuid_iso_iec_11578[16]
Definition: cbs_sei.h:41
SEIMessageState::extension_present
uint8_t extension_present
Definition: cbs_sei.h:128
SEIMessageTypeDescriptor::prefix
uint8_t prefix
Definition: cbs_sei.h:148
SEIRawFramePackingArrangement::fp_arrangement_persistence_flag
uint8_t fp_arrangement_persistence_flag
Definition: cbs_sei.h:62
SEIRawFramePackingArrangement::fp_frame0_grid_position_x
uint8_t fp_frame0_grid_position_x
Definition: cbs_sei.h:58