[vlc-devel] commit: Fixed taglib attachment extraction. (Laurent Aimar )

git version control git at videolan.org
Sat Jan 24 19:55:43 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jan 24 19:48:47 2009 +0100| [b514a038dc932f0e77021952514fefacd87ccf5c] | committer: Laurent Aimar 

Fixed taglib attachment extraction.

C++ is always so much fun ;)

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

 modules/meta_engine/taglib.cpp |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index c2042b3..60b4a94 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -204,7 +204,6 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t*
         input_attachment_t *p_attachment;
 
         const char *psz_mime;
-        const char *p_data; int i_data;
         char *psz_name, *psz_description;
 
         // Get the mime and description of the image.
@@ -234,17 +233,19 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t*
             continue;
         }
 
-        p_data = p_apic->picture().data();
-        i_data = p_apic->picture().size();
+        const ByteVector picture = p_apic->picture();
+        const char *p_data = picture.data();
+        const unsigned i_data = picture.size();
 
-        msg_Dbg( p_demux, "Found embedded art: %s (%s) is %i bytes",
+        msg_Dbg( p_demux, "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_description, p_data, i_data );
-        TAB_APPEND_CAST( (input_attachment_t**),
-                         p_demux_meta->i_attachments, p_demux_meta->attachments,
-                         p_attachment );
+        if( p_attachment )
+            TAB_APPEND_CAST( (input_attachment_t**),
+                             p_demux_meta->i_attachments, p_demux_meta->attachments,
+                             p_attachment );
         free( psz_description );
 
         if( pi_cover_score[p_apic->type()] > i_score )




More information about the vlc-devel mailing list