[SCM] libav/experimental: Parse ID3 tags in Musepack SV7 files Patch by Matti Hamalainen (mhamalai at students.oamk.+358) Thread: [PATCH] 6/6 Add parsing of ID3v2 tags in Musepack SV7 demuxer

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:49:57 UTC 2013


The following commit has been merged in the experimental branch:
commit 5f71844e788b1dd06e87d95ca9ce823770f9a4f0
Author: Matti Hamalainen <(mhamalai at students.oamk.fi>
Date:   Tue Aug 11 17:28:56 2009 +0000

    Parse ID3 tags in Musepack SV7 files
    Patch by Matti Hamalainen (mhamalai at students.oamk.+358)
    Thread: [PATCH] 6/6 Add parsing of ID3v2 tags in Musepack SV7 demuxer
    
    Originally committed as revision 19631 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index 03aa7f0..ea6e3c6 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -58,26 +58,32 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     MPCContext *c = s->priv_data;
     AVStream *st;
-    int t;
+    int t, ret;
+    int64_t pos = url_ftell(s->pb);
 
     t = get_le24(s->pb);
     if(t != MKTAG('M', 'P', '+', 0)){
-        if(t != MKTAG('I', 'D', '3', 0)){
+        uint8_t buf[ID3v2_HEADER_SIZE];
+        if (url_fseek(s->pb, pos, SEEK_SET) < 0)
+            return -1;
+        ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
+        if (ret != ID3v2_HEADER_SIZE || !ff_id3v2_match(buf)) {
             av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
             return -1;
         }
         /* skip ID3 tags and try again */
-        url_fskip(s->pb, 3);
-        t  = get_byte(s->pb) << 21;
-        t |= get_byte(s->pb) << 14;
-        t |= get_byte(s->pb) <<  7;
-        t |= get_byte(s->pb);
+        t = ff_id3v2_tag_len(buf) - ID3v2_HEADER_SIZE;
         av_log(s, AV_LOG_DEBUG, "Skipping %d(%X) bytes of ID3 data\n", t, t);
         url_fskip(s->pb, t);
         if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
             av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
             return -1;
         }
+        /* read ID3 tags */
+        if (url_fseek(s->pb, pos, SEEK_SET) < 0)
+            return -1;
+        ff_id3v2_read(s);
+        get_le24(s->pb);
     }
     c->ver = get_byte(s->pb);
     if(c->ver != 0x07 && c->ver != 0x17){

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list