]> git.sesse.net Git - vlc/blobdiff - modules/meta_engine/taglib.cpp
id3tag: use size_t to represent sizes
[vlc] / modules / meta_engine / taglib.cpp
index bdbdb5877e71d5f899dc94bf7d9a698c8577e5ec..ab19699a2e0c9029feb923e797d6aa0eafa0ebcf 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include <vlc_playlist.h>
 #include <vlc_meta.h>
@@ -119,6 +123,18 @@ static void DetectImage( FileRef f, demux_t *p_demux )
             ByteVector p_data_taglib; const char *p_data; int i_data;
 
             psz_mime = p_apic->mimeType().toCString(true);
+
+            /* some old iTunes version not only sets incorrectly the mime type
+             * but also embeds incorrectly the image.
+             * Recent versions seem to behave correctly */
+            if( !strncmp( psz_mime, "PNG", 3 ) )
+            {
+                msg_Warn( p_demux,
+                    "%s: Invalid picture embedded by broken iTunes version",
+                    f.file()->name() );
+                break;
+            }
+
             psz_description = p_apic->description().toCString(true);
             psz_name = psz_description;
 
@@ -179,6 +195,7 @@ static void DetectImage( FileRef f, demux_t *p_demux )
         TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
         p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
                 psz_description, p_data, i_data );
+        free( p_data );
 
         TAB_APPEND_CAST( (input_attachment_t**),
                 p_demux_meta->i_attachments, p_demux_meta->attachments,
@@ -218,7 +235,7 @@ static int ReadMeta( vlc_object_t *p_this )
 {
     demux_t         *p_demux = (demux_t *)p_this;
     demux_meta_t    *p_demux_meta = (demux_meta_t*)p_demux->p_private;
-    vlc_meta_t      *p_meta = p_demux_meta->p_meta;
+    vlc_meta_t      *p_meta;
 
     TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
     p_demux_meta->p_meta = NULL;