aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegaudio_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-24 02:37:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-24 02:48:37 +0200
commit89a420b71b531bcd0344f39d0390c26f3e0173ea (patch)
treee67726f35290553b130ca3106657a5dca69ce0ce /libavcodec/mpegaudio_parser.c
parentb23d2bac0d709b5642895d1acdf0cfef689d1ba1 (diff)
downloadffmpeg-89a420b71b531bcd0344f39d0390c26f3e0173ea.tar.gz
avcodec/mpegaudio_parser: Discard ID3v1 tag at the end
Ideally this should be discarded by the demuxer but this is not possible without fully parsing which would be then very similar to this. The current ID3v1 discard code in the demuxer does not work and will be removed in a subsequent commit The discard code could be adjusted if needed to also discard tags at other locations than the end or to limit this possibly to input from the mp3 demuxer or even to move the discarding to the decoder. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegaudio_parser.c')
-rw-r--r--libavcodec/mpegaudio_parser.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 58098d89f0..7849fed649 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -23,7 +23,7 @@
#include "parser.h"
#include "mpegaudiodecheader.h"
#include "libavutil/common.h"
-
+#include "libavformat/id3v1.h" // for ID3v1_TAG_SIZE
typedef struct MpegAudioParseContext {
ParseContext pc;
@@ -49,6 +49,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
uint32_t state= pc->state;
int i;
int next= END_NOT_FOUND;
+ int flush = !buf_size;
for(i=0; i<buf_size; ){
if(s->frame_size){
@@ -113,6 +114,12 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
return buf_size;
}
+ if (flush && buf_size >= ID3v1_TAG_SIZE && memcmp(buf, "TAG", 3) == 0) {
+ *poutbuf = NULL;
+ *poutbuf_size = 0;
+ return next;
+ }
+
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;