shithub: mp3dec

Download patch

ref: ed9dc0c5a18be0479c979420060e815a2f6068b9
parent: ea70d0b775b2d589d1697d1e1dfbc744ecab814e
author: lieff <lieff@users.noreply.github.com>
date: Wed Feb 12 21:30:23 EST 2020

mp3dec_ex: fix vbrtag coverage and vbrtag+mp3dec_ex_open_cb mode decoded length

--- a/minimp3_ex.h
+++ b/minimp3_ex.h
@@ -432,7 +432,6 @@
 {
     if (buf_size < MINIMP3_BUF_SIZE)
         return 0;
-    io->seek(0, io->seek_data);
     size_t filled = io->read(buf, MINIMP3_ID3_DETECT_SIZE, io->read_data), consumed = 0;
     uint64_t readed = 0, frames = 0;
     mp3dec_frame_info_t frame_info;
@@ -608,6 +607,7 @@
         dec->buffer_samples = 0;
         if (dec->io)
         {
+            dec->io->seek(dec->start_offset, dec->io->seek_data);
             if (mp3dec_iterate_cb(dec->io, (uint8_t *)dec->file.buffer, dec->file.size, mp3dec_load_index, dec) > 0 && !dec->index.frames)
                 return MP3D_E_MEMORY;
         } else
@@ -1123,6 +1123,7 @@
     mp3dec_init(&dec->mp3d);
     if (MP3D_SEEK_TO_SAMPLE == dec->seek_method)
     {
+        io->seek(0, io->seek_data);
         if (mp3dec_iterate_cb(io, (uint8_t *)dec->file.buffer, dec->file.size, mp3dec_load_index, dec) > 0 && !dec->index.frames && !dec->vbr_tag_found)
             return MP3D_E_MEMORY;
         dec->io->seek(dec->start_offset, dec->io->seek_data);
--- a/scripts/test_mode.sh
+++ b/scripts/test_mode.sh
@@ -12,7 +12,7 @@
 vectors/l3-sin1k0db.bit vectors/l3-test45.bit vectors/l3-test46.bit vectors/M2L3_bitrate_16_all.bit \
 vectors/M2L3_bitrate_22_all.bit vectors/M2L3_bitrate_24_all.bit vectors/M2L3_compl24.bit vectors/M2L3_noise.bit \
 vectors/l3-nonstandard-id3v1.bit vectors/l3-nonstandard-id3v2.bit vectors/l1-fl1.bit vectors/l2-fl10.bit"
-if [ "$MODE" = "2" ]; then
+if [ "$MODE" = "6" ] || [ "$MODE" = "7" ] || [ "$MODE" = "8" ]; then
 VECTORS+=" vectors/l3-nonstandard-sin1k0db_lame_vbrtag.bit"
 fi