summaryrefslogtreecommitdiff
path: root/libavformat/raw.c
diff options
context:
space:
mode:
authorDavid DeHaven <dave@sagetv.com>2009-01-25 00:16:27 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2009-01-25 00:16:27 +0000
commit6cde949a2084293c7f3661460b5758f11908cac9 (patch)
tree8d3c7b6c8d56a95c7c0222ee066ef3a8202ca567 /libavformat/raw.c
parent9f3d3ecf929f776f2d328e3ad118e4abcd33feaa (diff)
Handle ID3v2 tags in raw FLAC streams by skipping them.
Patch by David DeHaven (dave sagetv com) Originally committed as revision 16764 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/raw.c')
-rw-r--r--libavformat/raw.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libavformat/raw.c b/libavformat/raw.c
index fe6f6e40c3..fc52fe7bc4 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -289,6 +289,18 @@ static int audio_read_header(AVFormatContext *s,
st->codec->codec_id = s->iformat->value;
st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */
+
+ if(st->codec->codec_id == CODEC_ID_FLAC) {
+ /* skip ID3v2 header if found */
+ uint8_t buf[ID3v2_HEADER_SIZE];
+ int ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
+ if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf)) {
+ int len = ff_id3v2_tag_len(buf);
+ url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR);
+ } else {
+ url_fseek(s->pb, 0, SEEK_SET);
+ }
+ }
return 0;
}
@@ -573,7 +585,12 @@ static int eac3_probe(AVProbeData *p)
#if CONFIG_FLAC_DEMUXER
static int flac_probe(AVProbeData *p)
{
- if(memcmp(p->buf, "fLaC", 4)) return 0;
+ uint8_t *bufptr = p->buf;
+
+ if(ff_id3v2_match(bufptr))
+ bufptr += ff_id3v2_tag_len(bufptr);
+
+ if(memcmp(bufptr, "fLaC", 4)) return 0;
else return AVPROBE_SCORE_MAX / 2;
}
#endif