+#ifdef TAGLIB_HAVE_ASFPICTURE_H
+/**
+ * Read meta information from APE tags
+ * @param tag: the APE tag
+ * @param p_demux_meta: the demuxer meta
+ * @param p_meta: the meta
+ */
+static void ReadMetaFromASF( ASF::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
+{
+ // List the pictures
+ ASF::AttributeList list = tag->attributeListMap()["WM/Picture"];
+ ASF::AttributeList::Iterator iter;
+ for( iter = list.begin(); iter != list.end(); iter++ )
+ {
+ const ASF::Picture asfPicture = (*iter).toPicture();
+ const ByteVector picture = asfPicture.picture();
+ const char *psz_mime = asfPicture.mimeType().toCString();
+ const char *p_data = picture.data();
+ const unsigned i_data = picture.size();
+ char *psz_name;
+ input_attachment_t *p_attachment;
+
+ if( asfPicture.description().size() > 0 )
+ psz_name = strdup( asfPicture.description().toCString( true ) );
+ else
+ {
+ if( asprintf( &psz_name, "%i", asfPicture.type() ) == -1 )
+ continue;
+ }
+
+ msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %u bytes",
+ psz_name, psz_mime, i_data );
+
+ p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
+ 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 );
+ free( psz_name );
+
+ char *psz_url;
+ if( asprintf( &psz_url, "attachment://%s",
+ p_attachment->psz_name ) == -1 )
+ continue;
+ vlc_meta_SetArtURL( p_meta, psz_url );
+ free( psz_url );
+ }
+}
+#endif
+