[vlc-devel] commit: taglib: factorize. ( Rémi Duraffort )
git version control
git at videolan.org
Mon Nov 9 19:39:15 CET 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Nov 9 19:21:16 2009 +0100| [6041d1db33ee429f113ecddb729c8840a025ec02] | committer: Rémi Duraffort
taglib: factorize.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6041d1db33ee429f113ecddb729c8840a025ec02
---
modules/meta_engine/taglib.cpp | 40 ++++++++++++++--------------------------
1 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 19320d6..2d01ce9 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -578,35 +578,23 @@ static int WriteMeta( vlc_object_t *p_this )
char *psz_meta;
-#define SET( a, b ) \
- if( b ) \
- { \
- String* psz_tmp = new String( b, String::UTF8 ); \
- p_tag->set##a( *psz_tmp ); \
- delete psz_tmp; \
- }
+#define SET( a, b ) \
+ psz_meta = input_item_Get ## a( p_item ); \
+ if( psz_meta ) \
+ { \
+ String* psz_tmp = new String( psz_meta, String::UTF8 ); \
+ p_tag->set##b( *psz_tmp ); \
+ delete psz_tmp; \
+ } \
+ free( psz_meta );
// Saving all common fields
// If the title is empty, use the name
- psz_meta = input_item_GetTitleFbName( p_item );
- SET( Title, psz_meta );
- free( psz_meta );
-
- psz_meta = input_item_GetArtist( p_item );
- SET( Artist, psz_meta );
- free( psz_meta );
-
- psz_meta = input_item_GetAlbum( p_item );
- SET( Album, psz_meta );
- free( psz_meta );
-
- psz_meta = input_item_GetDescription( p_item );
- SET( Comment, psz_meta );
- free( psz_meta );
-
- psz_meta = input_item_GetGenre( p_item );
- SET( Genre, psz_meta );
- free( psz_meta );
+ SET( TitleFbName, Title );
+ SET( Artist, Artist );
+ SET( Album, Album );
+ SET( Description, Comment );
+ SET( Genre, Genre );
#undef SET
More information about the vlc-devel
mailing list