[vlc-commits] Taglib: generalize the couple-in-string extraction

Jean-Baptiste Kempf git at videolan.org
Fri Oct 16 19:08:55 CEST 2015


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Oct 16 18:17:04 2015 +0200| [9e2d67ff1da4ecc3c5e336259b97289800104158] | committer: Jean-Baptiste Kempf

Taglib: generalize the couple-in-string extraction

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9e2d67ff1da4ecc3c5e336259b97289800104158
---

 modules/meta_engine/taglib.cpp |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 23e2eab..fa9b79c 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -114,16 +114,17 @@ vlc_module_end ()
 
 using namespace TagLib;
 
-static void ExtractTrackNumberValues( vlc_meta_t* p_meta, const char *psz_value )
+static void ExtractTrackNumberValues( vlc_meta_t* p_meta, const char *psz_value,
+        vlc_meta_type_t first, vlc_meta_type_t second)
 {
     unsigned int i_trknum, i_trktot;
     if( sscanf( psz_value, "%u/%u", &i_trknum, &i_trktot ) == 2 )
     {
         char psz_trck[11];
         snprintf( psz_trck, sizeof( psz_trck ), "%u", i_trknum );
-        vlc_meta_SetTrackNum( p_meta, psz_trck );
+        vlc_meta_Set( p_meta, first, psz_trck );
         snprintf( psz_trck, sizeof( psz_trck ), "%u", i_trktot );
-        vlc_meta_Set( p_meta, vlc_meta_TrackTotal, psz_trck );
+        vlc_meta_Set( p_meta, second, psz_trck );
     }
 }
 
@@ -214,7 +215,8 @@ static void ReadMetaFromAPE( APE::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta
     iter = fields.find( "TRACK" );
     if( iter != fields.end() && !iter->second.isEmpty() )
     {
-        ExtractTrackNumberValues( p_meta, iter->second.toString().toCString( true ) );
+        ExtractTrackNumberValues( p_meta, iter->second.toString().toCString( true ),
+                vlc_meta_TrackNumber, vlc_meta_TrackTotal );
         fields.erase( iter );
     }
 
@@ -383,7 +385,8 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_meta_t* p_demux_meta, vlc_
     list = tag->frameListMap()["TRCK"];
     if( !list.isEmpty() )
     {
-        ExtractTrackNumberValues( p_meta, (*list.begin())->toString().toCString( true ) );
+        ExtractTrackNumberValues( p_meta, (*list.begin())->toString().toCString( true ),
+                vlc_meta_TrackNumber, vlc_meta_TrackTotal );
     }
 
     /* Preferred type of image



More information about the vlc-commits mailing list