{
int i;
MP3DecContext *mp3 = s->priv_data;
- int fill_index = mp3->usetoc && duration > 0;
+ int fill_index = mp3->usetoc == 1 && duration > 0;
if (!filesize &&
!(filesize = avio_size(s->pb))) {
int ret;
int i;
+ if (mp3->usetoc < 0)
+ mp3->usetoc = 0;
+
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
int64_t best_pos;
int best_score;
+ if (mp3->usetoc == 2)
+ return -1; // generic index code
+
if ( mp3->is_cbr
- && (mp3->usetoc <= 0 || !mp3->xing_toc)
+ && (mp3->usetoc == 0 || !mp3->xing_toc)
&& st->duration > 0
&& mp3->header_filesize > s->internal->data_offset
&& mp3->frames) {
}
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},
+ { "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, AV_OPT_FLAG_DECODING_PARAM},
{ NULL },
};
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-notoc
-fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 1"
+FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-toc fate-gapless-mp3-notoc
+fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 2"
+fate-gapless-mp3-toc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 1"
fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 0"
FATE_GAPLESS = $(FATE_GAPLESS-yes)
c96c3ae7bd3300fd2f4debac222de5b7
3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3.out-2
c96c3ae7bd3300fd2f4debac222de5b7
-70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3.out-3
+92e37f050ad4fc817730c8af17ee6d1b *tests/data/fate/gapless-mp3.out-3
--- /dev/null
+d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-toc.out-1
+c96c3ae7bd3300fd2f4debac222de5b7
+3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3-toc.out-2
+c96c3ae7bd3300fd2f4debac222de5b7
+70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3-toc.out-3