summaryrefslogtreecommitdiff
path: root/libavformat/oma.c
diff options
context:
space:
mode:
authorMichael Karcher <ffmpeg@mkarcher.dialup.fu-berlin.de>2010-01-17 00:23:08 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2010-01-17 00:23:08 +0000
commit1454618426f6983691eba3b89d4272641297405d (patch)
tree4b90c1e3182ffb4c743bc24f8a6dcc73408d4f09 /libavformat/oma.c
parent5090d8e16ac651611b6bad1d3e9e295c6fa4ff6d (diff)
Support demuxing of Sony OpenMG files without metadata header.
Original patch by Michael Karcher, ffmpeg A mkarcher dialup fu-berlin de Originally committed as revision 21257 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/oma.c')
-rw-r--r--libavformat/oma.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/oma.c b/libavformat/oma.c
index cc512cae76..b0d2607ccb 100644
--- a/libavformat/oma.c
+++ b/libavformat/oma.c
@@ -78,6 +78,7 @@ static int oma_read_header(AVFormatContext *s,
if (ret != 10)
return -1;
+ if(!memcmp(buf, "ea3", 3)) {
ea3_taglen = ((buf[6] & 0x7f) << 21) | ((buf[7] & 0x7f) << 14) | ((buf[8] & 0x7f) << 7) | (buf[9] & 0x7f);
EA3_pos = ea3_taglen + 10;
@@ -88,6 +89,10 @@ static int oma_read_header(AVFormatContext *s,
ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
if (ret != EA3_HEADER_SIZE)
return -1;
+ } else {
+ ret = get_buffer(s->pb, buf + 10, EA3_HEADER_SIZE - 10);
+ EA3_pos = 0;
+ }
if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
@@ -177,7 +182,9 @@ static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
static int oma_read_probe(AVProbeData *p)
{
- if (!memcmp(p->buf, ((const uint8_t[]){'e', 'a', '3', 3, 0}),5))
+ if (!memcmp(p->buf, ((const uint8_t[]){'e', 'a', '3', 3, 0}), 5) ||
+ (!memcmp(p->buf, "EA3", 3) &&
+ !p->buf[4] && p->buf[5] == EA3_HEADER_SIZE))
return AVPROBE_SCORE_MAX;
else
return 0;