if( p_sys->i_track < 0 && i_mrl_tracknum <= 0 )
{
- p_playlist = (playlist_t *) vlc_object_find( p_access,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_playlist ) return VLC_EGENERIC;
-
+ p_playlist = pl_Yield( p_access );
if( p_playlist->status.p_item->p_input ==
((input_thread_t *)p_access->p_parent)->input.p_item )
p_item = p_playlist->status.p_item;
#endif
if (! p_cdda->b_nav_mode ) {
- p_playlist = (playlist_t *) vlc_object_find( p_access,
- VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( !p_playlist )
- {
- msg_Warn( p_access, "can't find playlist" );
- return VLC_EGENERIC;
- }
+ p_playlist = pl_Yield( p_access );
}
if( b_single_track || p_cdda->b_nav_mode ) {
int i_mode, i_activity;
playlist_item_t *p_item, *p_root_category;
- vlc_bool_t b_play = VLC_FALSE;
-
- playlist_t *p_playlist =
- (playlist_t *) vlc_object_find( p_access,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-
- if( !p_playlist )
- {
- msg_Err( p_access, "can't find playlist" );
- goto end;
- }
+ playlist_t *p_playlist = pl_Yield( p_access );
psz_name = ToLocale( p_access->psz_path );
ptr = strdup( psz_name );
if( p_playlist->status.p_item && p_playlist->status.p_item->p_input ==
((input_thread_t *)p_access->p_parent)->input.p_item )
- {
p_item = p_playlist->status.p_item;
- b_play = VLC_TRUE;
- msg_Dbg( p_access, "starting directory playback");
- }
else
{
input_item_t *p_current = ( (input_thread_t*)p_access->p_parent)->
input.p_item;
p_item = playlist_LockItemGetByInput( p_playlist, p_current );
- msg_Dbg( p_access, "not starting directory playback");
if( !p_item )
{
msg_Dbg( p_playlist, "unable to find item in playlist");
- return -1;
+ return VLC_ENOOBJ;
}
- b_play = VLC_FALSE;
}
p_item->p_input->i_type = ITEM_TYPE_DIRECTORY;
var_SetInteger( p_playlist, "activity", i_activity -
DIRECTORY_ACTIVITY );
end:
-
- /* Begin to read the directory */
- if( b_play )
- {
-#if 0
- /// \bug we can start playing an already deleted item. Fix ?*/
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 1242,
- p_playlist->status.p_item, NULL );
-#endif
- }
if( psz_name ) free( psz_name );
vlc_object_release( p_playlist );
goto error;
}
- p_playlist = vlc_object_find( p_access, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( !p_playlist )
- {
- msg_Err( p_access, "redirection failed: can't find playlist" );
- goto error;
- }
-
/* Change the URI */
- vlc_mutex_lock( &p_playlist->object_lock );
+ p_playlist = pl_Yield( p_access );
+ PL_LOCK;
+
p_input_item = p_playlist->status.p_item->p_input;
vlc_mutex_lock( &p_input_item->lock );
free( p_input_item->psz_uri );
p_input_item->psz_uri = strdup( p_sys->psz_location );
p_access->psz_path = strdup( p_sys->psz_location );
vlc_mutex_unlock( &p_input_item->lock );
- vlc_mutex_unlock( &p_playlist->object_lock );
- vlc_object_release( p_playlist );
+
+ PL_UNLOCK;
+ pl_Release( p_access );
/* Clean up current Open() run */
vlc_UrlClean( &p_sys->url );
/* Handle redirection */
if( psz_location && *psz_location )
{
- playlist_t * p_playlist = vlc_object_find( p_access, VLC_OBJECT_PLAYLIST, FIND_PARENT );
-
+ playlist_t * p_playlist = pl_Yield( p_access );
msg_Dbg( p_access, "redirection to %s", psz_location );
- if( !p_playlist )
- {
- msg_Err( p_access, "redirection failed: can't find playlist" );
- free( psz_location );
- return VLC_EGENERIC;
- }
/** \bug we do not autodelete here */
playlist_PlaylistAdd( p_playlist, psz_location, psz_location,
PLAYLIST_INSERT | PLAYLIST_GO, PLAYLIST_END );
#ifdef HAVE_AVAHI_CLIENT
if( config_GetInt(p_this, SOUT_CFG_PREFIX "bonjour") )
{
- playlist_t *p_playlist;
char *psz_txt, *psz_name;
-
- p_playlist = (playlist_t *)vlc_object_find( p_access,
- VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist == NULL )
- {
- msg_Err( p_access, "unable to find playlist" );
- httpd_StreamDelete( p_sys->p_httpd_stream );
- httpd_HostDelete( p_sys->p_httpd_host );
- free( (void *)p_sys );
- return VLC_EGENERIC;
- }
+ playlist_t *p_playlist = pl_Yield( p_access );
psz_name = strrchr( p_playlist->status.p_item->p_input->psz_uri,
DIRECTORY_SEPARATOR );
p_sys->p_bonjour = bonjour_start_service( (vlc_object_t *)p_access,
strcmp( p_access->psz_access, "https" )
? "_vlc-http._tcp" : "_vlc-https._tcp",
- psz_name, i_bind_port, psz_txt );
+ psz_name, i_bind_port, psz_txt );
free( (void *)psz_txt );
if( p_sys->p_bonjour == NULL )
- {
- msg_Err( p_access, "Avahi stream announcing was requested, but no avahi service could be started" );
- }
+ msg_Err( p_access, "unable to start requested Bonjour announce" );
vlc_object_release( p_playlist );
}
else
/* Update the input */
if( p_intf->p_sys->p_input == NULL )
{
- p_playlist = (playlist_t *)vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( p_playlist )
- {
- p_intf->p_sys->p_input = p_playlist->p_input;
- if( p_intf->p_sys->p_input )
- vlc_object_yield( p_intf->p_sys->p_input );
- vlc_object_release( p_playlist );
- }
+ p_playlist = pl_Yield( p_intf );
+ p_intf->p_sys->p_input = p_playlist->p_input;
+ if( p_intf->p_sys->p_input )
+ vlc_object_yield( p_intf->p_sys->p_input );
+ vlc_object_release( p_playlist );
}
else if( p_intf->p_sys->p_input->b_dead )
{
if( i_action == ACTIONID_QUIT )
{
- p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist )
- {
- playlist_Stop( p_playlist );
- vlc_object_release( p_playlist );
- }
- /* Playlist is stopped now kill vlc. */
p_intf->p_libvlc->b_die = VLC_TRUE;
ClearChannels( p_intf, p_vout );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Quit" ) );
else if( i_action == ACTIONID_INTF_SHOW )
{
val.b_bool = VLC_TRUE;
- p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist )
- {
- var_Set( p_playlist, "intf-show", val );
- vlc_object_release( p_playlist );
- }
+ p_playlist = pl_Yield( p_intf );
+ var_Set( p_playlist, "intf-show", val );
+ vlc_object_release( p_playlist );
}
else if( i_action == ACTIONID_INTF_HIDE )
{
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
intf_thread_t *p_intf = (intf_thread_t*)p_this;
- playlist_t *p_playlist;
-
- p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( !p_playlist )
- {
- msg_Err( p_this, "no playlist" );
- return VLC_ENOOBJ;
- }
+ playlist_t *p_playlist = pl_Yield( p_this );
+ PL_LOCK;
if( p_playlist->p_input )
{
vlc_value_t val;
{
msg_rc( _("Type 'menu select' or 'pause' to continue.") );
vlc_object_release( p_playlist );
+ PL_UNLOCK;
return VLC_EGENERIC;
}
}
+ PL_UNLOCK;
/* Parse commands that require a playlist */
if( !strcmp( psz_cmd, "prev" ) )
}
else if (!strcmp( psz_cmd, "goto" ) )
{
+ msg_rc( _("goto is deprecated" ) );
msg_Err( p_playlist, "goto is deprecated" );
}
else if( !strcmp( psz_cmd, "stop" ) )
/* Notify the interfaces */
if( p_intf->p_sys->b_triggered )
{
- playlist_t *p_playlist =
- (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
-
- if( p_playlist != NULL )
- {
- vlc_value_t val;
- val.b_bool = VLC_TRUE;
- var_Set( p_playlist, "intf-show", val );
- vlc_object_release( p_playlist );
- }
+ playlist_t *p_playlist = pl_Yield( p_intf );
+ var_SetBool( p_playlist, "intf-show", VLC_TRUE );
+ vlc_object_release( p_playlist );
p_intf->p_sys->b_triggered = VLC_FALSE;
}
if( !p_input )
{
- playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- assert( p_playlist );
- PL_LOCK;
- p_input = p_playlist->p_input;
+ QPL_LOCK;
+ p_input = THEPL->p_input;
if( p_input )
{
vlc_object_yield( p_input );
emit inputChanged( p_input );
}
- PL_UNLOCK;
- vlc_object_release( p_playlist );
+ QPL_UNLOCK;
}
vlc_mutex_unlock( &p_intf->change_lock );
}
p_intf->p_sys = (intf_sys_t *)malloc(sizeof( intf_sys_t ) );
memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) );
- p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_intf->p_sys->p_playlist )
- {
- free( p_intf->p_sys );
- return VLC_EGENERIC;
- }
-
+ p_intf->p_sys->p_playlist = pl_Yield( p_intf );
p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
return VLC_SUCCESS;
};
#define THEPL p_intf->p_sys->p_playlist
+#define QPL_LOCK vlc_mutex_lock( &THEPL->object_lock );
+#define QPL_UNLOCK vlc_mutex_unlock( &THEPL->object_lock );
+
#define THEDP DialogsProvider::getInstance()
#define THEMIM MainInputManager::getInstance( NULL )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
- playlist_t *p_playlist = (playlist_t *)vlc_object_find(
- p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-
- if( !p_playlist )
- {
- msg_Err( p_intf, "could not find playlist object" );
- return VLC_ENOOBJ;
- }
-
+ playlist_t *p_playlist = pl_Yield( p_intf );
var_AddCallback( p_playlist, "playlist-current", ItemChange, p_intf );
- vlc_object_release( p_playlist );
+ pl_Release( p_intf );
RegisterToGrowl( p_this );
p_intf->pf_run = Run;
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
- playlist_t *p_playlist = (playlist_t *)vlc_object_find(
- p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-
- if( p_playlist )
- {
- var_DelCallback( p_playlist, "playlist-current", ItemChange, p_this );
- vlc_object_release( p_playlist );
- }
+ playlist_t *p_playlist = pl_Yield( p_this );
+ var_DelCallback( p_playlist, "playlist-current", ItemChange, p_this );
+ pl_Release( p_this );
}
/*****************************************************************************