]> git.sesse.net Git - vlc/blobdiff - src/input/meta.c
Remove META_ENGINE object type
[vlc] / src / input / meta.c
index 92ac141fcabbd1f51ee109baed02d2174e3803a4..538951f372dc524b863922cf5ea1d4e99bc9aeb4 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_input.h>
 #include <vlc_stream.h>
@@ -32,6 +36,7 @@
 #include "../playlist/playlist_internal.h"
 #include <errno.h>
 #include <limits.h>                                             /* PATH_MAX */
+#include <assert.h>
 
 #ifdef HAVE_SYS_STAT_H
 #   include <sys/stat.h>
@@ -89,7 +94,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;
@@ -99,11 +105,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 );
 
@@ -165,12 +171,20 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
     input_FindArtInCache( p_playlist, p_item );
 
     char *psz_arturl = input_item_GetArtURL( p_item );
-    if( !strncmp( psz_arturl, "file://", strlen( "file://" ) ) )
+    if( psz_arturl )
     {
+        /* We already have an URL */
+        if( !strncmp( psz_arturl, "file://", strlen( "file://" ) ) )
+        {
+            free( psz_arturl );
+            return 0; /* Art is in cache, no need to go further */
+        }
+
         free( psz_arturl );
-        return 0; /* Art is in cache, no need to go further */
+        
+        /* Art need to be put in cache */
+        return 1;
     }
-    free( psz_arturl );
 
     PL_LOCK;
     p_playlist->p_private = p_item;
@@ -416,7 +430,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*() */
@@ -562,7 +576,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;