Merge commit '505642f18276aed03278ac91b1f334ea888eac6a'

* commit '505642f18276aed03278ac91b1f334ea888eac6a':
  mp3dec: fallback to generic seeking when a TOC is not present

Conflicts:
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-04-19 21:30:39 +02:00
commit 194d0399a2

View File

@ -40,7 +40,7 @@ typedef struct {
int xing_toc; int xing_toc;
int start_pad; int start_pad;
int end_pad; int end_pad;
} MP3Context; } MP3DecContext;
/* mp3 read */ /* mp3 read */
@ -89,7 +89,7 @@ static int mp3_read_probe(AVProbeData *p)
static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration) static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration)
{ {
int i; int i;
MP3Context *mp3 = s->priv_data; MP3DecContext *mp3 = s->priv_data;
if (!filesize && if (!filesize &&
!(filesize = avio_size(s->pb))) { !(filesize = avio_size(s->pb))) {
@ -113,7 +113,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
*/ */
static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
{ {
MP3Context *mp3 = s->priv_data; MP3DecContext *mp3 = s->priv_data;
uint32_t v, spf; uint32_t v, spf;
unsigned frames = 0; /* Total number of frames in file */ unsigned frames = 0; /* Total number of frames in file */
unsigned size = 0; /* Total number of bytes in the stream */ unsigned size = 0; /* Total number of bytes in the stream */
@ -190,7 +190,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
static int mp3_read_header(AVFormatContext *s) static int mp3_read_header(AVFormatContext *s)
{ {
MP3Context *mp3 = s->priv_data; MP3DecContext *mp3 = s->priv_data;
AVStream *st; AVStream *st;
int64_t off; int64_t off;
@ -226,7 +226,7 @@ static int mp3_read_header(AVFormatContext *s)
static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
MP3Context *mp3 = s->priv_data; MP3DecContext *mp3 = s->priv_data;
int ret, size; int ret, size;
int64_t pos; int64_t pos;
@ -273,7 +273,7 @@ static int check(AVFormatContext *s, int64_t pos)
static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
int flags) int flags)
{ {
MP3Context *mp3 = s->priv_data; MP3DecContext *mp3 = s->priv_data;
AVIndexEntry *ie; AVIndexEntry *ie;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
int64_t ret = av_index_search_timestamp(st, timestamp, flags); int64_t ret = av_index_search_timestamp(st, timestamp, flags);
@ -319,11 +319,11 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
AVInputFormat ff_mp3_demuxer = { AVInputFormat ff_mp3_demuxer = {
.name = "mp3", .name = "mp3",
.long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"), .long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"),
.priv_data_size = sizeof(MP3Context),
.read_probe = mp3_read_probe, .read_probe = mp3_read_probe,
.read_header = mp3_read_header, .read_header = mp3_read_header,
.read_packet = mp3_read_packet, .read_packet = mp3_read_packet,
.read_seek = mp3_seek, .read_seek = mp3_seek,
.priv_data_size = sizeof(MP3DecContext),
.flags = AVFMT_GENERIC_INDEX, .flags = AVFMT_GENERIC_INDEX,
.extensions = "mp2,mp3,m2a", /* XXX: use probe */ .extensions = "mp2,mp3,m2a", /* XXX: use probe */
}; };