Great news: there is no need to check for the existance of the playlist!
13 files changed:
mtime_t i_seconds;
vlc_value_t time;
mtime_t i_seconds;
vlc_value_t time;
- p_playlist = (playlist_t *) vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if ( !p_playlist )
- {
- msg_Warn( p_intf, "can't find playlist" );
- return;
- }
+ p_playlist = pl_Yield( p_intf );
/* Get new URL */
p_current_item = p_playlist->status.p_item;
/* Get new URL */
p_current_item = p_playlist->status.p_item;
#endif
/* Find the playlist */
#endif
/* Find the playlist */
- p_playlist = (playlist_t *) vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if ( !p_playlist )
- {
- msg_Warn( p_intf, "can't find playlist" );
- return;
- }
+ p_playlist = pl_Yield( p_intf );
/* Retrieve navigation history from playlist */
if( var_Get( p_playlist, "navigation-history", &history ) != VLC_SUCCESS ||
/* Retrieve navigation history from playlist */
if( var_Get( p_playlist, "navigation-history", &history ) != VLC_SUCCESS ||
#endif
/* Find the playlist */
#endif
/* Find the playlist */
- p_playlist = (playlist_t *) vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if ( !p_playlist )
- {
- msg_Warn( p_intf, "can't find playlist" );
- return;
- }
+ p_playlist = pl_Yield( p_intf );
/* Retrieve navigation history from playlist */
if( var_Get( p_playlist, "navigation-history", &history ) != VLC_SUCCESS ||
/* Retrieve navigation history from playlist */
if( var_Get( p_playlist, "navigation-history", &history ) != VLC_SUCCESS ||
case GESTURE(RIGHT,LEFT,NONE,NONE):
{
input_thread_t * p_input;
case GESTURE(RIGHT,LEFT,NONE,NONE):
{
input_thread_t * p_input;
- p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
-
- if( !p_playlist )
- break;
+ p_playlist = pl_Yield( p_intf );
p_input = input_from_playlist( p_playlist );
vlc_object_release( p_playlist );
p_input = input_from_playlist( p_playlist );
vlc_object_release( p_playlist );
}
break;
case GESTURE(LEFT,DOWN,NONE,NONE):
}
break;
case GESTURE(LEFT,DOWN,NONE,NONE):
- p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist == NULL )
- {
- break;
- }
+ p_playlist = pl_Yield( p_intf );
playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
break;
case GESTURE(RIGHT,DOWN,NONE,NONE):
playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
break;
case GESTURE(RIGHT,DOWN,NONE,NONE):
- p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist == NULL )
- {
- break;
- }
+ p_playlist = pl_Yield( p_intf );
playlist_Next( p_playlist );
vlc_object_release( p_playlist );
playlist_Next( p_playlist );
vlc_object_release( p_playlist );
vlc_value_t val, list, list2;
int i_count, i;
vlc_value_t val, list, list2;
int i_count, i;
- p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
-
- if( !p_playlist )
- break;
+ p_playlist = pl_Yield( p_intf );
p_input = input_from_playlist( p_playlist );
p_input = input_from_playlist( p_playlist );
vlc_value_t val, list, list2;
int i_count, i;
vlc_value_t val, list, list2;
int i_count, i;
- p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
-
- if( !p_playlist )
- break;
+ p_playlist = pl_Yield( p_intf );
p_input = input_from_playlist( p_playlist );
vlc_object_release( p_playlist );
p_input = input_from_playlist( p_playlist );
vlc_object_release( p_playlist );
FIND_ANYWHERE );
if( p_input )
{
FIND_ANYWHERE );
if( p_input )
{
- p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
- FIND_PARENT );
+ p_playlist = pl_Yield( p_input );
}
}
/* New input has been registered */
}
}
/* New input has been registered */
p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( p_input )
{
p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( p_input )
{
- p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_PARENT );
- if( p_playlist )
+ p_playlist = pl_Yield( p_input );
+ char cmd[6];
+ switch( p_playlist->status.i_status )
- char cmd[6];
- switch( p_playlist->status.i_status )
- {
- case PLAYLIST_STOPPED:
- strcpy( cmd, "stop" );
- break;
- case PLAYLIST_RUNNING:
- strcpy( cmd, "play" );
- break;
- case PLAYLIST_PAUSED:
- strcpy( cmd, "pause" );
- break;
- default:
- cmd[0] = '\0';
- } /* var_GetInteger( p_input, "state" ) */
- msg_rc( STATUS_CHANGE "( %s state: %d ): %s",
- &cmd[0], newval.i_int,
- ppsz_input_state[ newval.i_int ] );
- vlc_object_release( p_playlist );
- }
+ case PLAYLIST_STOPPED:
+ strcpy( cmd, "stop" );
+ break;
+ case PLAYLIST_RUNNING:
+ strcpy( cmd, "play" );
+ break;
+ case PLAYLIST_PAUSED:
+ strcpy( cmd, "pause" );
+ break;
+ default:
+ cmd[0] = '\0';
+ } /* var_GetInteger( p_input, "state" ) */
+ msg_rc( STATUS_CHANGE "( %s state: %d ): %s",
+ &cmd[0], newval.i_int,
+ ppsz_input_state[ newval.i_int ] );
+ vlc_object_release( p_playlist );
vlc_object_release( p_input );
}
vlc_mutex_unlock( &p_intf->p_sys->status_lock );
vlc_object_release( p_input );
}
vlc_mutex_unlock( &p_intf->p_sys->status_lock );
VLC_UNUSED(oldval); VLC_UNUSED(newval);
playlist_t *p_playlist;
VLC_UNUSED(oldval); VLC_UNUSED(newval);
playlist_t *p_playlist;
- p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( p_playlist )
- {
- playlist_Stop( p_playlist );
- vlc_object_release( p_playlist );
- }
+ p_playlist = pl_Yield( p_this );
+ playlist_Stop( p_playlist );
+ vlc_object_release( p_playlist );
+
vlc_object_kill( p_this->p_libvlc );
return VLC_SUCCESS;
}
vlc_object_kill( p_this->p_libvlc );
return VLC_SUCCESS;
}
- p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_playlist )
- return VLC_ENOOBJ;
+ p_playlist = pl_Yield( p_this );
if( p_playlist->p_input )
{
if( p_playlist->p_input )
{
/*****************************************************************************
* applescript.m: MacOS X AppleScript support
*****************************************************************************
/*****************************************************************************
* applescript.m: MacOS X AppleScript support
*****************************************************************************
- * Copyright (C) 2002-2003, 2005, 2007 the VideoLAN team
+ * Copyright (C) 2002-2003, 2005, 2007-2008 the VideoLAN team
* $Id$
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
* $Id$
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
{
intf_thread_t * p_intf = VLCIntf;
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
+ playlist_t * p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL )
{
return nil;
if( p_playlist == NULL )
{
return nil;
NSString *o_command = [[self commandDescription] commandName];
intf_thread_t * p_intf = VLCIntf;
NSString *o_command = [[self commandDescription] commandName];
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
+ playlist_t * p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL )
{
return nil;
if( p_playlist == NULL )
{
return nil;
else
{
char *psz_name = input_item_GetName( p_item->p_input );
else
{
char *psz_name = input_item_GetName( p_item->p_input );
+ if( !EMPTY_STR( psz_name ) )
{
o_value = [NSString stringWithUTF8String: psz_name];
}
{
o_value = [NSString stringWithUTF8String: psz_name];
}
@"VLCPlaylistItemPboardType", nil]];
[o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
@"VLCPlaylistItemPboardType", nil]];
[o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
- /* This uses private Apple API which works fine until 10.4.
+ /* This uses private Apple API which works fine until 10.5.
* We need to keep checking in the future!
* These methods are being added artificially to NSOutlineView's interface above */
o_ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
* We need to keep checking in the future!
* These methods are being added artificially to NSOutlineView's interface above */
o_ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
}
else if( b_selected_item_met == YES &&
( [o_current_name rangeOfString:[o_search_field
}
else if( b_selected_item_met == YES &&
( [o_current_name rangeOfString:[o_search_field
- stringValue] options:NSCaseInsensitiveSearch ].length ||
+ stringValue] options:NSCaseInsensitiveSearch].length ||
[o_current_author rangeOfString:[o_search_field
[o_current_author rangeOfString:[o_search_field
- stringValue] options:NSCaseInsensitiveSearch ].length ) )
+ stringValue] options:NSCaseInsensitiveSearch].length ) )
{
vlc_object_release( p_playlist );
/*Adds the parent items in the result array as well, so that we can
{
vlc_object_release( p_playlist );
/*Adds the parent items in the result array as well, so that we can
- (BOOL)windowShouldClose:(id)sender
{
- (BOOL)windowShouldClose:(id)sender
{
- playlist_t * p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
+ playlist_t * p_playlist = pl_Yield( p_vout );
if( p_playlist == NULL )
{
return NO;
if( p_playlist == NULL )
{
return NO;
else
{
/* we are working as a dialogs provider */
else
{
/* we are working as a dialogs provider */
- playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( p_playlist )
- {
- p_input = p_playlist->p_input;
- emit inputChanged( p_input );
- }
+ playlist_t *p_playlist = pl_Yield( p_intf );
+ p_input = p_playlist->p_input;
+ emit inputChanged( p_input );
p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->p_sys->p_input = NULL;
p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->p_sys->p_input = NULL;
- 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 == NULL )
- {
- msg_Err( p_intf, "No playlist object found" );
- msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
- return VLC_EGENERIC;
- }
+ p_intf->p_sys->p_playlist = pl_Yield( p_intf );
// Initialize "singleton" objects
p_intf->p_sys->p_logger = NULL;
// Initialize "singleton" objects
p_intf->p_sys->p_logger = NULL;
// Do nothing is skins2 is not the main interface
if( var_Type( p_intf, "skin-to-load" ) == VLC_VAR_STRING )
{
// Do nothing is skins2 is not the main interface
if( var_Type( p_intf, "skin-to-load" ) == VLC_VAR_STRING )
{
- playlist_t *p_playlist =
- (playlist_t *) vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist != NULL )
- {
- // Make sure the item is deleted afterwards
- /// \bug does not always work
- p_playlist->status.p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
- vlc_object_release( p_playlist );
- }
+ playlist_t *p_playlist = pl_Yield( p_this );
+ // Make sure the item is deleted afterwards
+ /// \bug does not always work
+ p_playlist->status.p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
+ vlc_object_release( p_playlist );
vlc_value_t val;
val.psz_string = p_demux->psz_path;
vlc_value_t val;
val.psz_string = p_demux->psz_path;
playlist_t *p_playlist;
bool b_eof = false;
playlist_t *p_playlist;
bool b_eof = false;
- p_playlist = vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST, FIND_PARENT );
-
- if( p_playlist == NULL )
- {
- msg_Err( p_demux, "we are not attached to a playlist" );
- return -1;
- }
+ p_playlist = pl_Yield( p_demux );
switch( p_sys->i_command )
{
switch( p_sys->i_command )
{
*****************************************************************************/
static void AddStateVariableCallback(filter_t *p_filter)
{
*****************************************************************************/
static void AddStateVariableCallback(filter_t *p_filter)
{
- playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_filter,
- VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist )
+ playlist_t *p_playlist = pl_Yield( p_filter );
+ input_thread_t *p_input = p_playlist->p_input;
+ if(p_input)
- input_thread_t *p_input = p_playlist->p_input;
- if(p_input)
- {
- var_AddCallback( p_input, "state", StateCallback, p_filter );
- }
- vlc_object_release( p_playlist );
+ var_AddCallback( p_input, "state", StateCallback, p_filter );
+ vlc_object_release( p_playlist );
}
/*****************************************************************************
}
/*****************************************************************************
*****************************************************************************/
static void DelStateVariableCallback( filter_t *p_filter )
{
*****************************************************************************/
static void DelStateVariableCallback( filter_t *p_filter )
{
- playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_filter,
- VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist )
+ playlist_t *p_playlist = pl_Yield( p_filter );
+ input_thread_t *p_input = p_playlist->p_input;
+ if(p_input)
- input_thread_t *p_input = p_playlist->p_input;
- if(p_input)
- {
- var_DelCallback( p_input, "state", StateCallback, p_filter );
- }
- vlc_object_release( p_playlist );
+ var_DelCallback( p_input, "state", StateCallback, p_filter );
+ vlc_object_release( p_playlist );
break;
case CACA_EVENT_QUIT:
{
break;
case CACA_EVENT_QUIT:
{
- p_playlist = vlc_object_find( p_vout,
- VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( p_playlist )
- {
- playlist_Stop( p_playlist );
- vlc_object_release( p_playlist );
- }
+ p_playlist = pl_Yield( p_vout );
+ playlist_Stop( p_playlist );
+ vlc_object_release( p_playlist );
vlc_object_kill( p_vout->p_libvlc );
break;
}
vlc_object_kill( p_vout->p_libvlc );
break;
}
{
playlist_t *p_playlist;
{
playlist_t *p_playlist;
- p_playlist =
- (playlist_t *)vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
- FIND_PARENT );
- if( p_playlist )
- {
- /* Modify playlist as well because the vout might have to be
- * restarted */
- var_Create( p_playlist, "directx-wallpaper", VLC_VAR_BOOL );
- var_Set( p_playlist, "directx-wallpaper", newval );
-
- vlc_object_release( p_playlist );
- }
+ p_playlist = pl_Yield( p_this );
+ /* Modify playlist as well because the vout might have to be
+ * restarted */
+ var_Create( p_playlist, "directx-wallpaper", VLC_VAR_BOOL );
+ var_Set( p_playlist, "directx-wallpaper", newval );
+ vlc_object_release( p_playlist );
p_vout->p_sys->i_changes |= DX_WALLPAPER_CHANGE;
}
p_vout->p_sys->i_changes |= DX_WALLPAPER_CHANGE;
}
static void DirectXPopupMenu( event_thread_t *p_event, bool b_open )
{
static void DirectXPopupMenu( event_thread_t *p_event, bool b_open )
{
- playlist_t *p_playlist =
- vlc_object_find( p_event, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( p_playlist != NULL )
- {
- vlc_value_t val;
- val.b_bool = b_open;
- var_Set( p_playlist, "intf-popupmenu", val );
- vlc_object_release( p_playlist );
- }
+ playlist_t *p_playlist = pl_Yield( p_event );
+ vlc_value_t val;
+ val.b_bool = b_open;
+ var_Set( p_playlist, "intf-popupmenu", val );
+ vlc_object_release( p_playlist );
}
static int DirectXConvertKey( int i_key );
}
static int DirectXConvertKey( int i_key );
/* the user wants to close the window */
case WM_CLOSE:
{
/* the user wants to close the window */
case WM_CLOSE:
{
- playlist_t * p_playlist =
- (playlist_t *)vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist == NULL )
- {
- return 0;
- }
-
+ playlist_t * p_playlist = pl_Yield( p_vout );
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
return 0;
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
return 0;