Libav
wavdec.c
Go to the documentation of this file.
1 /*
2  * WAV demuxer
3  * Copyright (c) 2001, 2002 Fabrice Bellard
4  *
5  * Sony Wave64 demuxer
6  * RF64 demuxer
7  * Copyright (c) 2009 Daniel Verkamp
8  *
9  * This file is part of Libav.
10  *
11  * Libav is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * Libav is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with Libav; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24  */
25 
26 #include <stdint.h>
27 
28 #include "libavutil/avassert.h"
29 #include "libavutil/dict.h"
30 #include "libavutil/log.h"
31 #include "libavutil/mathematics.h"
32 #include "libavutil/opt.h"
33 #include "avformat.h"
34 #include "avio.h"
35 #include "avio_internal.h"
36 #include "internal.h"
37 #include "metadata.h"
38 #include "pcm.h"
39 #include "riff.h"
40 
41 typedef struct WAVDemuxContext {
42  int64_t data_end;
43  int w64;
45 
46 #if CONFIG_WAV_DEMUXER
47 
48 static int64_t next_tag(AVIOContext *pb, uint32_t *tag)
49 {
50  *tag = avio_rl32(pb);
51  return avio_rl32(pb);
52 }
53 
54 /* RIFF chunks are always on a even offset. */
55 static int64_t wav_seek_tag(AVIOContext *s, int64_t offset, int whence)
56 {
57  return avio_seek(s, offset + (offset & 1), whence);
58 }
59 
60 /* return the size of the found tag */
61 static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
62 {
63  unsigned int tag;
64  int64_t size;
65 
66  for (;;) {
67  if (pb->eof_reached)
68  return -1;
69  size = next_tag(pb, &tag);
70  if (tag == tag1)
71  break;
72  wav_seek_tag(pb, size, SEEK_CUR);
73  }
74  return size;
75 }
76 
77 static int wav_probe(AVProbeData *p)
78 {
79  /* check file header */
80  if (p->buf_size <= 32)
81  return 0;
82  if (!memcmp(p->buf + 8, "WAVE", 4)) {
83  if (!memcmp(p->buf, "RIFF", 4))
84  /* Since the ACT demuxer has a standard WAV header at the top of
85  * its own, the returned score is decreased to avoid a probe
86  * conflict between ACT and WAV. */
87  return AVPROBE_SCORE_MAX - 1;
88  else if (!memcmp(p->buf, "RF64", 4) &&
89  !memcmp(p->buf + 12, "ds64", 4))
90  return AVPROBE_SCORE_MAX;
91  }
92  return 0;
93 }
94 
95 static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st)
96 {
97  AVIOContext *pb = s->pb;
98  int ret;
99 
100  /* parse fmt header */
101  *st = avformat_new_stream(s, NULL);
102  if (!*st)
103  return AVERROR(ENOMEM);
104 
105  ret = ff_get_wav_header(pb, (*st)->codec, size);
106  if (ret < 0)
107  return ret;
108  (*st)->need_parsing = AVSTREAM_PARSE_FULL;
109 
110  avpriv_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate);
111 
112  return 0;
113 }
114 
115 static inline int wav_parse_bext_string(AVFormatContext *s, const char *key,
116  int length)
117 {
118  char temp[257];
119  int ret;
120 
121  av_assert0(length <= sizeof(temp));
122  if ((ret = avio_read(s->pb, temp, length)) < 0)
123  return ret;
124 
125  temp[length] = 0;
126 
127  if (strlen(temp))
128  return av_dict_set(&s->metadata, key, temp, 0);
129 
130  return 0;
131 }
132 
133 static int wav_parse_bext_tag(AVFormatContext *s, int64_t size)
134 {
135  char temp[131], *coding_history;
136  int ret, x;
137  uint64_t time_reference;
138  int64_t umid_parts[8], umid_mask = 0;
139 
140  if ((ret = wav_parse_bext_string(s, "description", 256)) < 0 ||
141  (ret = wav_parse_bext_string(s, "originator", 32)) < 0 ||
142  (ret = wav_parse_bext_string(s, "originator_reference", 32)) < 0 ||
143  (ret = wav_parse_bext_string(s, "origination_date", 10)) < 0 ||
144  (ret = wav_parse_bext_string(s, "origination_time", 8)) < 0)
145  return ret;
146 
147  time_reference = avio_rl64(s->pb);
148  snprintf(temp, sizeof(temp), "%"PRIu64, time_reference);
149  if ((ret = av_dict_set(&s->metadata, "time_reference", temp, 0)) < 0)
150  return ret;
151 
152  /* check if version is >= 1, in which case an UMID may be present */
153  if (avio_rl16(s->pb) >= 1) {
154  for (x = 0; x < 8; x++)
155  umid_mask |= umid_parts[x] = avio_rb64(s->pb);
156 
157  if (umid_mask) {
158  /* the string formatting below is per SMPTE 330M-2004 Annex C */
159  if (umid_parts[4] == 0 && umid_parts[5] == 0 &&
160  umid_parts[6] == 0 && umid_parts[7] == 0) {
161  /* basic UMID */
162  snprintf(temp, sizeof(temp),
163  "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64,
164  umid_parts[0], umid_parts[1],
165  umid_parts[2], umid_parts[3]);
166  } else {
167  /* extended UMID */
168  snprintf(temp, sizeof(temp),
169  "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64
170  "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64,
171  umid_parts[0], umid_parts[1],
172  umid_parts[2], umid_parts[3],
173  umid_parts[4], umid_parts[5],
174  umid_parts[6], umid_parts[7]);
175  }
176 
177  if ((ret = av_dict_set(&s->metadata, "umid", temp, 0)) < 0)
178  return ret;
179  }
180 
181  avio_skip(s->pb, 190);
182  } else
183  avio_skip(s->pb, 254);
184 
185  if (size > 602) {
186  /* CodingHistory present */
187  size -= 602;
188 
189  if (!(coding_history = av_malloc(size + 1)))
190  return AVERROR(ENOMEM);
191 
192  if ((ret = avio_read(s->pb, coding_history, size)) < 0)
193  return ret;
194 
195  coding_history[size] = 0;
196  if ((ret = av_dict_set(&s->metadata, "coding_history", coding_history,
198  return ret;
199  }
200 
201  return 0;
202 }
203 
204 static const AVMetadataConv wav_metadata_conv[] = {
205  { "description", "comment" },
206  { "originator", "encoded_by" },
207  { "origination_date", "date" },
208  { "origination_time", "creation_time" },
209  { 0 },
210 };
211 
212 /* wav input */
213 static int wav_read_header(AVFormatContext *s)
214 {
215  int64_t size, av_uninit(data_size);
216  int64_t sample_count = 0;
217  int rf64;
218  uint32_t tag;
219  AVIOContext *pb = s->pb;
220  AVStream *st = NULL;
221  WAVDemuxContext *wav = s->priv_data;
222  int ret, got_fmt = 0;
223  int64_t next_tag_ofs, data_ofs = -1;
224 
225  /* check RIFF header */
226  tag = avio_rl32(pb);
227 
228  rf64 = tag == MKTAG('R', 'F', '6', '4');
229  if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
230  return AVERROR_INVALIDDATA;
231  avio_rl32(pb); /* file size */
232  tag = avio_rl32(pb);
233  if (tag != MKTAG('W', 'A', 'V', 'E'))
234  return AVERROR_INVALIDDATA;
235 
236  if (rf64) {
237  if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))
238  return AVERROR_INVALIDDATA;
239  size = avio_rl32(pb);
240  if (size < 16)
241  return AVERROR_INVALIDDATA;
242  avio_rl64(pb); /* RIFF size */
243 
244  data_size = avio_rl64(pb);
245  sample_count = avio_rl64(pb);
246 
247  if (data_size < 0 || sample_count < 0) {
248  av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in "
249  "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n",
250  data_size, sample_count);
251  return AVERROR_INVALIDDATA;
252  }
253  avio_skip(pb, size - 16); /* skip rest of ds64 chunk */
254  }
255 
256  for (;;) {
257  size = next_tag(pb, &tag);
258  next_tag_ofs = avio_tell(pb) + size;
259 
260  if (pb->eof_reached)
261  break;
262 
263  switch (tag) {
264  case MKTAG('f', 'm', 't', ' '):
265  /* only parse the first 'fmt ' tag found */
266  if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st) < 0)) {
267  return ret;
268  } else if (got_fmt)
269  av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n");
270 
271  got_fmt = 1;
272  break;
273  case MKTAG('d', 'a', 't', 'a'):
274  if (!got_fmt) {
275  av_log(s, AV_LOG_ERROR,
276  "found no 'fmt ' tag before the 'data' tag\n");
277  return AVERROR_INVALIDDATA;
278  }
279 
280  if (rf64) {
281  next_tag_ofs = wav->data_end = avio_tell(pb) + data_size;
282  } else {
283  data_size = size;
284  next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX;
285  }
286 
287  data_ofs = avio_tell(pb);
288 
289  /* don't look for footer metadata if we can't seek or if we don't
290  * know where the data tag ends
291  */
292  if (!pb->seekable || (!rf64 && !size))
293  goto break_loop;
294  break;
295  case MKTAG('f', 'a', 'c', 't'):
296  if (!sample_count)
297  sample_count = avio_rl32(pb);
298  break;
299  case MKTAG('b', 'e', 'x', 't'):
300  if ((ret = wav_parse_bext_tag(s, size)) < 0)
301  return ret;
302  break;
303  case MKTAG('L', 'I', 'S', 'T'):
304  if (size < 4) {
305  av_log(s, AV_LOG_ERROR, "too short LIST");
306  return AVERROR_INVALIDDATA;
307  }
308  switch (avio_rl32(pb)) {
309  case MKTAG('I', 'N', 'F', 'O'):
310  if ((ret = ff_read_riff_info(s, size - 4)) < 0)
311  return ret;
312  }
313  break;
314  }
315 
316  /* seek to next tag unless we know that we'll run into EOF */
317  if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||
318  wav_seek_tag(pb, next_tag_ofs, SEEK_SET) < 0) {
319  break;
320  }
321  }
322 
323 break_loop:
324  if (data_ofs < 0) {
325  av_log(s, AV_LOG_ERROR, "no 'data' tag found\n");
326  return AVERROR_INVALIDDATA;
327  }
328 
329  avio_seek(pb, data_ofs, SEEK_SET);
330 
331  if (!sample_count && st->codec->channels &&
333  sample_count = (data_size << 3) /
334  (st->codec->channels *
335  (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
336  if (sample_count)
337  st->duration = sample_count;
338 
339  ff_metadata_conv_ctx(s, NULL, wav_metadata_conv);
341 
342  return 0;
343 }
344 
349 static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
350 {
351  uint8_t guid[16];
352  int64_t size;
353 
354  while (!pb->eof_reached) {
355  avio_read(pb, guid, 16);
356  size = avio_rl64(pb);
357  if (size <= 24)
358  return -1;
359  if (!memcmp(guid, guid1, 16))
360  return size;
361  avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24);
362  }
363  return -1;
364 }
365 
366 static const uint8_t guid_data[16] = {
367  'd', 'a', 't', 'a',
368  0xF3, 0xAC, 0xD3, 0x11,0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A
369 };
370 
371 #define MAX_SIZE 4096
372 
373 static int wav_read_packet(AVFormatContext *s, AVPacket *pkt)
374 {
375  int ret, size;
376  int64_t left;
377  AVStream *st;
378  WAVDemuxContext *wav = s->priv_data;
379 
380  st = s->streams[0];
381 
382  left = wav->data_end - avio_tell(s->pb);
383  if (left <= 0) {
384  if (CONFIG_W64_DEMUXER && wav->w64)
385  left = find_guid(s->pb, guid_data) - 24;
386  else
387  left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
388  if (left < 0)
389  return AVERROR_EOF;
390  wav->data_end = avio_tell(s->pb) + left;
391  }
392 
393  size = MAX_SIZE;
394  if (st->codec->block_align > 1) {
395  if (size < st->codec->block_align)
396  size = st->codec->block_align;
397  size = (size / st->codec->block_align) * st->codec->block_align;
398  }
399  size = FFMIN(size, left);
400  ret = av_get_packet(s->pb, pkt, size);
401  if (ret < 0)
402  return ret;
403  pkt->stream_index = 0;
404 
405  return ret;
406 }
407 
408 static int wav_read_seek(AVFormatContext *s,
409  int stream_index, int64_t timestamp, int flags)
410 {
411  AVStream *st;
412 
413  st = s->streams[0];
414  switch (st->codec->codec_id) {
415  case AV_CODEC_ID_MP2:
416  case AV_CODEC_ID_MP3:
417  case AV_CODEC_ID_AC3:
418  case AV_CODEC_ID_DTS:
419  /* use generic seeking with dynamically generated indexes */
420  return -1;
421  default:
422  break;
423  }
424  return ff_pcm_read_seek(s, stream_index, timestamp, flags);
425 }
426 
427 AVInputFormat ff_wav_demuxer = {
428  .name = "wav",
429  .long_name = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"),
430  .priv_data_size = sizeof(WAVDemuxContext),
431  .read_probe = wav_probe,
432  .read_header = wav_read_header,
433  .read_packet = wav_read_packet,
434  .read_seek = wav_read_seek,
435  .flags = AVFMT_GENERIC_INDEX,
436  .codec_tag = (const AVCodecTag * const []) { ff_codec_wav_tags, 0 },
437 };
438 #endif /* CONFIG_WAV_DEMUXER */
439 
440 #if CONFIG_W64_DEMUXER
441 static const uint8_t guid_riff[16] = {
442  'r', 'i', 'f', 'f',
443  0x2E, 0x91, 0xCF, 0x11,0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
444 };
445 
446 static const uint8_t guid_wave[16] = {
447  'w', 'a', 'v', 'e',
448  0xF3, 0xAC, 0xD3, 0x11,0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A
449 };
450 
451 static const uint8_t guid_fmt[16] = {
452  'f', 'm', 't', ' ',
453  0xF3, 0xAC, 0xD3, 0x11,0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A
454 };
455 
456 static int w64_probe(AVProbeData *p)
457 {
458  if (p->buf_size <= 40)
459  return 0;
460  if (!memcmp(p->buf, guid_riff, 16) &&
461  !memcmp(p->buf + 24, guid_wave, 16))
462  return AVPROBE_SCORE_MAX;
463  else
464  return 0;
465 }
466 
467 static int w64_read_header(AVFormatContext *s)
468 {
469  int64_t size;
470  AVIOContext *pb = s->pb;
471  WAVDemuxContext *wav = s->priv_data;
472  AVStream *st;
473  uint8_t guid[16];
474  int ret;
475 
476  avio_read(pb, guid, 16);
477  if (memcmp(guid, guid_riff, 16))
478  return AVERROR_INVALIDDATA;
479 
480  /* riff + wave + fmt + sizes */
481  if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8)
482  return AVERROR_INVALIDDATA;
483 
484  avio_read(pb, guid, 16);
485  if (memcmp(guid, guid_wave, 16)) {
486  av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
487  return AVERROR_INVALIDDATA;
488  }
489 
490  size = find_guid(pb, guid_fmt);
491  if (size < 0) {
492  av_log(s, AV_LOG_ERROR, "could not find fmt guid\n");
493  return AVERROR_INVALIDDATA;
494  }
495 
496  st = avformat_new_stream(s, NULL);
497  if (!st)
498  return AVERROR(ENOMEM);
499 
500  /* subtract chunk header size - normal wav file doesn't count it */
501  ret = ff_get_wav_header(pb, st->codec, size - 24);
502  if (ret < 0)
503  return ret;
504  avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);
505 
507 
508  avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
509 
510  size = find_guid(pb, guid_data);
511  if (size < 0) {
512  av_log(s, AV_LOG_ERROR, "could not find data guid\n");
513  return AVERROR_INVALIDDATA;
514  }
515  wav->data_end = avio_tell(pb) + size - 24;
516  wav->w64 = 1;
517 
518  return 0;
519 }
520 
521 AVInputFormat ff_w64_demuxer = {
522  .name = "w64",
523  .long_name = NULL_IF_CONFIG_SMALL("Sony Wave64"),
524  .priv_data_size = sizeof(WAVDemuxContext),
525  .read_probe = w64_probe,
526  .read_header = w64_read_header,
527  .read_packet = wav_read_packet,
528  .read_seek = wav_read_seek,
529  .flags = AVFMT_GENERIC_INDEX,
530  .codec_tag = (const AVCodecTag * const []) { ff_codec_wav_tags, 0 },
531 };
532 #endif /* CONFIG_W64_DEMUXER */
int ff_read_riff_info(AVFormatContext *s, int64_t size)
Definition: riffdec.c:179
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:62
Bytestream IO Context.
Definition: avio.h:68
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:54
void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv)
Definition: metadata.c:59
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:241
Buffered I/O operations.
int size
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:129
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:2829
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:186
#define MAX_SIZE
Definition: vf_unsharp.c:49
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
Definition: avcodec.h:1844
#define FFALIGN(x, a)
Definition: common.h:62
Format I/O context.
Definition: avformat.h:922
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
internal metadata API header see avformat.h or the public API!
Public dictionary API.
uint8_t
AVOptions.
enum AVStreamParseType need_parsing
Definition: avformat.h:867
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:2521
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:990
static int flags
Definition: log.c:44
uint32_t tag
Definition: movenc.c:844
#define AVERROR_EOF
End of file.
Definition: error.h:51
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:117
uint64_t avio_rb64(AVIOContext *s)
Definition: aviobuf.c:671
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:219
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:463
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:2055
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1130
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:575
#define AVERROR(e)
Definition: error.h:43
int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
Definition: riffdec.c:82
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:145
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: avcodec.h:379
simple assert() macros that are a bit more flexible than ISO C assert().
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
const AVCodecTag ff_codec_wav_tags[]
Definition: riff.c:353
return
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:718
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:398
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:397
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:117
#define FFMIN(a, b)
Definition: common.h:57
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() and chilren.
Definition: dict.h:66
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: avio.h:210
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
#define CONFIG_W64_DEMUXER
Definition: config.h:940
int ff_pcm_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: pcm.c:26
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:544
if(ac->has_optimized_func)
Stream structure.
Definition: avformat.h:699
NULL
Definition: eval.c:55
enum AVCodecID codec_id
Definition: avcodec.h:1067
int sample_rate
samples per second
Definition: avcodec.h:1807
AVIOContext * pb
I/O context.
Definition: avformat.h:964
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:114
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:68
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:417
This structure contains the data a format has to probe a file.
Definition: avformat.h:395
const AVMetadataConv ff_riff_info_conv[]
Definition: riff.c:421
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:756
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:404
full parsing and repack
Definition: avformat.h:653
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:559
Main libavformat public API header.
int64_t data_end
Definition: wavdec.c:42
int eof_reached
true if eof reached
Definition: avio.h:96
int channels
number of audio channels
Definition: avcodec.h:1808
void * priv_data
Format private data.
Definition: avformat.h:950
#define av_uninit(x)
Definition: attributes.h:109
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:525
int stream_index
Definition: avcodec.h:975
#define MKTAG(a, b, c, d)
Definition: common.h:238
This structure stores compressed data.
Definition: avcodec.h:950
uint64_t avio_rl64(AVIOContext *s)
Definition: aviobuf.c:583