pl_Hold() assumed the playlist was already created.
pl_Release() does not solve any problem. Playlist synchronization is
done with the playlist lock, while playlist deletion must anyway be done
after all interfaces, services and other threads are joined.
#define PL_UNLOCK playlist_Unlock( p_playlist )
#define PL_ASSERT_LOCKED playlist_AssertLocked( p_playlist )
-VLC_EXPORT( playlist_t *, pl_Hold, ( vlc_object_t * ) );
-#define pl_Hold( a ) pl_Hold( VLC_OBJECT(a) )
-
-VLC_EXPORT( void, pl_Release, ( vlc_object_t * ) );
-#define pl_Release(a) pl_Release( VLC_OBJECT(a) )
+VLC_EXPORT( playlist_t *, pl_Get, ( vlc_object_t * ) );
+#define pl_Get( a ) pl_Get( VLC_OBJECT(a) )
/* Playlist control */
#define playlist_Play(p) playlist_Control(p,PLAYLIST_PLAY, pl_Unlocked )
#define pl_CurrentInput(a) __pl_CurrentInput( VLC_OBJECT(a) )
static inline input_thread_t * __pl_CurrentInput( vlc_object_t * p_this )
{
- playlist_t * p_playlist = pl_Hold( p_this );
- if( !p_playlist ) return NULL;
- input_thread_t * p_input = playlist_CurrentInput( p_playlist );
- pl_Release( p_this );
- return p_input;
+ return playlist_CurrentInput( pl_Get( p_this ) );
}
/** Tell if the playlist is empty */
if( var_InheritInteger(p_this, SOUT_CFG_PREFIX "bonjour") )
{
char *psz_txt, *psz_name;
- playlist_t *p_playlist = pl_Hold( p_access );
+ playlist_t *p_playlist = pl_Get( p_access );
char *psz_uri = input_item_GetURI( p_playlist->status.p_item->p_input );
char *psz_newuri = psz_uri;
if( psz_file_name &&
asprintf( &psz_txt, "path=%s", psz_file_name ) == -1 )
{
- pl_Release( p_access );
free( psz_uri );
return VLC_ENOMEM;
}
if( p_sys->p_bonjour == NULL )
msg_Err( p_access, "unable to start requested Bonjour announce" );
- pl_Release( p_access );
}
else
p_sys->p_bonjour = NULL;
p_sys->p_events = vlc_array_new();
vlc_mutex_init( &p_sys->lock );
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
p_sys->p_playlist = p_playlist;
PL_LOCK;
var_DelCallback( p_input, "state", AllCallback, p_intf );
vlc_object_release( p_input );
}
- pl_Release( p_intf );
dbus_connection_unref( p_sys->p_conn );
/* If you modify this, please try to follow this convention:
Start with LEFT, RIGHT for playback related commands
and UP, DOWN, for other commands */
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
switch( p_sys->i_pattern )
{
case LEFT:
p_sys->i_num_gestures = 0;
p_sys->i_pattern = 0;
p_sys->b_got_gesture = false;
- pl_Release( p_intf );
}
/*
if( p_sys->p_vout == NULL )
{
- playlist_t *p_playlist = pl_Hold( p_intf );
- p_input = playlist_CurrentInput( p_playlist );
- pl_Release( p_intf );
+ p_input = playlist_CurrentInput( pl_Get( p_intf ) );
if( p_input )
{
p_sys->p_vout = input_GetVout( p_input );
static int PutAction( intf_thread_t *p_intf, int i_action )
{
intf_sys_t *p_sys = p_intf->p_sys;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
/* Update the input */
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
vlc_object_release( p_vout );
if( p_input )
vlc_object_release( p_input );
- pl_Release( p_intf );
return VLC_SUCCESS;
}
if( asprintf( &psz_bookmark_name, "bookmark%i", i_num ) == -1 )
return;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
char *psz_bookmark = var_CreateGetString( p_intf, psz_bookmark_name );
PL_LOCK;
free( psz_bookmark );
free( psz_bookmark_name );
- pl_Release( p_intf );
}
static void SetBookmark( intf_thread_t *p_intf, int i_num )
if( asprintf( &psz_bookmark_name, "bookmark%i", i_num ) == -1 )
return;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
var_Create( p_intf, psz_bookmark_name,
VLC_VAR_STRING|VLC_VAR_DOINHERIT );
playlist_item_t * p_item = playlist_CurrentPlayingItem( p_playlist );
config_SaveConfigFile( p_intf, "hotkeys" );
}
- pl_Release( p_intf );
free( psz_bookmark_name );
}
return( VLC_ENOMEM );
}
- p_sys->p_playlist = pl_Hold( p_this );
+ p_sys->p_playlist = pl_Get( p_this );
p_sys->p_input = NULL;
p_sys->p_vlm = NULL;
p_sys->psz_address = psz_address;
if( p_sys->p_httpd_host == NULL )
{
msg_Err( p_intf, "cannot listen on %s:%d", psz_address, i_port );
- pl_Release( p_this );
free( p_sys->psz_address );
free( p_sys );
return VLC_EGENERIC;
httpd_HostDelete( p_sys->p_httpd_host );
free( p_sys->psz_address );
free( p_sys );
- pl_Release( p_this );
return VLC_EGENERIC;
}
httpd_HostDelete( p_sys->p_httpd_host );
free( p_sys->psz_address );
free( p_sys );
- pl_Release( p_this );
}
/****************************************************************************
sys->timeout = var_InheritInteger(intf, "netsync-timeout");
if (sys->timeout < 500)
sys->timeout = 500;
- sys->playlist = pl_Hold(intf);
+ sys->playlist = pl_Get(intf);
sys->input = NULL;
var_AddCallback(sys->playlist, "input-current", PlaylistEvent, intf);
assert(sys->input == NULL);
var_DelCallback(sys->playlist, "input-current", PlaylistEvent, intf);
- pl_Release(intf);
net_Close(sys->fd);
free(sys);
}
static void Run( intf_thread_t *p_intf )
{
input_thread_t * p_input = NULL;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
char p_buffer[ MAX_LINE_LENGTH + 1 ];
bool b_showpos = var_InheritInteger( p_intf, "rc-show-pos" );
vlc_object_release( p_input );
}
- pl_Release( p_intf );
-
var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, p_intf );
vlc_restorecancel( canc );
}
if( p_intf->p_sys == NULL )
return VLC_ENOMEM;
- p_sys->p_playlist = pl_Hold( p_intf );
+ p_sys->p_playlist = pl_Get( p_intf );
p_sys->p_input = NULL;
p_sys->p_main_window = NULL;
vlc_sem_init (&p_sys->ready, 0);
if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{
- pl_Release (p_sys->p_playlist);
free (p_sys);
return VLC_ENOMEM;
}
var_Destroy (p_this->p_libvlc, "hildon-iface");
vlc_join (p_intf->p_sys->thread, NULL);
- pl_Release ( p_intf->p_sys->p_playlist );
vlc_spin_destroy( &p_intf->p_sys->event_lock );
free( p_intf->p_sys );
}
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
if( p_playlist == NULL )
{
return nil;
noteNewRecentDocumentURL: o_url];
}
}
- pl_Release( p_intf );
}
return nil;
}
NSString *o_command = [[self commandDescription] commandName];
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
if( p_playlist == NULL )
{
return nil;
[o_controls volumeDown:self];
}
}
- pl_Release( p_intf );
return nil;
}
- (IBAction)play:(id)sender
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
bool empty;
PL_LOCK;
empty = playlist_IsEmpty( p_playlist );
PL_UNLOCK;
- pl_Release( p_intf );
-
if( empty )
[o_main intfOpenFileGeneric: (id)sender];
{
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
var_Get( p_playlist, "random", &val );
val.b_bool = !val.b_bool;
p_intf->p_sys->b_playmode_update = true;
p_intf->p_sys->b_intf_update = true;
- pl_Release( p_intf );
}
/* three little ugly helpers */
- (void)shuffle
{
vlc_value_t val;
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
var_Get( p_playlist, "random", &val );
[o_btn_shuffle setState: val.b_bool];
if(val.b_bool)
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"sidebarShuffleOn"]];
else
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"sidebarShuffle"]];
- pl_Release( VLCIntf );
}
- (IBAction)repeatButtonAction:(id)sender
{
vlc_value_t looping,repeating;
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
var_Get( p_playlist, "repeat", &repeating );
var_Get( p_playlist, "loop", &looping );
var_Set( p_playlist, "loop", looping );
p_intf->p_sys->b_playmode_update = true;
p_intf->p_sys->b_intf_update = true;
-
- pl_Release( p_intf );
}
{
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
var_Get( p_playlist, "repeat", &val );
if (!val.b_bool)
p_intf->p_sys->b_playmode_update = true;
p_intf->p_sys->b_intf_update = true;
- pl_Release( p_intf );
}
- (IBAction)loop:(id)sender
{
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
var_Get( p_playlist, "loop", &val );
if (!val.b_bool)
p_intf->p_sys->b_playmode_update = true;
p_intf->p_sys->b_intf_update = true;
- pl_Release( p_intf );
}
- (IBAction)quitAfterPlayback:(id)sender
{
vlc_value_t val;
- playlist_t * p_playlist = pl_Hold( VLCIntf );
- var_Get( p_playlist, "play-and-exit", &val );
- val.b_bool = !val.b_bool;
- var_Set( p_playlist, "play-and-exit", val );
- pl_Release( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
+ var_ToggleBool( p_playlist, "play-and-exit" );
}
- (IBAction)forward:(id)sender
- (IBAction)volumeSliderUpdated:(id)sender
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
audio_volume_t i_volume = (audio_volume_t)[sender intValue];
int i_volume_step;
i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" );
aout_VolumeSet( p_playlist, i_volume * i_volume_step );
- pl_Release( p_intf );
/* Manage volume status */
[o_main manageVolumeSlider];
}
}
else
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
if( [o_title isEqualToString: _NS("Fullscreen")] ||
[sender isKindOfClass:[NSButton class]] )
{
var_ToggleBool( p_playlist, "fullscreen" );
}
-
- pl_Release( VLCIntf );
}
vlc_object_release( p_input );
}
BOOL bEnabled = TRUE;
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
input_thread_t * p_input = playlist_CurrentInput( p_playlist );
if( [[o_mi title] isEqualToString: _NS("Faster")] ||
}
if( p_input ) vlc_object_release( p_input );
- pl_Release( p_intf );
return( bEnabled );
}
- (BOOL)windowShouldClose:(id)sender
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
/* Only want to stop playback if video is playing */
if( videoRatio.height != 0. && videoRatio.width != 0. )
playlist_Stop( p_playlist );
- pl_Release( VLCIntf );
return YES;
}
vlc_object_t *p_object = VLC_OBJECT(p_aout);
if( !p_object )
{
- p_object = (vlc_object_t *)pl_Hold( p_intf );
+ p_object = vlc_object_hold(pl_Get( p_intf ));
}
psz_string = var_GetNonEmptyString( p_object, "audio-filter" );
char *psz_parser, *psz_string;
vlc_object_t *p_object = VLC_OBJECT(getAout());
if( p_object == NULL )
- p_object = (vlc_object_t *)pl_Hold( p_intf );
+ p_object = vlc_object_hold(pl_Get( p_intf ));
if( (BOOL)config_GetInt( p_intf, "macosx-eq-keep" ) == YES )
psz_string = config_GetPsz( p_intf, "audio-filter" );
vlc_object_t *p_object = VLC_OBJECT(getAout());
if( p_object == NULL )
- p_object = (vlc_object_t *)pl_Hold( p_intf );
+ p_object = vlc_object_hold(pl_Get( p_intf ));
var_Create( p_object, "equalizer-preamp", VLC_VAR_FLOAT |
VLC_VAR_DOINHERIT );
vlc_object_t *p_object = VLC_OBJECT(getAout());
if( p_object == NULL )
- p_object = (vlc_object_t *)pl_Hold( p_intf );
+ p_object = vlc_object_hold(pl_Get( p_intf ));
const char *psz_values;
NSString *preset = [NSString stringWithFormat:@"%.1f", [o_slider_band1 floatValue] ];
int i;
vlc_object_t *p_object= VLC_OBJECT(getAout());
if( p_object == NULL )
- p_object = (vlc_object_t *)pl_Hold( p_intf );
+ p_object = vlc_object_hold(pl_Get( p_intf ));
var_SetString( p_object , "equalizer-preset" , preset_list[[sender indexOfSelectedItem]] );
vlc_object_t *p_object = VLC_OBJECT(getAout());
if( p_object == NULL )
- p_object = (vlc_object_t *)pl_Hold( p_intf );
+ p_object = vlc_object_hold(pl_Get( p_intf ));
var_SetFloat( p_object, "equalizer-preamp", f_preamp );
aout_instance_t *p_aout = getAout();
vlc_object_t *p_object= VLC_OBJECT(p_aout);
if( p_object == NULL )
- p_object = (vlc_object_t *)pl_Hold( p_intf );
+ p_object = vl_object_hold(pl_Get( p_intf ));
var_SetBool( p_object, "equalizer-2pass", b_2p );
int i;
vlc_object_t *p_object= VLC_OBJECT(getAout());
if( p_object == NULL )
- p_object = (vlc_object_t *)pl_Hold( VLCIntf );
+ p_object = vlc_object_hold(pl_Get( VLCIntf ));
[o_window setExcludedFromWindowsMenu: TRUE];
id o_window = [NSApp keyWindow];
NSArray *o_windows = [NSApp orderedWindows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator];
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
vout_thread_t *p_vout = getVout();
vout_thread_t *p_real_vout;
/* store to prefs */
config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
- pl_Release( VLCIntf );
-
o_config_changed = YES;
}
{
/* save the preferences to make sure that our module-changes will up on
* next launch again */
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
int returnedValue;
NSArray * theModules;
theModules = [[NSArray alloc] initWithObjects: @"main",
"extended control attribute '%s' (%i)",
[[theModules objectAtIndex: x] UTF8String] , returnedValue);
[theModules release];
- pl_Release( VLCIntf );
return;
}
msg_Dbg( VLCIntf, "VLCExtended: saved certain preferences successfully" );
[theModules release];
- pl_Release( VLCIntf );
}
@end
o_size_with_playlist = [o_window contentRectForFrameRect:[o_window frame]].size;
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
val.b_bool = false;
var_AddCallback( p_playlist, "fullscreen", FullscreenChanged, self);
var_AddCallback( p_intf->p_libvlc, "intf-show", ShowController, self);
- pl_Release( p_intf );
-
/* load our Core Dialogs nib */
nib_coredialogs_loaded = [NSBundle loadNibNamed:@"CoreDialogs" owner: NSApp];
/* Kill the playlist, so that it doesn't accept new request
* such as the play request from vlc.c (we are a blocking interface). */
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
vlc_object_kill( p_playlist );
- pl_Release( p_intf );
-
libvlc_Quit( p_intf->p_libvlc );
[self setIntf:nil];
var_DelCallback( p_playlist, "playlist-item-append", PlaylistChanged, self );
var_DelCallback( p_playlist, "playlist-item-deleted", PlaylistChanged, self );
- pl_Release( p_intf );
-
if( p_input ) vlc_object_release( p_input );
}
vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW );
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
var_AddCallback( p_playlist, "item-current", PlaylistChanged, self );
var_AddCallback( p_playlist, "intf-change", PlaylistChanged, self );
- (void)manageVolumeSlider
{
audio_volume_t i_volume;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
aout_VolumeGet( p_playlist, &i_volume );
- pl_Release( p_intf );
if( i_volume != i_lastShownVolume )
{
* the playlist or the selection is empty */
if( [self isPlaylistCollapsed] == YES )
{
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
PL_LOCK;
playlist_item_t * p_item = playlist_CurrentPlayingItem( p_playlist );
PL_UNLOCK;
if( p_item )
[[self info] updatePanelWithItem: p_item->p_input];
- pl_Release( p_intf );
}
}
if( p_intf->p_sys->b_intf_update )
bool b_seekable = false;
bool b_chapters = false;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
PL_LOCK;
b_plmul = playlist_CurrentSize( p_playlist ) > 1;
//b_chapters = p_input->stream.i_area_nb > 1;
vlc_object_release( p_input );
}
- pl_Release( p_intf );
if( b_buffering )
{
- (void)setupMenus
{
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
input_thread_t * p_input = playlist_CurrentInput( p_playlist );
if( p_input != NULL )
{
}
vlc_object_release( p_input );
}
- pl_Release( p_intf );
}
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification
- (void)resetScrollField
{
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
input_thread_t * p_input = playlist_CurrentInput( p_playlist );
i_end_scroll = -1;
[self setScrollField: o_temp stopAfter:-1];
[[[self controls] fspanel] setStreamTitle: o_temp];
vlc_object_release( p_input );
- pl_Release( p_intf );
return;
}
- pl_Release( p_intf );
[self setScrollField: _NS("VLC media player") stopAfter:-1];
}
default:
return;
}
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
p_input = playlist_CurrentInput( p_playlist );
if( p_input != NULL )
{
[o_embedded_window setTime: o_time position: f_updated];
vlc_object_release( p_input );
}
- pl_Release( p_intf );
}
- (IBAction)timeFieldWasClicked:(id)sender
}
- (void)awakeFromNib
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
[o_outline_view setTarget: self];
[o_outline_view setDelegate: self];
[o_outline_view setDataSource: self];
[o_outline_view_other setDataSource: self];
[o_outline_view_other setAllowsEmptySelection: NO];
- pl_Release( VLCIntf );
[self initStrings];
}
{
int i_return = 0;
playlist_item_t *p_item = NULL;
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
//assert( outlineView == o_outline_view );
if( !item )
if( p_item )
i_return = p_item->i_children;
- pl_Release( VLCIntf );
-
return i_return > 0 ? i_return : 0;
}
{
playlist_item_t *p_return = NULL, *p_item = NULL;
NSValue *o_value;
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
PL_LOCK;
if( item == nil )
p_return = p_item->pp_children[index];
PL_UNLOCK;
- pl_Release( VLCIntf );
-
o_value = [o_outline_dict objectForKey:[NSString stringWithFormat: @"%p", p_return]];
if( o_value == nil )
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
int i_return = 0;
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
PL_LOCK;
if( item == nil )
i_return = p_item->i_children;
}
PL_UNLOCK;
- pl_Release( VLCIntf );
return (i_return >= 0);
}
- (void)awakeFromNib
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
int i;
char ** ppsz_name;
char ** ppsz_services = vlc_sd_GetNames( VLCIntf, &ppsz_name );
if( !ppsz_services )
- {
- pl_Release( VLCIntf );
return;
- }
for( i = 0; ppsz_services[i]; i++ )
{
}
free( ppsz_services );
free( ppsz_name );
-
- pl_Release( VLCIntf );
}
- (void)searchfieldChanged:(NSNotification *)o_notification
[[[[VLCMain sharedInstance] wizard] playlistWizard] reloadOutlineView];
[[[[VLCMain sharedInstance] bookmarks] dataTable] reloadData];
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
PL_LOCK;
if( playlist_CurrentSize( p_playlist ) >= 2 )
}
}
PL_UNLOCK;
- pl_Release( VLCIntf );
[self outlineViewSelectionDidChange: nil];
}
- (void)playModeUpdated
{
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
bool loop = var_GetBool( p_playlist, "loop" );
bool repeat = var_GetBool( p_playlist, "repeat" );
[[[VLCMain sharedInstance] controls] repeatOff];
[[[VLCMain sharedInstance] controls] shuffle];
-
- pl_Release( VLCIntf );
}
- (void)outlineViewSelectionDidChange:(NSNotification *)notification
unsigned int j;
// FIXME: unsafe
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
playlist_item_t *p_item, *p_temp_item;
NSMutableArray *o_array = [NSMutableArray array];
if( p_item == NULL )
{
PL_UNLOCK;
- pl_Release( VLCIntf );
return;
}
[o_outline_view expandItem: o_item];
}
}
-
- pl_Release( VLCIntf );
}
/* Check if p_item is a child of p_node recursively. We need to check the item
locked:(BOOL)b_locked
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
playlist_item_t *p_temp_item = p_item;
if( p_node == p_item )
- {
- pl_Release( VLCIntf );
return YES;
- }
if( p_node->i_children < 1)
- {
- pl_Release( VLCIntf );
return NO;
- }
if ( p_temp_item )
{
else if ( i == p_playlist->all_items.i_size - 1 )
{
if(!b_locked) PL_UNLOCK;
- pl_Release( VLCIntf );
return NO;
}
}
if( p_temp_item == p_node )
{
if(!b_locked) PL_UNLOCK;
- pl_Release( VLCIntf );
return YES;
}
}
if(!b_locked) PL_UNLOCK;
}
-
- pl_Release( VLCIntf );
return NO;
}
- (IBAction)savePlaylist:(id)sender
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
NSSavePanel *o_save_panel = [NSSavePanel savePanel];
NSString * o_name = [NSString stringWithFormat: @"%@", _NS("Untitled")];
p_playlist->p_local_category, "export-html" );
}
}
- pl_Release( VLCIntf );
}
/* When called retrieves the selected outlineview row and plays that node or item */
- (IBAction)playItem:(id)sender
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
playlist_item_t *p_item;
playlist_item_t *p_node = NULL;
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_node, p_item );
}
PL_UNLOCK;
- pl_Release( p_intf );
}
- (void)playSidebarItem:(id)item
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
playlist_item_t *p_item;
playlist_item_t *p_node = NULL;
}
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Unlocked, p_node, p_item );
}
- pl_Release( p_intf );
}
- (IBAction)revealItemInFinder:(id)sender
int i_count;
NSMutableArray *o_to_preparse;
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
i_count = [o_to_preparse count];
}
}
}
- pl_Release( p_intf );
[self playlistUpdated];
}
int i_count;
NSMutableArray *o_to_preparse;
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
i_count = [o_to_preparse count];
playlist_AskForArtEnqueue( p_playlist, p_item->p_input );
}
}
- pl_Release( p_intf );
[self playlistUpdated];
}
{
NSMenuItem *o_mi = (NSMenuItem *)sender;
NSString *o_string = [o_mi representedObject];
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
if( !playlist_IsServicesDiscoveryLoaded( p_playlist, [o_string UTF8String] ) )
playlist_ServicesDiscoveryAdd( p_playlist, [o_string UTF8String] );
else
[o_mi setState: playlist_IsServicesDiscoveryLoaded( p_playlist,
[o_string UTF8String] ) ? YES : NO];
- pl_Release( VLCIntf );
[self playlistUpdated];
return;
}
o_to_delete = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
i_count = [o_to_delete count];
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
for( int i = 0; i < i_count; i++ )
{
}
[self playlistUpdated];
- pl_Release( p_intf );
}
- (IBAction)sortNodeByName:(id)sender
- (void)sortNode:(int)i_mode
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
playlist_item_t * p_item;
if( [o_outline_view selectedRow] > -1 )
p_item->p_parent, i_mode, ORDER_NORMAL );
}
PL_UNLOCK;
- pl_Release( VLCIntf );
[self playlistUpdated];
}
- (input_item_t *)createItem:(NSDictionary *)o_one_item
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
input_item_t *p_input;
int i;
p_input = input_item_New( p_playlist, [o_uri fileSystemRepresentation], o_name ? [o_name UTF8String] : NULL );
if( !p_input )
- {
- pl_Release( p_intf );
return NULL;
- }
if( o_options )
{
[[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL: o_true_file];
}
-
- pl_Release( p_intf );
return p_input;
}
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
{
int i_item;
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
PL_LOCK;
for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
PL_UNLOCK;
[self playlistUpdated];
- pl_Release( VLCIntf );
}
- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue
{
int i_item;
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
{
vlc_gc_decref( p_input );
}
[self playlistUpdated];
- pl_Release( VLCIntf );
}
- (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item
{
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
playlist_item_t *p_selected_item;
int i_current, i_selected_row;
else if( p_selected_item == p_item->pp_children[i_current] &&
b_selected_item_met == YES )
{
- pl_Release( VLCIntf );
return NULL;
}
else if( b_selected_item_met == YES &&
[o_current_author rangeOfString:[o_search_field
stringValue] options:NSCaseInsensitiveSearch].length ) )
{
- pl_Release( VLCIntf );
/*Adds the parent items in the result array as well, so that we can
expand the tree*/
return [NSMutableArray arrayWithObject: [NSValue
p_item->pp_children[i_current]];
if( o_result != NULL )
{
- pl_Release( VLCIntf );
[o_result insertObject: [NSValue valueWithPointer:
p_item->pp_children[i_current]] atIndex:0];
return o_result;
}
}
}
- pl_Release( VLCIntf );
return NULL;
}
- (IBAction)searchItem:(id)sender
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
id o_result;
unsigned int i;
[o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:i_row] byExtendingSelection:NO];
[o_outline_view scrollRowToVisible: i_row];
}
- pl_Release( VLCIntf );
}
- (IBAction)recursiveExpandNode:(id)sender
int i_mode, i_type = 0;
intf_thread_t *p_intf = VLCIntf;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
/* Check whether the selected table column header corresponds to a
sortable table column*/
if( !( o_tc == o_tc_name || o_tc == o_tc_author ) )
{
- pl_Release( p_intf );
return;
}
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
PL_UNLOCK;
- pl_Release( p_intf );
[self playlistUpdated];
o_tc_sortColumn = o_tc;
forTableColumn:(NSTableColumn *)tableColumn
item:(id)item
{
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
id o_playing_item;
{
[cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toNotHaveTrait:NSBoldFontMask]];
}
- pl_Release( VLCIntf );
}
- (id)playingItem
{
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
id o_playing_item;
[NSString stringWithFormat:@"%p", playlist_CurrentPlayingItem( p_playlist )]];
PL_UNLOCK;
- pl_Release( VLCIntf );
-
return o_playing_item;
}
- (IBAction)addNode:(id)sender
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW );
PL_LOCK;
p_playlist->p_local_category, 0, NULL );
PL_UNLOCK;
- pl_Release( VLCIntf );
-
[self playlistUpdated];
}
@end
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
{
id o_value = [super outlineView: outlineView child: index ofItem: item];
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
PL_LOCK;
if( playlist_CurrentSize( p_playlist ) >= 2 )
}
PL_UNLOCK;
- pl_Release( VLCIntf );
-
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
[o_value pointerValue]]];
return o_value;
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
{
unsigned int i;
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
/* First remove the items that were moved during the last drag & drop
operation */
[o_item pointerValue] == p_playlist->p_local_category ||
[o_item pointerValue] == p_playlist->p_ml_category )
{
- pl_Release( VLCIntf );
return NO;
}
/* Fill the items and nodes to move in 2 different arrays */
@"VLCPlaylistItemPboardType", nil] owner: self];
[pboard setData:[NSData data] forType:@"VLCPlaylistItemPboardType"];
- pl_Release( VLCIntf );
return YES;
}
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
{
- playlist_t *p_playlist = pl_Hold( VLCIntf );
+ playlist_t *p_playlist = pl_Get( VLCIntf );
NSPasteboard *o_pasteboard = [info draggingPasteboard];
if( !p_playlist ) return NSDragOperationNone;
if( index == NSOutlineViewDropOnItemIndex &&
((playlist_item_t *)[item pointerValue])->i_children == -1 )
{
- pl_Release( VLCIntf );
return NSDragOperationNone;
}
}
/* Don't allow on drop on playlist root element's child */
if( !item && index != NSOutlineViewDropOnItemIndex)
{
- pl_Release( VLCIntf );
return NSDragOperationNone;
}
if( !( ([self isItem: [item pointerValue] inNode: p_playlist->p_local_category checkItemExistence: NO] ||
( var_CreateGetBool( p_playlist, "media-library" ) && [self isItem: [item pointerValue] inNode: p_playlist->p_ml_category checkItemExistence: NO] ) ) || item == nil ) )
{
- pl_Release( VLCIntf );
return NSDragOperationNone;
}
[[o_nodes_array objectAtIndex: i] pointerValue]
checkItemExistence: NO] )
{
- pl_Release( VLCIntf );
return NSDragOperationNone;
}
}
- pl_Release( VLCIntf );
return NSDragOperationMove;
}
/* Drop from the Finder */
else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
{
- pl_Release( VLCIntf );
return NSDragOperationGeneric;
}
- pl_Release( VLCIntf );
return NSDragOperationNone;
}
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
NSPasteboard *o_pasteboard = [info draggingPasteboard];
/* Drag & Drop inside the playlist */
(This should never be true) */
if( p_new_parent->i_children < 0 )
{
- pl_Release( VLCIntf );
return NO;
}
[o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:i_row] byExtendingSelection:NO];
[o_outline_view scrollRowToVisible: i_row];
- pl_Release( VLCIntf );
return YES;
}
[self appendNodeArray:o_array inNode: p_node
atPos:index enqueue:YES];
}
- pl_Release( VLCIntf );
return YES;
}
- pl_Release( VLCIntf );
return NO;
}
@end
{
if( !input_item_IsPreparsed( p_item ) )
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
- playlist_PreparseEnqueue( p_playlist, p_item );
- pl_Release( VLCIntf );
+ playlist_PreparseEnqueue( pl_Get( VLCIntf ), p_item );
}
/* fill uri info */
input_item_SetDescription( p_item, utf8( o_description_txt ) );
input_item_SetLanguage( p_item, utf8( o_language_txt ) );
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
input_item_WriteMeta( VLC_OBJECT(p_playlist), p_item );
var_SetBool( p_playlist, "intf-change", true );
[self updatePanelWithItem: p_item];
- pl_Release( VLCIntf );
[o_saveMetaData_btn setEnabled: NO];
return;
- (IBAction)downloadCoverArt:(id)sender
{
- playlist_t * p_playlist = pl_Hold( VLCIntf );
+ playlist_t * p_playlist = pl_Get( VLCIntf );
if( p_item) playlist_AskForArtEnqueue( p_playlist, p_item );
- pl_Release( VLCIntf );
}
- (input_item_t *)item
- (void)enterFullscreen
{
/* Save the settings for next playing item */
- playlist_t * p_playlist = pl_Hold( p_real_vout );
+ playlist_t * p_playlist = pl_Get( p_real_vout );
var_SetBool( p_playlist, "fullscreen", true );
- pl_Release( p_real_vout );
}
- (void)leaveFullscreen
{
/* Save the settings for next playing item */
- playlist_t * p_playlist = pl_Hold( p_real_vout );
+ playlist_t * p_playlist = pl_Get( p_real_vout );
var_SetBool( p_playlist, "fullscreen", false );
- pl_Release( p_real_vout );
}
@end
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
int x = 0;
int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
x += 1;
}
- pl_Release( p_intf );
-
/* close the window, since we are done */
[o_wizard_window close];
}
{
vlc_object_release( p_sys->p_input );
}
- pl_Release( p_intf );
/* Close the ncurses interface */
endwin();
static void Run( intf_thread_t *p_intf )
{
intf_sys_t *p_sys = p_intf->p_sys;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
p_sys->p_playlist = p_playlist;
int i_key;
intf_sys_t *p_sys = p_intf->p_sys;
int i_ret = 1;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
if( p_sys->i_box_type == BOX_PLAYLIST )
{
}
end:
- pl_Release( p_intf );
return i_ret;
}
{
intf_sys_t *p_sys = p_intf->p_sys;
input_thread_t *p_input = p_sys->p_input;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
int y = 0;
int h;
int y_end;
refresh();
*t_last_refresh = time( 0 );
- pl_Release( p_intf );
}
static playlist_item_t *PlaylistGetRoot( intf_thread_t *p_intf )
{
intf_sys_t *p_sys = p_intf->p_sys;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
playlist_item_t *p_item;
switch( p_sys->i_current_view )
default:
p_item = p_playlist->p_root_onelevel;
}
- pl_Release( p_intf );
return p_item;
}
static void PlaylistRebuild( intf_thread_t *p_intf )
{
intf_sys_t *p_sys = p_intf->p_sys;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
PL_LOCK;
p_sys->b_need_update = false;
PL_UNLOCK;
-
- pl_Release( p_intf );
}
static void PlaylistAddNode( intf_thread_t *p_intf, playlist_item_t *p_node,
VLC_UNUSED(p_this); VLC_UNUSED(psz_variable);
VLC_UNUSED(oval); VLC_UNUSED(nval);
intf_thread_t *p_intf = (intf_thread_t *)param;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
p_intf->p_sys->b_need_update = true;
p_intf->p_sys->p_node = playlist_CurrentPlayingItem(p_playlist) ? playlist_CurrentPlayingItem(p_playlist)->p_parent : NULL;
- pl_Release( p_intf );
return VLC_SUCCESS;
}
* If it's neither of these, then return
*/
- playlist_t * p_playlist = pl_Hold( p_intf );
+ playlist_t * p_playlist = pl_Get( p_intf );
PL_LOCK;
if( playlist_CurrentPlayingItem(p_playlist) == NULL )
{
PL_UNLOCK;
- pl_Release( p_intf );
return;
}
if( psz_device == NULL )
{
- pl_Release( p_intf );
return;
}
}
free( psz_device );
- pl_Release( p_intf );
- return;
}
static int comp_dir_entries( const void *pp_dir_entry1,
static void PlayPause( intf_thread_t *p_intf )
{
input_thread_t *p_input = p_intf->p_sys->p_input;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
vlc_value_t val;
if( p_input )
}
else
playlist_Play( p_playlist );
-
- pl_Release( p_intf );
}
/****************************************************************************
{
/* Only if volume is set by user action on slider */
setMuted( false );
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
int i_res = i_sliderVolume * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;
aout_VolumeSet( p_playlist, i_res );
- pl_Release( p_intf );
}
/* libvlc changed value event slot */
{
/* Audio part */
audio_volume_t i_volume;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
aout_VolumeGet( p_playlist, &i_volume );
- pl_Release( p_intf );
i_volume = ( ( i_volume + 1 ) * VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);
int i_gauge = volumeSlider->value();
if ( !b_is_muted && /* do not show mute effect on volume (set to 0) */
/* libvlc mute/unmute event slot */
void SoundWidget::updateMuteStatus()
{
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
b_is_muted = aout_IsMuted( VLC_OBJECT(p_playlist) );
- pl_Release( p_intf );
SoundSlider *soundSlider = qobject_cast<SoundSlider *>(volumeSlider);
if( soundSlider )
void SoundWidget::setMuted( bool mute )
{
b_is_muted = mute;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
aout_SetMute( VLC_OBJECT(p_playlist), NULL, mute );
- pl_Release( p_intf );
}
bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
input_item_SetPublisher( p_input, qtu( publisher_text->text() ) );
input_item_SetDescription( p_input, qtu( description_text->text() ) );
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
input_item_WriteMeta( VLC_OBJECT(p_playlist), p_input );
- pl_Release( p_intf );
/* Reset the status of the mode. No need to emit any signal because parent
is the only caller */
{
if( hasInput() )
{
- playlist_t *p_playlist = pl_Hold( p_intf );
- playlist_AskForArtEnqueue( p_playlist, input_GetItem( p_input ) );
- pl_Release( p_intf );
+ playlist_AskForArtEnqueue( pl_Get(p_intf), input_GetItem( p_input ) );
}
else
{
p_input = NULL;
}
/* we are working as a dialogs provider */
- playlist_t *p_playlist = pl_Hold( p_intf );
- p_input = playlist_CurrentInput( p_playlist );
+ p_input = playlist_CurrentInput( pl_Get(p_intf) );
if( p_input )
{
emit inputChanged( p_input );
}
- pl_Release( p_intf );
}
}
p_intf->p_sys->b_isDialogProvider = isDialogProvider;
p_sys->p_popup_menu = NULL;
p_sys->p_mi = NULL;
- p_sys->p_playlist = pl_Hold( p_intf );
+ p_sys->p_playlist = pl_Get( p_intf );
/* */
vlc_sem_init (&ready, 0);
if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{
- pl_Release (p_sys->p_playlist);
delete p_sys;
return VLC_ENOMEM;
}
QVLCApp::triggerQuit();
vlc_join (p_sys->thread, NULL);
- pl_Release (p_this);
delete p_sys;
#ifdef Q_WS_X11
free (x11_display);
#endif
p_intf->p_sys->p_input = NULL;
- p_intf->p_sys->p_playlist = pl_Hold( p_intf );
- if( !p_intf->p_sys->p_playlist )
- {
- free( p_intf->p_sys );
- return VLC_EGENERIC;
- }
+ p_intf->p_sys->p_playlist = pl_Get( p_intf );
// Initialize "singleton" objects
p_intf->p_sys->p_logger = NULL;
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
vlc_cond_destroy( &p_intf->p_sys->vout_wait );
vlc_mutex_destroy( &p_intf->p_sys->vout_lock );
- pl_Release( p_intf->p_sys->p_playlist );
free( p_intf->p_sys );
return VLC_EGENERIC;
}
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
vlc_cond_destroy( &p_intf->p_sys->init_wait );
- if( p_intf->p_sys->p_playlist )
- pl_Release( p_this );
-
// Unsubscribe from messages bank
#if 0
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
if( p_intf != NULL )
{
- playlist_t *p_playlist = pl_Hold( p_this );
+ playlist_t *p_playlist = pl_Get( p_this );
PL_LOCK;
// Make sure the item is deleted afterwards
playlist_CurrentPlayingItem( p_playlist )->i_flags |= PLAYLIST_REMOVE_FLAG;
PL_UNLOCK;
- pl_Release( p_this );
-
var_SetString( p_intf, "skin-to-load", p_demux->psz_path );
vlc_object_release( p_intf );
}
vlc_mutex_init( &p_sys->lock );
vlc_cond_init( &p_sys->wait );
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
PL_LOCK;
var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
PL_UNLOCK;
- pl_Release( p_intf );
p_intf->pf_run = Run;
intf_thread_t *p_intf = ( intf_thread_t* ) p_this;
intf_sys_t *p_sys = p_intf->p_sys;
- p_playlist = pl_Hold( p_intf );
- if( p_playlist )
- {
-
- var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
+ p_playlist = pl_Get( p_intf );
+ var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
- p_input = playlist_CurrentInput( p_playlist );
- if ( p_input )
- {
- if( p_sys->b_state_cb )
- var_DelCallback( p_input, "intf-event", PlayingChange, p_intf );
-
- vlc_object_release( p_input );
- }
-
- pl_Release( p_intf );
+ p_input = playlist_CurrentInput( p_playlist );
+ if ( p_input )
+ {
+ if( p_sys->b_state_cb )
+ var_DelCallback( p_input, "intf-event", PlayingChange, p_intf );
+ vlc_object_release( p_input );
}
int i;
p_sys->b_meta_read = false;
p_sys->b_submit = false;
- p_playlist = pl_Hold( p_intf );
- p_input = playlist_CurrentInput( p_playlist );
+ p_input = playlist_CurrentInput( pl_Get( p_intf ) );
if( !p_input || p_input->b_dead )
- {
- pl_Release( p_intf );
return VLC_SUCCESS;
- }
-
- pl_Release( p_intf );
p_item = input_GetItem( p_input );
if( !p_item )
intf_sys_t *p_sys = p_this->p_sys;
- p_playlist = pl_Hold( p_this );
- p_input = playlist_CurrentInput( p_playlist );
+ p_input = playlist_CurrentInput( pl_Get( p_this ) );
if( !p_input )
- {
- pl_Release( p_this );
return( VLC_SUCCESS );
- }
-
- pl_Release( p_this );
p_item = input_GetItem( p_input );
if( !p_item )
return VLC_EGENERIC;
}
- p_sys->p_playlist = pl_Hold( p_intf );
+ p_sys->p_playlist = pl_Get( p_intf );
var_AddCallback( p_sys->p_playlist, "item-current", InputChange, p_intf );
return VLC_SUCCESS;
}
intf_sys_t *p_sys = p_intf->p_sys;
var_DelCallback( p_sys->p_playlist, "item-current", InputChange, p_intf );
- pl_Release( p_intf );
if( p_sys->p_input ) /* Do delete "state" after "item-changed"! */
{
input_thread_t *p_input_thread = demux_GetParentInput( p_demux );
input_item_t *p_current_input = input_GetItem( p_input_thread );
- playlist_t *p_playlist = pl_Hold( p_demux );
+ playlist_t *p_playlist = pl_Get( p_demux );
luaL_register( L, "vlc", p_reg_parse );
{
msg_Warn( p_demux, "Error while runing script %s, "
"function parse() not found", psz_filename );
- pl_Release( p_demux );
return VLC_EGENERIC;
}
msg_Warn( p_demux, "Error while runing script %s, "
"function parse(): %s", psz_filename,
lua_tostring( L, lua_gettop( L ) ) );
- pl_Release( p_demux );
return VLC_EGENERIC;
}
msg_Err( p_demux, "Script went completely foobar" );
vlc_object_release( p_input_thread );
- vlclua_release_playlist_internal( p_playlist );
return -1; /* Needed for correct operation of go back */
}
}
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
- vlclua_release_playlist_internal( p_playlist );
return p_input;
}
if( p_playlist )
{
vlclua_push_vlc_object( L, p_playlist, vlclua_gc_release );
+ vlc_object_hold( p_playlist );
}
else lua_pushnil( L );
- //vlclua_release_playlist_internal( p_playlist );
return 1;
}
playlist_t *vlclua_get_playlist_internal( lua_State *L )
{
vlc_object_t *p_this = vlclua_get_this( L );
- return pl_Hold( p_this );
-}
-
-void vlclua_release_playlist_internal( playlist_t *p_playlist )
-{
- vlc_object_release( p_playlist );
+ return pl_Get( p_this );
}
static int vlclua_playlist_prev( lua_State * L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Prev( p_playlist );
- vlclua_release_playlist_internal( p_playlist );
return 0;
}
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Next( p_playlist );
- vlclua_release_playlist_internal( p_playlist );
return 0;
}
int i_skip = luaL_checkint( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Skip( p_playlist, i_skip );
- vlclua_release_playlist_internal( p_playlist );
return 0;
}
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Play( p_playlist );
- vlclua_release_playlist_internal( p_playlist );
return 0;
}
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Pause( p_playlist );
- vlclua_release_playlist_internal( p_playlist );
return 0;
}
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Stop( p_playlist );
- vlclua_release_playlist_internal( p_playlist );
return 0;
}
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
playlist_Stop( p_playlist ); /* Isn't this already implied by Clear? */
playlist_Clear( p_playlist, pl_Unlocked );
- vlclua_release_playlist_internal( p_playlist );
return 0;
}
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "repeat" );
- vlclua_release_playlist_internal( p_playlist );
return i_ret;
}
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "loop" );
- vlclua_release_playlist_internal( p_playlist );
return i_ret;
}
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "random" );
- vlclua_release_playlist_internal( p_playlist );
return i_ret;
}
true, NULL,
playlist_ItemGetById( p_playlist, i_id ) );
PL_UNLOCK;
- vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
NULL, true );
- vlclua_release_playlist_internal( p_playlist );
lua_pushinteger( L, i_count );
return 1;
}
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
NULL, false );
- vlclua_release_playlist_internal( p_playlist );
lua_pushinteger( L, i_count );
return 1;
}
if( !p_item )
{
PL_UNLOCK;
- vlclua_release_playlist_internal( p_playlist );
return 0; /* Should we return an error instead? */
}
}
if( !p_item )
{
PL_UNLOCK;
- vlclua_release_playlist_internal( p_playlist );
return 0; /* Should we return an error instead? */
}
}
}
push_playlist_item( L, p_item );
PL_UNLOCK;
- vlclua_release_playlist_internal( p_playlist );
return 1;
}
playlist_LiveSearchUpdate( p_playlist, p_playlist->p_root, psz_string );
PL_UNLOCK;
push_playlist_item( L, p_playlist->p_root );
- vlclua_release_playlist_internal( p_playlist );
return 1;
}
#warning Indexing input items by ID is unsafe,
lua_pushinteger( L, id );
- vlclua_release_playlist_internal( p_playlist );
return 1;
}
int i_ret = playlist_RecursiveNodeSort( p_playlist, p_playlist->p_playing,
i_mode, i_type );
PL_UNLOCK;
- vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
break;
}
PL_UNLOCK;
- vlclua_release_playlist_internal( p_playlist );
return 1;
}
#define VLC_LUA_PLAYLIST_H
playlist_t *vlclua_get_playlist_internal( lua_State * );
-void vlclua_release_playlist_internal( playlist_t * );
#endif
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
char **ppsz_longnames;
char **ppsz_names = vlc_sd_GetNames( p_playlist, &ppsz_longnames );
- vlclua_release_playlist_internal( p_playlist );
if( !ppsz_names )
return 0;
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = playlist_ServicesDiscoveryAdd( p_playlist, psz_sd );
- vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
int i_ret = playlist_ServicesDiscoveryRemove( p_playlist, psz_sd );
- vlclua_release_playlist_internal( p_playlist );
return vlclua_push_ret( L, i_ret );
}
const char *psz_sd = luaL_checkstring( L, 1 );
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
lua_pushboolean( L, playlist_IsServicesDiscoveryLoaded( p_playlist, psz_sd ));
- vlclua_release_playlist_internal( p_playlist );
return 1;
}
int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX),
AOUT_VOLUME_MIN);
int i_ret = aout_VolumeSet( p_this, i_volume );
- vlclua_release_playlist_internal( p_this );
return vlclua_push_ret( L, i_ret );
}
lua_pushnumber( L, i_volume );
else
lua_pushnil( L );
- vlclua_release_playlist_internal( p_this );
return 1;
}
playlist_t *p_this = vlclua_get_playlist_internal( L );
aout_VolumeUp( p_this, luaL_optint( L, 1, 1 ), &i_volume );
lua_pushnumber( L, i_volume );
- vlclua_release_playlist_internal( p_this );
return 1;
}
playlist_t *p_this = vlclua_get_playlist_internal( L );
aout_VolumeDown( p_this, luaL_optint( L, 1, 1 ), &i_volume );
lua_pushnumber( L, i_volume );
- vlclua_release_playlist_internal( p_this );
return 1;
}
{
art_finder_t *p_finder = (art_finder_t *)p_this;
input_item_t *p_item = p_finder->p_item;
- playlist_t *p_playlist = pl_Hold( p_this );
- if( !p_playlist )
- return VLC_EGENERIC;
lua_State *L = init( p_this, p_item );
int i_ret = vlclua_scripts_batch_execute( p_this, "meta/art", &fetch_art, L, p_item );
lua_close( L );
- pl_Release( p_this );
return i_ret;
}
free( data_path );
p_sys->default_icon = (CFDataRef) readFile( buf );
- playlist_t *p_playlist = pl_Hold( p_intf );
- var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
- pl_Release( p_intf );
+ var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
RegisterToGrowl( p_this );
return VLC_SUCCESS;
[p_sys->p_pool release];
free( p_sys );
- playlist_t *p_playlist = pl_Hold( p_this );
- var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
- pl_Release( p_this );
+ var_DelCallback( pl_Get( p_this ), "item-current", ItemChange, p_this );
}
/*****************************************************************************
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
- playlist_t *p_playlist = pl_Hold( p_intf );
- var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
- pl_Release( p_intf );
+ var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
RegisterToGrowl( p_this );
return VLC_SUCCESS;
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
- playlist_t *p_playlist = pl_Hold( p_this );
- var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
- pl_Release( p_this );
+ var_DelCallback( pl_Get( p_this ), "item-current", ItemChange, p_this );
}
/*****************************************************************************
}
msg_Dbg( p_intf, "using format: %s", p_intf->p_sys->psz_format );
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );
var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
- pl_Release( p_intf );
return VLC_SUCCESS;
}
static void Close( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
- playlist_t *p_playlist = pl_Hold( p_this );
+ playlist_t *p_playlist = pl_Get( p_this );
/* clear the MSN stuff ... else it looks like we're still playing
* something although VLC (or the MSN plugin) is closed */
var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
- pl_Release( p_this );
/* Destroy structure */
free( p_intf->p_sys->psz_format );
}
/* */
- playlist_t *p_playlist = pl_Hold( p_intf );
- var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
- pl_Release( p_intf );
+ var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
return VLC_SUCCESS;
}
intf_thread_t *p_intf = ( intf_thread_t* ) p_this;
intf_sys_t *p_sys = p_intf->p_sys;
- playlist_t *p_playlist = pl_Hold( p_this );
- var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
- pl_Release( p_this );
+ var_DelCallback( pl_Get( p_this ), "item-current", ItemChange, p_this );
if( p_sys->notification )
{
VLC_UNUSED(psz);
notify_notification_close( notification, NULL );
- playlist_t *p_playlist = pl_Hold( p_object );
- playlist_Next( p_playlist );
- pl_Release( p_object );
+ playlist_Next( pl_Get( p_object ) );
}
/* libnotify callback, called when the "Previous" button is pressed */
VLC_UNUSED(psz);
notify_notification_close( notification, NULL );
- playlist_t *p_playlist = pl_Hold( p_object );
- playlist_Prev( p_playlist );
- pl_Release( p_object );
+ playlist_Prev( pl_Get( p_object ) );
}
static int Notify( vlc_object_t *p_this, const char *psz_temp, GdkPixbuf *pix,
p_intf->p_sys->i_id = -1;
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );
var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
- pl_Release( p_intf );
return VLC_SUCCESS;
}
static void Close( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
- playlist_t *p_playlist = pl_Hold( p_this );
+ playlist_t *p_playlist = pl_Get( p_this );
input_thread_t *p_input = NULL;
var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
var_DelCallback( p_input, "state", StateChange, p_intf );
vlc_object_release( p_input );
}
- pl_Release( p_this );
/* Clears the Presence message ... else it looks like we're still playing
* something although VLC (or the Telepathy plugin) is closed */
vlc_mutex_init( &p_sys->lock );
vlc_cond_init( &p_sys->cond );
// Add the callbacks
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
var_AddCallback( p_playlist, "item-current", PlaylistNext, p_this );
var_AddCallback( p_playlist, "item-change", PlaylistNext, p_this );
- pl_Release( p_intf );
p_sys->b_need_update = true;
p_intf->pf_run = Run;
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
- playlist_t *p_playlist = pl_Hold( p_intf );
+ playlist_t *p_playlist = pl_Get( p_intf );
var_DelCallback( p_playlist, "item-current", PlaylistNext, p_this );
var_DelCallback( p_playlist, "item-change", PlaylistNext, p_this );
- pl_Release( p_intf );
/* Uninitialize library */
xosd_destroy( p_intf->p_sys->p_osd );
// Compute the signal
cancel = vlc_savecancel();
- p_playlist = pl_Hold( p_intf );
+ p_playlist = pl_Get( p_intf );
PL_LOCK;
// If the playlist is empty don't do anything
if( playlist_IsEmpty( p_playlist ) )
{
PL_UNLOCK;
- pl_Release( p_intf );
continue;
}
{
psz_display = NULL;
PL_UNLOCK;
- pl_Release( p_intf );
continue;
}
input_item_t *p_input = p_item->p_input;
psz_display = strdup( p_input->psz_name );
}
PL_UNLOCK;
- pl_Release( p_intf );
/* Display */
xosd_display( p_intf->p_sys->p_osd, 0, /* first line */
*****************************************************************************/
static void AddStateVariableCallback(filter_t *p_filter)
{
- playlist_t *p_playlist = pl_Hold( p_filter );
- input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+ input_thread_t *p_input = playlist_CurrentInput( pl_Get( p_filter ) );
if(p_input)
{
var_AddCallback( p_input, "state", StateCallback, p_filter );
vlc_object_release( p_input );
}
- pl_Release( p_filter );
}
/*****************************************************************************
*****************************************************************************/
static void DelStateVariableCallback( filter_t *p_filter )
{
- playlist_t *p_playlist = pl_Hold( p_filter );
- input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+ input_thread_t *p_input = playlist_CurrentInput( pl_Get ( p_filter ) );
if(p_input)
{
var_DelCallback( p_input, "state", StateCallback, p_filter );
vlc_object_release( p_input );
}
- pl_Release( p_filter );
}
/* FIXME we should have a way to export variable to be saved */
if (ch_desktop) {
- playlist_t *p_playlist = pl_Hold(vd);
- if (p_playlist) {
- /* Modify playlist as well because the vout might have to be
- * restarted */
- var_Create(p_playlist, "direct3d-desktop", VLC_VAR_BOOL);
- var_SetBool(p_playlist, "direct3d-desktop", newval.b_bool);
- pl_Release(vd);
- }
+ playlist_t *p_playlist = pl_Get(vd);
+ /* Modify playlist as well because the vout might have to be
+ * restarted */
+ var_Create(p_playlist, "direct3d-desktop", VLC_VAR_BOOL);
+ var_SetBool(p_playlist, "direct3d-desktop", newval.b_bool);
}
return VLC_SUCCESS;
}
/* FIXME we should have a way to export variable to be saved */
if (ch_wallpaper) {
- playlist_t *p_playlist = pl_Hold(vd);
- if (p_playlist) {
- /* Modify playlist as well because the vout might have to be
- * restarted */
- var_Create(p_playlist, "video-wallpaper", VLC_VAR_BOOL);
- var_SetBool(p_playlist, "video-wallpaper", newval.b_bool);
- pl_Release(vd);
- }
+ playlist_t *p_playlist = pl_Get(vd);
+ /* Modify playlist as well because the vout might have to be
+ * restarted */
+ var_Create(p_playlist, "video-wallpaper", VLC_VAR_BOOL);
+ var_SetBool(p_playlist, "video-wallpaper", newval.b_bool);
}
return VLC_SUCCESS;
}
static char *TitleGet( vlc_object_t *p_this )
{
- playlist_t *pl = pl_Hold( p_this );
- if( !pl )
- return NULL;
-
- input_thread_t *p_input = playlist_CurrentInput( pl );
- pl_Release( p_this );
+ input_thread_t *p_input = playlist_CurrentInput( pl_Get( p_this ) );
if( !p_input )
return NULL;
static aout_instance_t *findAout (vlc_object_t *obj)
{
- playlist_t *pl = pl_Hold (obj->p_libvlc);
- if (pl == NULL)
- return NULL;
-
- input_thread_t *p_input = playlist_CurrentInput (pl);
- pl_Release (obj->p_libvlc);
+ input_thread_t *p_input = playlist_CurrentInput (pl_Get (obj));
if (p_input == NULL)
return NULL;
return;
}
- playlist_t *p_playlist = pl_Hold( p_input );
- if( !p_playlist )
- {
- free( psz_arturl );
- return;
- }
-
+ playlist_t *p_playlist = pl_Get( p_input );
if( input_item_IsArtFetched( p_item ) )
{
vlc_input_attachment_Delete( p_attachment );
exit:
- pl_Release( p_input );
free( psz_arturl );
}
if( psz_modules )
{
char *p = psz_modules, *m;
- playlist_t *p_playlist = pl_Hold( p_libvlc );
while( ( m = strsep( &p, " :," ) ) != NULL )
playlist_ServicesDiscoveryAdd( p_playlist, m );
free( psz_modules );
- pl_Release (p_libvlc);
}
#ifdef ENABLE_VLM
psz_val = var_InheritString( p_libvlc, "open" );
if ( psz_val != NULL )
{
- playlist_t *p_playlist = pl_Hold( p_libvlc );
playlist_AddExt( p_playlist, psz_val, NULL, PLAYLIST_INSERT, 0,
-1, 0, NULL, 0, true, pl_Unlocked );
- pl_Release( p_libvlc );
free( psz_val );
}
if( !mrl )
continue;
- playlist_t *p_playlist = pl_Hold( p_vlc );
- playlist_AddExt( p_playlist, mrl, NULL, PLAYLIST_INSERT,
+ playlist_AddExt( pl_Get( p_vlc ), mrl, NULL, PLAYLIST_INSERT,
0, -1, i_options, ( i_options ? &ppsz_argv[i_opt + 1] : NULL ),
VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked );
- pl_Release( p_vlc );
free( mrl );
}
playlist_TreeMove
playlist_TreeMoveMany
playlist_Unlock
-pl_Hold
-pl_Release
+pl_Get
resolve_xml_special_chars
sdp_AddAttribute
sdp_AddMedia
static vlc_mutex_t global_lock = VLC_STATIC_MUTEX;
-#undef pl_Hold
-playlist_t *pl_Hold (vlc_object_t *obj)
+#undef pl_Get
+playlist_t *pl_Get (vlc_object_t *obj)
{
playlist_t *pl;
libvlc_int_t *p_libvlc = obj->p_libvlc;
playlist_Activate (pl);
libvlc_priv (p_libvlc)->playlist_active = true;
}
-
- /* The playlist should hold itself with vlc_object_hold() if ever. */
- assert (VLC_OBJECT (pl) != obj);
- if (pl)
- vlc_object_hold (pl);
vlc_mutex_unlock (&global_lock);
return pl;
}
-#undef pl_Release
-void pl_Release( vlc_object_t *p_this )
-{
- playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist;
- assert( pl != NULL );
-
- /* The rule is that pl_Release() should act on
- the same object than pl_Hold() */
- assert( VLC_OBJECT(pl) != p_this);
-
- vlc_object_release( pl );
-}
-
void pl_Deactivate (libvlc_int_t *p_libvlc)
{
bool deactivate;
if( !dst ) return NULL;
int d = 0;
- playlist_t *p_playlist = pl_Hold( p_object );
- input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+ input_thread_t *p_input = playlist_CurrentInput( pl_Get(p_object) );
input_item_t *p_item = NULL;
- pl_Release( p_object );
if( p_input )
{
p_item = input_GetItem(p_input);
/* Ask to stop
* FIXME works only for input handled by the playlist
*/
- playlist_t *playlist = pl_Hold(vout);
- if (playlist) {
- playlist_Stop(playlist);
- pl_Release(vout);
- }
+ playlist_t *playlist = pl_Get(vout);
+ playlist_Stop(playlist);
}
static inline void vout_SendEventKey(vout_thread_t *vout, int key)
{
if( !p_this ) return 0;
/* Add files to the playlist */
- p_playlist = pl_Hold( p_this );
- if( !p_playlist ) return 0;
+ p_playlist = pl_Get( p_this );
if( pwm_data->lpData )
{
free( ppsz_argv );
}
-
- vlc_object_release( p_playlist );
}
return DefWindowProc( hwnd, uMsg, wParam, lParam );