typedef struct services_discovery_sys_t services_discovery_sys_t;
typedef struct playlist_add_t playlist_add_t;
typedef struct playlist_preparse_t playlist_preparse_t;
-typedef struct playlist_secondary_preparse_t playlist_secondary_preparse_t;
+typedef struct playlist_fetcher_t playlist_fetcher_t;
/* Modules */
typedef struct module_bank_t module_bank_t;
#define FREENULL(a) if( a ) { free( a ); a = NULL; }
#define FREE(a) if( a ) { free( a ); }
+#define EMPTY_STR(str) (!str || !*str)
+
#include <vlc_arrays.h>
/* MSB (big endian)/LSB (little endian) conversions - network order is always
VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) );
VLC_EXPORT( void, input_DestroyThread, ( input_thread_t * ) );
+typedef struct playlist_album_t
+{
+ char *psz_artist;
+ char *psz_album;
+ vlc_bool_t b_found;
+} playlist_album_t;
int input_MetaFetch ( playlist_t *, input_item_t * );
-int input_ArtFetch ( playlist_t *, input_item_t * );
+int input_ArtFind ( playlist_t *, input_item_t * );
vlc_bool_t input_MetaSatisfied ( playlist_t*, input_item_t*,
- uint32_t*, uint32_t*, vlc_bool_t );
+ uint32_t*, uint32_t* );
int input_DownloadAndCacheArt ( playlist_t *, input_item_t * );
enum input_query_e
#define ITEM_META_FETCHED 0x02
#define ITEM_ARTURL_FETCHED 0x04
#define ITEM_ART_FETCHED 0x08
+#define ITEM_ART_NOTFOUND 0x10
struct vlc_meta_t
{
ALBUM_ART_NEVER,
ALBUM_ART_WHEN_ASKED,
ALBUM_ART_WHEN_PLAYED,
- ALBUM_ART_ALL };
+ ALBUM_ART_ALL
+};
struct meta_export_t
{
mtime_t gc_date;
vlc_bool_t b_cant_sleep;
playlist_preparse_t *p_preparse; /**< Preparser object */
- playlist_secondary_preparse_t *p_secondary_preparse;/**< Preparser object */
+ playlist_fetcher_t *p_fetcher;/**< Meta and art fetcher object */
vlc_mutex_t gc_lock; /**< Lock to protect the garbage collection */
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{
+ /* Configuration */
settings = new QSettings( "VideoLAN", "VLC" );
settings->beginGroup( "MainWindow" );
- setAcceptDrops(true);
-
need_components_update = false;
bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
embeddedPlaylistWasActive = videoIsActive = false;
- /* Fetch configuration from settings and vlc config */
videoEmbeddedFlag = false;
- if( config_GetInt( p_intf, "embedded-video" ) )
- videoEmbeddedFlag = true;
+ if( config_GetInt( p_intf, "embedded-video" ) ) videoEmbeddedFlag = true;
alwaysVideoFlag = false;
if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ))
alwaysVideoFlag = true;
- playlistEmbeddedFlag = settings->value( "playlist-embedded", true ).
- toBool();
+ playlistEmbeddedFlag = settings->value("playlist-embedded", true).toBool();
advControlsEnabled= settings->value( "adv-controls", false ).toBool();
visualSelectorEnabled= settings->value( "visual-selector", false ).toBool();
+ /* UI */
setWindowTitle( QString::fromUtf8( _("VLC media player") ) );
handleMainUi( settings );
-
QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag,
advControlsEnabled, visualSelectorEnabled );
-
- /* Status bar */
timeLabel = new QLabel( 0 );
nameLabel = new QLabel( 0 );
statusBar()->addWidget( nameLabel, 4 );
statusBar()->addPermanentWidget( timeLabel, 1 );
setFocusPolicy( Qt::StrongFocus );
+ setAcceptDrops(true);
/* Init input manager */
MainInputManager::getInstance( p_intf );
p_intf->b_interaction = VLC_TRUE;
}
-void MainInterface::dropEvent(QDropEvent *event)
-{
- const QMimeData *mimeData = event->mimeData();
-
- /* D&D of a subtitles file, add it on the fly */
- if( mimeData->urls().size() == 1 )
- {
- if( THEMIM->getIM()->hasInput() )
- {
- if( input_AddSubtitles( THEMIM->getInput(),
- qtu( mimeData->urls()[0].toString() ),
- VLC_TRUE ) )
- {
- event->acceptProposedAction();
- return;
- }
- }
- }
- bool first = true;
- foreach( QUrl url, mimeData->urls() ) {
- QString s = url.toString();
- if( s.length() > 0 ) {
- playlist_PlaylistAdd( THEPL, qtu(s), NULL,
- PLAYLIST_APPEND | (first ? PLAYLIST_GO:0),
- PLAYLIST_END );
- first = false;
- }
- }
- event->acceptProposedAction();
-}
-void MainInterface::dragEnterEvent(QDragEnterEvent *event)
-{
- event->acceptProposedAction();
-}
-void MainInterface::dragMoveEvent(QDragMoveEvent *event)
-{
- event->acceptProposedAction();
-}
-void MainInterface::dragLeaveEvent(QDragLeaveEvent *event)
-{
- event->accept();
-}
-
-
-
MainInterface::~MainInterface()
{
settings->setValue( "playlist-embedded", playlistEmbeddedFlag );
{
unsigned int i_width = va_arg( args, unsigned int );
unsigned int i_height = va_arg( args, unsigned int );
-// if( !i_width && p_vout ) i_width = p_vout->i_window_width;
-// if( !i_height && p_vout ) i_height = p_vout->i_window_height;
videoWidget->widgetSize = QSize( i_width, i_height );
videoWidget->updateGeometry();
need_components_update = true;
QSize( 650, 310 ) ).toSize();
playlistWidget->hide();
}
- /// Todo, reset its size ?
- if( VISIBLE( playlistWidget) )
+ if( VISIBLE( playlistWidget ) )
{
playlistWidget->hide();
if( videoIsActive )
}
}
+
+/************************************************************************
+ * D&D
+ ************************************************************************/
+void MainInterface::dropEvent(QDropEvent *event)
+{
+ const QMimeData *mimeData = event->mimeData();
+
+ /* D&D of a subtitles file, add it on the fly */
+ if( mimeData->urls().size() == 1 )
+ {
+ if( THEMIM->getIM()->hasInput() )
+ {
+ if( input_AddSubtitles( THEMIM->getInput(),
+ qtu( mimeData->urls()[0].toString() ),
+ VLC_TRUE ) )
+ {
+ event->acceptProposedAction();
+ return;
+ }
+ }
+ }
+ bool first = true;
+ foreach( QUrl url, mimeData->urls() ) {
+ QString s = url.toString();
+ if( s.length() > 0 ) {
+ playlist_PlaylistAdd( THEPL, qtu(s), NULL,
+ PLAYLIST_APPEND | (first ? PLAYLIST_GO:0),
+ PLAYLIST_END );
+ first = false;
+ }
+ }
+ event->acceptProposedAction();
+}
+void MainInterface::dragEnterEvent(QDragEnterEvent *event)
+{
+ event->acceptProposedAction();
+}
+void MainInterface::dragMoveEvent(QDragMoveEvent *event)
+{
+ event->acceptProposedAction();
+}
+void MainInterface::dragLeaveEvent(QDragLeaveEvent *event)
+{
+ event->accept();
+}
+
/************************************************************************
* Other stuff
************************************************************************/
#include <vlc_meta.h>
#include "vlc_playlist.h"
#include "charset.h"
+#include "../playlist/playlist_internal.h"
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
int input_FindArtInCache( playlist_t *p_playlist, input_item_t *p_item );
vlc_bool_t input_MetaSatisfied( playlist_t *p_playlist, input_item_t *p_item,
- uint32_t *pi_mandatory, uint32_t *pi_optional,
- vlc_bool_t b_check_cache )
+ uint32_t *pi_mandatory, uint32_t *pi_optional )
{
- // FIXME don't var_Stuff at each loop
- int i_policy = var_CreateGetInteger( p_playlist, "album-art" );
- if( b_check_cache )
- input_FindArtInCache( p_playlist, p_item );
-
- *pi_mandatory = VLC_META_ENGINE_TITLE | VLC_META_ENGINE_ARTIST |
- (i_policy == ALBUM_ART_ALL ? VLC_META_ENGINE_ART_URL : 0 );
+ *pi_mandatory = VLC_META_ENGINE_TITLE | VLC_META_ENGINE_ARTIST;
uint32_t i_meta = input_CurrentMetaFlags( p_item->p_meta );
*pi_mandatory &= ~i_meta;
if( !p_item->p_meta ) return VLC_EGENERIC;
- input_MetaSatisfied( p_playlist, p_item,
- &i_mandatory, &i_optional, VLC_FALSE );
-
+ input_MetaSatisfied( p_playlist, p_item, &i_mandatory, &i_optional );
// Meta shouldn't magically appear
assert( i_mandatory );
+ /* FIXME: object creation is overkill, use p_private */
p_me = vlc_object_create( p_playlist, VLC_OBJECT_META_ENGINE );
p_me->i_flags |= OBJECT_FLAGS_NOINTERACT;
p_me->i_flags |= OBJECT_FLAGS_QUIET;
vlc_object_destroy( p_me );
return VLC_EGENERIC;
}
-
module_Unneed( p_me, p_me->p_module );
vlc_object_destroy( p_me );
-
return VLC_SUCCESS;
}
-int input_ArtFetch( playlist_t *p_playlist, input_item_t *p_item )
+/* Return codes:
+ * 0 : Art is in cache
+ * 1 : Art found, need to download
+ * -X : Error/not found
+ */
+int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
{
- if( !p_item->p_meta ) return VLC_EGENERIC;
+ int i_ret = VLC_EGENERIC;
+ module_t *p_module;
+ if( !p_item->p_meta || !p_item->p_meta->psz_album ||
+ !p_item->p_meta->psz_artist )
+ return VLC_EGENERIC;
- if( !p_item->p_meta->psz_arturl || !*p_item->p_meta->psz_arturl )
- {
- module_t *p_module;
- PL_LOCK;
- p_playlist->p_private = p_item;
- p_module = module_Need( p_playlist, "art finder", 0, VLC_FALSE );
- if( !p_module )
+ /* If we already checked this album in this session, skip */
+ FOREACH_ARRAY( playlist_album_t album, p_playlist->p_fetcher->albums )
+ if( !strcmp( album.psz_artist, p_item->p_meta->psz_artist ) &&
+ !strcmp( album.psz_album, p_item->p_meta->psz_album ) )
{
- msg_Dbg( p_playlist, "unable to find art" );
- PL_UNLOCK;
- return VLC_EGENERIC;
+ msg_Dbg( p_playlist, " %s - %s has already been searched",
+ p_item->p_meta->psz_artist, p_item->p_meta->psz_album );
+ if( album.b_found )
+ {
+ /* Actually get URL from cache */
+ input_FindArtInCache( p_playlist, p_item );
+ return 0;
+ }
+ else
+ return VLC_EGENERIC;
}
+ FOREACH_END();
+
+ input_FindArtInCache( p_playlist, p_item );
+ if( !EMPTY_STR( p_item->p_meta->psz_arturl ) )
+ return 0;
+
+ PL_LOCK;
+ p_playlist->p_private = p_item;
+ msg_Dbg( p_playlist, "searching art for %s - %s",
+ p_item->p_meta->psz_artist, p_item->p_meta->psz_album );
+ p_module = module_Need( p_playlist, "art finder", 0, VLC_FALSE );
+
+ if( p_module )
+ i_ret = 1;
+ else
+ msg_Dbg( p_playlist, "unable to find art" );
+
+ /* Record this album */
+ playlist_album_t a;
+ a.psz_artist = strdup( p_item->p_meta->psz_artist );
+ a.psz_album = strdup( p_item->p_meta->psz_album );
+ a.b_found = (i_ret == VLC_EGENERIC ? VLC_FALSE : VLC_TRUE );
+ ARRAY_APPEND( p_playlist->p_fetcher->albums, a );
+
+ if( p_module )
module_Unneed( p_playlist, p_module );
- p_playlist->p_private = NULL;
- PL_UNLOCK;
+ p_playlist->p_private = NULL;
+ PL_UNLOCK;
- if( !p_item->p_meta->psz_arturl || !*p_item->p_meta->psz_arturl )
- return VLC_EGENERIC;
- }
- return input_DownloadAndCacheArt( p_playlist, p_item );
+ return i_ret;
}
#ifndef MAX_PATH
{
char *psz_artist;
char *psz_album;
- char psz_filename[MAX_PATH];
+ char psz_filename[MAX_PATH+1];
int i;
struct stat a;
const char *ppsz_type[] = { ".jpg", ".png", ".gif", ".bmp", "" };
return VLC_SUCCESS;
}
}
-
return VLC_EGENERIC;
}
{
int i_status = VLC_EGENERIC;
stream_t *p_stream;
- char psz_filename[MAX_PATH], psz_dir[MAX_PATH];
+ char psz_filename[MAX_PATH+1], psz_dir[MAX_PATH+1];
char *psz_artist;
char *psz_album;
char *psz_type;
psz_artist = p_item->p_meta->psz_artist;
psz_album = p_item->p_meta->psz_album;
- /* You dummy ! How am I supposed to download NULL ? */
- if( !p_item->p_meta || !p_item->p_meta->psz_arturl
- || !*p_item->p_meta->psz_arturl )
- return VLC_EGENERIC;
+ assert( p_item->p_meta && !EMPTY_STR(p_item->p_meta->psz_arturl) );
/* FIXME: use an alternate saving filename scheme if we don't have
* the artist or album name */
- if( !p_item->p_meta->psz_artist
- || !p_item->p_meta->psz_album )
+ if( !p_item->p_meta->psz_artist || !p_item->p_meta->psz_album )
return VLC_EGENERIC;
- /* Check if file doesn't already exist */
- if( input_FindArtInCache( p_playlist, p_item ) == VLC_SUCCESS )
- return VLC_SUCCESS;
-
psz_type = strrchr( p_item->p_meta->psz_arturl, '.' );
/* Todo: get a helper to do this */
psz_artist, psz_album );
utf8_mkdir( psz_dir );
- /* Todo: check for stuff that needs a downloader module */
- p_stream = stream_UrlNew( p_playlist, p_item->p_meta->psz_arturl );
+ if( !strncmp( p_item->p_meta->psz_arturl , "APIC", 4 ) )
+ {
+ msg_Warn( p_playlist, "APIC fetch not supported yet" );
+ return VLC_EGENERIC;
+ }
+ p_stream = stream_UrlNew( p_playlist, p_item->p_meta->psz_arturl );
if( p_stream )
{
void *p_buffer = malloc( 1<<16 );
CHECK( title, TITLE )
CHECK( artist, ARTIST )
+ CHECK( album, COLLECTION )
+#if 0
+ /* As this is not used at the moment, don't uselessly check for it.
+ * Re-enable this when it is used */
CHECK( genre, GENRE )
CHECK( copyright, COPYRIGHT )
- CHECK( album, COLLECTION )
CHECK( tracknum, SEQ_NUM )
CHECK( description, DESCRIPTION )
CHECK( rating, RATING )
CHECK( date, DATE )
CHECK( url, URL )
CHECK( language, LANGUAGE )
+#endif
CHECK( arturl, ART_URL )
return i_meta;
{
int i_bom_size = 0;
char *psz_encoding = NULL;
-
+
if( p_data[0] == 0xEF && p_data[1] == 0xBB && p_data[2] == 0xBF )
{
psz_encoding = strdup( "UTF-8" );
p.p_item = p_item;
p.b_fetch_art = VLC_TRUE;
- vlc_mutex_lock( &p_playlist->p_secondary_preparse->object_lock );
- for( i = 0; i < p_playlist->p_secondary_preparse->i_waiting &&
- p_playlist->p_secondary_preparse->p_waiting->b_fetch_art == VLC_TRUE;
+ vlc_mutex_lock( &p_playlist->p_fetcher->object_lock );
+ for( i = 0; i < p_playlist->p_fetcher->i_waiting &&
+ p_playlist->p_fetcher->p_waiting->b_fetch_art == VLC_TRUE;
i++ );
vlc_gc_incref( p_item );
- INSERT_ELEM( p_playlist->p_secondary_preparse->p_waiting,
- p_playlist->p_secondary_preparse->i_waiting,
+ INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
+ p_playlist->p_fetcher->i_waiting,
i, p );
- vlc_mutex_unlock( &p_playlist->p_secondary_preparse->object_lock );
- vlc_cond_signal( &p_playlist->p_secondary_preparse->object_wait );
+ vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
+ vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
return VLC_SUCCESS;
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc/sout.h>
playlist_MLDump( p_playlist );
vlc_thread_join( p_playlist->p_preparse );
- vlc_thread_join( p_playlist->p_secondary_preparse );
+ vlc_thread_join( p_playlist->p_fetcher );
vlc_thread_join( p_playlist );
vlc_object_detach( p_playlist->p_preparse );
- vlc_object_detach( p_playlist->p_secondary_preparse );
+ vlc_object_detach( p_playlist->p_fetcher );
var_Destroy( p_playlist, "intf-change" );
var_Destroy( p_playlist, "item-change" );
vlc_mutex_destroy( &p_playlist->gc_lock );
vlc_object_destroy( p_playlist->p_preparse );
- vlc_object_destroy( p_playlist->p_secondary_preparse );
+ vlc_object_destroy( p_playlist->p_fetcher );
vlc_object_detach( p_playlist );
vlc_object_destroy( p_playlist );
PL_LOCK;
/* If we haven't retrieved enough meta, add to secondary queue
- * which will run the "meta fetchers"
- * TODO:
- * don't do this for things we won't get meta for, like
- * videos
+ * which will run the "meta fetchers".
+ * This only checks for meta, not for art
+ * \todo don't do this for things we won't get meta for, like vids
*/
- if( !input_MetaSatisfied( p_playlist, p_current, &i_m, &i_o,
- VLC_TRUE ) )
+ if( !input_MetaSatisfied( p_playlist, p_current, &i_m, &i_o ) )
{
preparse_item_t p;
+ PL_DEBUG("need to fetch meta for %s", p_current->psz_name );
p.p_item = p_current;
p.b_fetch_art = VLC_FALSE;
- vlc_mutex_lock( &p_playlist->p_secondary_preparse->object_lock);
- INSERT_ELEM( p_playlist->p_secondary_preparse->p_waiting,
- p_playlist->p_secondary_preparse->i_waiting,
- p_playlist->p_secondary_preparse->i_waiting,
+ vlc_mutex_lock( &p_playlist->p_fetcher->object_lock );
+ INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
+ p_playlist->p_fetcher->i_waiting,
+ p_playlist->p_fetcher->i_waiting,
+ p );
+ vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
+ vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
+ }
+ /* We already have all needed meta, but we need art right now */
+ else if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
+ EMPTY_STR( p_current->p_meta->psz_arturl ) )
+ {
+ preparse_item_t p;
+ PL_DEBUG("meta ok for %s, need to fetch art",
+ p_current->psz_name );
+ p.p_item = p_current;
+ p.b_fetch_art = VLC_TRUE;
+ vlc_mutex_lock( &p_playlist->p_fetcher->object_lock );
+ INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
+ p_playlist->p_fetcher->i_waiting,
+ p_playlist->p_fetcher->i_waiting,
p );
- vlc_mutex_unlock(
- &p_playlist->p_secondary_preparse->object_lock);
- vlc_cond_signal(
- &p_playlist->p_secondary_preparse->object_wait );
+ vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
+ vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
}
else
+ {
+ PL_DEBUG( "no fetch required for %s (art currently %s)",
+ p_current->psz_name, p_current->p_meta->psz_arturl );
vlc_gc_decref( p_current );
+ }
PL_UNLOCK;
}
else
}
/** Main loop for secondary preparser queue */
-void playlist_SecondaryPreparseLoop( playlist_secondary_preparse_t *p_obj )
+void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
{
playlist_t *p_playlist = (playlist_t *)p_obj->p_parent;
vlc_bool_t b_fetch_art;
p_item->p_meta->i_status |= ITEM_META_FETCHED;
var_SetInteger( p_playlist, "item-change", p_item->i_id );
/* Fetch right now */
- if( var_GetInteger( p_playlist, "album-art" ) == ALBUM_ART_ALL )
+ if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL )
{
vlc_mutex_lock( &p_obj->object_lock );
preparse_item_t p;
p.p_item = p_item;
p.b_fetch_art = VLC_TRUE;
- INSERT_ELEM( p_playlist->p_secondary_preparse->p_waiting,
- p_playlist->p_secondary_preparse->i_waiting,
+ INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
+ p_playlist->p_fetcher->i_waiting,
0, p );
+ PL_DEBUG("meta fetched for %s, get art", p_item->psz_name);
vlc_mutex_unlock( &p_obj->object_lock );
+ continue;
}
else
vlc_gc_decref( p_item );
}
else
{
- input_ArtFetch( p_playlist, p_item );
- p_item->p_meta->i_status |= ITEM_ART_FETCHED;
+ int i_ret = input_ArtFind( p_playlist, p_item );
+ if( i_ret == 1 )
+ {
+ PL_DEBUG("downloading art for %s", p_item->psz_name );
+ if( !input_DownloadAndCacheArt( p_playlist, p_item ) )
+ p_item->p_meta->i_status |= ITEM_ART_NOTFOUND;
+ else
+ p_item->p_meta->i_status |= ITEM_ART_FETCHED;
+ }
+ else if( i_ret == 0 ) /* Was in cache */
+ {
+ PL_DEBUG("found art for %s in cache", p_item->psz_name );
+ p_item->p_meta->i_status |= ITEM_ART_FETCHED;
+ }
+ else
+ {
+ PL_DEBUG("art not found for %s", p_item->psz_name );
+ p_item->p_meta->i_status |= ITEM_ART_NOTFOUND;
+ }
vlc_gc_decref( p_item );
}
}
vlc_bool_t b_fetch_art;
} preparse_item_t;
-struct playlist_secondary_preparse_t
+struct playlist_fetcher_t
{
VLC_COMMON_MEMBERS
vlc_mutex_t lock;
+ int i_art_policy;
int i_waiting;
preparse_item_t *p_waiting;
+
+ DECL_ARRAY(playlist_album_t) albums;
};
/*****************************************************************************
void playlist_MainLoop( playlist_t * );
void playlist_LastLoop( playlist_t * );
void playlist_PreparseLoop( playlist_preparse_t * );
-void playlist_SecondaryPreparseLoop( playlist_secondary_preparse_t * );
+void playlist_FetcherLoop( playlist_fetcher_t * );
void ResetCurrentlyPlaying( playlist_t *, vlc_bool_t, playlist_item_t * );
* @}
*/
-//#define PLAYLIST_DEBUG 1
-#undef PLAYLIST_DEBUG
+#define PLAYLIST_DEBUG 1
+//#undef PLAYLIST_DEBUG
#ifdef PLAYLIST_DEBUG
#define PL_DEBUG( msg, args... ) msg_Dbg( p_playlist, msg, ## args )
*****************************************************************************/
static void RunControlThread ( playlist_t * );
static void RunPreparse( playlist_preparse_t * );
-static void RunSecondaryPreparse( playlist_secondary_preparse_t * );
+static void RunFetcher( playlist_fetcher_t * );
static playlist_t * CreatePlaylist( vlc_object_t *p_parent );
static void EndPlaylist( playlist_t * );
}
// Secondary Preparse
- p_playlist->p_secondary_preparse = vlc_object_create( p_playlist,
- sizeof( playlist_secondary_preparse_t ) );
- if( !p_playlist->p_secondary_preparse )
+ p_playlist->p_fetcher = vlc_object_create( p_playlist,
+ sizeof( playlist_fetcher_t ) );
+ if( !p_playlist->p_fetcher )
{
msg_Err( p_playlist, "unable to create secondary preparser" );
vlc_object_destroy( p_playlist );
return;
}
- p_playlist->p_secondary_preparse->i_waiting = 0;
- p_playlist->p_secondary_preparse->p_waiting = NULL;
-
- vlc_object_attach( p_playlist->p_secondary_preparse, p_playlist );
- if( vlc_thread_create( p_playlist->p_secondary_preparse,
- "secondary preparser",
- RunSecondaryPreparse,
+ p_playlist->p_fetcher->i_waiting = 0;
+ p_playlist->p_fetcher->p_waiting = NULL;
+ p_playlist->p_fetcher->i_art_policy = var_CreateGetInteger( p_playlist,
+ "album-art" );
+
+ vlc_object_attach( p_playlist->p_fetcher, p_playlist );
+ if( vlc_thread_create( p_playlist->p_fetcher,
+ "fetcher",
+ RunFetcher,
VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
{
msg_Err( p_playlist, "cannot spawn secondary preparse thread" );
- vlc_object_detach( p_playlist->p_secondary_preparse );
- vlc_object_destroy( p_playlist->p_secondary_preparse );
+ vlc_object_detach( p_playlist->p_fetcher );
+ vlc_object_destroy( p_playlist->p_fetcher );
return;
}
vlc_cond_signal( &p_playlist->p_preparse->object_wait );
free( p_playlist->p_preparse->pp_waiting );
}
- if( p_playlist->p_secondary_preparse )
+ if( p_playlist->p_fetcher )
{
- vlc_cond_signal( &p_playlist->p_secondary_preparse->object_wait );
- free( p_playlist->p_secondary_preparse->p_waiting );
+ vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
+ free( p_playlist->p_fetcher->p_waiting );
}
DestroyInteraction( p_playlist );
playlist_PreparseLoop( p_obj );
}
-static void RunSecondaryPreparse( playlist_secondary_preparse_t *p_obj )
+static void RunFetcher( playlist_fetcher_t *p_obj )
{
/* Tell above that we're ready */
vlc_thread_ready( p_obj );
- playlist_SecondaryPreparseLoop( p_obj );
+ playlist_FetcherLoop( p_obj );
}
/*****************************************************************************