37 int fsize, frames, sample_rate;
39 uint8_t *buf, *buf0, *buf2, *end;
44 while(buf0 < end && !*buf0)
50 for(; buf < end; buf= buf2+1) {
53 for(frames = 0; buf2 < end; frames++) {
60 max_frames =
FFMAX(max_frames, frames);
69 else if(max_frames>=1)
return 1;
82 const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
91 vbrtag_size = c.frame_size;
96 avio_skip(s->
pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]);
98 if(v ==
MKBETAG(
'X',
'i',
'n',
'g') || v ==
MKBETAG(
'I',
'n',
'f',
'o')) {
109 if(v ==
MKBETAG(
'V',
'B',
'R',
'I')) {
125 spf = c.lsf ? 576 : 1152;
165 #define MP3_PACKET_SIZE 1024
198 .extensions =
"mp2,mp3,m2a",
AV_WL32 AV_WL24 AV_WL16 AV_RB32
void ff_id3v1_read(AVFormatContext *s)
Read an ID3v1 tag.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
unsigned int avio_rb16(AVIOContext *s)
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
unsigned int avio_rb32(AVIOContext *s)
enum AVStreamParseType need_parsing
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
AVCodecContext * codec
codec context
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int bit_rate
the average bitrate
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int mp3_read_probe(AVProbeData *p)
enum AVMediaType codec_type
main external API structure.
rational number numerator/denominator
static int mp3_read_header(AVFormatContext *s, AVFormatParameters *ap)
This structure contains the data a format has to probe a file.
int64_t duration
Decoding: duration of the stream, in stream time base.
int64_t start_time
Decoding: pts of the first frame of the stream, in stream time base.
AVInputFormat ff_mp3_demuxer
#define MKBETAG(a, b, c, d)
static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
Try to find Xing/Info/VBRI tags and compute duration from info therein.
#define AV_DICT_IGNORE_SUFFIX
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
preferred ID for decoding MPEG audio layer 1, 2 or 3