38 if (!memcmp(p->
buf,
"RIFF", 4) && !memcmp(p->
buf + 8,
"XWMA", 4))
47 uint32_t dpds_table_size = 0;
48 uint32_t *dpds_table = 0;
61 if (tag !=
MKTAG(
'R',
'I',
'F',
'F'))
65 if (tag !=
MKTAG(
'X',
'W',
'M',
'A'))
70 if (tag !=
MKTAG(
'f',
'm',
't',
' '))
139 if (tag ==
MKTAG(
'd',
'a',
't',
'a')) {
142 }
else if (tag ==
MKTAG(
'd',
'p',
'd',
's')) {
162 "dpds chunk size %"PRId64
" not divisible by 4\n", size);
164 dpds_table_size = size / 4;
165 if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) {
167 "dpds chunk size %"PRId64
" invalid\n", size);
174 dpds_table =
av_malloc(dpds_table_size *
sizeof(uint32_t));
179 for (i = 0; i < dpds_table_size; ++i) {
196 if (dpds_table && dpds_table_size) {
198 const uint32_t bytes_per_sample
202 const uint64_t total_decoded_bytes = dpds_table[dpds_table_size - 1];
204 if (!bytes_per_sample) {
206 "Invalid bits_per_coded_sample %d for %d channels\n",
211 st->
duration = total_decoded_bytes / bytes_per_sample;
223 for (i = 0; i < dpds_table_size; ++i) {
230 dpds_table[i] / bytes_per_sample,
264 size =
FFMIN(size, left);
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
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.
static int xwma_read_packet(AVFormatContext *s, AVPacket *pkt)
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
enum AVStreamParseType need_parsing
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define MKTAG(a, b, c, d)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int xwma_read_header(AVFormatContext *s)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
AVInputFormat ff_xwma_demuxer
unsigned int avio_rl32(AVIOContext *s)
int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
static int xwma_probe(AVProbeData *p)
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int bit_rate
the average bitrate
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
static int read_header(FFV1Context *f)
int sample_rate
samples per second
AVIOContext * pb
I/O context.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
#define FF_INPUT_BUFFER_PADDING_SIZE
This structure contains the data a format has to probe a file.
int64_t duration
Decoding: duration of the stream, in stream time base.
#define AVERROR_INVALIDDATA
#define AVPROBE_SCORE_MAX
int eof_reached
true if eof reached
int channels
number of audio channels
void * priv_data
Format private data.
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 ...