Commit 82921f3c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove p_playlist from p_libvlc

Plugins are already using pl_Yield to get the playlist, as they should.
parent 3c74d129
/*****************************************************************************
* main.h: access to all program variables
* Declaration and extern access to global program object.
* Declaration and extern access to LibVLC instance object.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 the VideoLAN team
* $Id$
* Copyright (C) 1999, 2000, 2001, 2002, 2008 the VideoLAN team
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -40,8 +39,6 @@ struct libvlc_int_t
/* Global properties */
char * psz_homedir; ///< user's home directory
playlist_t *p_playlist; ///< playlist object
global_stats_t *p_stats; ///< Global statistics
......
......@@ -412,7 +412,7 @@ static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file)
#define playlist_IsEmpty( pl ) ( pl->items.i_size == 0 )
/** Tell the number of items in the current playing context */
#define playlist_CurrentSize( obj ) obj->p_libvlc->p_playlist->current.i_size
#define playlist_CurrentSize( pl ) pl->current.i_size
/** Ask the playlist to do some work */
#define playlist_Signal( p_playlist ) vlc_object_signal( p_playlist )
......
......@@ -120,7 +120,7 @@ static void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options,
gtk_list_store_set (GTK_LIST_STORE(p_play_model), &p_play_iter,
0, name, /* Add path to it !!! */
1, "no info",
2, playlist_CurrentSize(p_intf), /* Hidden index. */
2, playlist_CurrentSize(p_playlist), /* Hidden index. */
-1 );
/* Add to VLC's playlist */
......@@ -163,7 +163,7 @@ void PlaylistRebuildListStore( intf_thread_t *p_intf,
red.green = 0;
#endif
vlc_mutex_lock( &p_playlist->object_lock );
for( i_dummy = 0; i_dummy < playlist_CurrentSize(p_intf) ; i_dummy++ )
for( i_dummy = 0; i_dummy < playlist_CurrentSize(p_playlist) ; i_dummy++ )
{
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_dummy, true );
if( p_item )
......@@ -384,7 +384,7 @@ void onPlay(GtkButton *button, gpointer user_data)
if (p_playlist)
{
vlc_mutex_lock( &p_playlist->object_lock );
if (playlist_CurrentSize(p_intf))
if (playlist_CurrentSize(p_playlist))
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
......@@ -929,7 +929,7 @@ void onClearPlaylist(GtkButton *button, gpointer user_data)
return;
}
for(item = playlist_CurrentSize(p_intf) - 1; item >= 0 ;item-- )
for(item = playlist_CurrentSize(p_playlist) - 1; item >= 0 ;item-- )
{
msg_Err( p_playlist, "fix pda delete" );
}
......
......@@ -22,7 +22,7 @@
*****************************************************************************/
#include "libvlc_internal.h"
#include "libvlc.h"
#include <vlc/libvlc.h>
#include <vlc_input.h>
#include <vlc_meta.h>
......@@ -215,7 +215,7 @@ static void preparse_if_needed( libvlc_media_t *p_md )
if (!p_md->b_preparsed)
{
playlist_PreparseEnqueue(
p_md->p_libvlc_instance->p_libvlc_int->p_playlist,
libvlc_priv (p_md->p_libvlc_instance->p_libvlc_int)->p_playlist,
p_md->p_input_item );
p_md->b_preparsed = true;
}
......@@ -430,7 +430,7 @@ char * libvlc_media_get_meta( libvlc_media_t *p_md,
if( e_meta == libvlc_meta_ArtworkURL && !psz_meta )
{
playlist_AskForArtEnqueue(
p_md->p_libvlc_instance->p_libvlc_int->p_playlist,
libvlc_priv(p_md->p_libvlc_instance->p_libvlc_int)->p_playlist,
p_md->p_input_item );
}
......
......@@ -30,7 +30,7 @@
#include "../playlist/playlist_internal.h"
#define PL p_instance->p_libvlc_int->p_playlist
#define PL (libvlc_priv (p_instance->p_libvlc_int)->p_playlist)
static inline int playlist_was_locked( libvlc_instance_t *p_instance )
{
......
......@@ -553,7 +553,7 @@ static int Run( input_thread_t *p_input )
/* We have finished */
p_input->b_eof = true;
playlist_Signal( p_input->p_libvlc->p_playlist );
playlist_Signal( libvlc_priv (p_input->p_libvlc)->p_playlist );
}
/* Wait until we are asked to die */
......@@ -2110,7 +2110,8 @@ static int UpdateFromAccess( input_thread_t *p_input )
vlc_meta_t *p_meta = vlc_meta_New();
access_Control( p_input->p->input.p_access,ACCESS_GET_META, p_meta );
InputUpdateMeta( p_input, p_meta );
var_SetInteger( p_input->p_libvlc->p_playlist, "item-change", p_input->p->input.p_item->i_id );
var_SetInteger( libvlc_priv (p_input->p_libvlc)->p_playlist,
"item-change", p_input->p->input.p_item->i_id );
p_access->info.i_update &= ~INPUT_UPDATE_META;
}
......@@ -2153,8 +2154,8 @@ static void UpdateItemLength( input_thread_t *p_input, int64_t i_length )
if( !p_input->b_preparsing )
{
pl_Yield( p_input );
var_SetInteger( p_input->p_libvlc->p_playlist, "item-change",
p_input->p->input.p_item->i_id );
var_SetInteger( libvlc_priv (p_input->p_libvlc)->p_playlist,
"item-change", p_input->p->input.p_item->i_id );
pl_Release( p_input );
}
}
......
......@@ -179,7 +179,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
return NULL;
priv = libvlc_priv (p_libvlc);
p_libvlc->p_playlist = NULL;
priv->p_playlist = NULL;
priv->p_interaction = NULL;
priv->p_vlm = NULL;
p_libvlc->psz_object_name = strdup( "libvlc" );
......@@ -736,7 +736,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/* Initialize playlist and get commandline files */
playlist_ThreadCreate( p_libvlc );
if( !p_libvlc->p_playlist )
if( !priv->p_playlist )
{
msg_Err( p_libvlc, "playlist initialization failed" );
if( priv->p_memcpy_module != NULL )
......@@ -746,7 +746,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
module_EndBank( p_libvlc );
return VLC_EGENERIC;
}
p_playlist = p_libvlc->p_playlist;
p_playlist = priv->p_playlist;
psz_modules = config_GetPsz( p_playlist, "services-discovery" );
if( psz_modules && *psz_modules )
......@@ -939,7 +939,7 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
/* Free playlist */
msg_Dbg( p_libvlc, "removing playlist" );
playlist_ThreadDestroy( p_libvlc->p_playlist );
playlist_ThreadDestroy( priv->p_playlist );
/* Free video outputs */
msg_Dbg( p_libvlc, "removing all video outputs" );
......@@ -1138,7 +1138,7 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc,
/* Interface doesn't handle play on start so do it ourselves */
if( !p_intf->b_play && b_play )
playlist_Play( p_libvlc->p_playlist );
playlist_Play( libvlc_priv(p_libvlc)->p_playlist );
/* Try to run the interface */
p_intf->b_play = b_play;
......
......@@ -296,11 +296,12 @@ int VLC_VariableType( int i_object, char const *psz_var, int *pi_type )
#define LIBVLC_PLAYLIST_FUNC \
libvlc_int_t *p_libvlc = vlc_current_object( i_object );\
if( !p_libvlc || !p_libvlc->p_playlist ) return VLC_ENOOBJ; \
vlc_object_yield( p_libvlc->p_playlist );
if( !p_libvlc ) return VLC_ENOOBJ; \
playlist_t *p_playlist = pl_Yield( p_libvlc ); \
if( !p_playlist ) return VLC_ENOOBJ
#define LIBVLC_PLAYLIST_FUNC_END \
vlc_object_release( p_libvlc->p_playlist ); \
pl_Release( p_libvlc ); \
if( i_object ) vlc_object_release( p_libvlc );
/*****************************************************************************
......@@ -315,7 +316,7 @@ int VLC_AddTarget( int i_object, char const *psz_target,
{
int i_err;
LIBVLC_PLAYLIST_FUNC;
i_err = playlist_AddExt( p_libvlc->p_playlist, psz_target,
i_err = playlist_AddExt( p_playlist, psz_target,
NULL, i_mode, i_pos, -1,
ppsz_options, i_options, true, false );
LIBVLC_PLAYLIST_FUNC_END;
......@@ -328,7 +329,7 @@ int VLC_AddTarget( int i_object, char const *psz_target,
int VLC_Play( int i_object )
{
LIBVLC_PLAYLIST_FUNC;
playlist_Play( p_libvlc->p_playlist );
playlist_Play( p_playlist );
LIBVLC_PLAYLIST_FUNC_END;
return VLC_SUCCESS;
}
......@@ -339,7 +340,7 @@ int VLC_Play( int i_object )
int VLC_Pause( int i_object )
{
LIBVLC_PLAYLIST_FUNC;
playlist_Pause( p_libvlc->p_playlist );
playlist_Pause( p_playlist );
LIBVLC_PLAYLIST_FUNC_END;
return VLC_SUCCESS;
}
......@@ -350,7 +351,7 @@ int VLC_Pause( int i_object )
int VLC_Stop( int i_object )
{
LIBVLC_PLAYLIST_FUNC;
playlist_Stop( p_libvlc->p_playlist );
playlist_Stop( p_playlist );
LIBVLC_PLAYLIST_FUNC_END;
return VLC_SUCCESS;
}
......@@ -363,15 +364,15 @@ bool VLC_IsPlaying( int i_object )
bool b_playing;
LIBVLC_PLAYLIST_FUNC;
if( p_libvlc->p_playlist->p_input )
if( p_playlist->p_input )
{
vlc_value_t val;
var_Get( p_libvlc->p_playlist->p_input, "state", &val );
var_Get( p_playlist->p_input, "state", &val );
b_playing = ( val.i_int == PLAYING_S );
}
else
{
b_playing = playlist_IsPlaying( p_libvlc->p_playlist );
b_playing = playlist_IsPlaying( p_playlist );
}
LIBVLC_PLAYLIST_FUNC_END;
return b_playing;
......@@ -672,7 +673,7 @@ int VLC_PlaylistNumberOfItems( int i_object )
{
int i_size;
LIBVLC_PLAYLIST_FUNC;
i_size = p_libvlc->p_playlist->items.i_size;
i_size = p_playlist->items.i_size;
LIBVLC_PLAYLIST_FUNC_END;
return i_size;
}
......@@ -685,7 +686,7 @@ int VLC_PlaylistNumberOfItems( int i_object )
int VLC_PlaylistNext( int i_object )
{
LIBVLC_PLAYLIST_FUNC;
playlist_Next( p_libvlc->p_playlist );
playlist_Next( p_playlist );
LIBVLC_PLAYLIST_FUNC_END;
return VLC_SUCCESS;
}
......@@ -698,7 +699,7 @@ int VLC_PlaylistNext( int i_object )
int VLC_PlaylistPrev( int i_object )
{
LIBVLC_PLAYLIST_FUNC;
playlist_Prev( p_libvlc->p_playlist );
playlist_Prev( p_playlist );
LIBVLC_PLAYLIST_FUNC_END;
return VLC_SUCCESS;
}
......@@ -709,7 +710,7 @@ int VLC_PlaylistPrev( int i_object )
int VLC_PlaylistClear( int i_object )
{
LIBVLC_PLAYLIST_FUNC;
playlist_Clear( p_libvlc->p_playlist, true );
playlist_Clear( p_playlist, true );
LIBVLC_PLAYLIST_FUNC_END;
return VLC_SUCCESS;
}
......
......@@ -232,7 +232,8 @@ typedef struct libvlc_priv_t
/// (needs cleanup)
module_t *p_memcpy_module; ///< Fast memcpy plugin used
vlm_t *p_vlm; ///< VLM if created from libvlc-common.c
playlist_t *p_playlist; //< the playlist singleton
vlm_t *p_vlm; ///< the VLM singleton (or NULL)
vlc_object_t *p_interaction; ///< interface interaction object
httpd_t *p_httpd; ///< HTTP daemon (src/network/httpd.c)
} libvlc_priv_t;
......
......@@ -314,9 +314,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
if( !p_this ) return 0;
/* Add files to the playlist */
p_playlist = (playlist_t *)vlc_object_find( p_this,
VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
p_playlist = pl_Yield( p_this );
if( !p_playlist ) return 0;
if( pwm_data->lpData )
......
......@@ -43,7 +43,7 @@ static void PreparseEnqueueItemSub( playlist_t *, playlist_item_t * );
playlist_t *__pl_Yield( vlc_object_t *p_this )
{
playlist_t *pl = p_this->p_libvlc->p_playlist;
playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist;
assert( pl != NULL );
vlc_object_yield( pl );
return pl;
......@@ -51,7 +51,7 @@ playlist_t *__pl_Yield( vlc_object_t *p_this )
void __pl_Release( vlc_object_t *p_this )
{
playlist_t *pl = p_this->p_libvlc->p_playlist;
playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist;
assert( pl != NULL );
vlc_object_release( pl );
}
......
......@@ -74,7 +74,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
TAB_INIT( p_playlist->i_sds, p_playlist->pp_sds );
p_parent->p_libvlc->p_playlist = p_playlist;
libvlc_priv(p_parent->p_libvlc)->p_playlist = p_playlist;
VariablesInit( p_playlist );
......
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