Commit 408a016e authored by Clément Stenac's avatar Clément Stenac

Start splitting the various meta module types

* 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
parent 71e7084e
...@@ -53,7 +53,7 @@ vlc_module_begin(); ...@@ -53,7 +53,7 @@ vlc_module_begin();
set_shortname( N_( "Dummy" ) ); set_shortname( N_( "Dummy" ) );
set_description( _("Dummy meta data") ); set_description( _("Dummy meta data") );
set_capability( "meta engine", 1000 ); set_capability( "meta engine", 0 );
set_callbacks( FindMeta, NULL ); set_callbacks( FindMeta, NULL );
vlc_module_end(); vlc_module_end();
......
...@@ -56,7 +56,7 @@ vlc_module_begin(); ...@@ -56,7 +56,7 @@ vlc_module_begin();
set_shortname( N_( "Folder" ) ); set_shortname( N_( "Folder" ) );
set_description( _("Folder meta data") ); set_description( _("Folder meta data") );
set_capability( "meta engine", 10 ); set_capability( "art finder", 10 );
set_callbacks( FindMeta, NULL ); set_callbacks( FindMeta, NULL );
vlc_module_end(); vlc_module_end();
......
...@@ -48,7 +48,7 @@ vlc_module_begin(); ...@@ -48,7 +48,7 @@ vlc_module_begin();
set_shortname( N_( "MusicBrainz" ) ); set_shortname( N_( "MusicBrainz" ) );
set_description( _("MusicBrainz meta data") ); set_description( _("MusicBrainz meta data") );
set_capability( "meta engine", 80 ); set_capability( "meta fetcher", 80 );
set_callbacks( FindMeta, NULL ); set_callbacks( FindMeta, NULL );
vlc_module_end(); vlc_module_end();
......
...@@ -113,7 +113,6 @@ static int ReadMeta( vlc_object_t *p_this ) ...@@ -113,7 +113,6 @@ static int ReadMeta( vlc_object_t *p_this )
static int WriteMeta( vlc_object_t *p_this ) static int WriteMeta( vlc_object_t *p_this )
{ {
playlist_t *p_playlist = (playlist_t *)p_this; playlist_t *p_playlist = (playlist_t *)p_this;
meta_export_t *p_export = (meta_export_t *)p_playlist->p_private; meta_export_t *p_export = (meta_export_t *)p_playlist->p_private;
input_item_t *p_item = p_export->p_item; input_item_t *p_item = p_export->p_item;
......
...@@ -362,6 +362,7 @@ int __input_SecondaryPreparse( vlc_object_t *p_parent, input_item_t *p_item ) ...@@ -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 p_me->i_mandatory = VLC_META_ENGINE_TITLE
| VLC_META_ENGINE_ARTIST; | VLC_META_ENGINE_ARTIST;
p_me->i_optional = 0; p_me->i_optional = 0;
/*
if( var_CreateGetInteger( p_parent, "album-art" ) != ALBUM_ART_NEVER ) if( var_CreateGetInteger( p_parent, "album-art" ) != ALBUM_ART_NEVER )
{ {
p_me->i_mandatory |= VLC_META_ENGINE_ART_URL; 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 ) ...@@ -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->i_optional |= VLC_META_ENGINE_ART_URL;
} }
*/
p_me->p_item = p_item; 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 ) if( !p_me->p_module )
{ {
msg_Err( p_parent, "no suitable meta engine module" ); msg_Err( p_parent, "no suitable meta engine module" );
......
...@@ -482,22 +482,32 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj ) ...@@ -482,22 +482,32 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
p_current->p_meta->i_status |= ITEM_PREPARSED; p_current->p_meta->i_status |= ITEM_PREPARSED;
var_SetInteger( p_playlist, "item-change", p_current->i_id ); var_SetInteger( p_playlist, "item-change", p_current->i_id );
} }
vlc_gc_decref( p_current ); PL_LOCK;
/* Add to secondary preparse queue */ /* We haven't retrieved enough meta, add to secondary queue
PL_LOCK * which will run the "meta fetchers"
vlc_mutex_lock( &p_playlist->p_secondary_preparse->object_lock ); * TODO: - use i_mandatory stuff here instead of hardcoded T/A
INSERT_ELEM( p_playlist->p_secondary_preparse->pp_waiting, * - don't do this for things we won't get meta for, like
p_playlist->p_secondary_preparse->i_waiting, * videos
p_playlist->p_secondary_preparse->i_waiting, */
p_current ); if( !(p_current->p_meta->psz_title && *p_current->p_meta->psz_title
vlc_gc_incref( p_current ); && p_current->p_meta->psz_artist &&
vlc_mutex_unlock( &p_playlist->p_secondary_preparse->object_lock ); *p_current->p_meta->psz_artist) )
PL_UNLOCK {
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 else
{ PL_UNLOCK;
vlc_mutex_unlock( &p_playlist->object_lock );
}
vlc_mutex_lock( &p_obj->object_lock ); vlc_mutex_lock( &p_obj->object_lock );
i_activity = var_GetInteger( p_playlist, "activity" ); i_activity = var_GetInteger( p_playlist, "activity" );
if( i_activity < 0 ) i_activity = 0; if( i_activity < 0 ) i_activity = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment