]> git.sesse.net Git - vlc/commitdiff
Start splitting the various meta module types
authorClément Stenac <zorglub@videolan.org>
Sun, 24 Sep 2006 16:44:52 +0000 (16:44 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 24 Sep 2006 16:44:52 +0000 (16:44 +0000)
* meta reader : read directly from the file, should be made from the demux.
  Examples: taglib, id3tag
* meta fetcher : use web services to get meta, either from the current ones.
  Called only if we don't have the tags after using the meta readers
* art finder : find the URL of the suitable album art. Called according to the
  art policy
* art downloader : used to retrieve the art from special locations. Not needed
  if art is available directly from an URL.
  Examples: APIC ID3 tag reader

modules/meta_engine/dummy.c
modules/meta_engine/folder.c
modules/meta_engine/musicbrainz.c
modules/meta_engine/taglib.cpp
src/input/input.c
src/playlist/engine.c

index cb5fd84fd0159253c3a147d771bcbc5da091546b..25978c7a9fd4c3ad04ac0709e04b4dcad6e62ca8 100644 (file)
@@ -53,7 +53,7 @@ vlc_module_begin();
     set_shortname( N_( "Dummy" ) );
     set_description( _("Dummy meta data") );
 
-    set_capability( "meta engine", 1000 );
+    set_capability( "meta engine", 0 );
     set_callbacks( FindMeta, NULL );
 vlc_module_end();
 
index 8aecfd283c3d1e2d4c1c35fb0f5d83a8427cbb9b..cb0814a05b01f0bd3f1e926156f63f2ace22d226 100644 (file)
@@ -56,7 +56,7 @@ vlc_module_begin();
     set_shortname( N_( "Folder" ) );
     set_description( _("Folder meta data") );
 
-    set_capability( "meta engine", 10 );
+    set_capability( "art finder", 10 );
     set_callbacks( FindMeta, NULL );
 vlc_module_end();
 
index f2de995d3a668d86c1d36f599a2d6a57337828f7..7c296489065a3f3b39c5fa0ebc439dcc027f1d72 100644 (file)
@@ -48,7 +48,7 @@ vlc_module_begin();
     set_shortname( N_( "MusicBrainz" ) );
     set_description( _("MusicBrainz meta data") );
 
-    set_capability( "meta engine", 80 );
+    set_capability( "meta fetcher", 80 );
     set_callbacks( FindMeta, NULL );
 vlc_module_end();
 
index 62ad579919f1ab41e658f9e89c4e677dc905813c..4cd597a8fb13ff35a0ffc75ac95559e2f5e1416e 100644 (file)
@@ -113,7 +113,6 @@ static int ReadMeta( vlc_object_t *p_this )
 static int WriteMeta( vlc_object_t *p_this )
 {
     playlist_t *p_playlist = (playlist_t *)p_this;
-
     meta_export_t *p_export = (meta_export_t *)p_playlist->p_private;
     input_item_t *p_item = p_export->p_item;
 
index cacd0c64259390460700441fba33f0ccdf97a50e..b7da2ed8a9dcbe9efdda487477ffc9bf5ed512f0 100644 (file)
@@ -362,6 +362,7 @@ int __input_SecondaryPreparse( vlc_object_t *p_parent, input_item_t *p_item )
     p_me->i_mandatory =   VLC_META_ENGINE_TITLE
                         | VLC_META_ENGINE_ARTIST;
     p_me->i_optional = 0;
+/*
     if( var_CreateGetInteger( p_parent, "album-art" ) != ALBUM_ART_NEVER )
     {
         p_me->i_mandatory |= VLC_META_ENGINE_ART_URL;
@@ -370,10 +371,10 @@ int __input_SecondaryPreparse( vlc_object_t *p_parent, input_item_t *p_item )
     {
         p_me->i_optional |= VLC_META_ENGINE_ART_URL;
     }
+*/
     p_me->p_item = p_item;
-    p_me->p_module = module_Need( p_me, "meta engine", 0, VLC_FALSE );
-
-
+    p_me->p_module = module_Need( p_me, "meta fetcher", 0, VLC_FALSE );
+    vlc_object_attach( p_me, p_parent );
     if( !p_me->p_module )
     {
         msg_Err( p_parent, "no suitable meta engine module" );
index d1d927e5decd9fa9efaab4afda1184aa53851529..98c3ced77c1f51c245cb66f60f5b5432fd45518f 100644 (file)
@@ -482,22 +482,32 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
                 p_current->p_meta->i_status |= ITEM_PREPARSED;
                 var_SetInteger( p_playlist, "item-change", p_current->i_id );
             }
-            vlc_gc_decref( p_current );
-            /* Add to secondary preparse queue */
-            PL_LOCK
-            vlc_mutex_lock( &p_playlist->p_secondary_preparse->object_lock );
-            INSERT_ELEM( p_playlist->p_secondary_preparse->pp_waiting,
-                         p_playlist->p_secondary_preparse->i_waiting,
-                         p_playlist->p_secondary_preparse->i_waiting,
-                         p_current );
-            vlc_gc_incref( p_current );
-            vlc_mutex_unlock( &p_playlist->p_secondary_preparse->object_lock );
-            PL_UNLOCK
+            PL_LOCK;
+            /* We haven't retrieved enough meta, add to secondary queue
+             * which will run the "meta fetchers"
+             * TODO: - use i_mandatory stuff here instead of hardcoded T/A
+             *       - don't do this for things we won't get meta for, like
+             *         videos
+             */
+            if( !(p_current->p_meta->psz_title && *p_current->p_meta->psz_title
+                && p_current->p_meta->psz_artist &&
+                   *p_current->p_meta->psz_artist) )
+            {
+                vlc_mutex_lock( &p_playlist->p_secondary_preparse->object_lock);
+                INSERT_ELEM( p_playlist->p_secondary_preparse->pp_waiting,
+                             p_playlist->p_secondary_preparse->i_waiting,
+                             p_playlist->p_secondary_preparse->i_waiting,
+                             p_current );
+                vlc_mutex_unlock(
+                            &p_playlist->p_secondary_preparse->object_lock);
+            }
+            else
+                vlc_gc_decref( p_current );
+            PL_UNLOCK;
         }
         else
-        {
-            vlc_mutex_unlock( &p_playlist->object_lock );
-        }
+            PL_UNLOCK;
+
         vlc_mutex_lock( &p_obj->object_lock );
         i_activity = var_GetInteger( p_playlist, "activity" );
         if( i_activity < 0 ) i_activity = 0;