diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-06 05:34:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-06 05:43:48 +0200 |
commit | 0844630e6b01b71ed9dd50158b94d2833f7f8269 (patch) | |
tree | da967b451478493093abdfac9875be192e49c632 /libavformat | |
parent | 68b7b534be5912dbd28283d0d566a2ee88e51f9b (diff) | |
download | ffmpeg-0844630e6b01b71ed9dd50158b94d2833f7f8269.tar.gz |
avformat/mp3dec: Add usetoc option to allow dlsabling the use of the xing TOC
The toc is inexact and not using it can thus make sense.
Using it is faster though, thus the opposite can similarly makes sense
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mp3dec.c | 20 | ||||
-rw-r--r-- | libavformat/version.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 644ffe4b4c..c822eb6f2a 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/opt.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "libavutil/dict.h" @@ -36,10 +37,12 @@ #define XING_TOC_COUNT 100 typedef struct { + AVClass *class; int64_t filesize; int xing_toc; int start_pad; int end_pad; + int usetoc; } MP3DecContext; /* mp3 read */ @@ -91,6 +94,9 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration int i; MP3DecContext *mp3 = s->priv_data; + if (!mp3->usetoc) + return; + if (!filesize && !(filesize = avio_size(s->pb))) { av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n"); @@ -316,6 +322,19 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, return 0; } +static const AVOption options[] = { + { "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM}, + { NULL }, +}; + +static const AVClass demuxer_class = { + .class_name = "mp3", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, + .category = AV_CLASS_CATEGORY_DEMUXER, +}; + AVInputFormat ff_mp3_demuxer = { .name = "mp3", .long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"), @@ -326,4 +345,5 @@ AVInputFormat ff_mp3_demuxer = { .priv_data_size = sizeof(MP3DecContext), .flags = AVFMT_GENERIC_INDEX, .extensions = "mp2,mp3,m2a", /* XXX: use probe */ + .priv_class = &demuxer_class, }; diff --git a/libavformat/version.h b/libavformat/version.h index fcf53d889d..287e7a58a8 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,7 +31,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 55 #define LIBAVFORMAT_VERSION_MINOR 11 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ |