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