FFmpeg
Loading...
Searching...
No Matches
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
32
36 uint8_t *data;
37 uint8_t *data_ref; ///< RefStruct reference
40
42 uint8_t uuid_iso_iec_11578[16];
43 uint8_t *data;
44 uint8_t *data_ref; ///< RefStruct reference
47
67
77
86
91
95
101
122
129
141
142typedef struct SEIRawMessage {
143 uint32_t payload_type;
144 uint32_t payload_size;
145 void *payload;
146 void *payload_ref; ///< RefStruct reference
147 uint8_t *extension_data; ///< RefStruct reference
150
156
157
158typedef struct SEIMessageState {
159 // The type of the payload being written.
160 uint32_t payload_type;
161 // When reading, contains the size of the payload to allow finding the
162 // end of variable-length fields (such as user_data_payload_byte[]).
163 // (When writing, the size will be derived from the total number of
164 // bytes actually written.)
165 uint32_t payload_size;
166 // When writing, indicates that payload extension data is present so
167 // all extended fields must be written. May be updated by the writer
168 // to indicate that extended fields have been written, so the extension
169 // end bits must be written too.
172
173struct GetBitContext;
174struct PutBitContext;
175
177 struct GetBitContext *rw,
178 void *current,
180
182 struct PutBitContext *rw,
183 void *current,
185
187 // Payload type for the message. (-1 in this field ends a list.)
188 int type;
189 // Valid in a prefix SEI NAL unit (always for H.264).
190 uint8_t prefix;
191 // Valid in a suffix SEI NAL unit (never for H.264).
192 uint8_t suffix;
193 // Size of the decomposed structure.
194 size_t size;
195 // Read bitstream into SEI message.
197 // Write bitstream from SEI message.
200
201// End-of-list sentinel element.
202#define SEI_MESSAGE_TYPE_END { .type = -1 }
203
204
207
208/**
209 * Find the type descriptor for the given payload type.
210 *
211 * Returns NULL if the payload type is not known.
212 */
214 int payload_type);
215
216/**
217 * Allocate a new payload for the given SEI message.
218 */
221
222/**
223 * Allocate a new empty SEI message in a message list.
224 *
225 * The new message is in place nb_messages - 1.
226 */
228
229/**
230 * Free all SEI messages in a message list.
231 */
233
234/**
235 * Add an SEI message to an access unit.
236 *
237 * Will add to an existing SEI NAL unit, or create a new one for the
238 * message if there is no suitable existing one.
239 *
240 * If set, payload_ref must be a RefStruct reference backing payload_data.
241 * This function creates a new reference to payload_ref in this case.
242 * If payload_ref is NULL, the new message will not be reference counted.
243 */
246 int prefix,
247 uint32_t payload_type,
248 void *payload_data,
249 void *payload_ref);
250
251/**
252 * Iterate over messages with the given payload type in an access unit.
253 *
254 * Set message to NULL in the first call. Returns 0 while more messages
255 * are available, AVERROR(ENOENT) when all messages have been found.
256 */
259 uint32_t payload_type,
261
262/**
263 * Delete all messages with the given payload type from an access unit.
264 */
267 uint32_t payload_type);
268
277
278#endif /* AVCODEC_CBS_SEI_H */
const SEIMessageTypeDescriptor ff_cbs_sei_h264_types[]
Definition cbs_h264.c:744
static int FUNC sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
const SEIMessageTypeDescriptor ff_cbs_sei_h265_types[]
Definition cbs_h265.c:754
int(* SEIMessageWriteFunction)(CodedBitstreamContext *ctx, struct PutBitContext *rw, void *current, SEIMessageState *sei)
Definition cbs_sei.h:181
int(* SEIMessageReadFunction)(CodedBitstreamContext *ctx, struct GetBitContext *rw, void *current, SEIMessageState *sei)
Definition cbs_sei.h:176
int ff_cbs_sei_write_message_list(CodedBitstreamContext *ctx, struct PutBitContext *rw, SEIRawMessageList *current, int prefix)
void ff_cbs_sei_free_message_list(SEIRawMessageList *list)
Free all SEI messages in a message list.
Definition cbs_sei.c:291
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:240
int ff_cbs_sei_read_message_list(CodedBitstreamContext *ctx, struct GetBitContext *rw, SEIRawMessageList *current, int prefix)
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:567
int ff_cbs_sei_list_add(SEIRawMessageList *list)
Allocate a new empty SEI message in a message list.
Definition cbs_sei.c:266
int ff_cbs_sei_read_message(CodedBitstreamContext *ctx, struct GetBitContext *rw, SEIRawMessage *current)
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:467
const SEIMessageTypeDescriptor * ff_cbs_sei_find_type(CodedBitstreamContext *ctx, int payload_type)
Find the type descriptor for the given payload type.
Definition cbs_sei.c:673
int ff_cbs_sei_write_message(CodedBitstreamContext *ctx, struct PutBitContext *rw, SEIRawMessage *current)
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:514
static struct @111144215057303131116103221376075045141373005341 current
const char * desc
Definition libsvtav1.c:83
Context structure for coded bitstream operations.
Definition cbs.h:226
Coded bitstream fragment structure, combining one or more units.
Definition cbs.h:129
uint32_t payload_size
Definition cbs_sei.h:165
uint32_t payload_type
Definition cbs_sei.h:160
uint8_t extension_present
Definition cbs_sei.h:170
SEIMessageWriteFunction write
Definition cbs_sei.h:198
SEIMessageReadFunction read
Definition cbs_sei.h:196
uint16_t max_pic_average_light_level
Definition cbs_sei.h:89
uint16_t max_content_light_level
Definition cbs_sei.h:88
uint8_t dph_sei_reserved_zero_7bits
Definition cbs_sei.h:75
uint8_t dph_sei_single_component_flag
Definition cbs_sei.h:70
uint16_t dph_sei_picture_crc[3]
Definition cbs_sei.h:72
uint32_t dph_sei_picture_checksum[3]
Definition cbs_sei.h:73
uint8_t dph_sei_picture_md5[3][16]
Definition cbs_sei.h:71
uint8_t display_orientation_persistence_flag
Definition cbs_sei.h:125
uint8_t display_orientation_transform_type
Definition cbs_sei.h:126
uint8_t display_orientation_reserved_zero_3bits
Definition cbs_sei.h:127
uint8_t display_orientation_cancel_flag
Definition cbs_sei.h:124
uint32_t payload_size
Definition cbs_sei.h:30
uint8_t fg_intensity_interval_upper_bound[3][256]
Definition cbs_sei.h:118
uint8_t fg_comp_model_present_flag[3]
Definition cbs_sei.h:114
uint8_t fg_separate_colour_description_present_flag
Definition cbs_sei.h:105
uint8_t fg_num_intensity_intervals_minus1[3]
Definition cbs_sei.h:115
uint8_t fg_num_model_values_minus1[3]
Definition cbs_sei.h:116
uint8_t fg_intensity_interval_lower_bound[3][256]
Definition cbs_sei.h:117
int16_t fg_comp_model_value[3][256][6]
Definition cbs_sei.h:119
uint8_t fg_characteristics_persistence_flag
Definition cbs_sei.h:120
uint8_t ffi_display_elemental_periods_minus1
Definition cbs_sei.h:137
uint8_t ffi_paired_with_next_field_flag
Definition cbs_sei.h:134
uint8_t ffi_display_fields_from_frame_flag
Definition cbs_sei.h:135
uint8_t fp_frame0_self_contained_flag
Definition cbs_sei.h:58
uint8_t fp_content_interpretation_type
Definition cbs_sei.h:53
uint8_t fp_frame1_self_contained_flag
Definition cbs_sei.h:59
uint8_t fp_upsampled_aspect_ratio_flag
Definition cbs_sei.h:65
uint8_t fp_arrangement_persistence_flag
Definition cbs_sei.h:64
uint8_t fp_current_frame_is_frame0_flag
Definition cbs_sei.h:57
int nb_messages_allocated
Definition cbs_sei.h:154
SEIRawMessage * messages
Definition cbs_sei.h:152
uint32_t payload_size
Definition cbs_sei.h:144
uint8_t * extension_data
RefStruct reference.
Definition cbs_sei.h:147
void * payload_ref
RefStruct reference.
Definition cbs_sei.h:146
uint32_t payload_type
Definition cbs_sei.h:143
size_t extension_bit_length
Definition cbs_sei.h:148
void * payload
Definition cbs_sei.h:145
uint8_t itu_t_t35_country_code_extension_byte
Definition cbs_sei.h:35
uint8_t * data_ref
RefStruct reference.
Definition cbs_sei.h:37
uint8_t itu_t_t35_country_code
Definition cbs_sei.h:34
uint8_t uuid_iso_iec_11578[16]
Definition cbs_sei.h:42
uint8_t * data_ref
RefStruct reference.
Definition cbs_sei.h:44
static AVFormatContext * ctx
Definition movenc.c:49
char prefix[8]