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
27
28
32
36 uint8_t *
data;
///< RefStruct reference
39
42 uint8_t *
data;
///< RefStruct reference
45
65
72
75
84
89
93
99
108
114
115
117 // The type of the payload being written.
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.)
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
133
136 void *current,
138
141 void *current,
143
145 // Payload type for the message. (-1 in this field ends a list.)
147 // Valid in a prefix SEI NAL unit (always for H.264).
149 // Valid in a suffix SEI NAL unit (never for H.264).
151 // Size of the decomposed structure.
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 */