FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
av1dec.c
Go to the documentation of this file.
1 /*
2  * AV1 Annex B demuxer
3  * Copyright (c) 2019 James Almer <jamrial@gmail.com>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "config_components.h"
23 
24 #include "libavutil/common.h"
25 #include "libavutil/opt.h"
26 #include "libavcodec/av1_parse.h"
27 #include "libavcodec/bsf.h"
28 #include "avformat.h"
29 #include "avio_internal.h"
30 #include "demux.h"
31 #include "internal.h"
32 
33 typedef struct AV1DemuxContext {
34  const AVClass *class;
38  uint32_t frame_unit_size;
41 
42 //return < 0 if we need more data
43 static int get_score(int type, int *seq)
44 {
45  switch (type) {
47  *seq = 1;
48  return -1;
49  case AV1_OBU_FRAME:
51  return *seq ? AVPROBE_SCORE_EXTENSION + 1 : 0;
52  case AV1_OBU_METADATA:
53  case AV1_OBU_PADDING:
54  return -1;
55  default:
56  break;
57  }
58  return 0;
59 }
60 
62 {
63  AV1DemuxContext *const c = s->priv_data;
64  const AVBitStreamFilter *filter = av_bsf_get_by_name("av1_frame_merge");
65  AVStream *st;
66  FFStream *sti;
67  int ret;
68 
69  if (!filter) {
70  av_log(s, AV_LOG_ERROR, "av1_frame_merge bitstream filter "
71  "not found. This is a bug, please report it.\n");
72  return AVERROR_BUG;
73  }
74 
75  st = avformat_new_stream(s, NULL);
76  if (!st)
77  return AVERROR(ENOMEM);
78  sti = ffstream(st);
79 
83 
84  st->avg_frame_rate = c->framerate;
85  // taken from rawvideo demuxers
86  avpriv_set_pts_info(st, 64, 1, 1200000);
87 
88  ret = av_bsf_alloc(filter, &c->bsf);
89  if (ret < 0)
90  return ret;
91 
92  ret = avcodec_parameters_copy(c->bsf->par_in, st->codecpar);
93  if (ret < 0)
94  return ret;
95 
96  ret = av_bsf_init(c->bsf);
97  if (ret < 0)
98  return ret;
99 
100  c->pos = avio_tell(s->pb);
101 
102  return 0;
103 }
104 
106 {
107  AV1DemuxContext *const c = s->priv_data;
108 
109  av_bsf_free(&c->bsf);
110  return 0;
111 }
112 
113 #define DEC AV_OPT_FLAG_DECODING_PARAM
114 #define OFFSET(x) offsetof(AV1DemuxContext, x)
115 static const AVOption av1_options[] = {
116  { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC},
117  { NULL },
118 };
119 #undef OFFSET
120 
121 static const AVClass av1_demuxer_class = {
122  .class_name = "AV1 Annex B/low overhead OBU demuxer",
123  .item_name = av_default_item_name,
124  .option = av1_options,
125  .version = LIBAVUTIL_VERSION_INT,
126 };
127 
128 #if CONFIG_AV1_DEMUXER
129 
130 static int leb(AVIOContext *pb, uint32_t *len, int eof) {
131  int more, i = 0;
132  *len = 0;
133  do {
134  unsigned bits;
135  int byte = avio_r8(pb);
136  if (pb->error)
137  return pb->error;
138  if (pb->eof_reached)
139  return (eof && !i) ? AVERROR_EOF : AVERROR_INVALIDDATA;
140  more = byte & 0x80;
141  bits = byte & 0x7f;
142  if (i <= 3 || (i == 4 && bits < (1 << 4)))
143  *len |= bits << (i * 7);
144  else if (bits)
145  return AVERROR_INVALIDDATA;
146  if (++i == 8 && more)
147  return AVERROR_INVALIDDATA;
148  } while (more);
149  return i;
150 }
151 
152 static int read_obu(const uint8_t *buf, int size, int64_t *obu_size, int *type)
153 {
154  int start_pos, temporal_id, spatial_id;
155  int len;
156 
157  len = parse_obu_header(buf, size, obu_size, &start_pos,
158  type, &temporal_id, &spatial_id);
159  if (len < 0)
160  return len;
161 
162  return 0;
163 }
164 
165 static int annexb_probe(const AVProbeData *p)
166 {
168  AVIOContext *const pb = &ctx.pub;
169  int64_t obu_size;
170  uint32_t temporal_unit_size, frame_unit_size, obu_unit_size;
171  int seq = 0;
172  int ret, type, cnt = 0;
173 
175 
176  ret = leb(pb, &temporal_unit_size, 1);
177  if (ret < 0)
178  return 0;
179  cnt += ret;
180  ret = leb(pb, &frame_unit_size, 0);
181  if (ret < 0 || ((int64_t)frame_unit_size + ret) > temporal_unit_size)
182  return 0;
183  cnt += ret;
184  ret = leb(pb, &obu_unit_size, 0);
185  if (ret < 0 || ((int64_t)obu_unit_size + ret) >= frame_unit_size)
186  return 0;
187  cnt += ret;
188 
189  frame_unit_size -= obu_unit_size + ret;
190 
191  avio_skip(pb, obu_unit_size);
192  if (pb->eof_reached || pb->error)
193  return 0;
194 
195  // Check that the first OBU is a Temporal Delimiter.
196  ret = read_obu(p->buf + cnt, FFMIN(p->buf_size - cnt, obu_unit_size), &obu_size, &type);
197  if (ret < 0 || type != AV1_OBU_TEMPORAL_DELIMITER || obu_size > 0)
198  return 0;
199  cnt += obu_unit_size;
200 
201  do {
202  ret = leb(pb, &obu_unit_size, 0);
203  if (ret < 0 || ((int64_t)obu_unit_size + ret) > frame_unit_size)
204  return 0;
205  cnt += ret;
206 
207  avio_skip(pb, obu_unit_size);
208  if (pb->eof_reached || pb->error)
209  return 0;
210 
211  ret = read_obu(p->buf + cnt, FFMIN(p->buf_size - cnt, obu_unit_size), &obu_size, &type);
212  if (ret < 0)
213  return 0;
214  cnt += obu_unit_size;
215 
216  ret = get_score(type, &seq);
217  if (ret >= 0)
218  return ret;
219 
220  frame_unit_size -= obu_unit_size + ret;
221  } while (frame_unit_size);
222 
223  return 0;
224 }
225 
226 static int annexb_read_packet(AVFormatContext *s, AVPacket *pkt)
227 {
228  AV1DemuxContext *const c = s->priv_data;
229  uint32_t obu_unit_size;
230  int64_t pos = c->pos;
231  int ret, len;
232 
233 retry:
234  if (avio_feof(s->pb)) {
235  if (c->temporal_unit_size || c->frame_unit_size)
236  return AVERROR_INVALIDDATA;
237  goto end;
238  }
239 
240  if (!c->temporal_unit_size) {
241  c->pos = avio_tell(s->pb);
242  len = leb(s->pb, &c->temporal_unit_size, 1);
243  if (len == AVERROR_EOF) goto end;
244  else if (len < 0) return len;
245  }
246 
247  if (!c->frame_unit_size) {
248  len = leb(s->pb, &c->frame_unit_size, 0);
249  if (len < 0)
250  return len;
251  if (((int64_t)c->frame_unit_size + len) > c->temporal_unit_size)
252  return AVERROR_INVALIDDATA;
253  c->temporal_unit_size -= len;
254  }
255 
256  len = leb(s->pb, &obu_unit_size, 0);
257  if (len < 0)
258  return len;
259  if (((int64_t)obu_unit_size + len) > c->frame_unit_size)
260  return AVERROR_INVALIDDATA;
261 
262  ret = av_get_packet(s->pb, pkt, obu_unit_size);
263  if (ret < 0)
264  return ret;
265  if (ret != obu_unit_size)
266  return AVERROR_INVALIDDATA;
267 
268  c->temporal_unit_size -= obu_unit_size + len;
269  c->frame_unit_size -= obu_unit_size + len;
270 
271 end:
272  ret = av_bsf_send_packet(c->bsf, pkt);
273  if (ret < 0) {
274  av_log(s, AV_LOG_ERROR, "Failed to send packet to "
275  "av1_frame_merge filter\n");
276  return ret;
277  }
278 
279  ret = av_bsf_receive_packet(c->bsf, pkt);
280  if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
281  av_log(s, AV_LOG_ERROR, "av1_frame_merge filter failed to "
282  "send output packet\n");
283 
284  if (ret == AVERROR(EAGAIN))
285  goto retry;
286 
287  if (!ret)
288  pkt->pos = pos;
289 
290  return ret;
291 }
292 
294  .p.name = "av1",
295  .p.long_name = NULL_IF_CONFIG_SMALL("AV1 Annex B"),
296  .p.extensions = "obu",
298  .p.priv_class = &av1_demuxer_class,
299  .priv_data_size = sizeof(AV1DemuxContext),
300  .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
303  .read_packet = annexb_read_packet,
305 };
306 #endif
307 
308 #if CONFIG_OBU_DEMUXER
309 //For low overhead obu, we can't foresee the obu size before we parsed the header.
310 //So, we can't use parse_obu_header here, since it will check size <= buf_size
311 //see c27c7b49dc for more details
312 static int read_obu_with_size(const uint8_t *buf, int buf_size, int64_t *obu_size, int *type)
313 {
314  GetBitContext gb;
315  int ret, extension_flag, start_pos;
316  int64_t size;
317 
318  ret = init_get_bits8(&gb, buf, FFMIN(buf_size, MAX_OBU_HEADER_SIZE));
319  if (ret < 0)
320  return ret;
321 
322  if (get_bits1(&gb) != 0) // obu_forbidden_bit
323  return AVERROR_INVALIDDATA;
324 
325  *type = get_bits(&gb, 4);
326  extension_flag = get_bits1(&gb);
327  if (!get_bits1(&gb)) // has_size_flag
328  return AVERROR_INVALIDDATA;
329  skip_bits1(&gb); // obu_reserved_1bit
330 
331  if (extension_flag) {
332  get_bits(&gb, 3); // temporal_id
333  get_bits(&gb, 2); // spatial_id
334  skip_bits(&gb, 3); // extension_header_reserved_3bits
335  }
336 
337  *obu_size = get_leb128(&gb);
338  if (*obu_size > INT_MAX)
339  return AVERROR_INVALIDDATA;
340 
341  if (get_bits_left(&gb) < 0)
342  return AVERROR_INVALIDDATA;
343 
344  start_pos = get_bits_count(&gb) / 8;
345 
346  size = *obu_size + start_pos;
347  if (size > INT_MAX)
348  return AVERROR_INVALIDDATA;
349  return size;
350 }
351 
352 static int obu_probe(const AVProbeData *p)
353 {
354  int64_t obu_size;
355  int seq = 0;
356  int ret, type, cnt;
357 
358  // Check that the first OBU is a Temporal Delimiter.
359  cnt = read_obu_with_size(p->buf, p->buf_size, &obu_size, &type);
360  if (cnt < 0 || type != AV1_OBU_TEMPORAL_DELIMITER || obu_size != 0)
361  return 0;
362 
363  while (1) {
364  ret = read_obu_with_size(p->buf + cnt, p->buf_size - cnt, &obu_size, &type);
365  if (ret < 0 || obu_size <= 0)
366  return 0;
367  cnt += FFMIN(ret, p->buf_size - cnt);
368 
369  ret = get_score(type, &seq);
370  if (ret >= 0)
371  return ret;
372  }
373  return 0;
374 }
375 
376 static int obu_get_packet(AVFormatContext *s, AVPacket *pkt)
377 {
378  AV1DemuxContext *const c = s->priv_data;
380  int64_t obu_size;
381  int size;
382  int ret, len, type;
383 
384  if ((ret = ffio_ensure_seekback(s->pb, MAX_OBU_HEADER_SIZE)) < 0)
385  return ret;
387  if (size < 0)
388  return size;
389 
391  len = read_obu_with_size(header, size, &obu_size, &type);
392  if (len < 0) {
393  av_log(c, AV_LOG_ERROR, "Failed to read obu\n");
394  return len;
395  }
396  avio_seek(s->pb, -size, SEEK_CUR);
397 
398  ret = av_get_packet(s->pb, pkt, len);
399  if (ret != len) {
400  av_log(c, AV_LOG_ERROR, "Failed to get packet for obu\n");
401  return ret < 0 ? ret : AVERROR_INVALIDDATA;
402  }
403  return 0;
404 }
405 
406 static int obu_read_packet(AVFormatContext *s, AVPacket *pkt)
407 {
408  AV1DemuxContext *const c = s->priv_data;
409  int ret;
410 
411  if (s->io_repositioned) {
412  av_bsf_flush(c->bsf);
413  s->io_repositioned = 0;
414  }
415  while (1) {
416  ret = obu_get_packet(s, pkt);
417  /* In case of AVERROR_EOF we need to flush the BSF. Conveniently
418  * obu_get_packet() returns a blank pkt in this case which
419  * can be used to signal that the BSF should be flushed. */
420  if (ret < 0 && ret != AVERROR_EOF)
421  return ret;
422  ret = av_bsf_send_packet(c->bsf, pkt);
423  if (ret < 0) {
424  av_log(s, AV_LOG_ERROR, "Failed to send packet to "
425  "av1_frame_merge filter\n");
426  return ret;
427  }
428  ret = av_bsf_receive_packet(c->bsf, pkt);
429  if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
430  av_log(s, AV_LOG_ERROR, "av1_frame_merge filter failed to "
431  "send output packet\n");
432  if (ret != AVERROR(EAGAIN))
433  break;
434  }
435 
436  return ret;
437 }
438 
440  .p.name = "obu",
441  .p.long_name = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"),
442  .p.extensions = "obu",
444  .p.priv_class = &av1_demuxer_class,
445  .priv_data_size = sizeof(AV1DemuxContext),
446  .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
447  .read_probe = obu_probe,
449  .read_packet = obu_read_packet,
451 };
452 #endif
AVFMT_NO_BYTE_SEEK
#define AVFMT_NO_BYTE_SEEK
Format does not allow seeking by bytes.
Definition: avformat.h:487
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:678
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
opt.h
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
ff_av1_demuxer
const FFInputFormat ff_av1_demuxer
get_score
static int get_score(int type, int *seq)
Definition: av1dec.c:43
AV1DemuxContext
Definition: av1dec.c:33
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
Definition: opt.h:315
AVFMT_NOTIMESTAMPS
#define AVFMT_NOTIMESTAMPS
Format does not need / have any timestamps.
Definition: avformat.h:479
int64_t
long long int64_t
Definition: coverity.c:34
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:249
AVOption
AVOption.
Definition: opt.h:429
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:834
AVIOContext::error
int error
contains the error code or 0 if no error happened
Definition: avio.h:239
filter
void(* filter)(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:29
ffio_init_read_context
void ffio_init_read_context(FFIOContext *s, const uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for reading.
Definition: aviobuf.c:99
AVProbeData::buf_size
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:454
AV1_OBU_TEMPORAL_DELIMITER
@ AV1_OBU_TEMPORAL_DELIMITER
Definition: av1.h:31
av_bsf_free
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
Definition: bsf.c:52
FFIOContext
Definition: avio_internal.h:28
AVBSFContext
The bitstream filter state.
Definition: bsf.h:68
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:364
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:318
av1_parse.h
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:777
bsf.h
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:347
AV1_OBU_FRAME_HEADER
@ AV1_OBU_FRAME_HEADER
Definition: av1.h:32
GetBitContext
Definition: get_bits.h:108
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:480
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
annexb_probe
static int annexb_probe(const AVProbeData *p)
Definition: evcdec.c:60
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:528
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
parse_obu_header
static int parse_obu_header(const uint8_t *buf, int buf_size, int64_t *obu_size, int *start_pos, int *type, int *temporal_id, int *spatial_id)
Definition: av1_parse.h:92
s
#define s(width, name)
Definition: cbs_vp9.c:198
av_bsf_flush
void av_bsf_flush(AVBSFContext *ctx)
Reset the internal bitstream filter state.
Definition: bsf.c:190
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:550
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:453
av1_read_close
static int av1_read_close(AVFormatContext *s)
Definition: av1dec.c:105
bits
uint8_t bits
Definition: vp3data.h:128
AV1DemuxContext::pos
int64_t pos
Definition: av1dec.c:39
ctx
AVFormatContext * ctx
Definition: movenc.c:49
av_bsf_alloc
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
Definition: bsf.c:104
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
FFStream::need_parsing
enum AVStreamParseType need_parsing
Definition: internal.h:314
AVFormatContext
Format I/O context.
Definition: avformat.h:1265
internal.h
DEC
#define DEC
Definition: av1dec.c:113
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:768
framerate
float framerate
Definition: av1_levels.c:29
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_bsf_init
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
Definition: bsf.c:149
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
NULL
#define NULL
Definition: coverity.c:32
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:284
av_bsf_receive_packet
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
Definition: bsf.c:230
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:240
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:371
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AVPROBE_SCORE_EXTENSION
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:461
AV1DemuxContext::bsf
AVBSFContext * bsf
Definition: av1dec.c:35
AV1_OBU_FRAME
@ AV1_OBU_FRAME
Definition: av1.h:35
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
OFFSET
#define OFFSET(x)
Definition: av1dec.c:114
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
FFStream
Definition: internal.h:128
av_bsf_send_packet
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
Definition: bsf.c:202
size
int size
Definition: twinvq_data.h:10344
AV1_OBU_SEQUENCE_HEADER
@ AV1_OBU_SEQUENCE_HEADER
Definition: av1.h:30
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:46
header
static const uint8_t header[24]
Definition: sdr2.c:68
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:603
ffio_ensure_seekback
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
Definition: aviobuf.c:1023
skip_bits1
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:396
read_header
static int read_header(FFV1Context *f, RangeCoder *c)
Definition: ffv1dec.c:489
AV1DemuxContext::frame_unit_size
uint32_t frame_unit_size
Definition: av1dec.c:38
AV1_OBU_PADDING
@ AV1_OBU_PADDING
Definition: av1.h:39
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
avio_internal.h
common.h
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
demux.h
len
int len
Definition: vorbis_enc_data.h:426
av_get_packet
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:94
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:745
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:231
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:81
AVSTREAM_PARSE_HEADERS
@ AVSTREAM_PARSE_HEADERS
Only parse headers, do not repack.
Definition: avformat.h:591
pos
unsigned int pos
Definition: spdifenc.c:414
avformat.h
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
AV1DemuxContext::temporal_unit_size
uint32_t temporal_unit_size
Definition: av1dec.c:37
AVBitStreamFilter
Definition: bsf.h:111
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:612
AVIOContext::eof_reached
int eof_reached
true if was unable to read due to error or eof
Definition: avio.h:238
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:318
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
av1_options
static const AVOption av1_options[]
Definition: av1dec.c:115
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AVPacket
This structure stores compressed data.
Definition: packet.h:512
av1_read_header
static int av1_read_header(AVFormatContext *s)
Definition: av1dec.c:61
av1_demuxer_class
static const AVClass av1_demuxer_class
Definition: av1dec.c:121
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:555
FFInputFormat
Definition: demux.h:42
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
ff_obu_demuxer
const FFInputFormat ff_obu_demuxer
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV1DemuxContext::framerate
AVRational framerate
Definition: av1dec.c:36
AV1_OBU_METADATA
@ AV1_OBU_METADATA
Definition: av1.h:34
avcodec_parameters_copy
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
Definition: codec_par.c:106
MAX_OBU_HEADER_SIZE
#define MAX_OBU_HEADER_SIZE
Definition: av1_parse.h:36
get_leb128
static int64_t get_leb128(GetBitContext *gb)
Read a unsigned integer coded as a variable number of up to eight little-endian bytes,...
Definition: leb.h:57
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:346
av_bsf_get_by_name
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
Definition: bitstream_filters.c:88