FFmpeg  4.4.4
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.h"
23 
24 #include "libavutil/common.h"
25 #include "libavutil/fifo.h"
26 #include "libavutil/opt.h"
27 #include "libavcodec/av1_parse.h"
28 #include "avformat.h"
29 #include "avio_internal.h"
30 #include "internal.h"
31 
32 //return < 0 if we need more data
33 static int get_score(int type, int *seq)
34 {
35  switch (type) {
37  *seq = 1;
38  return -1;
39  case AV1_OBU_FRAME:
41  return *seq ? AVPROBE_SCORE_EXTENSION + 1 : 0;
42  case AV1_OBU_METADATA:
43  case AV1_OBU_PADDING:
44  return -1;
45  default:
46  break;
47  }
48  return 0;
49 }
50 
51 static int read_header(AVFormatContext *s, const AVRational *framerate, AVBSFContext **bsf, void *logctx)
52 {
53  const AVBitStreamFilter *filter = av_bsf_get_by_name("av1_frame_merge");
54  AVStream *st;
55  int ret;
56 
57  if (!filter) {
58  av_log(logctx, AV_LOG_ERROR, "av1_frame_merge bitstream filter "
59  "not found. This is a bug, please report it.\n");
60  return AVERROR_BUG;
61  }
62 
63  st = avformat_new_stream(s, NULL);
64  if (!st)
65  return AVERROR(ENOMEM);
66 
70 
72  // taken from rawvideo demuxers
73  avpriv_set_pts_info(st, 64, 1, 1200000);
74 
75  ret = av_bsf_alloc(filter, bsf);
76  if (ret < 0)
77  return ret;
78 
79  ret = avcodec_parameters_copy((*bsf)->par_in, st->codecpar);
80  if (ret < 0) {
81  av_bsf_free(bsf);
82  return ret;
83  }
84 
85  ret = av_bsf_init(*bsf);
86  if (ret < 0)
87  av_bsf_free(bsf);
88 
89  return ret;
90 
91 }
92 
93 #define DEC AV_OPT_FLAG_DECODING_PARAM
94 
95 #if CONFIG_AV1_DEMUXER
96 typedef struct AnnexBContext {
97  const AVClass *class;
98  AVBSFContext *bsf;
99  uint32_t temporal_unit_size;
100  uint32_t frame_unit_size;
102 } AnnexBContext;
103 
104 static int leb(AVIOContext *pb, uint32_t *len) {
105  int more, i = 0;
106  uint8_t byte;
107  *len = 0;
108  do {
109  unsigned bits;
110  byte = avio_r8(pb);
111  more = byte & 0x80;
112  bits = byte & 0x7f;
113  if (i <= 3 || (i == 4 && bits < (1 << 4)))
114  *len |= bits << (i * 7);
115  else if (bits)
116  return AVERROR_INVALIDDATA;
117  if (++i == 8 && more)
118  return AVERROR_INVALIDDATA;
119  if (pb->eof_reached || pb->error)
120  return pb->error ? pb->error : AVERROR(EIO);
121  } while (more);
122  return i;
123 }
124 
125 static int read_obu(const uint8_t *buf, int size, int64_t *obu_size, int *type)
126 {
127  int start_pos, temporal_id, spatial_id;
128  int len;
129 
130  len = parse_obu_header(buf, size, obu_size, &start_pos,
131  type, &temporal_id, &spatial_id);
132  if (len < 0)
133  return len;
134 
135  return 0;
136 }
137 
138 static int annexb_probe(const AVProbeData *p)
139 {
140  AVIOContext pb;
141  int64_t obu_size;
142  uint32_t temporal_unit_size, frame_unit_size, obu_unit_size;
143  int seq = 0;
144  int ret, type, cnt = 0;
145 
146  ffio_init_context(&pb, p->buf, p->buf_size, 0,
147  NULL, NULL, NULL, NULL);
148 
149  ret = leb(&pb, &temporal_unit_size);
150  if (ret < 0)
151  return 0;
152  cnt += ret;
153  ret = leb(&pb, &frame_unit_size);
154  if (ret < 0 || ((int64_t)frame_unit_size + ret) > temporal_unit_size)
155  return 0;
156  cnt += ret;
157  ret = leb(&pb, &obu_unit_size);
158  if (ret < 0 || ((int64_t)obu_unit_size + ret) >= frame_unit_size)
159  return 0;
160  cnt += ret;
161 
162  frame_unit_size -= obu_unit_size + ret;
163 
164  avio_skip(&pb, obu_unit_size);
165  if (pb.eof_reached || pb.error)
166  return 0;
167 
168  // Check that the first OBU is a Temporal Delimiter.
169  ret = read_obu(p->buf + cnt, FFMIN(p->buf_size - cnt, obu_unit_size), &obu_size, &type);
170  if (ret < 0 || type != AV1_OBU_TEMPORAL_DELIMITER || obu_size > 0)
171  return 0;
172  cnt += obu_unit_size;
173 
174  do {
175  ret = leb(&pb, &obu_unit_size);
176  if (ret < 0 || ((int64_t)obu_unit_size + ret) > frame_unit_size)
177  return 0;
178  cnt += ret;
179 
180  avio_skip(&pb, obu_unit_size);
181  if (pb.eof_reached || pb.error)
182  return 0;
183 
184  ret = read_obu(p->buf + cnt, FFMIN(p->buf_size - cnt, obu_unit_size), &obu_size, &type);
185  if (ret < 0)
186  return 0;
187  cnt += obu_unit_size;
188 
189  ret = get_score(type, &seq);
190  if (ret >= 0)
191  return ret;
192 
193  frame_unit_size -= obu_unit_size + ret;
194  } while (frame_unit_size);
195 
196  return 0;
197 }
198 
199 static int annexb_read_header(AVFormatContext *s)
200 {
201  AnnexBContext *c = s->priv_data;
202  return read_header(s, &c->framerate, &c->bsf, c);
203 }
204 
205 static int annexb_read_packet(AVFormatContext *s, AVPacket *pkt)
206 {
207  AnnexBContext *c = s->priv_data;
208  uint32_t obu_unit_size;
209  int ret, len;
210 
211 retry:
212  if (avio_feof(s->pb)) {
213  if (c->temporal_unit_size || c->frame_unit_size)
214  return AVERROR(EIO);
215  goto end;
216  }
217 
218  if (!c->temporal_unit_size) {
219  len = leb(s->pb, &c->temporal_unit_size);
220  if (len < 0) return AVERROR_INVALIDDATA;
221  }
222 
223  if (!c->frame_unit_size) {
224  len = leb(s->pb, &c->frame_unit_size);
225  if (len < 0 || ((int64_t)c->frame_unit_size + len) > c->temporal_unit_size)
226  return AVERROR_INVALIDDATA;
227  c->temporal_unit_size -= len;
228  }
229 
230  len = leb(s->pb, &obu_unit_size);
231  if (len < 0 || ((int64_t)obu_unit_size + len) > c->frame_unit_size)
232  return AVERROR_INVALIDDATA;
233 
234  ret = av_get_packet(s->pb, pkt, obu_unit_size);
235  if (ret < 0)
236  return ret;
237  if (ret != obu_unit_size)
238  return AVERROR(EIO);
239 
240  c->temporal_unit_size -= obu_unit_size + len;
241  c->frame_unit_size -= obu_unit_size + len;
242 
243 end:
244  ret = av_bsf_send_packet(c->bsf, pkt);
245  if (ret < 0) {
246  av_log(s, AV_LOG_ERROR, "Failed to send packet to "
247  "av1_frame_merge filter\n");
248  return ret;
249  }
250 
251  ret = av_bsf_receive_packet(c->bsf, pkt);
252  if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
253  av_log(s, AV_LOG_ERROR, "av1_frame_merge filter failed to "
254  "send output packet\n");
255 
256  if (ret == AVERROR(EAGAIN))
257  goto retry;
258 
259  return ret;
260 }
261 
262 static int annexb_read_close(AVFormatContext *s)
263 {
264  AnnexBContext *c = s->priv_data;
265 
266  av_bsf_free(&c->bsf);
267  return 0;
268 }
269 
270 #define OFFSET(x) offsetof(AnnexBContext, x)
271 static const AVOption annexb_options[] = {
272  { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC},
273  { NULL },
274 };
275 #undef OFFSET
276 
277 static const AVClass annexb_demuxer_class = {
278  .class_name = "AV1 Annex B demuxer",
279  .item_name = av_default_item_name,
280  .option = annexb_options,
281  .version = LIBAVUTIL_VERSION_INT,
282 };
283 
285  .name = "av1",
286  .long_name = NULL_IF_CONFIG_SMALL("AV1 Annex B"),
287  .priv_data_size = sizeof(AnnexBContext),
288  .read_probe = annexb_probe,
289  .read_header = annexb_read_header,
290  .read_packet = annexb_read_packet,
291  .read_close = annexb_read_close,
292  .extensions = "obu",
294  .priv_class = &annexb_demuxer_class,
295 };
296 #endif
297 
298 #if CONFIG_OBU_DEMUXER
299 typedef struct ObuContext {
300  const AVClass *class;
301  AVBSFContext *bsf;
303  AVFifoBuffer *fifo;
304 } ObuContext;
305 
306 //For low overhead obu, we can't foresee the obu size before we parsed the header.
307 //So, we can't use parse_obu_header here, since it will check size <= buf_size
308 //see c27c7b49dc for more details
309 static int read_obu_with_size(const uint8_t *buf, int buf_size, int64_t *obu_size, int *type)
310 {
311  GetBitContext gb;
312  int ret, extension_flag, start_pos;
313  int64_t size;
314 
315  ret = init_get_bits8(&gb, buf, FFMIN(buf_size, MAX_OBU_HEADER_SIZE));
316  if (ret < 0)
317  return ret;
318 
319  if (get_bits1(&gb) != 0) // obu_forbidden_bit
320  return AVERROR_INVALIDDATA;
321 
322  *type = get_bits(&gb, 4);
323  extension_flag = get_bits1(&gb);
324  if (!get_bits1(&gb)) // has_size_flag
325  return AVERROR_INVALIDDATA;
326  skip_bits1(&gb); // obu_reserved_1bit
327 
328  if (extension_flag) {
329  get_bits(&gb, 3); // temporal_id
330  get_bits(&gb, 2); // spatial_id
331  skip_bits(&gb, 3); // extension_header_reserved_3bits
332  }
333 
334  *obu_size = leb128(&gb);
335  if (*obu_size > INT_MAX)
336  return AVERROR_INVALIDDATA;
337 
338  if (get_bits_left(&gb) < 0)
339  return AVERROR_INVALIDDATA;
340 
341  start_pos = get_bits_count(&gb) / 8;
342 
343  size = *obu_size + start_pos;
344  if (size > INT_MAX)
345  return AVERROR_INVALIDDATA;
346  return size;
347 }
348 
349 static int obu_probe(const AVProbeData *p)
350 {
351  int64_t obu_size;
352  int seq = 0;
353  int ret, type, cnt;
354 
355  // Check that the first OBU is a Temporal Delimiter.
356  cnt = read_obu_with_size(p->buf, p->buf_size, &obu_size, &type);
357  if (cnt < 0 || type != AV1_OBU_TEMPORAL_DELIMITER || obu_size != 0)
358  return 0;
359 
360  while (1) {
361  ret = read_obu_with_size(p->buf + cnt, p->buf_size - cnt, &obu_size, &type);
362  if (ret < 0 || obu_size <= 0)
363  return 0;
364  cnt += FFMIN(ret, p->buf_size - cnt);
365 
366  ret = get_score(type, &seq);
367  if (ret >= 0)
368  return ret;
369  }
370  return 0;
371 }
372 
373 static int obu_read_header(AVFormatContext *s)
374 {
375  ObuContext *c = s->priv_data;
377  if (!c->fifo)
378  return AVERROR(ENOMEM);
379  return read_header(s, &c->framerate, &c->bsf, c);
380 }
381 
382 static int obu_get_packet(AVFormatContext *s, AVPacket *pkt)
383 {
384  ObuContext *c = s->priv_data;
386  int64_t obu_size;
387  int size = av_fifo_space(c->fifo);
388  int ret, len, type;
389 
390  av_fifo_generic_write(c->fifo, s->pb, size,
391  (int (*)(void*, void*, int))avio_read);
392  size = av_fifo_size(c->fifo);
393  if (!size)
394  return 0;
395 
397 
398  len = read_obu_with_size(header, size, &obu_size, &type);
399  if (len < 0) {
400  av_log(c, AV_LOG_ERROR, "Failed to read obu\n");
401  return len;
402  }
403 
404  ret = av_new_packet(pkt, len);
405  if (ret < 0) {
406  av_log(c, AV_LOG_ERROR, "Failed to allocate packet for obu\n");
407  return ret;
408  }
409  size = FFMIN(size, len);
410  av_fifo_generic_read(c->fifo, pkt->data, size, NULL);
411  len -= size;
412  if (len > 0) {
413  ret = avio_read(s->pb, pkt->data + size, len);
414  if (ret != len) {
415  av_log(c, AV_LOG_ERROR, "Failed to read %d frome file\n", len);
416  return ret < 0 ? ret : AVERROR_INVALIDDATA;
417  }
418  }
419  return 0;
420 }
421 
422 static int obu_read_packet(AVFormatContext *s, AVPacket *pkt)
423 {
424  ObuContext *c = s->priv_data;
425  int ret;
426 
427  while (1) {
428  ret = obu_get_packet(s, pkt);
429  if (ret < 0)
430  return ret;
431  ret = av_bsf_send_packet(c->bsf, pkt);
432  if (ret < 0) {
433  av_log(s, AV_LOG_ERROR, "Failed to send packet to "
434  "av1_frame_merge filter\n");
435  return ret;
436  }
437  ret = av_bsf_receive_packet(c->bsf, pkt);
438  if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
439  av_log(s, AV_LOG_ERROR, "av1_frame_merge filter failed to "
440  "send output packet\n");
441  if (ret != AVERROR(EAGAIN))
442  break;
443  }
444 
445  return ret;
446 }
447 
448 static int obu_read_close(AVFormatContext *s)
449 {
450  ObuContext *c = s->priv_data;
451 
452  av_fifo_freep(&c->fifo);
453  av_bsf_free(&c->bsf);
454  return 0;
455 }
456 
457 #define OFFSET(x) offsetof(ObuContext, x)
458 static const AVOption obu_options[] = {
459  { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC},
460  { NULL },
461 };
462 #undef OFFSET
463 
464 static const AVClass obu_demuxer_class = {
465  .class_name = "AV1 low overhead OBU demuxer",
466  .item_name = av_default_item_name,
467  .option = obu_options,
468  .version = LIBAVUTIL_VERSION_INT,
469 };
470 
472  .name = "obu",
473  .long_name = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"),
474  .priv_data_size = sizeof(ObuContext),
475  .read_probe = obu_probe,
476  .read_header = obu_read_header,
477  .read_packet = obu_read_packet,
478  .read_close = obu_read_close,
479  .extensions = "obu",
481  .priv_class = &obu_demuxer_class,
482 };
483 #endif
AVInputFormat ff_obu_demuxer
AVInputFormat ff_av1_demuxer
uint8_t
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:103
#define MAX_OBU_HEADER_SIZE
Definition: av1_parse.h:31
Main libavformat public API header.
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:451
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:310
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:463
@ AVSTREAM_PARSE_HEADERS
Only parse headers, do not repack.
Definition: avformat.h:795
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:364
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:337
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:633
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:624
int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Definition: aviobuf.c:88
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
#define flags(name, subs,...)
Definition: cbs_av1.c:561
#define leb128(name)
Definition: cbs_av1.c:705
#define s(width, name)
Definition: cbs_vp9.c:257
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
Definition: cfhddsp.c:27
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
Definition: codec_par.c:72
common internal and external API header
#define FFMIN(a, b)
Definition: common.h:105
#define NULL
Definition: coverity.c:32
int
a very simple circular buffer FIFO implementation
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:677
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:538
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:238
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:40
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
Definition: bsf.c:148
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
Definition: bsf.c:95
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
Definition: bsf.c:227
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
Definition: bsf.c:201
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
@ AV_CODEC_ID_AV1
Definition: codec_id.h:279
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition: avcodec.h:215
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:99
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:4509
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:50
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define AVERROR_EOF
End of file.
Definition: error.h:55
#define AVERROR(e)
Definition: error.h:43
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
cl_device_type type
int i
Definition: input.c:407
@ AV1_OBU_TEMPORAL_DELIMITER
Definition: av1.h:31
@ AV1_OBU_METADATA
Definition: av1.h:34
@ AV1_OBU_FRAME_HEADER
Definition: av1.h:32
@ AV1_OBU_PADDING
Definition: av1.h:39
@ AV1_OBU_FRAME
Definition: av1.h:35
@ AV1_OBU_SEQUENCE_HEADER
Definition: av1.h:30
#define OFFSET(x)
Definition: av1dec.c:1207
static int get_score(int type, int *seq)
Definition: av1dec.c:33
static int read_header(AVFormatContext *s, const AVRational *framerate, AVBSFContext **bsf, void *logctx)
Definition: av1dec.c:51
#define DEC
Definition: av1dec.c:93
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: utils.c:4945
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
void av_fifo_freep(AVFifoBuffer **f)
Free an AVFifoBuffer and reset pointer to NULL.
Definition: fifo.c:63
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
Definition: fifo.c:77
int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
Definition: fifo.c:189
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
Definition: fifo.c:213
int av_fifo_space(const AVFifoBuffer *f)
Return the amount of space in bytes in the AVFifoBuffer, that is the amount of data you can write int...
Definition: fifo.c:82
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
Definition: fifo.c:43
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
Feed data from a user-supplied callback to an AVFifoBuffer.
Definition: fifo.c:122
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
AVOptions.
static const uint8_t header[24]
Definition: sdr2.c:67
The bitstream filter state.
Definition: bsf.h:49
Describe the class of an AVClass context structure.
Definition: log.h:67
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:72
AVRational framerate
Definition: avcodec.h:2071
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:56
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
Format I/O context.
Definition: avformat.h:1232
Bytestream IO Context.
Definition: avio.h:161
int eof_reached
true if was unable to read due to error or eof
Definition: avio.h:239
int error
contains the error code or 0 if no error happened
Definition: avio.h:245
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:645
AVOption.
Definition: opt.h:248
This structure stores compressed data.
Definition: packet.h:346
uint8_t * data
Definition: packet.h:369
This structure contains the data a format has to probe a file.
Definition: avformat.h:441
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:444
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:443
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition: internal.h:180
Stream structure.
Definition: avformat.h:873
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1038
enum AVStreamParseType need_parsing
Definition: avformat.h:1081
AVStreamInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1113
#define av_log(a,...)
int framerate
Definition: h264_levels.c:65
AVPacket * pkt
Definition: movenc.c:59
int size
int len
uint8_t bits
Definition: vp3data.h:141
static double c[64]