[vlc-commits] taglib: read a few more APE tags

Rafaël Carré git at videolan.org
Sun Jul 1 15:29:54 CEST 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Jul  1 15:28:45 2012 +0200| [5ada985bfacfb1b329897bb99cc5a92e26b40895] | committer: Rafaël Carré

taglib: read a few more APE tags

Close #5558

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

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

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 0ce4c16..148401b 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -127,13 +127,47 @@ static void ExtractTrackNumberValues( vlc_meta_t* p_meta, const char *psz_value
  * @param p_demux_meta: the demuxer meta
  * @param p_meta: the meta
  */
-static void ReadMetaFromAPE( APE::Tag* tag, demux_meta_t*, vlc_meta_t* p_meta )
+static void ReadMetaFromAPE( APE::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
 {
     APE::Item item;
+
+    item = tag->itemListMap()["COVER ART (FRONT)"];
+    if( !item.isEmpty() )
+    {
+        input_attachment_t *p_attachment;
+
+        const ByteVector picture = item.value();
+        const char *p_data = picture.data();
+        unsigned i_data = picture.size();
+
+        size_t desc_len = strnlen(p_data, i_data);
+        if (desc_len < i_data) {
+            const char *psz_name = p_data;
+            p_data += desc_len + 1; /* '\0' */
+            i_data -= desc_len + 1;
+            msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %u bytes",
+                     psz_name, "image/jpeg", i_data );
+
+            p_attachment = vlc_input_attachment_New( "cover", "image/jpeg",
+                                    psz_name, p_data, i_data );
+            if( p_attachment )
+                TAB_APPEND_CAST( (input_attachment_t**),
+                                 p_demux_meta->i_attachments, p_demux_meta->attachments,
+                                 p_attachment );
+
+            vlc_meta_SetArtURL( p_meta, "attachment://cover" );
+        }
+    }
+
 #define SET( keyName, metaName ) \
     item = tag->itemListMap()[keyName]; \
     if( !item.isEmpty() ) vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) ); \
 
+    SET( "ALBUM", Album );
+    SET( "ARTIST", Artist );
+    SET( "COMMENT", Description );
+    SET( "GENRE", Genre );
+    SET( "TITLE", Title );
     SET( "COPYRIGHT", Copyright );
     SET( "LANGUAGE", Language );
     SET( "PUBLISHER", Publisher );



More information about the vlc-commits mailing list