[vlc-devel] [PATCH] MP3: support TRCK total number

Jean-Baptiste Kempf jb at videolan.org
Wed Jun 13 02:58:48 CEST 2012


---
 modules/meta_engine/taglib.cpp |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index e1f63ee..5ea1981 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -244,6 +244,22 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_meta_t* p_demux_meta, vlc_
 
 #undef SET
 
+    /* */
+    list = tag->frameListMap()["TRCK"];
+    if( !list.isEmpty() )
+    {
+        int i_trknum, i_trktot;
+        if( sscanf( (*list.begin())->toString().toCString( true ),
+                    "%i/%i", &i_trknum, &i_trktot ) == 2 )
+        {
+            char psz_trck[11];
+            snprintf( psz_trck, sizeof( psz_trck ), "%i", i_trknum );
+            vlc_meta_SetTrackNum( p_meta, psz_trck );
+            snprintf( psz_trck, sizeof( psz_trck ), "%i", i_trktot );
+            vlc_meta_Set( p_meta, vlc_meta_TrackTotal, psz_trck );
+        }
+    }
+
     /* Preferred type of image
      * The 21 types are defined in id3v2 standard:
      * http://www.id3.org/id3v2.4.0-frames */
-- 
1.7.10.4




More information about the vlc-devel mailing list