]> git.sesse.net Git - vlc/blobdiff - modules/meta_engine/taglib.cpp
Missing item to translate.
[vlc] / modules / meta_engine / taglib.cpp
index bdbdb5877e71d5f899dc94bf7d9a698c8577e5ec..67e54dd7e3ac4c37846e72e1ffa853a6fc192517 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_playlist.h>
 #include <vlc_meta.h>
 #include <vlc_demux.h>
@@ -119,8 +124,21 @@ 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);
-            psz_description = p_apic->description().toCString(true);
-            psz_name = psz_description;
+            psz_description = psz_name = p_apic->description().toCString(true);
+
+            /* some old iTunes version not only sets incorrectly the mime type
+             * or the description of the image,
+             * but also embeds incorrectly the image.
+             * Recent versions seem to behave correctly */
+            if( !strncmp( psz_mime, "PNG", 3 ) ||
+                !strncmp( psz_name, "\xC2\x89PNG", 5 ) )
+            {
+                msg_Warn( p_demux,
+                    "%s: Invalid picture embedded by broken iTunes version, "
+                    "you really shouldn't use this crappy software.",
+                    (const char *)f.file()->name() );
+                break;
+            }
 
             p_data_taglib = p_apic->picture();
             p_data = p_data_taglib.data();
@@ -179,6 +197,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 +237,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;