FFmpeg
extract_extradata.c
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 #include <stdint.h>
20 
21 #include "libavutil/log.h"
22 #include "libavutil/mem.h"
23 #include "libavutil/opt.h"
24 
25 #include "av1.h"
26 #include "av1_parse.h"
27 #include "bsf.h"
28 #include "bsf_internal.h"
29 #include "bytestream.h"
30 #include "h2645_parse.h"
31 #include "h264.h"
32 #include "hevc.h"
33 #include "startcode.h"
34 #include "vc1_common.h"
35 #include "vvc.h"
36 
37 typedef struct ExtractExtradataContext {
38  const AVClass *class;
39 
41  uint8_t **data, int *size);
42 
43  /* AV1 specific fields */
45 
46  /* H264/HEVC specific fields */
48 
49  /* AVOptions */
50  int remove;
52 
53 static int val_in_array(const int *arr, size_t len, int val)
54 {
55  for (size_t i = 0; i < len; i++)
56  if (arr[i] == val)
57  return 1;
58  return 0;
59 }
60 
61 static int metadata_is_global(const AV1OBU *obu)
62 {
63  static const int metadata_obu_types[] = {
65  };
66  GetBitContext gb;
67  int metadata_type;
68 
69  if (init_get_bits(&gb, obu->data, obu->size_bits) < 0)
70  return 0;
71 
72  metadata_type = get_leb(&gb);
73 
74  return val_in_array(metadata_obu_types, FF_ARRAY_ELEMS(metadata_obu_types),
75  metadata_type);
76 }
77 
78 static int obu_is_global(const AV1OBU *obu)
79 {
80  static const int extradata_obu_types[] = {
82  };
83 
84  if (!val_in_array(extradata_obu_types, FF_ARRAY_ELEMS(extradata_obu_types),
85  obu->type))
86  return 0;
87  if (obu->type != AV1_OBU_METADATA)
88  return 1;
89 
90  return metadata_is_global(obu);
91 }
92 
94  uint8_t **data, int *size)
95 {
96 
98 
99  int extradata_size = 0, filtered_size = 0;
100  int i, has_seq = 0, ret = 0;
101 
102  ret = ff_av1_packet_split(&s->av1_pkt, pkt->data, pkt->size, ctx);
103  if (ret < 0)
104  return ret;
105 
106  for (i = 0; i < s->av1_pkt.nb_obus; i++) {
107  AV1OBU *obu = &s->av1_pkt.obus[i];
108  if (obu_is_global(obu)) {
109  extradata_size += obu->raw_size;
110  if (obu->type == AV1_OBU_SEQUENCE_HEADER)
111  has_seq = 1;
112  } else if (s->remove) {
113  filtered_size += obu->raw_size;
114  }
115  }
116 
117  if (extradata_size && has_seq) {
118  AVBufferRef *filtered_buf = NULL;
119  PutByteContext pb_filtered_data, pb_extradata;
120  uint8_t *extradata;
121 
122  if (s->remove) {
123  filtered_buf = av_buffer_alloc(filtered_size + AV_INPUT_BUFFER_PADDING_SIZE);
124  if (!filtered_buf) {
125  return AVERROR(ENOMEM);
126  }
127  memset(filtered_buf->data + filtered_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
128  }
129 
130  extradata = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
131  if (!extradata) {
132  av_buffer_unref(&filtered_buf);
133  return AVERROR(ENOMEM);
134  }
135 
136  *data = extradata;
137  *size = extradata_size;
138 
139  bytestream2_init_writer(&pb_extradata, extradata, extradata_size);
140  if (s->remove)
141  bytestream2_init_writer(&pb_filtered_data, filtered_buf->data, filtered_size);
142 
143  for (i = 0; i < s->av1_pkt.nb_obus; i++) {
144  AV1OBU *obu = &s->av1_pkt.obus[i];
145  if (obu_is_global(obu)) {
146  bytestream2_put_bufferu(&pb_extradata, obu->raw_data, obu->raw_size);
147  } else if (s->remove) {
148  bytestream2_put_bufferu(&pb_filtered_data, obu->raw_data, obu->raw_size);
149  }
150  }
151 
152  if (s->remove) {
154  pkt->buf = filtered_buf;
155  pkt->data = filtered_buf->data;
156  pkt->size = filtered_size;
157  }
158  }
159 
160  return 0;
161 }
162 
164  uint8_t **data, int *size)
165 {
166  static const int extradata_nal_types_vvc[] = {
168  };
169  static const int extradata_nal_types_hevc[] = {
171  };
172  static const int extradata_nal_types_h264[] = {
174  };
175 
177 
178  int extradata_size = 0, filtered_size = 0;
179  const int *extradata_nal_types;
180  size_t nb_extradata_nal_types;
181  int i, has_sps = 0, has_vps = 0, ret = 0;
182 
183  if (ctx->par_in->codec_id == AV_CODEC_ID_VVC) {
184  extradata_nal_types = extradata_nal_types_vvc;
185  nb_extradata_nal_types = FF_ARRAY_ELEMS(extradata_nal_types_vvc);
186  } else if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) {
187  extradata_nal_types = extradata_nal_types_hevc;
188  nb_extradata_nal_types = FF_ARRAY_ELEMS(extradata_nal_types_hevc);
189  } else {
190  extradata_nal_types = extradata_nal_types_h264;
191  nb_extradata_nal_types = FF_ARRAY_ELEMS(extradata_nal_types_h264);
192  }
193 
194  ret = ff_h2645_packet_split(&s->h2645_pkt, pkt->data, pkt->size,
195  ctx, 0, 0, ctx->par_in->codec_id, 1, 0);
196  if (ret < 0)
197  return ret;
198 
199  for (i = 0; i < s->h2645_pkt.nb_nals; i++) {
200  H2645NAL *nal = &s->h2645_pkt.nals[i];
201  if (val_in_array(extradata_nal_types, nb_extradata_nal_types, nal->type)) {
202  extradata_size += nal->raw_size + 3;
203  if (ctx->par_in->codec_id == AV_CODEC_ID_VVC) {
204  if (nal->type == VVC_SPS_NUT) has_sps = 1;
205  if (nal->type == VVC_VPS_NUT) has_vps = 1;
206  } else if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) {
207  if (nal->type == HEVC_NAL_SPS) has_sps = 1;
208  if (nal->type == HEVC_NAL_VPS) has_vps = 1;
209  } else {
210  if (nal->type == H264_NAL_SPS) has_sps = 1;
211  }
212  } else if (s->remove) {
213  filtered_size += nal->raw_size + 3;
214  }
215  }
216 
217  if (extradata_size &&
218  ((ctx->par_in->codec_id == AV_CODEC_ID_VVC && has_sps) ||
219  (ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps) ||
220  (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) {
221  AVBufferRef *filtered_buf = NULL;
222  PutByteContext pb_filtered_data, pb_extradata;
223  uint8_t *extradata;
224 
225  if (s->remove) {
226  filtered_buf = av_buffer_alloc(filtered_size + AV_INPUT_BUFFER_PADDING_SIZE);
227  if (!filtered_buf) {
228  return AVERROR(ENOMEM);
229  }
230  memset(filtered_buf->data + filtered_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
231  }
232 
233  extradata = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
234  if (!extradata) {
235  av_buffer_unref(&filtered_buf);
236  return AVERROR(ENOMEM);
237  }
238 
239  *data = extradata;
240  *size = extradata_size;
241 
242  bytestream2_init_writer(&pb_extradata, extradata, extradata_size);
243  if (s->remove)
244  bytestream2_init_writer(&pb_filtered_data, filtered_buf->data, filtered_size);
245 
246  for (i = 0; i < s->h2645_pkt.nb_nals; i++) {
247  H2645NAL *nal = &s->h2645_pkt.nals[i];
248  if (val_in_array(extradata_nal_types, nb_extradata_nal_types,
249  nal->type)) {
250  bytestream2_put_be24u(&pb_extradata, 1); //startcode
251  bytestream2_put_bufferu(&pb_extradata, nal->raw_data, nal->raw_size);
252  } else if (s->remove) {
253  bytestream2_put_be24u(&pb_filtered_data, 1); // startcode
254  bytestream2_put_bufferu(&pb_filtered_data, nal->raw_data, nal->raw_size);
255  }
256  }
257 
258  if (s->remove) {
260  pkt->buf = filtered_buf;
261  pkt->data = filtered_buf->data;
262  pkt->size = filtered_size;
263  }
264  }
265 
266  return 0;
267 }
268 
270  uint8_t **data, int *size)
271 {
273  const uint8_t *ptr = pkt->data, *end = pkt->data + pkt->size;
274  uint32_t state = UINT32_MAX;
275  int has_extradata = 0, extradata_size = 0;
276 
277  while (ptr < end) {
278  ptr = avpriv_find_start_code(ptr, end, &state);
280  has_extradata = 1;
281  } else if (has_extradata && IS_MARKER(state)) {
282  extradata_size = ptr - 4 - pkt->data;
283  break;
284  }
285  }
286 
287  if (extradata_size) {
288  *data = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
289  if (!*data)
290  return AVERROR(ENOMEM);
291 
292  memcpy(*data, pkt->data, extradata_size);
293  *size = extradata_size;
294 
295  if (s->remove) {
296  pkt->data += extradata_size;
297  pkt->size -= extradata_size;
298  }
299  }
300 
301  return 0;
302 }
303 
305  uint8_t **data, int *size)
306 {
308  uint32_t state = UINT32_MAX;
309  int i, found = 0;
310 
311  for (i = 0; i < pkt->size; i++) {
312  state = (state << 8) | pkt->data[i];
313  if (state == 0x1B3)
314  found = 1;
315  else if (found && state != 0x1B5 && state < 0x200 && state >= 0x100) {
316  *size = i - 3;
318  if (!*data)
319  return AVERROR(ENOMEM);
320 
321  memcpy(*data, pkt->data, *size);
322 
323  if (s->remove) {
324  pkt->data += *size;
325  pkt->size -= *size;
326  }
327  break;
328  }
329  }
330  return 0;
331 }
332 
334  uint8_t **data, int *size)
335 {
337  const uint8_t *ptr = pkt->data, *end = pkt->data + pkt->size;
338  uint32_t state = UINT32_MAX;
339 
340  while (ptr < end) {
341  ptr = avpriv_find_start_code(ptr, end, &state);
342  if (state == 0x1B3 || state == 0x1B6) {
343  if (ptr - pkt->data > 4) {
344  *size = ptr - 4 - pkt->data;
346  if (!*data)
347  return AVERROR(ENOMEM);
348 
349  memcpy(*data, pkt->data, *size);
350 
351  if (s->remove) {
352  pkt->data += *size;
353  pkt->size -= *size;
354  }
355  }
356  break;
357  }
358  }
359  return 0;
360 }
361 
362 static const struct {
363  enum AVCodecID id;
365  uint8_t **data, int *size);
366 } extract_tab[] = {
378 };
379 
381 {
383  int i;
384 
385  for (i = 0; i < FF_ARRAY_ELEMS(extract_tab); i++) {
386  if (extract_tab[i].id == ctx->par_in->codec_id) {
387  s->extract = extract_tab[i].extract;
388  break;
389  }
390  }
391  if (!s->extract)
392  return AVERROR_BUG;
393 
394  return 0;
395 }
396 
398 {
400  uint8_t *extradata = NULL;
401  int extradata_size;
402  int ret = 0;
403 
405  if (ret < 0)
406  return ret;
407 
408  ret = s->extract(ctx, pkt, &extradata, &extradata_size);
409  if (ret < 0)
410  goto fail;
411 
412  if (extradata) {
413  memset(extradata + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
415  extradata, extradata_size);
416  if (ret < 0) {
417  av_freep(&extradata);
418  goto fail;
419  }
420  }
421 
422  return 0;
423 
424 fail:
426  return ret;
427 }
428 
430 {
432  ff_av1_packet_uninit(&s->av1_pkt);
433  ff_h2645_packet_uninit(&s->h2645_pkt);
434 }
435 
436 static const enum AVCodecID codec_ids[] = {
449 };
450 
451 #define OFFSET(x) offsetof(ExtractExtradataContext, x)
452 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
453 static const AVOption options[] = {
454  { "remove", "remove the extradata from the bitstream", OFFSET(remove), AV_OPT_TYPE_INT,
455  { .i64 = 0 }, 0, 1, FLAGS },
456  { NULL },
457 };
458 
460  .class_name = "extract_extradata",
461  .item_name = av_default_item_name,
462  .option = options,
463  .version = LIBAVUTIL_VERSION_INT,
464 };
465 
467  .p.name = "extract_extradata",
468  .p.codec_ids = codec_ids,
469  .p.priv_class = &extract_extradata_class,
470  .priv_data_size = sizeof(ExtractExtradataContext),
473  .close = extract_extradata_close,
474 };
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: packet.c:427
ExtractExtradataContext::h2645_pkt
H2645Packet h2645_pkt
Definition: extract_extradata.c:47
h2645_parse.h
AVERROR
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
bsf_internal.h
opt.h
extract_extradata_h2645
static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size)
Definition: extract_extradata.c:163
OFFSET
#define OFFSET(x)
Definition: extract_extradata.c:451
AV_PKT_DATA_NEW_EXTRADATA
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
Definition: packet.h:56
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
extract_extradata_vc1
static int extract_extradata_vc1(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size)
Definition: extract_extradata.c:269
AVBitStreamFilter::name
const char * name
Definition: bsf.h:112
AV_CODEC_ID_MPEG4
@ AV_CODEC_ID_MPEG4
Definition: codec_id.h:64
extract_extradata_class
static const AVClass extract_extradata_class
Definition: extract_extradata.c:459
AVPacket::data
uint8_t * data
Definition: packet.h:524
AVOption
AVOption.
Definition: opt.h:346
ff_h2645_packet_uninit
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
Definition: h2645_parse.c:598
AV_CODEC_ID_AVS2
@ AV_CODEC_ID_AVS2
Definition: codec_id.h:246
data
const char data[16]
Definition: mxf.c:148
AV1OBU
Definition: av1_parse.h:38
id
enum AVCodecID id
Definition: extract_extradata.c:363
extract_extradata_mpeg12
static int extract_extradata_mpeg12(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size)
Definition: extract_extradata.c:304
ExtractExtradataContext::av1_pkt
AV1Packet av1_pkt
Definition: extract_extradata.c:44
filter
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:228
obu_is_global
static int obu_is_global(const AV1OBU *obu)
Definition: extract_extradata.c:78
extract
int(* extract)(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size)
Definition: extract_extradata.c:364
ExtractExtradataContext::remove
int remove
Definition: extract_extradata.c:50
H264_NAL_PPS
@ H264_NAL_PPS
Definition: h264.h:42
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:514
AVBSFContext
The bitstream filter state.
Definition: bsf.h:68
AV1OBU::data
const uint8_t * data
Definition: av1_parse.h:41
ff_av1_packet_split
int ff_av1_packet_split(AV1Packet *pkt, const uint8_t *buf, int length, void *logctx)
Split an input packet into OBUs.
Definition: av1_parse.c:56
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
av1_parse.h
bsf.h
av_packet_add_side_data
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size)
Wrap an existing array as a packet side data.
Definition: packet.c:197
AV1Packet
An input packet split into OBUs.
Definition: av1_parse.h:60
fail
#define fail()
Definition: checkasm.h:179
ExtractExtradataContext::extract
int(* extract)(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size)
Definition: extract_extradata.c:40
extract_extradata_close
static void extract_extradata_close(AVBSFContext *ctx)
Definition: extract_extradata.c:429
GetBitContext
Definition: get_bits.h:108
val
static double val(void *priv, double ch)
Definition: aeval.c:78
extract_extradata_mpeg4
static int extract_extradata_mpeg4(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size)
Definition: extract_extradata.c:333
pkt
AVPacket * pkt
Definition: movenc.c:60
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
bytestream2_init_writer
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
Definition: bytestream.h:147
s
#define s(width, name)
Definition: cbs_vp9.c:198
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
H2645NAL::type
int type
NAL unit type.
Definition: h2645_parse.h:52
if
if(ret)
Definition: filter_design.txt:179
AV_CODEC_ID_AVS3
@ AV_CODEC_ID_AVS3
Definition: codec_id.h:248
AVPacket::buf
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition: packet.h:507
H2645NAL::raw_size
int raw_size
Definition: h2645_parse.h:44
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
get_leb
static unsigned get_leb(GetBitContext *s)
Read a unsigned integer coded as a variable number of up to eight little-endian bytes,...
Definition: leb.h:35
FFBitStreamFilter
Definition: bsf_internal.h:27
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:280
HEVC_NAL_PPS
@ HEVC_NAL_PPS
Definition: hevc.h:63
state
static struct @414 state
VC1_CODE_SEQHDR
@ VC1_CODE_SEQHDR
Definition: vc1_common.h:40
codec_ids
static enum AVCodecID codec_ids[]
Definition: extract_extradata.c:436
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
IS_MARKER
#define IS_MARKER(state)
Definition: dca_parser.c:51
VC1_CODE_ENTRYPOINT
@ VC1_CODE_ENTRYPOINT
Definition: vc1_common.h:39
extract_extradata_filter
static int extract_extradata_filter(AVBSFContext *ctx, AVPacket *pkt)
Definition: extract_extradata.c:397
avpriv_find_start_code
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
ff_extract_extradata_bsf
const FFBitStreamFilter ff_extract_extradata_bsf
Definition: extract_extradata.c:466
AV_CODEC_ID_MPEG1VIDEO
@ AV_CODEC_ID_MPEG1VIDEO
Definition: codec_id.h:53
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
PutByteContext
Definition: bytestream.h:37
FFBitStreamFilter::p
AVBitStreamFilter p
The public AVBitStreamFilter.
Definition: bsf_internal.h:31
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
extract_extradata_init
static int extract_extradata_init(AVBSFContext *ctx)
Definition: extract_extradata.c:380
AVPacket::size
int size
Definition: packet.h:525
VVC_VPS_NUT
@ VVC_VPS_NUT
Definition: vvc.h:43
AV1_METADATA_TYPE_HDR_CLL
@ AV1_METADATA_TYPE_HDR_CLL
Definition: av1.h:44
size
int size
Definition: twinvq_data.h:10344
H264_NAL_SPS
@ H264_NAL_SPS
Definition: h264.h:41
H2645NAL
Definition: h2645_parse.h:34
AV1_OBU_SEQUENCE_HEADER
@ AV1_OBU_SEQUENCE_HEADER
Definition: av1.h:30
options
static const AVOption options[]
Definition: extract_extradata.c:453
val_in_array
static int val_in_array(const int *arr, size_t len, int val)
Definition: extract_extradata.c:53
ff_h2645_packet_split
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int is_nalff, int nal_length_size, enum AVCodecID codec_id, int small_padding, int use_ref)
Split an input packet into NAL units.
Definition: h2645_parse.c:464
AV_CODEC_ID_VVC
@ AV_CODEC_ID_VVC
Definition: codec_id.h:250
AV1OBU::raw_size
int raw_size
Size of entire OBU, including header.
Definition: av1_parse.h:50
av_buffer_alloc
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
Definition: buffer.c:77
VVC_SPS_NUT
@ VVC_SPS_NUT
Definition: vvc.h:44
vc1_common.h
AV1OBU::size_bits
int size_bits
Size, in bits, of just the data, excluding the trailing_one_bit and any trailing padding.
Definition: av1_parse.h:47
FLAGS
#define FLAGS
Definition: extract_extradata.c:452
log.h
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AV_CODEC_ID_CAVS
@ AV_CODEC_ID_CAVS
Definition: codec_id.h:139
AV1OBU::raw_data
const uint8_t * raw_data
Definition: av1_parse.h:51
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:226
ff_av1_packet_uninit
void ff_av1_packet_uninit(AV1Packet *pkt)
Free all the allocated memory in the packet.
Definition: av1_parse.c:104
AV_CODEC_ID_VC1
@ AV_CODEC_ID_VC1
Definition: codec_id.h:122
len
int len
Definition: vorbis_enc_data.h:426
extract_extradata_av1
static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size)
Definition: extract_extradata.c:93
HEVC_NAL_VPS
@ HEVC_NAL_VPS
Definition: hevc.h:61
ret
ret
Definition: filter_design.txt:187
H2645NAL::raw_data
const uint8_t * raw_data
Definition: h2645_parse.h:45
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
VVC_PPS_NUT
@ VVC_PPS_NUT
Definition: vvc.h:45
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
extract_tab
static const struct @48 extract_tab[]
ExtractExtradataContext
Definition: extract_extradata.c:37
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV1OBU::type
int type
Definition: av1_parse.h:53
HEVC_NAL_SPS
@ HEVC_NAL_SPS
Definition: hevc.h:62
mem.h
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
bytestream2_put_bufferu
static av_always_inline unsigned int bytestream2_put_bufferu(PutByteContext *p, const uint8_t *src, unsigned int size)
Definition: bytestream.h:301
AVPacket
This structure stores compressed data.
Definition: packet.h:501
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
bytestream.h
h264.h
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
metadata_is_global
static int metadata_is_global(const AV1OBU *obu)
Definition: extract_extradata.c:61
ff_bsf_get_packet_ref
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
Definition: bsf.c:256
int
int
Definition: ffmpeg_filter.c:424
AV_CODEC_ID_MPEG2VIDEO
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:54
H2645Packet
Definition: h2645_parse.h:82
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1283
AV1_OBU_METADATA
@ AV1_OBU_METADATA
Definition: av1.h:34
AV1_METADATA_TYPE_HDR_MDCV
@ AV1_METADATA_TYPE_HDR_MDCV
Definition: av1.h:45