summaryrefslogtreecommitdiff
path: root/libavformat/avformat.h
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2014-09-21 12:51:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-21 14:57:12 +0200
commit6c7f1155bb648eced8e5aa08b1fd490df2f8b325 (patch)
tree607abb626c790b71c3a55e0597fe501b21499240 /libavformat/avformat.h
parent36bf549b2706bd10014556a84a33ed6daf5d5373 (diff)
avformat/mp3dec: avoid early EOF with concatenated gapless mp3s
Consider a file created with something like: cat file1.mp3 file2.mp3 > result.mp3 Then if file2.mp3 has gapless information, result.mp3 would stop playing something in the middle. This happens because the gapless info directs the decoder to discard all samples after a certain position. To make matters worse, the gapless info of file2.mp3 will be used when playing the file1.mp3 part, because the gapless info is located at the end of the file. While handling concatenated gapless files correctly would be insane and a lot of effort (especially without scanning the whole file on opening), it's easy to prevent at least early EOF. Playback will happen to work, even if it's slightly broken. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avformat.h')
-rw-r--r--libavformat/avformat.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 2370cb08da..78054debca 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1036,7 +1036,14 @@ typedef struct AVStream {
* avoided for broken by design formats such as mp3 with ad-hoc gapless
* audio support.
*/
- int64_t end_discard_sample;
+ int64_t first_discard_sample;
+
+ /**
+ * The sample after last sample that is intended to be discarded after
+ * first_discard_sample. Works on frame boundaries only. Used to prevent
+ * early EOF if the gapless info is broken (considered concatenated mp3s).
+ */
+ int64_t last_discard_sample;
/**
* Number of internally decoded frames, used internally in libavformat, do not access