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
26
29
30
34
42
49
58
63
67
77
83
84
86 // The type of the payload being written.
88 // When reading, contains the size of the payload to allow finding the
89 // end of variable-length fields (such as user_data_payload_byte[]).
90 // (When writing, the size will be derived from the total number of
91 // bytes actually written.)
93 // When writing, indicates that payload extension data is present so
94 // all extended fields must be written. May be updated by the writer
95 // to indicate that extended fields have been written, so the extension
96 // end bits must be written too.
99
102
105 void *current,
107
110 void *current,
112
114 // Payload type for the message. (-1 in this field ends a list.)
116 // Valid in a prefix SEI NAL unit (always for H.264).
118 // Valid in a suffix SEI NAL unit (never for H.264).
120 // Size of the decomposed structure.
122 // Read bitstream into SEI message.
124 // Write bitstream from SEI message.
127
128 // Macro for the read/write pair. The clumsy cast is needed because the
129 // current pointer is typed in all of the read/write functions but has to
130 // be void here to fit all cases.
131 #define SEI_MESSAGE_RW(codec, name) \
132 .read = (SEIMessageReadFunction) cbs_ ## codec ## _read_ ## name, \
133 .write = (SEIMessageWriteFunction)cbs_ ## codec ## _write_ ## name
134
135 // End-of-list sentinel element.
136 #define SEI_MESSAGE_TYPE_END { .type = -1 }
137
138
139 /**
140 * Find the type descriptor for the given payload type.
141 *
142 * Returns NULL if the payload type is not known.
143 */
145 int payload_type);
146
147 /**
148 * Allocate a new payload for the given SEI message.
149 */
152
153 /**
154 * Allocate a new empty SEI message in a message list.
155 *
156 * The new message is in place nb_messages - 1.
157 */
159
160 /**
161 * Free all SEI messages in a message list.
162 */
164
165 /**
166 * Add an SEI message to an access unit.
167 *
168 * Will add to an existing SEI NAL unit, or create a new one for the
169 * message if there is no suitable existing one.
170 *
171 * Takes a new reference to payload_buf, if set. If payload_buf is
172 * NULL then the new message will not be reference counted.
173 */
176 int prefix,
177 uint32_t payload_type,
178 void *payload_data,
180
181 /**
182 * Iterate over messages with the given payload type in an access unit.
183 *
184 * Set message to NULL in the first call. Returns 0 while more messages
185 * are available, AVERROR(ENOENT) when all messages have been found.
186 */
189 uint32_t payload_type,
191
192 /**
193 * Delete all messages with the given payload type from an access unit.
194 */
197 uint32_t payload_type);
198
199 #endif /* AVCODEC_CBS_SEI_H */