[vlc-commits] Taglib: use new method for Vorbis Comments TRACKNUMBER parsing
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 19:03:46 2015 +0200| [ab163d3ef3b4b9c45466a5759414199470b91347] | committer: Jean-Baptiste Kempf
Taglib: use new method for Vorbis Comments TRACKNUMBER parsing
Because of course TRACKNUMBER can be xx or xx/xx, and then depending on
the result we need TRACKTOTAL and TOTALTRACKS
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ab163d3ef3b4b9c45466a5759414199470b91347
---
modules/meta_engine/taglib.cpp | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 0923f1d..7028c46 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -548,21 +548,9 @@ static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_meta_t* p_demux_meta,
list = tag->fieldListMap()["TRACKNUMBER"];
if( !list.isEmpty() )
{
- const char *psz_value;
- unsigned short u_track;
- unsigned short u_total;
- psz_value = (*list.begin()).toCString( true );
- if( sscanf( psz_value, "%hu/%hu", &u_track, &u_total ) == 2)
- {
- char str[6];
- snprintf(str, 6, "%u", u_track);
- vlc_meta_SetTrackNum( p_meta, str);
- snprintf(str, 6, "%u", u_total);
- vlc_meta_SetTrackTotal( p_meta, str);
- hasTrackTotal = true;
- }
- else
- vlc_meta_SetTrackNum( p_meta, psz_value);
+ int i_values = ExtractCoupleNumberValues( p_meta, (*list.begin()).toCString( true ),
+ vlc_meta_TrackNumber, vlc_meta_TrackTotal );
+ hasTrackTotal = i_values == 2;
}
if( !hasTrackTotal )
{
More information about the vlc-commits
mailing list