changeset 5553:d15ba827d5ea libavformat

Support demuxing of Sony OpenMG files without metadata header. Original patch by Michael Karcher, ffmpeg A mkarcher dialup fu-berlin de
author cehoyos
date Sun, 17 Jan 2010 00:23:08 +0000
parents f05f12818849
children dde1a233f3f6
files oma.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/oma.c	Sat Jan 16 13:13:49 2010 +0000
+++ b/oma.c	Sun Jan 17 00:23:08 2010 +0000
@@ -78,6 +78,7 @@
     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 @@
     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_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;