[vlc-commits] taglib: ID3v2: save TrackTotal
Francois Cartegnie
git at videolan.org
Tue Dec 18 22:56:50 CET 2012
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec 18 22:54:37 2012 +0100| [c55da911c50a6a22124ab5be4607e45b4f8f7505] | committer: Francois Cartegnie
taglib: ID3v2: save TrackTotal
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c55da911c50a6a22124ab5be4607e45b4f8f7505
---
modules/meta_engine/taglib.cpp | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 2561b4c..49561d1 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -715,6 +715,34 @@ static void WriteMetaToId3v2( ID3v2::Tag* tag, input_item_t* p_item )
WRITE( Publisher, "TPUB" );
#undef WRITE
+ /* Track Total as Custom Field */
+ psz_meta = input_item_GetTrackTotal( p_item );
+ if ( psz_meta )
+ {
+ ID3v2::FrameList list = tag->frameListMap()["TXXX"];
+ ID3v2::UserTextIdentificationFrame *p_txxx;
+ for( ID3v2::FrameList::Iterator iter = list.begin(); iter != list.end(); iter++ )
+ {
+ p_txxx = dynamic_cast<ID3v2::UserTextIdentificationFrame*>(*iter);
+ if( !p_txxx )
+ continue;
+ if( !strcmp( p_txxx->description().toCString( true ), "TRACKTOTAL" ) )
+ {
+ p_txxx->setText( psz_meta );
+ FREENULL( psz_meta );
+ break;
+ }
+ }
+ if( psz_meta ) /* not found in existing custom fields */
+ {
+ ByteVector p_byte( "TXXX", 4 );
+ p_txxx = new ID3v2::UserTextIdentificationFrame( p_byte );
+ p_txxx->setDescription( "TRACKTOTAL" );
+ p_txxx->setText( psz_meta );
+ free( psz_meta );
+ tag->addFrame( p_txxx );
+ }
+ }
/* Write album art */
char *psz_url = input_item_GetArtworkURL( p_item );
More information about the vlc-commits
mailing list