FFmpeg
brstm.c
Go to the documentation of this file.
1 /*
2  * BRSTM demuxer
3  * Copyright (c) 2012 Paul B Mahol
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 "libavutil/intreadwrite.h"
23 #include "libavcodec/bytestream.h"
24 #include "avformat.h"
25 #include "demux.h"
26 #include "internal.h"
27 
28 typedef struct BRSTMCoeffOffset {
29  uint8_t channel;
30  uint32_t offset;
32 
33 typedef struct BRSTMDemuxContext {
34  uint32_t block_size;
35  uint32_t block_count;
36  uint32_t current_block;
39  uint32_t last_block_size;
41  uint32_t data_start;
42  uint8_t table[256 * 32];
43  uint8_t *adpc;
47 
48 static int probe(const AVProbeData *p)
49 {
50  if (AV_RL32(p->buf) == MKTAG('R','S','T','M') &&
51  (AV_RL16(p->buf + 4) == 0xFFFE ||
52  AV_RL16(p->buf + 4) == 0xFEFF))
53  return AVPROBE_SCORE_MAX / 3 * 2;
54  return 0;
55 }
56 
57 static int probe_bfstm(const AVProbeData *p)
58 {
59  if ((AV_RL32(p->buf) == MKTAG('F','S','T','M') ||
60  AV_RL32(p->buf) == MKTAG('C','S','T','M')) &&
61  (AV_RL16(p->buf + 4) == 0xFFFE ||
62  AV_RL16(p->buf + 4) == 0xFEFF))
63  return AVPROBE_SCORE_MAX / 3 * 2;
64  return 0;
65 }
66 
68 {
69  BRSTMDemuxContext *b = s->priv_data;
70 
71  av_freep(&b->adpc);
72 
73  return 0;
74 }
75 
76 static int sort_offsets(const void *a, const void *b)
77 {
78  const BRSTMCoeffOffset *s1 = a;
79  const BRSTMCoeffOffset *s2 = b;
80  return FFDIFFSIGN(s1->offset, s2->offset);
81 }
82 
84 {
85  BRSTMDemuxContext *b = s->priv_data;
86  if (b->little_endian)
87  return avio_rl16(s->pb);
88  else
89  return avio_rb16(s->pb);
90 }
91 
93 {
94  BRSTMDemuxContext *b = s->priv_data;
95  if (b->little_endian)
96  return avio_rl32(s->pb);
97  else
98  return avio_rb32(s->pb);
99 }
100 
102 {
103  BRSTMDemuxContext *b = s->priv_data;
104  int bom, major, minor, codec, chunk;
105  int64_t h1offset, pos, toffset;
106  uint32_t size, asize, start = 0;
107  AVStream *st;
108  int loop = 0;
109  int bfstm = !strcmp("bfstm", s->iformat->name);
110 
111  st = avformat_new_stream(s, NULL);
112  if (!st)
113  return AVERROR(ENOMEM);
115 
116  avio_skip(s->pb, 4);
117 
118  bom = avio_rb16(s->pb);
119  if (bom != 0xFEFF && bom != 0xFFFE) {
120  av_log(s, AV_LOG_ERROR, "invalid byte order: %X\n", bom);
121  return AVERROR_INVALIDDATA;
122  }
123 
124  if (bom == 0xFFFE)
125  b->little_endian = 1;
126 
127  if (!bfstm) {
128  major = avio_r8(s->pb);
129  minor = avio_r8(s->pb);
130  avio_skip(s->pb, 4); // size of file
131  size = read16(s);
132  if (size < 14)
133  return AVERROR_INVALIDDATA;
134 
135  avio_skip(s->pb, size - 14);
136  pos = avio_tell(s->pb);
137  if (avio_rl32(s->pb) != MKTAG('H','E','A','D'))
138  return AVERROR_INVALIDDATA;
139  } else {
140  uint32_t info_offset = 0;
141  uint16_t section_count, header_size, i;
142 
143  header_size = read16(s); // 6
144 
145  avio_skip(s->pb, 4); // Unknown constant 0x00030000
146  avio_skip(s->pb, 4); // size of file
147  section_count = read16(s);
148  avio_skip(s->pb, 2); // padding
149  for (i = 0; avio_tell(s->pb) < header_size
150  && !(start && info_offset)
151  && i < section_count; i++) {
152  uint16_t flag = read16(s);
153  avio_skip(s->pb, 2);
154  switch (flag) {
155  case 0x4000:
156  info_offset = read32(s);
157  /*info_size =*/ read32(s);
158  break;
159  case 0x4001:
160  avio_skip(s->pb, 4); // seek offset
161  avio_skip(s->pb, 4); // seek size
162  break;
163  case 0x4002:
164  start = read32(s) + 8;
165  avio_skip(s->pb, 4); //data_size = read32(s);
166  break;
167  case 0x4003:
168  avio_skip(s->pb, 4); // REGN offset
169  avio_skip(s->pb, 4); // REGN size
170  break;
171  }
172  }
173 
174  if (!info_offset || !start)
175  return AVERROR_INVALIDDATA;
176 
177  avio_skip(s->pb, info_offset - avio_tell(s->pb));
178  pos = avio_tell(s->pb);
179  if (avio_rl32(s->pb) != MKTAG('I','N','F','O'))
180  return AVERROR_INVALIDDATA;
181  }
182 
183  size = read32(s);
184  if (size < 40)
185  return AVERROR_INVALIDDATA;
186  avio_skip(s->pb, 4); // unknown
187  h1offset = read32(s);
188  if (h1offset > size)
189  return AVERROR_INVALIDDATA;
190  avio_skip(s->pb, 12);
191  toffset = read32(s) + 16LL;
192  if (toffset > size)
193  return AVERROR_INVALIDDATA;
194 
195  avio_skip(s->pb, pos + h1offset + 8 - avio_tell(s->pb));
196  codec = avio_r8(s->pb);
197 
198  switch (codec) {
199  case 0: codec = AV_CODEC_ID_PCM_S8_PLANAR; break;
200  case 1: codec = b->little_endian ?
203  case 2: codec = b->little_endian ?
205  AV_CODEC_ID_ADPCM_THP; break;
206  default:
207  avpriv_request_sample(s, "codec %d", codec);
208  return AVERROR_PATCHWELCOME;
209  }
210 
211  loop = avio_r8(s->pb); // loop flag
212  st->codecpar->codec_id = codec;
213  st->codecpar->ch_layout.nb_channels = avio_r8(s->pb);
214  if (!st->codecpar->ch_layout.nb_channels)
215  return AVERROR_INVALIDDATA;
216 
217  avio_skip(s->pb, 1); // padding
218 
219  st->codecpar->sample_rate = bfstm ? read32(s) : read16(s);
220  if (st->codecpar->sample_rate <= 0)
221  return AVERROR_INVALIDDATA;
222 
223  if (!bfstm)
224  avio_skip(s->pb, 2); // padding
225 
226  if (loop) {
227  if (av_dict_set_int(&s->metadata, "loop_start",
229  st->codecpar->sample_rate),
230  0) < 0)
231  return AVERROR(ENOMEM);
232  } else {
233  avio_skip(s->pb, 4);
234  }
235 
236  st->start_time = 0;
237  st->duration = read32(s);
238  avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
239 
240  if (!bfstm)
241  start = read32(s);
242  b->current_block = 0;
243  b->block_count = read32(s);
244  if (b->block_count > UINT16_MAX) {
245  av_log(s, AV_LOG_WARNING, "too many blocks: %"PRIu32"\n", b->block_count);
246  return AVERROR_INVALIDDATA;
247  }
248 
249  b->block_size = read32(s);
250  if (b->block_size > UINT32_MAX / st->codecpar->ch_layout.nb_channels)
251  return AVERROR_INVALIDDATA;
252 
253  b->samples_per_block = read32(s);
254  b->last_block_used_bytes = read32(s);
255  b->last_block_samples = read32(s);
256  b->last_block_size = read32(s);
257  if (b->last_block_size > UINT32_MAX / st->codecpar->ch_layout.nb_channels)
258  return AVERROR_INVALIDDATA;
259  if (b->last_block_used_bytes > b->last_block_size)
260  return AVERROR_INVALIDDATA;
261 
262 
263  if (codec == AV_CODEC_ID_ADPCM_THP || codec == AV_CODEC_ID_ADPCM_THP_LE) {
264  int ch;
265 
266  avio_skip(s->pb, pos + toffset - avio_tell(s->pb));
267  if (!bfstm)
268  toffset = read32(s) + 16LL;
269  else
270  toffset = toffset + read32(s) + st->codecpar->ch_layout.nb_channels * 8 - 8;
271  if (toffset > size)
272  return AVERROR_INVALIDDATA;
273 
274  if (!bfstm) {
275  avio_skip(s->pb, pos + toffset - avio_tell(s->pb) - 8LL * (st->codecpar->ch_layout.nb_channels + 1));
276  for (ch = 0; ch < st->codecpar->ch_layout.nb_channels; ch++) {
277  avio_skip(s->pb, 4);
278  b->offsets[ch].channel = ch;
279  b->offsets[ch].offset = read32(s);
280  }
281 
282  qsort(b->offsets, st->codecpar->ch_layout.nb_channels, sizeof(*b->offsets), sort_offsets);
283  }
284 
285  avio_skip(s->pb, pos + toffset - avio_tell(s->pb));
286 
287  for (ch = 0; ch < st->codecpar->ch_layout.nb_channels; ch++) {
288  if (!bfstm)
289  avio_skip(s->pb, pos + 16LL + b->offsets[ch].offset - avio_tell(s->pb));
290 
291  if (avio_read(s->pb, b->table + ch * 32, 32) != 32)
292  return AVERROR_INVALIDDATA;
293 
294  if (bfstm)
295  avio_skip(s->pb, 14);
296  }
297  }
298 
299  if (size < (avio_tell(s->pb) - pos))
300  return AVERROR_INVALIDDATA;
301 
302  avio_skip(s->pb, size - (avio_tell(s->pb) - pos));
303 
304  while (!avio_feof(s->pb)) {
305  chunk = avio_rl32(s->pb);
306  size = read32(s);
307  if (size < 8)
308  return AVERROR_INVALIDDATA;
309  size -= 8;
310  switch (chunk) {
311  case MKTAG('S','E','E','K'):
312  case MKTAG('A','D','P','C'):
313  if (codec != AV_CODEC_ID_ADPCM_THP &&
314  codec != AV_CODEC_ID_ADPCM_THP_LE)
315  goto skip;
316 
317  asize = b->block_count * st->codecpar->ch_layout.nb_channels * 4;
318  if (size < asize)
319  return AVERROR_INVALIDDATA;
320  if (b->adpc) {
321  av_log(s, AV_LOG_WARNING, "skipping additional ADPC chunk\n");
322  goto skip;
323  } else {
324  b->adpc = av_mallocz(asize);
325  if (!b->adpc)
326  return AVERROR(ENOMEM);
327  if (bfstm && codec != AV_CODEC_ID_ADPCM_THP_LE) {
328  // Big-endian BFSTMs have little-endian SEEK tables
329  // for some strange reason.
330  int i;
331  for (i = 0; i < asize; i += 2) {
332  b->adpc[i+1] = avio_r8(s->pb);
333  b->adpc[i] = avio_r8(s->pb);
334  }
335  } else {
336  avio_read(s->pb, b->adpc, asize);
337  }
338  avio_skip(s->pb, size - asize);
339  }
340  break;
341  case MKTAG('D','A','T','A'):
342  if ((start < avio_tell(s->pb)) ||
343  (!b->adpc && (codec == AV_CODEC_ID_ADPCM_THP ||
344  codec == AV_CODEC_ID_ADPCM_THP_LE)))
345  return AVERROR_INVALIDDATA;
346  avio_skip(s->pb, start - avio_tell(s->pb));
347 
348  if (bfstm && (codec == AV_CODEC_ID_ADPCM_THP ||
349  codec == AV_CODEC_ID_ADPCM_THP_LE))
350  avio_skip(s->pb, 24);
351 
352  b->data_start = avio_tell(s->pb);
353 
354  if (!bfstm && (major != 1 || minor))
355  avpriv_request_sample(s, "Version %d.%d", major, minor);
356 
357  return 0;
358  default:
359  av_log(s, AV_LOG_WARNING, "skipping unknown chunk: %X\n", chunk);
360 skip:
361  avio_skip(s->pb, size);
362  }
363  }
364 
365  return AVERROR_EOF;
366 }
367 
369 {
370  AVCodecParameters *par = s->streams[0]->codecpar;
371  BRSTMDemuxContext *b = s->priv_data;
372  uint32_t samples, size, skip = 0;
373  int channels = par->ch_layout.nb_channels;
374  int ret, i;
375 
376  if (avio_feof(s->pb))
377  return AVERROR_EOF;
378  b->current_block++;
379  if (b->current_block == b->block_count) {
380  size = b->last_block_used_bytes;
381  samples = b->last_block_samples;
382  skip = b->last_block_size - b->last_block_used_bytes;
383 
384  if (samples < size * 14 / 8) {
385  uint32_t adjusted_size = samples / 14 * 8;
386  if (samples % 14)
387  adjusted_size += (samples % 14 + 1) / 2 + 1;
388 
389  skip += size - adjusted_size;
390  size = adjusted_size;
391  }
392  } else if (b->current_block < b->block_count) {
393  size = b->block_size;
394  samples = b->samples_per_block;
395  } else {
396  return AVERROR_EOF;
397  }
398 
399  if (par->codec_id == AV_CODEC_ID_ADPCM_THP ||
401  uint8_t *dst;
402 
403  if (!b->adpc) {
404  av_log(s, AV_LOG_ERROR, "adpcm_thp requires ADPC chunk, but none was found.\n");
405  return AVERROR_INVALIDDATA;
406  }
407 
408  if (size > (INT_MAX - 32 - 4) ||
409  (32 + 4 + size) > (INT_MAX / channels) ||
410  (32 + 4 + size) * channels > INT_MAX - 8)
411  return AVERROR_INVALIDDATA;
412  if ((ret = av_new_packet(pkt, 8 + (32 + 4 + size) * channels)) < 0)
413  return ret;
414  dst = pkt->data;
415  if (par->codec_id == AV_CODEC_ID_ADPCM_THP_LE) {
416  bytestream_put_le32(&dst, size * channels);
417  bytestream_put_le32(&dst, samples);
418  } else {
419  bytestream_put_be32(&dst, size * channels);
420  bytestream_put_be32(&dst, samples);
421  }
422  bytestream_put_buffer(&dst, b->table, 32 * channels);
423  bytestream_put_buffer(&dst, b->adpc + 4 * channels *
424  (b->current_block - 1), 4 * channels);
425 
426  for (i = 0; i < channels; i++) {
427  ret = avio_read(s->pb, dst, size);
428  dst += size;
429  avio_skip(s->pb, skip);
430  if (ret != size) {
431  return AVERROR(EIO);
432  }
433  }
434  pkt->duration = samples;
435  } else {
436  size *= channels;
437  ret = av_get_packet(s->pb, pkt, size);
438  }
439 
440  pkt->stream_index = 0;
441 
442  if (ret != size)
443  ret = AVERROR(EIO);
444 
445  return ret;
446 }
447 
448 static int read_seek(AVFormatContext *s, int stream_index,
449  int64_t timestamp, int flags)
450 {
451  AVStream *st = s->streams[stream_index];
452  BRSTMDemuxContext *b = s->priv_data;
453  int64_t ret = 0;
454 
455  if (timestamp < 0)
456  timestamp = 0;
457  timestamp /= b->samples_per_block;
458  if (timestamp >= b->block_count)
459  timestamp = b->block_count - 1;
460  ret = avio_seek(s->pb, b->data_start + timestamp * b->block_size *
461  st->codecpar->ch_layout.nb_channels, SEEK_SET);
462  if (ret < 0)
463  return ret;
464 
465  b->current_block = timestamp;
466  avpriv_update_cur_dts(s, st, timestamp * b->samples_per_block);
467  return 0;
468 }
469 
471  .name = "brstm",
472  .long_name = NULL_IF_CONFIG_SMALL("BRSTM (Binary Revolution Stream)"),
473  .priv_data_size = sizeof(BRSTMDemuxContext),
474  .flags_internal = FF_FMT_INIT_CLEANUP,
475  .read_probe = probe,
479  .read_seek = read_seek,
480  .extensions = "brstm",
481 };
482 
484  .name = "bfstm",
485  .long_name = NULL_IF_CONFIG_SMALL("BFSTM (Binary Cafe Stream)"),
486  .priv_data_size = sizeof(BRSTMDemuxContext),
487  .flags_internal = FF_FMT_INIT_CLEANUP,
492  .read_seek = read_seek,
493  .extensions = "bfstm,bcstm",
494 };
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
sort_offsets
static int sort_offsets(const void *a, const void *b)
Definition: brstm.c:76
FF_FMT_INIT_CLEANUP
#define FF_FMT_INIT_CLEANUP
For an AVInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: internal.h:48
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
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: options.c:237
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:57
read_seek
static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: brstm.c:448
BRSTMDemuxContext::last_block_used_bytes
uint32_t last_block_used_bytes
Definition: brstm.c:38
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:53
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
ff_brstm_demuxer
const AVInputFormat ff_brstm_demuxer
Definition: brstm.c:470
AVPacket::data
uint8_t * data
Definition: packet.h:374
AV_CODEC_ID_PCM_S16BE_PLANAR
@ AV_CODEC_ID_PCM_S16BE_PLANAR
Definition: codec_id.h:350
b
#define b
Definition: input.c:34
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:392
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:300
BRSTMDemuxContext::last_block_size
uint32_t last_block_size
Definition: brstm.c:39
BRSTMDemuxContext::last_block_samples
uint32_t last_block_samples
Definition: brstm.c:40
avpriv_update_cur_dts
void avpriv_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
Update cur_dts of all streams based on the given timestamp and AVStream.
Definition: seek.c:33
AV_CODEC_ID_PCM_S16LE_PLANAR
@ AV_CODEC_ID_PCM_S16LE_PLANAR
Definition: codec_id.h:338
AV_CODEC_ID_ADPCM_THP_LE
@ AV_CODEC_ID_ADPCM_THP_LE
Definition: codec_id.h:395
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:465
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:763
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:505
BRSTMCoeffOffset::offset
uint32_t offset
Definition: brstm.c:30
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:998
loop
static int loop
Definition: ffplay.c:340
avio_rl16
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:743
BRSTMDemuxContext::block_size
uint32_t block_size
Definition: brstm.c:34
BRSTMCoeffOffset
Definition: brstm.c:28
FFDIFFSIGN
#define FFDIFFSIGN(x, y)
Comparator.
Definition: macros.h:45
BRSTMDemuxContext::current_block
uint32_t current_block
Definition: brstm.c:36
avio_rb32
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:790
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AVInputFormat
Definition: avformat.h:656
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:256
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:97
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:661
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:455
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
s1
#define s1
Definition: regdef.h:38
channels
channels
Definition: aptx.h:32
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:94
ff_bfstm_demuxer
const AVInputFormat ff_bfstm_demuxer
Definition: brstm.c:483
read_close
static int read_close(AVFormatContext *s)
Definition: brstm.c:67
AVFormatContext
Format I/O context.
Definition: avformat.h:1213
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
NULL
#define NULL
Definition: coverity.c:32
BRSTMDemuxContext::adpc
uint8_t * adpc
Definition: brstm.c:43
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:453
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:212
convert_header.major
int major
Definition: convert_header.py:23
BRSTMDemuxContext::samples_per_block
uint32_t samples_per_block
Definition: brstm.c:37
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:177
s2
#define s2
Definition: regdef.h:39
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:759
BRSTMCoeffOffset::channel
uint8_t channel
Definition: brstm.c:29
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:117
size
int size
Definition: twinvq_data.h:10344
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:632
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
flag
#define flag(name)
Definition: cbs_av1.c:553
convert_header.minor
int minor
Definition: convert_header.py:26
bytestream_put_buffer
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
Definition: bytestream.h:372
BRSTMDemuxContext::block_count
uint32_t block_count
Definition: brstm.c:35
BRSTMDemuxContext
Definition: brstm.c:33
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
BRSTMDemuxContext::table
uint8_t table[256 *32]
Definition: brstm.c:42
AV_TIME_BASE
#define AV_TIME_BASE
Internal time base represented as integer.
Definition: avutil.h:254
BRSTMDemuxContext::offsets
BRSTMCoeffOffset offsets[256]
Definition: brstm.c:44
av_always_inline
#define av_always_inline
Definition: attributes.h:49
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:264
demux.h
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
BRSTMDemuxContext::data_start
uint32_t data_start
Definition: brstm.c:41
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:102
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:948
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:260
avio_rb16
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:775
pos
unsigned int pos
Definition: spdifenc.c:412
avformat.h
read32
static av_always_inline unsigned int read32(AVFormatContext *s)
Definition: brstm.c:92
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
probe
static int probe(const AVProbeData *p)
Definition: brstm.c:48
probe_bfstm
static int probe_bfstm(const AVProbeData *p)
Definition: brstm.c:57
BRSTMDemuxContext::little_endian
int little_endian
Definition: brstm.c:45
read_packet
static int read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: brstm.c:368
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:641
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
AVPacket::stream_index
int stream_index
Definition: packet.h:376
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:347
av_dict_set_int
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set that converts the value to a string and stores it.
Definition: dict.c:147
AV_CODEC_ID_ADPCM_THP
@ AV_CODEC_ID_ADPCM_THP
Definition: codec_id.h:377
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:61
AVPacket
This structure stores compressed data.
Definition: packet.h:351
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
AV_CODEC_ID_PCM_S8_PLANAR
@ AV_CODEC_ID_PCM_S8_PLANAR
Definition: codec_id.h:347
bytestream.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
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
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:988
read_header
static int read_header(AVFormatContext *s)
Definition: brstm.c:101
read16
static av_always_inline unsigned int read16(AVFormatContext *s)
Definition: brstm.c:83
bom
static const char * bom
Definition: microdvddec.c:77
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:375