Commit 045b80e5 authored by Clément Bœsch's avatar Clément Bœsch Committed by Janne Grunau

Move ID3v1 skip from decoder to demuxer

Signed-off-by: 's avatarJanne Grunau <janne-ffmpeg@jannau.net>
parent f4b1e21a
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h" #include "dsputil.h"
#include "libavformat/id3v1.h"
/* /*
* TODO: * TODO:
...@@ -2044,13 +2043,6 @@ static int decode_frame(AVCodecContext * avctx, ...@@ -2044,13 +2043,6 @@ static int decode_frame(AVCodecContext * avctx,
header = AV_RB32(buf); header = AV_RB32(buf);
if(ff_mpa_check_header(header) < 0){ if(ff_mpa_check_header(header) < 0){
if (buf_size == ID3v1_TAG_SIZE
&& buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G') {
*data_size = 0;
return ID3v1_TAG_SIZE;
}
av_log(avctx, AV_LOG_ERROR, "Header missing\n"); av_log(avctx, AV_LOG_ERROR, "Header missing\n");
return -1; return -1;
} }
......
...@@ -174,6 +174,11 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -174,6 +174,11 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret <= 0) { if (ret <= 0) {
return AVERROR(EIO); return AVERROR(EIO);
} }
if (ret > ID3v1_TAG_SIZE &&
memcmp(&pkt->data[ret - ID3v1_TAG_SIZE], "TAG", 3) == 0)
ret -= ID3v1_TAG_SIZE;
/* note: we need to modify the packet size here to handle the last /* note: we need to modify the packet size here to handle the last
packet */ packet */
pkt->size = ret; pkt->size = ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment