91 int bom, major, minor, codec, chunk;
92 int64_t h1offset, pos, toffset;
107 if (bom != 0xFEFF && bom != 0xFFFE) {
128 uint32_t info_offset = 0;
129 uint16_t section_count, header_size, i;
135 section_count =
read16(s);
138 && !(start && info_offset)
139 && i < section_count; i++) {
162 if (!info_offset || !start)
179 toffset =
read32(s) + 16LL;
256 toffset =
read32(s) + 16LL;
292 case MKTAG(
'S',
'E',
'E',
'K'):
293 case MKTAG(
'A',
'D',
'P',
'C'):
316 for (i = 0; i < asize; i += 2) {
326 case MKTAG(
'D',
'A',
'T',
'A'):
341 if (!bfstm && (major != 1 || minor))
362 uint32_t samples,
size, skip = 0;
373 if (samples < size * 14 / 8) {
374 uint32_t adjusted_size = samples / 14 * 8;
376 adjusted_size += (samples % 14 + 1) / 2 + 1;
378 skip += size - adjusted_size;
379 size = adjusted_size;
402 if (size > (INT_MAX - 32 - 4) ||
403 (32 + 4 + size) > (INT_MAX / codec->
channels) ||
404 (32 + 4 + size) * codec->
channels > INT_MAX - 8)
410 bytestream_put_le32(&dst, size * codec->
channels);
411 bytestream_put_le32(&dst, samples);
413 bytestream_put_be32(&dst, size * codec->
channels);
414 bytestream_put_be32(&dst, samples);
420 for (i = 0; i < codec->
channels; i++) {
444 int64_t timestamp,
int flags)
470 .extensions =
"brstm",
482 .extensions =
"bfstm,bcstm",
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
AVInputFormat ff_bfstm_demuxer
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int avio_rb16(AVIOContext *s)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static av_always_inline unsigned int read16(AVFormatContext *s)
static int probe_bfstm(AVProbeData *p)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
unsigned int avio_rb32(AVIOContext *s)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static int probe(AVProbeData *p)
AVStream ** streams
A list of all streams in the file.
uint32_t samples_per_block
#define AVERROR_EOF
End of file.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
uint32_t last_block_samples
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
uint32_t last_block_used_bytes
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int avio_r8(AVIOContext *s)
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define AV_TIME_BASE
Internal time base represented as integer.
static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
This structure contains the data a format has to probe a file.
AVInputFormat ff_brstm_demuxer
int64_t duration
Decoding: duration of the stream, in stream time base.
unsigned int avio_rl16(AVIOContext *s)
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
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...
struct AVInputFormat * iformat
The input container format.
static int read_header(AVFormatContext *s)
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
int channels
number of audio channels
void * priv_data
Format private data.
static av_always_inline unsigned int read32(AVFormatContext *s)
static int read_packet(AVFormatContext *s, AVPacket *pkt)
static int read_close(AVFormatContext *s)
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
#define MKTAG(a, b, c, d)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...