]> git.sesse.net Git - vlc/blobdiff - src/input/meta.c
input: Allow NULL item name.
[vlc] / src / input / meta.c
index 3655b6f8e9df858192c4a454b639fc46f1a3d0dc..4ced9e4887b3094ed462920f24beb12b3acd5005 100644 (file)
@@ -42,6 +42,8 @@
 #   include <sys/stat.h>
 #endif
 
+#include "../libvlc.h"
+
 static const char * meta_type_to_string[VLC_META_TYPE_COUNT] =
 {
     [vlc_meta_Title]            = N_("Title"),
@@ -94,7 +96,8 @@ int input_MetaFetch( playlist_t *p_playlist, input_item_t *p_item )
     assert( i_mandatory );
 
     /* FIXME: object creation is overkill, use p_private */
-    p_me = vlc_object_create( p_playlist, VLC_OBJECT_META_ENGINE );
+    p_me = vlc_custom_create( VLC_OBJECT(p_playlist), sizeof( *p_me ),
+                              VLC_OBJECT_GENERIC, "meta engine" );
     p_me->i_flags |= OBJECT_FLAGS_NOINTERACT;
     p_me->i_flags |= OBJECT_FLAGS_QUIET;
     p_me->i_mandatory = i_mandatory;
@@ -104,11 +107,11 @@ int input_MetaFetch( playlist_t *p_playlist, input_item_t *p_item )
     p_me->p_module = module_Need( p_me, "meta fetcher", 0, VLC_FALSE );
     if( !p_me->p_module )
     {
-        vlc_object_destroy( p_me );
+        vlc_object_release( p_me );
         return VLC_EGENERIC;
     }
     module_Unneed( p_me, p_me->p_module );
-    vlc_object_destroy( p_me );
+    vlc_object_release( p_me );
 
     input_item_SetMetaFetched( p_item, VLC_TRUE );
 
@@ -429,7 +432,7 @@ int input_DownloadAndCacheArt( playlist_t *p_playlist, input_item_t *p_item )
     }
 
     psz_type = strrchr( psz_arturl, '.' );
-    if( strlen( psz_type ) > 5 )
+    if( psz_type && strlen( psz_type ) > 5 )
         psz_type = NULL; /* remove extension if it's > to 4 characters */
 
     /* Warning: psz_title, psz_artist, psz_album may change in ArtCache*() */
@@ -575,7 +578,7 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
 }
 
 
-uint32_t input_CurrentMetaFlags( vlc_meta_t *p_meta )
+uint32_t input_CurrentMetaFlags( const vlc_meta_t *p_meta )
 {
     uint32_t i_meta = 0;