typedef enum
{ PLAYLIST_STOPPED,PLAYLIST_RUNNING,PLAYLIST_PAUSED } playlist_status_t;
+typedef struct playlist_private_t playlist_private_t;
+
/** Structure containing information about the playlist */
struct playlist_t
{
int i_order; /**< Last ordering applied to the playlist */
mtime_t gc_date;
bool b_cant_sleep;
- playlist_preparse_t *p_preparse; /**< Preparser object */
- playlist_fetcher_t *p_fetcher;/**< Meta and art fetcher object */
struct {
/* Current status. These fields are readonly, only the playlist
when processing the request */
vlc_mutex_t lock; /**< Lock to protect request */
} request;
+
+ /* All other data is PRIVATE. You can't access it
+ * outside of src/input */
+ playlist_private_t *p;
};
/** Helper to add an item */
/* If we already checked this album in this session, skip */
if( psz_artist && psz_album )
{
- FOREACH_ARRAY( playlist_album_t album, p_playlist->p_fetcher->albums )
+ FOREACH_ARRAY( playlist_album_t album, p_playlist->p->p_fetcher->albums )
if( !strcmp( album.psz_artist, psz_artist ) &&
!strcmp( album.psz_album, psz_album ) )
{
a.psz_album = psz_album;
a.psz_arturl = input_item_GetArtURL( p_item );
a.b_found = (i_ret == VLC_EGENERIC ? false : true );
- ARRAY_APPEND( p_playlist->p_fetcher->albums, a );
+ ARRAY_APPEND( p_playlist->p->p_fetcher->albums, a );
}
else
{
int playlist_PreparseEnqueue( playlist_t *p_playlist,
input_item_t *p_item )
{
- vlc_object_lock( p_playlist->p_preparse );
- if( !vlc_object_alive( p_playlist->p_preparse ) )
+ vlc_object_lock( p_playlist->p->p_preparse );
+ if( !vlc_object_alive( p_playlist->p->p_preparse ) )
{
- vlc_object_unlock( p_playlist->p_preparse );
+ vlc_object_unlock( p_playlist->p->p_preparse );
return VLC_EGENERIC;
}
vlc_gc_incref( p_item );
- INSERT_ELEM( p_playlist->p_preparse->pp_waiting,
- p_playlist->p_preparse->i_waiting,
- p_playlist->p_preparse->i_waiting,
+ INSERT_ELEM( p_playlist->p->p_preparse->pp_waiting,
+ p_playlist->p->p_preparse->i_waiting,
+ p_playlist->p->p_preparse->i_waiting,
p_item );
- vlc_object_signal_unlocked( p_playlist->p_preparse );
- vlc_object_unlock( p_playlist->p_preparse );
+ vlc_object_signal_unlocked( p_playlist->p->p_preparse );
+ vlc_object_unlock( p_playlist->p->p_preparse );
return VLC_SUCCESS;
}
playlist_item_t *p_item )
{
vlc_object_lock( p_playlist );
- vlc_object_lock( p_playlist->p_preparse );
- if( !vlc_object_alive( p_playlist->p_preparse ) )
+ vlc_object_lock( p_playlist->p->p_preparse );
+ if( !vlc_object_alive( p_playlist->p->p_preparse ) )
{
- vlc_object_unlock( p_playlist->p_preparse );
+ vlc_object_unlock( p_playlist->p->p_preparse );
vlc_object_unlock( p_playlist );
return VLC_EGENERIC;
}
PreparseEnqueueItemSub( p_playlist, p_item );
- vlc_object_unlock( p_playlist->p_preparse );
+ vlc_object_unlock( p_playlist->p->p_preparse );
vlc_object_unlock( p_playlist );
return VLC_SUCCESS;
}
int playlist_AskForArtEnqueue( playlist_t *p_playlist,
input_item_t *p_item )
{
- vlc_object_lock( p_playlist->p_fetcher );
- if( !vlc_object_alive( p_playlist->p_fetcher ) )
+ vlc_object_lock( p_playlist->p->p_fetcher );
+ if( !vlc_object_alive( p_playlist->p->p_fetcher ) )
{
- vlc_object_unlock( p_playlist->p_fetcher );
+ vlc_object_unlock( p_playlist->p->p_fetcher );
return VLC_EGENERIC;
}
vlc_gc_incref( p_item );
- INSERT_ELEM( p_playlist->p_fetcher->pp_waiting,
- p_playlist->p_fetcher->i_waiting,
- p_playlist->p_fetcher->i_waiting, p_item );
- vlc_object_signal_unlocked( p_playlist->p_fetcher );
- vlc_object_unlock( p_playlist->p_fetcher );
+ INSERT_ELEM( p_playlist->p->p_fetcher->pp_waiting,
+ p_playlist->p->p_fetcher->i_waiting,
+ p_playlist->p->p_fetcher->i_waiting, p_item );
+ vlc_object_signal_unlocked( p_playlist->p->p_fetcher );
+ vlc_object_unlock( p_playlist->p->p_fetcher );
return VLC_SUCCESS;
}
if( p_item->i_children == -1 )
{
vlc_gc_incref( p_item->p_input );
- INSERT_ELEM( p_playlist->p_preparse->pp_waiting,
- p_playlist->p_preparse->i_waiting,
- p_playlist->p_preparse->i_waiting,
+ INSERT_ELEM( p_playlist->p->p_preparse->pp_waiting,
+ p_playlist->p->p_preparse->i_waiting,
+ p_playlist->p->p_preparse->i_waiting,
p_item->p_input );
}
else
}
free( psz_uri );
- if( p_playlist->p_fetcher &&
- p_playlist->p_fetcher->i_art_policy == ALBUM_ART_WHEN_PLAYED )
+ if( p_playlist->p->p_fetcher &&
+ p_playlist->p->p_fetcher->i_art_policy == ALBUM_ART_WHEN_PLAYED )
{
bool b_has_art;
{
playlist_t * p_playlist = (playlist_t *)p_this;
- if( p_playlist->p_preparse )
+ if( p_playlist->p->p_preparse )
{
- vlc_object_release( p_playlist->p_preparse );
+ vlc_object_release( p_playlist->p->p_preparse );
}
- if( p_playlist->p_fetcher )
+ if( p_playlist->p->p_fetcher )
{
- vlc_object_release( p_playlist->p_fetcher );
+ vlc_object_release( p_playlist->p->p_fetcher );
}
msg_Dbg( p_this, "Destroyed" );
}
playlist_ServicesDiscoveryKillAll( p_playlist );
playlist_MLDump( p_playlist );
- vlc_object_kill( p_playlist->p_preparse );
- vlc_thread_join( p_playlist->p_preparse );
- vlc_object_kill( p_playlist->p_fetcher );
- vlc_thread_join( p_playlist->p_fetcher );
+ vlc_object_kill( p_playlist->p->p_preparse );
+ vlc_thread_join( p_playlist->p->p_preparse );
+ vlc_object_kill( p_playlist->p->p_fetcher );
+ vlc_thread_join( p_playlist->p->p_fetcher );
PL_LOCK;
*/
char *psz_arturl = input_item_GetArtURL( p_current );
char *psz_name = input_item_GetName( p_current );
- if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
+ if( p_playlist->p->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
( !psz_arturl || strncmp( psz_arturl, "file://", 7 ) ) )
{
PL_DEBUG("meta ok for %s, need to fetch art", psz_name );
- vlc_object_lock( p_playlist->p_fetcher );
- if( vlc_object_alive( p_playlist->p_fetcher ) )
+ vlc_object_lock( p_playlist->p->p_fetcher );
+ if( vlc_object_alive( p_playlist->p->p_fetcher ) )
{
- INSERT_ELEM( p_playlist->p_fetcher->pp_waiting,
- p_playlist->p_fetcher->i_waiting,
- p_playlist->p_fetcher->i_waiting, p_current);
- vlc_object_signal_unlocked( p_playlist->p_fetcher );
+ INSERT_ELEM( p_playlist->p->p_fetcher->pp_waiting,
+ p_playlist->p->p_fetcher->i_waiting,
+ p_playlist->p->p_fetcher->i_waiting, p_current);
+ vlc_object_signal_unlocked( p_playlist->p->p_fetcher );
}
else
vlc_gc_decref( p_current );
- vlc_object_unlock( p_playlist->p_fetcher );
+ vlc_object_unlock( p_playlist->p->p_fetcher );
}
else
{
#include "input/input_internal.h"
#include <assert.h>
+struct playlist_private_t
+{
+ playlist_preparse_t *p_preparse; /**< Preparser object */
+ playlist_fetcher_t *p_fetcher; /**< Meta and art fetcher object */
+};
+
struct playlist_preparse_t
{
VLC_COMMON_MEMBERS
// Preparse
static const char ppname[] = "preparser";
- p_playlist->p_preparse =
+ p_playlist->p->p_preparse =
vlc_custom_create( p_playlist, sizeof( playlist_preparse_t ),
VLC_OBJECT_GENERIC, ppname );
- if( !p_playlist->p_preparse )
+ if( !p_playlist->p->p_preparse )
{
msg_Err( p_playlist, "unable to create preparser" );
vlc_object_release( p_playlist );
return;
}
- p_playlist->p_preparse->psz_object_name = strdup( "preparser" );
- p_playlist->p_preparse->i_waiting = 0;
- p_playlist->p_preparse->pp_waiting = NULL;
+ p_playlist->p->p_preparse->psz_object_name = strdup( "preparser" );
+ p_playlist->p->p_preparse->i_waiting = 0;
+ p_playlist->p->p_preparse->pp_waiting = NULL;
- vlc_object_set_destructor( p_playlist->p_preparse, PreparseDestructor );
+ vlc_object_set_destructor( p_playlist->p->p_preparse, PreparseDestructor );
- vlc_object_attach( p_playlist->p_preparse, p_playlist );
- if( vlc_thread_create( p_playlist->p_preparse, "preparser",
+ vlc_object_attach( p_playlist->p->p_preparse, p_playlist );
+ if( vlc_thread_create( p_playlist->p->p_preparse, "preparser",
RunPreparse, VLC_THREAD_PRIORITY_LOW, true ) )
{
msg_Err( p_playlist, "cannot spawn preparse thread" );
- vlc_object_release( p_playlist->p_preparse );
+ vlc_object_release( p_playlist->p->p_preparse );
return;
}
// Secondary Preparse
static const char fname[] = "fetcher";
- p_playlist->p_fetcher =
+ p_playlist->p->p_fetcher =
vlc_custom_create( p_playlist, sizeof( playlist_fetcher_t ),
VLC_OBJECT_GENERIC, fname );
- if( !p_playlist->p_fetcher )
+ if( !p_playlist->p->p_fetcher )
{
msg_Err( p_playlist, "unable to create secondary preparser" );
vlc_object_release( p_playlist );
return;
}
- p_playlist->p_fetcher->psz_object_name = strdup( "fetcher" );
- p_playlist->p_fetcher->i_waiting = 0;
- p_playlist->p_fetcher->pp_waiting = NULL;
- p_playlist->p_fetcher->i_art_policy = var_CreateGetInteger( p_playlist,
+ p_playlist->p->p_fetcher->psz_object_name = strdup( "fetcher" );
+ p_playlist->p->p_fetcher->i_waiting = 0;
+ p_playlist->p->p_fetcher->pp_waiting = NULL;
+ p_playlist->p->p_fetcher->i_art_policy = var_CreateGetInteger( p_playlist,
"album-art" );
- vlc_object_set_destructor( p_playlist->p_fetcher, FetcherDestructor );
+ vlc_object_set_destructor( p_playlist->p->p_fetcher, FetcherDestructor );
- vlc_object_attach( p_playlist->p_fetcher, p_playlist );
- if( vlc_thread_create( p_playlist->p_fetcher,
+ vlc_object_attach( p_playlist->p->p_fetcher, p_playlist );
+ if( vlc_thread_create( p_playlist->p->p_fetcher,
"fetcher",
RunFetcher,
VLC_THREAD_PRIORITY_LOW, true ) )
{
msg_Err( p_playlist, "cannot spawn secondary preparse thread" );
- vlc_object_release( p_playlist->p_fetcher );
+ vlc_object_release( p_playlist->p->p_fetcher );
return;
}