FFmpeg  2.1.1
cafdec.c
Go to the documentation of this file.
1 /*
2  * Core Audio Format demuxer
3  * Copyright (c) 2007 Justin Ruggles
4  * Copyright (c) 2009 Peter Ross
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * Core Audio Format demuxer
26  */
27 
28 #include "avformat.h"
29 #include "internal.h"
30 #include "isom.h"
31 #include "mov_chan.h"
32 #include "libavutil/intreadwrite.h"
33 #include "libavutil/intfloat.h"
34 #include "libavutil/dict.h"
35 #include "caf.h"
36 
37 typedef struct {
38  int bytes_per_packet; ///< bytes in a packet, or 0 if variable
39  int frames_per_packet; ///< frames in a packet, or 0 if variable
40  int64_t num_bytes; ///< total number of bytes in stream
41 
42  int64_t packet_cnt; ///< packet counter
43  int64_t frame_cnt; ///< frame counter
44 
45  int64_t data_start; ///< data start position, in bytes
46  int64_t data_size; ///< raw data size, in bytes
47 } CaffContext;
48 
49 static int probe(AVProbeData *p)
50 {
51  if (AV_RB32(p->buf) == MKBETAG('c','a','f','f') && AV_RB16(&p->buf[4]) == 1)
52  return AVPROBE_SCORE_MAX;
53  return 0;
54 }
55 
56 /** Read audio description chunk */
58 {
59  AVIOContext *pb = s->pb;
60  CaffContext *caf = s->priv_data;
61  AVStream *st;
62  int flags;
63 
64  /* new audio stream */
65  st = avformat_new_stream(s, NULL);
66  if (!st)
67  return AVERROR(ENOMEM);
68 
69  /* parse format description */
72  st->codec->codec_tag = avio_rl32(pb);
73  flags = avio_rb32(pb);
74  caf->bytes_per_packet = avio_rb32(pb);
76  caf->frames_per_packet = avio_rb32(pb);
77  st->codec->channels = avio_rb32(pb);
79 
80  /* calculate bit rate for constant size packets */
81  if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
82  st->codec->bit_rate = (uint64_t)st->codec->sample_rate * (uint64_t)caf->bytes_per_packet * 8
83  / (uint64_t)caf->frames_per_packet;
84  } else {
85  st->codec->bit_rate = 0;
86  }
87 
88  /* determine codec */
89  if (st->codec->codec_tag == MKTAG('l','p','c','m'))
90  st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, (flags ^ 0x2) | 0x4);
91  else
93  return 0;
94 }
95 
96 /** Read magic cookie chunk */
97 static int read_kuki_chunk(AVFormatContext *s, int64_t size)
98 {
99  AVIOContext *pb = s->pb;
100  AVStream *st = s->streams[0];
101 
102  if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
103  return -1;
104 
105  if (st->codec->codec_id == AV_CODEC_ID_AAC) {
106  /* The magic cookie format for AAC is an mp4 esds atom.
107  The lavc AAC decoder requires the data from the codec specific
108  description as extradata input. */
109  int strt, skip;
110  MOVAtom atom;
111 
112  strt = avio_tell(pb);
113  ff_mov_read_esds(s, pb, atom);
114  skip = size - (avio_tell(pb) - strt);
115  if (skip < 0 || !st->codec->extradata ||
116  st->codec->codec_id != AV_CODEC_ID_AAC) {
117  av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n");
118  return AVERROR_INVALIDDATA;
119  }
120  avio_skip(pb, skip);
121  } else if (st->codec->codec_id == AV_CODEC_ID_ALAC) {
122 #define ALAC_PREAMBLE 12
123 #define ALAC_HEADER 36
124 #define ALAC_NEW_KUKI 24
125  uint8_t preamble[12];
126  if (size < ALAC_NEW_KUKI) {
127  av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
128  avio_skip(pb, size);
129  return AVERROR_INVALIDDATA;
130  }
131  avio_read(pb, preamble, ALAC_PREAMBLE);
132 
134  return AVERROR(ENOMEM);
135 
136  /* For the old style cookie, we skip 12 bytes, then read 36 bytes.
137  * The new style cookie only contains the last 24 bytes of what was
138  * 36 bytes in the old style cookie, so we fabricate the first 12 bytes
139  * in that case to maintain compatibility. */
140  if (!memcmp(&preamble[4], "frmaalac", 8)) {
141  if (size < ALAC_PREAMBLE + ALAC_HEADER) {
142  av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
143  av_freep(&st->codec->extradata);
144  return AVERROR_INVALIDDATA;
145  }
147  avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
148  } else {
149  AV_WB32(st->codec->extradata, 36);
150  memcpy(&st->codec->extradata[4], "alac", 4);
151  AV_WB32(&st->codec->extradata[8], 0);
152  memcpy(&st->codec->extradata[12], preamble, 12);
153  avio_read(pb, &st->codec->extradata[24], ALAC_NEW_KUKI - 12);
154  avio_skip(pb, size - ALAC_NEW_KUKI);
155  }
156  } else {
157  if (ff_alloc_extradata(st->codec, size))
158  return AVERROR(ENOMEM);
159  avio_read(pb, st->codec->extradata, size);
160  }
161 
162  return 0;
163 }
164 
165 /** Read packet table chunk */
166 static int read_pakt_chunk(AVFormatContext *s, int64_t size)
167 {
168  AVIOContext *pb = s->pb;
169  AVStream *st = s->streams[0];
170  CaffContext *caf = s->priv_data;
171  int64_t pos = 0, ccount, num_packets;
172  int i;
173 
174  ccount = avio_tell(pb);
175 
176  num_packets = avio_rb64(pb);
177  if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
178  return AVERROR_INVALIDDATA;
179 
180  st->nb_frames = avio_rb64(pb); /* valid frames */
181  st->nb_frames += avio_rb32(pb); /* priming frames */
182  st->nb_frames += avio_rb32(pb); /* remainder frames */
183 
184  st->duration = 0;
185  for (i = 0; i < num_packets; i++) {
186  av_add_index_entry(s->streams[0], pos, st->duration, 0, 0, AVINDEX_KEYFRAME);
189  }
190 
191  if (avio_tell(pb) - ccount > size) {
192  av_log(s, AV_LOG_ERROR, "error reading packet table\n");
193  return AVERROR_INVALIDDATA;
194  }
195  avio_skip(pb, ccount + size - avio_tell(pb));
196 
197  caf->num_bytes = pos;
198  return 0;
199 }
200 
201 /** Read information chunk */
202 static void read_info_chunk(AVFormatContext *s, int64_t size)
203 {
204  AVIOContext *pb = s->pb;
205  unsigned int i;
206  unsigned int nb_entries = avio_rb32(pb);
207  for (i = 0; i < nb_entries; i++) {
208  char key[32];
209  char value[1024];
210  avio_get_str(pb, INT_MAX, key, sizeof(key));
211  avio_get_str(pb, INT_MAX, value, sizeof(value));
212  av_dict_set(&s->metadata, key, value, 0);
213  }
214 }
215 
217 {
218  AVIOContext *pb = s->pb;
219  CaffContext *caf = s->priv_data;
220  AVStream *st;
221  uint32_t tag = 0;
222  int found_data, ret;
223  int64_t size, pos;
224 
225  avio_skip(pb, 8); /* magic, version, file flags */
226 
227  /* audio description chunk */
228  if (avio_rb32(pb) != MKBETAG('d','e','s','c')) {
229  av_log(s, AV_LOG_ERROR, "desc chunk not present\n");
230  return AVERROR_INVALIDDATA;
231  }
232  size = avio_rb64(pb);
233  if (size != 32)
234  return AVERROR_INVALIDDATA;
235 
236  ret = read_desc_chunk(s);
237  if (ret)
238  return ret;
239  st = s->streams[0];
240 
241  /* parse each chunk */
242  found_data = 0;
243  while (!url_feof(pb)) {
244 
245  /* stop at data chunk if seeking is not supported or
246  data chunk size is unknown */
247  if (found_data && (caf->data_size < 0 || !pb->seekable))
248  break;
249 
250  tag = avio_rb32(pb);
251  size = avio_rb64(pb);
252  pos = avio_tell(pb);
253  if (url_feof(pb))
254  break;
255 
256  switch (tag) {
257  case MKBETAG('d','a','t','a'):
258  avio_skip(pb, 4); /* edit count */
259  caf->data_start = avio_tell(pb);
260  caf->data_size = size < 0 ? -1 : size - 4;
261  if (caf->data_size > 0 && pb->seekable)
262  avio_skip(pb, caf->data_size);
263  found_data = 1;
264  break;
265 
266  case MKBETAG('c','h','a','n'):
267  if ((ret = ff_mov_read_chan(s, s->pb, st, size)) < 0)
268  return ret;
269  break;
270 
271  /* magic cookie chunk */
272  case MKBETAG('k','u','k','i'):
273  if (read_kuki_chunk(s, size))
274  return AVERROR_INVALIDDATA;
275  break;
276 
277  /* packet table chunk */
278  case MKBETAG('p','a','k','t'):
279  if (read_pakt_chunk(s, size))
280  return AVERROR_INVALIDDATA;
281  break;
282 
283  case MKBETAG('i','n','f','o'):
284  read_info_chunk(s, size);
285  break;
286 
287  default:
288 #define _(x) ((x) >= ' ' ? (x) : ' ')
289  av_log(s, AV_LOG_WARNING, "skipping CAF chunk: %08X (%c%c%c%c), size %"PRId64"\n",
290  tag, _(tag>>24), _((tag>>16)&0xFF), _((tag>>8)&0xFF), _(tag&0xFF), size);
291 #undef _
292  case MKBETAG('f','r','e','e'):
293  if (size < 0)
294  return AVERROR_INVALIDDATA;
295  break;
296  }
297 
298  if (size > 0) {
299  if (pos > INT64_MAX - size)
300  return AVERROR_INVALIDDATA;
301  avio_skip(pb, FFMAX(0, pos + size - avio_tell(pb)));
302  }
303  }
304 
305  if (!found_data)
306  return AVERROR_INVALIDDATA;
307 
308  if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) {
309  if (caf->data_size > 0)
310  st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet;
311  } else if (st->nb_index_entries && st->duration > 0) {
312  st->codec->bit_rate = st->codec->sample_rate * caf->data_size * 8 /
313  st->duration;
314  } else {
315  av_log(s, AV_LOG_ERROR, "Missing packet table. It is required when "
316  "block size or frame size are variable.\n");
317  return AVERROR_INVALIDDATA;
318  }
319 
320  avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
321  st->start_time = 0;
322 
323  /* position the stream at the start of data */
324  if (caf->data_size >= 0)
325  avio_seek(pb, caf->data_start, SEEK_SET);
326 
327  return 0;
328 }
329 
330 #define CAF_MAX_PKT_SIZE 4096
331 
333 {
334  AVIOContext *pb = s->pb;
335  AVStream *st = s->streams[0];
336  CaffContext *caf = s->priv_data;
337  int res, pkt_size = 0, pkt_frames = 0;
338  int64_t left = CAF_MAX_PKT_SIZE;
339 
340  if (url_feof(pb))
341  return AVERROR_EOF;
342 
343  /* don't read past end of data chunk */
344  if (caf->data_size > 0) {
345  left = (caf->data_start + caf->data_size) - avio_tell(pb);
346  if (!left)
347  return AVERROR_EOF;
348  if (left < 0)
349  return AVERROR(EIO);
350  }
351 
352  pkt_frames = caf->frames_per_packet;
353  pkt_size = caf->bytes_per_packet;
354 
355  if (pkt_size > 0 && pkt_frames == 1) {
356  pkt_size = (CAF_MAX_PKT_SIZE / pkt_size) * pkt_size;
357  pkt_size = FFMIN(pkt_size, left);
358  pkt_frames = pkt_size / caf->bytes_per_packet;
359  } else if (st->nb_index_entries) {
360  if (caf->packet_cnt < st->nb_index_entries - 1) {
361  pkt_size = st->index_entries[caf->packet_cnt + 1].pos - st->index_entries[caf->packet_cnt].pos;
362  pkt_frames = st->index_entries[caf->packet_cnt + 1].timestamp - st->index_entries[caf->packet_cnt].timestamp;
363  } else if (caf->packet_cnt == st->nb_index_entries - 1) {
364  pkt_size = caf->num_bytes - st->index_entries[caf->packet_cnt].pos;
365  pkt_frames = st->duration - st->index_entries[caf->packet_cnt].timestamp;
366  } else {
367  return AVERROR(EIO);
368  }
369  }
370 
371  if (pkt_size == 0 || pkt_frames == 0 || pkt_size > left)
372  return AVERROR(EIO);
373 
374  res = av_get_packet(pb, pkt, pkt_size);
375  if (res < 0)
376  return res;
377 
378  pkt->size = res;
379  pkt->stream_index = 0;
380  pkt->dts = pkt->pts = caf->frame_cnt;
381 
382  caf->packet_cnt++;
383  caf->frame_cnt += pkt_frames;
384 
385  return 0;
386 }
387 
388 static int read_seek(AVFormatContext *s, int stream_index,
389  int64_t timestamp, int flags)
390 {
391  AVStream *st = s->streams[0];
392  CaffContext *caf = s->priv_data;
393  int64_t pos, packet_cnt, frame_cnt;
394 
395  timestamp = FFMAX(timestamp, 0);
396 
397  if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
398  /* calculate new byte position based on target frame position */
399  pos = caf->bytes_per_packet * (timestamp / caf->frames_per_packet);
400  if (caf->data_size > 0)
401  pos = FFMIN(pos, caf->data_size);
402  packet_cnt = pos / caf->bytes_per_packet;
403  frame_cnt = caf->frames_per_packet * packet_cnt;
404  } else if (st->nb_index_entries) {
405  packet_cnt = av_index_search_timestamp(st, timestamp, flags);
406  frame_cnt = st->index_entries[packet_cnt].timestamp;
407  pos = st->index_entries[packet_cnt].pos;
408  } else {
409  return -1;
410  }
411 
412  if (avio_seek(s->pb, pos + caf->data_start, SEEK_SET) < 0)
413  return -1;
414 
415  caf->packet_cnt = packet_cnt;
416  caf->frame_cnt = frame_cnt;
417 
418  return 0;
419 }
420 
422  .name = "caf",
423  .long_name = NULL_IF_CONFIG_SMALL("Apple CAF (Core Audio Format)"),
424  .priv_data_size = sizeof(CaffContext),
425  .read_probe = probe,
428  .read_seek = read_seek,
429  .codec_tag = (const AVCodecTag* const []){ ff_codec_caf_tags, 0 },
430 };
const char * s
Definition: avisynth_c.h:668
Bytestream IO Context.
Definition: avio.h:68
int size
static int read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: cafdec.c:332
int64_t data_size
raw data size, in bytes
Definition: cafdec.c:46
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
Definition: utils.c:1675
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
Definition: utils.c:2556
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:478
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: avcodec.h:4153
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:3922
int64_t pos
Definition: avformat.h:609
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:686
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:593
int size
Definition: avcodec.h:1064
CAF common code.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:624
#define CAF_MAX_PKT_SIZE
Definition: cafdec.c:330
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
Definition: avcodec.h:1910
static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: cafdec.c:388
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1254
static int read_header(AVFormatContext *s)
Definition: cafdec.c:216
#define _(x)
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:234
int64_t data_start
data start position, in bytes
Definition: cafdec.c:45
Format I/O context.
Definition: avformat.h:968
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
Definition: aviobuf.c:647
#define ALAC_PREAMBLE
static uint8_t * res
Definition: ffhash.c:43
#define AV_RB16(x)
Definition: intreadwrite.h:232
uint8_t
static int read_kuki_chunk(AVFormatContext *s, int64_t size)
Read magic cookie chunk.
Definition: cafdec.c:97
int64_t num_bytes
total number of bytes in stream
Definition: cafdec.c:40
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:336
uint64_t avio_rb64(AVIOContext *s)
Definition: aviobuf.c:689
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:248
uint32_t tag
Definition: movenc.c:961
#define AV_WB32(p, darg)
Definition: intreadwrite.h:265
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: avformat.h:823
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2563
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:3348
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:200
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: avcodec.h:4147
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
Definition: utils.c:1718
int ff_mp4_read_descr_len(AVIOContext *pb)
Definition: isom.c:390
void * priv_data
Format private data.
Definition: avformat.h:988
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
Definition: avformat.h:610
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:151
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
Definition: avcodec.h:580
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:117
int bit_rate
the average bitrate
Definition: avcodec.h:1204
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:54
ret
Definition: avfilter.c:961
AVStream ** streams
Definition: avformat.h:1016
AVInputFormat ff_caf_demuxer
Definition: cafdec.c:421
#define FFMIN(a, b)
Definition: avcodec.h:925
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:199
#define ALAC_NEW_KUKI
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size)
Read &#39;chan&#39; tag from the input stream.
Definition: mov_chan.c:547
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom)
Definition: mov.c:606
Stream structure.
Definition: avformat.h:667
enum AVMediaType codec_type
Definition: avcodec.h:1154
#define FFMAX(a, b)
Definition: avcodec.h:923
enum AVCodecID codec_id
Definition: avcodec.h:1157
int sample_rate
samples per second
Definition: avcodec.h:1873
int bytes_per_packet
bytes in a packet, or 0 if variable
Definition: cafdec.c:38
unsigned int codec_tag
fourcc (LSB first, so &quot;ABCD&quot; -&gt; (&#39;D&#39;&lt;&lt;24) + (&#39;C&#39;&lt;&lt;16) + (&#39;B&#39;&lt;&lt;8) + &#39;A&#39;).
Definition: avcodec.h:1172
int ff_alloc_extradata(AVCodecContext *avctx, int size)
Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0...
Definition: utils.c:2690
AVIOContext * pb
I/O context.
Definition: avformat.h:1001
int64_t packet_cnt
packet counter
Definition: cafdec.c:42
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:62
int nb_index_entries
Definition: avformat.h:825
double value
Definition: eval.c:83
#define MKTAG(a, b, c, d)
static void read_info_chunk(AVFormatContext *s, int64_t size)
Read information chunk.
Definition: cafdec.c:202
Definition: isom.h:65
AVDictionary * metadata
Definition: avformat.h:1128
#define AVINDEX_KEYFRAME
Definition: avformat.h:616
This structure contains the data a format has to probe a file.
Definition: avformat.h:334
#define MKBETAG(a, b, c, d)
static int read_pakt_chunk(AVFormatContext *s, int64_t size)
Read packet table chunk.
Definition: cafdec.c:166
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:256
static int flags
Definition: cpu.c:45
#define AVERROR_EOF
static int probe(AVProbeData *p)
Definition: cafdec.c:49
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:342
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:720
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:480
int url_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
Definition: aviobuf.c:280
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
Definition: intfloat.h:60
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
Definition: avformat.h:713
Main libavformat public API header.
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:722
#define ALAC_HEADER
#define AV_RB32(x)
Definition: intreadwrite.h:258
#define AVERROR_INVALIDDATA
int channels
number of audio channels
Definition: avcodec.h:1874
enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
Compute codec id for &#39;lpcm&#39; tag.
Definition: mov.c:1220
#define AVERROR(e)
int64_t dts
Decompression timestamp in AVStream-&gt;time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:1062
int64_t frame_cnt
frame counter
Definition: cafdec.c:43
static AVPacket pkt
Definition: demuxing.c:52
static int read_desc_chunk(AVFormatContext *s)
Read audio description chunk.
Definition: cafdec.c:57
int stream_index
Definition: avcodec.h:1065
const AVCodecTag ff_codec_caf_tags[]
Known codec tags for CAF.
Definition: caf.c:34
This structure stores compressed data.
Definition: avcodec.h:1040
int64_t pts
Presentation timestamp in AVStream-&gt;time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1056
int frames_per_packet
frames in a packet, or 0 if variable
Definition: cafdec.c:39