Commit 7fef8b87 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* updated all files to yield the playlist instead of finding it

parent c77d5dcd
...@@ -63,24 +63,21 @@ ...@@ -63,24 +63,21 @@
{ {
vlc_value_t val; vlc_value_t val;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist )
{
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size <= 0 )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
[o_main intfOpenFileGeneric: (id)sender];
}
else
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
}
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size <= 0 )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
[o_main intfOpenFileGeneric: (id)sender];
}
else
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
} }
val.i_int = config_GetInt( p_intf, "key-play-pause" ); val.i_int = config_GetInt( p_intf, "key-play-pause" );
var_Set( p_intf->p_libvlc, "key-pressed", val ); var_Set( p_intf->p_libvlc, "key-pressed", val );
} }
...@@ -155,12 +152,7 @@ ...@@ -155,12 +152,7 @@
{ {
vlc_value_t val; vlc_value_t val;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "random", &val ); var_Get( p_playlist, "random", &val );
val.b_bool = !val.b_bool; val.b_bool = !val.b_bool;
...@@ -185,12 +177,7 @@ ...@@ -185,12 +177,7 @@
{ {
vlc_value_t val; vlc_value_t val;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "repeat", &val ); var_Get( p_playlist, "repeat", &val );
if (!val.b_bool) if (!val.b_bool)
...@@ -219,12 +206,7 @@ ...@@ -219,12 +206,7 @@
{ {
vlc_value_t val; vlc_value_t val;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "loop", &val ); var_Get( p_playlist, "loop", &val );
if (!val.b_bool) if (!val.b_bool)
...@@ -345,17 +327,17 @@ ...@@ -345,17 +327,17 @@
} }
else else
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( p_playlist && ( [o_title isEqualToString: _NS("Fullscreen")] || if( [o_title isEqualToString: _NS("Fullscreen")] ||
[sender isKindOfClass:[NSButton class]] ) ) [sender isKindOfClass:[NSButton class]] )
{ {
vlc_value_t val; vlc_value_t val;
var_Get( p_playlist, "fullscreen", &val ); var_Get( p_playlist, "fullscreen", &val );
var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool ); var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
} }
if( p_playlist ) vlc_object_release( (vlc_object_t *)p_playlist );
vlc_object_release( p_playlist );
} }
} }
...@@ -697,14 +679,9 @@ ...@@ -697,14 +679,9 @@
BOOL bEnabled = TRUE; BOOL bEnabled = TRUE;
vlc_value_t val; vlc_value_t val;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist != NULL ) vlc_mutex_lock( &p_playlist->object_lock );
{
vlc_mutex_lock( &p_playlist->object_lock );
}
else return FALSE;
#define p_input p_playlist->p_input #define p_input p_playlist->p_input
......
...@@ -87,12 +87,7 @@ ...@@ -87,12 +87,7 @@
- (BOOL)windowShouldClose:(id)sender - (BOOL)windowShouldClose:(id)sender
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return NO;
}
playlist_Stop( p_playlist ); playlist_Stop( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
......
...@@ -369,8 +369,7 @@ static VLCExtended *_o_sharedInstance = nil; ...@@ -369,8 +369,7 @@ static VLCExtended *_o_sharedInstance = nil;
id o_window = [NSApp keyWindow]; id o_window = [NSApp keyWindow];
NSArray *o_windows = [NSApp orderedWindows]; NSArray *o_windows = [NSApp orderedWindows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator]; NSEnumerator *o_enumerator = [o_windows objectEnumerator];
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
vout_thread_t *p_real_vout; vout_thread_t *p_real_vout;
...@@ -848,8 +847,7 @@ static VLCExtended *_o_sharedInstance = nil; ...@@ -848,8 +847,7 @@ static VLCExtended *_o_sharedInstance = nil;
{ {
/* save the preferences to make sure that our module-changes will up on /* save the preferences to make sure that our module-changes will up on
* next launch again */ * next launch again */
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
int returnedValue; int returnedValue;
NSArray * theModules; NSArray * theModules;
theModules = [[NSArray alloc] initWithObjects: @"main", @"headphone", theModules = [[NSArray alloc] initWithObjects: @"main", @"headphone",
......
...@@ -456,25 +456,22 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -456,25 +456,22 @@ static VLCMain *_o_sharedMainInstance = nil;
o_size_with_playlist = [o_window frame].size; o_size_with_playlist = [o_window frame].size;
p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); p_playlist = pl_Yield( p_intf );
if( p_playlist ) /* Check if we need to start playing */
if( p_intf->b_play )
{ {
/* Check if we need to start playing */ playlist_LockControl( p_playlist, PLAYLIST_AUTOPLAY );
if( p_intf->b_play ) }
{ var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
playlist_LockControl( p_playlist, PLAYLIST_AUTOPLAY ); val.b_bool = VLC_FALSE;
}
var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
val.b_bool = VLC_FALSE;
var_AddCallback( p_playlist, "fullscreen", FullscreenChanged, self); var_AddCallback( p_playlist, "fullscreen", FullscreenChanged, self);
var_AddCallback( p_playlist, "intf-show", ShowController, self); var_AddCallback( p_playlist, "intf-show", ShowController, self);
[o_embedded_window setFullscreen: var_GetBool( p_playlist, [o_embedded_window setFullscreen: var_GetBool( p_playlist,
"fullscreen" )]; "fullscreen" )];
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
}
var_Create( p_intf, "interaction", VLC_VAR_ADDRESS ); var_Create( p_intf, "interaction", VLC_VAR_ADDRESS );
var_AddCallback( p_intf, "interaction", InteractCallback, self ); var_AddCallback( p_intf, "interaction", InteractCallback, self );
...@@ -741,7 +738,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -741,7 +738,7 @@ static VLCMain *_o_sharedMainInstance = nil;
case kRemoteButtonVolume_Plus: case kRemoteButtonVolume_Plus:
/* there are two events when the plus or minus button is pressed /* there are two events when the plus or minus button is pressed
one when the button is pressed down and one when the button is released */ one when the button is pressed down and one when the button is released */
if (pressedDown) if( pressedDown )
{ {
[o_controls volumeUp: self]; [o_controls volumeUp: self];
} }
...@@ -749,7 +746,8 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -749,7 +746,8 @@ static VLCMain *_o_sharedMainInstance = nil;
case kRemoteButtonVolume_Minus: case kRemoteButtonVolume_Minus:
/* there are two events when the plus or minus button is pressed /* there are two events when the plus or minus button is pressed
one when the button is pressed down and one when the button is released */ one when the button is pressed down and one when the button is released */
if (pressedDown) { if( pressedDown )
{
[o_controls volumeDown: self]; [o_controls volumeDown: self];
} }
break; break;
...@@ -763,7 +761,8 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -763,7 +761,8 @@ static VLCMain *_o_sharedMainInstance = nil;
case kRemoteButtonLeft_Hold: case kRemoteButtonLeft_Hold:
/* simulate an event as long as the user holds the button */ /* simulate an event as long as the user holds the button */
b_left_right_remote_button_hold = pressedDown; b_left_right_remote_button_hold = pressedDown;
if (pressedDown) { if( pressedDown )
{
NSNumber* buttonIdentifierNumber = [NSNumber numberWithInt: buttonIdentifier]; NSNumber* buttonIdentifierNumber = [NSNumber numberWithInt: buttonIdentifier];
[self performSelector:@selector(triggerMovieStepForRemoteButton:) [self performSelector:@selector(triggerMovieStepForRemoteButton:)
withObject:buttonIdentifierNumber]; withObject:buttonIdentifierNumber];
...@@ -917,11 +916,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -917,11 +916,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (id)getPlaylist - (id)getPlaylist
{ {
if ( o_playlist ) return o_playlist;
{
return o_playlist;
}
return nil;
} }
- (id)getInfo - (id)getInfo
...@@ -999,19 +994,15 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -999,19 +994,15 @@ static VLCMain *_o_sharedMainInstance = nil;
vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW ); vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW );
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist != NULL ) var_AddCallback( p_playlist, "intf-change", PlaylistChanged, self );
{ var_AddCallback( p_playlist, "item-change", PlaylistChanged, self );
var_AddCallback( p_playlist, "intf-change", PlaylistChanged, self ); var_AddCallback( p_playlist, "item-append", PlaylistChanged, self );
var_AddCallback( p_playlist, "item-change", PlaylistChanged, self ); var_AddCallback( p_playlist, "item-deleted", PlaylistChanged, self );
var_AddCallback( p_playlist, "item-append", PlaylistChanged, self ); var_AddCallback( p_playlist, "playlist-current", PlaylistChanged, self );
var_AddCallback( p_playlist, "item-deleted", PlaylistChanged, self );
var_AddCallback( p_playlist, "playlist-current", PlaylistChanged, self );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
}
while( !p_intf->b_die ) while( !p_intf->b_die )
{ {
...@@ -1073,8 +1064,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1073,8 +1064,7 @@ static VLCMain *_o_sharedMainInstance = nil;
vlc_bool_t b_seekable = VLC_FALSE; vlc_bool_t b_seekable = VLC_FALSE;
vlc_bool_t b_chapters = VLC_FALSE; vlc_bool_t b_chapters = VLC_FALSE;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
b_plmul = p_playlist->i_size > 1; b_plmul = p_playlist->i_size > 1;
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -1122,8 +1112,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1122,8 +1112,7 @@ static VLCMain *_o_sharedMainInstance = nil;
if( p_intf->p_sys->b_fullscreen_update ) if( p_intf->p_sys->b_fullscreen_update )
{ {
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
var_Get( p_playlist, "fullscreen", &val ); var_Get( p_playlist, "fullscreen", &val );
[o_embedded_window setFullscreen: val.b_bool]; [o_embedded_window setFullscreen: val.b_bool];
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -1146,11 +1135,11 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1146,11 +1135,11 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
NSString *o_temp; NSString *o_temp;
vout_thread_t *p_vout; vout_thread_t *p_vout;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL || p_playlist->status.p_item == NULL ) if( p_playlist->status.p_item == NULL )
{ {
vlc_object_release( p_playlist );
return; return;
} }
o_temp = [NSString stringWithUTF8String: o_temp = [NSString stringWithUTF8String:
...@@ -1344,12 +1333,8 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1344,12 +1333,8 @@ static VLCMain *_o_sharedMainInstance = nil;
if( p_intf->p_sys->p_input && !p_intf->p_sys->p_input->b_die ) if( p_intf->p_sys->p_input && !p_intf->p_sys->p_input->b_die )
{ {
NSString *o_temp; NSString *o_temp;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
o_temp = [NSString stringWithUTF8String: o_temp = [NSString stringWithUTF8String:
p_playlist->status.p_item->p_input->psz_name]; p_playlist->status.p_item->p_input->psz_name];
if( o_temp == NULL ) if( o_temp == NULL )
...@@ -1536,12 +1521,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1536,12 +1521,9 @@ static VLCMain *_o_sharedMainInstance = nil;
#undef p_input #undef p_input
/* Stop playback */ /* Stop playback */
if( ( p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE ) ) ) playlist_Stop( p_playlist );
{ vlc_object_release( p_playlist );
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
/* FIXME - Wait here until all vouts are terminated because /* FIXME - Wait here until all vouts are terminated because
libvlc's VLC_CleanUp destroys interfaces before vouts, which isn't libvlc's VLC_CleanUp destroys interfaces before vouts, which isn't
...@@ -1647,7 +1629,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1647,7 +1629,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenFile:(id)sender - (IBAction)intfOpenFile:(id)sender
{ {
if (!nib_open_loaded) if ( !nib_open_loaded )
{ {
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self]; nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib]; [o_open awakeFromNib];
...@@ -1659,7 +1641,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1659,7 +1641,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenFileGeneric:(id)sender - (IBAction)intfOpenFileGeneric:(id)sender
{ {
if (!nib_open_loaded) if ( !nib_open_loaded )
{ {
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self]; nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib]; [o_open awakeFromNib];
...@@ -1671,7 +1653,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1671,7 +1653,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenDisc:(id)sender - (IBAction)intfOpenDisc:(id)sender
{ {
if (!nib_open_loaded) if ( !nib_open_loaded )
{ {
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self]; nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib]; [o_open awakeFromNib];
...@@ -1683,7 +1665,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1683,7 +1665,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)intfOpenNet:(id)sender - (IBAction)intfOpenNet:(id)sender
{ {
if (!nib_open_loaded) if ( !nib_open_loaded )
{ {
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self]; nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
[o_open awakeFromNib]; [o_open awakeFromNib];
...@@ -1695,7 +1677,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1695,7 +1677,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)showWizard:(id)sender - (IBAction)showWizard:(id)sender
{ {
if (!nib_wizard_loaded) if ( !nib_wizard_loaded )
{ {
nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self]; nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
[o_wizard initStrings]; [o_wizard initStrings];
...@@ -1713,7 +1695,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1713,7 +1695,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
o_extended = [[VLCExtended alloc] init]; o_extended = [[VLCExtended alloc] init];
} }
if (!nib_extended_loaded) if ( !nib_extended_loaded )
{ {
nib_extended_loaded = [NSBundle loadNibNamed:@"Extended" owner:self]; nib_extended_loaded = [NSBundle loadNibNamed:@"Extended" owner:self];
[o_extended initStrings]; [o_extended initStrings];
...@@ -1729,7 +1711,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1729,7 +1711,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
o_sfilters = [[VLCsFilters alloc] init]; o_sfilters = [[VLCsFilters alloc] init];
} }
if (!nib_sfilters_loaded) if ( !nib_sfilters_loaded )
{ {
nib_sfilters_loaded = [NSBundle loadNibNamed:@"SFilters" owner:self]; nib_sfilters_loaded = [NSBundle loadNibNamed:@"SFilters" owner:self];
[o_sfilters initStrings]; [o_sfilters initStrings];
...@@ -1742,13 +1724,13 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1742,13 +1724,13 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)showBookmarks:(id)sender - (IBAction)showBookmarks:(id)sender
{ {
/* we need the wizard-nib for the bookmarks's extract functionality */ /* we need the wizard-nib for the bookmarks's extract functionality */
if (!nib_wizard_loaded) if ( !nib_wizard_loaded )
{ {
nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self]; nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
[o_wizard initStrings]; [o_wizard initStrings];
} }
if (!nib_bookmarks_loaded) if ( !nib_bookmarks_loaded )
{ {
nib_bookmarks_loaded = [NSBundle loadNibNamed:@"Bookmarks" owner:self]; nib_bookmarks_loaded = [NSBundle loadNibNamed:@"Bookmarks" owner:self];
[o_bookmarks showBookmarks]; [o_bookmarks showBookmarks];
...@@ -1759,7 +1741,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1759,7 +1741,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)viewAbout:(id)sender - (IBAction)viewAbout:(id)sender
{ {
if (!nib_about_loaded) if ( !nib_about_loaded )
{ {
nib_about_loaded = [NSBundle loadNibNamed:@"About" owner:self]; nib_about_loaded = [NSBundle loadNibNamed:@"About" owner:self];
[o_about showPanel]; [o_about showPanel];
...@@ -1778,7 +1760,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1778,7 +1760,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (IBAction)checkForUpdate:(id)sender - (IBAction)checkForUpdate:(id)sender
{ {
if (!nib_update_loaded) if ( !nib_update_loaded )
{ {
nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner:self]; nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner:self];
[o_update showUpdateWindow]; [o_update showUpdateWindow];
......
...@@ -114,8 +114,7 @@ ...@@ -114,8 +114,7 @@
} }
- (void)awakeFromNib - (void)awakeFromNib
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
[o_outline_view setTarget: self]; [o_outline_view setTarget: self];
[o_outline_view setDelegate: self]; [o_outline_view setDelegate: self];
[o_outline_view setDataSource: self]; [o_outline_view setDataSource: self];
...@@ -151,10 +150,7 @@ ...@@ -151,10 +150,7 @@
{ {
int i_return = 0; int i_return = 0;
playlist_item_t *p_item = NULL; playlist_item_t *p_item = NULL;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( p_playlist == NULL )
return 0;
if( outlineView != o_outline_view ) if( outlineView != o_outline_view )
{ {
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -185,11 +181,7 @@ NSLog( @"%d children for %s", i_return, p_item->p_input->psz_name ); ...@@ -185,11 +181,7 @@ NSLog( @"%d children for %s", i_return, p_item->p_input->psz_name );
{ {
playlist_item_t *p_return = NULL, *p_item = NULL; playlist_item_t *p_return = NULL, *p_item = NULL;
NSValue *o_value; NSValue *o_value;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( p_playlist == NULL )
return nil;
if( item == nil ) if( item == nil )
{ {
...@@ -206,11 +198,13 @@ NSLog( @"%d children for %s", i_return, p_item->p_input->psz_name ); ...@@ -206,11 +198,13 @@ NSLog( @"%d children for %s", i_return, p_item->p_input->psz_name );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
o_value = [o_outline_dict objectForKey:[NSString stringWithFormat: @"%p", p_return]]; o_value = [o_outline_dict objectForKey:[NSString stringWithFormat: @"%p", p_return]];
#if 0
NSLog( @"%s", p_return->p_input->psz_name); NSLog( @"%s", p_return->p_input->psz_name);
#endif
if( o_value == nil ) if( o_value == nil )
{ {
o_value = [[NSValue valueWithPointer: p_return] retain]; o_value = [[NSValue valueWithPointer: p_return] retain];
NSLog( @"error missing value" ); msg_Err( VLCIntf, @"missing playlist item's pointer value" );
} }
return o_value; return o_value;
} }
...@@ -219,10 +213,7 @@ NSLog( @"%d children for %s", i_return, p_item->p_input->psz_name ); ...@@ -219,10 +213,7 @@ NSLog( @"%d children for %s", i_return, p_item->p_input->psz_name );
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{ {
int i_return = 0; int i_return = 0;
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( p_playlist == NULL )
return NO;
if( item == nil ) if( item == nil )
{ {
...@@ -252,16 +243,10 @@ NSLog( @"expandable" ); ...@@ -252,16 +243,10 @@ NSLog( @"expandable" );
{ {
id o_value = nil; id o_value = nil;
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
playlist_t *p_playlist;
playlist_item_t *p_item; playlist_item_t *p_item;
if( item == nil || ![item isKindOfClass: [NSValue class]] ) return( @"error" ); if( item == nil || ![item isKindOfClass: [NSValue class]] ) return( @"error" );
/* Check to see if the playlist is present */
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL ) return( @"error");
vlc_object_release( p_playlist);
p_item = (playlist_item_t *)[item pointerValue]; p_item = (playlist_item_t *)[item pointerValue];
if( p_item == NULL ) if( p_item == NULL )
{ {
...@@ -354,8 +339,7 @@ NSLog( @"expandable" ); ...@@ -354,8 +339,7 @@ NSLog( @"expandable" );
- (void)awakeFromNib - (void)awakeFromNib
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
vlc_list_t *p_list = vlc_list_find( p_playlist, VLC_OBJECT_MODULE, vlc_list_t *p_list = vlc_list_find( p_playlist, VLC_OBJECT_MODULE,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -478,10 +462,7 @@ NSLog( @"expandable" ); ...@@ -478,10 +462,7 @@ NSLog( @"expandable" );
[[[[VLCMain sharedInstance] getWizard] getPlaylistWizard] reloadOutlineView]; [[[[VLCMain sharedInstance] getWizard] getPlaylistWizard] reloadOutlineView];
[[[[VLCMain sharedInstance] getBookmarks] getDataTable] reloadData]; [[[[VLCMain sharedInstance] getBookmarks] getDataTable] reloadData];
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if(! p_playlist )
return;
if( p_playlist->i_size >= 2 ) if( p_playlist->i_size >= 2 )
{ {
...@@ -504,15 +485,9 @@ NSLog( @"expandable" ); ...@@ -504,15 +485,9 @@ NSLog( @"expandable" );
- (void)playModeUpdated - (void)playModeUpdated
{ {
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
vlc_value_t val, val2; vlc_value_t val, val2;
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "loop", &val2 ); var_Get( p_playlist, "loop", &val2 );
var_Get( p_playlist, "repeat", &val ); var_Get( p_playlist, "repeat", &val );
if( val.b_bool == VLC_TRUE ) if( val.b_bool == VLC_TRUE )
...@@ -539,14 +514,10 @@ NSLog( @"expandable" ); ...@@ -539,14 +514,10 @@ NSLog( @"expandable" );
int i_row; int i_row;
unsigned int j; unsigned int j;
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
playlist_item_t *p_item, *p_temp_item; playlist_item_t *p_item, *p_temp_item;
NSMutableArray *o_array = [NSMutableArray array]; NSMutableArray *o_array = [NSMutableArray array];
if( p_playlist == NULL )
return;
p_item = p_playlist->status.p_item; p_item = p_playlist->status.p_item;
if( p_item == NULL ) if( p_item == NULL )
{ {
...@@ -587,7 +558,7 @@ NSLog( @"expandable" ); ...@@ -587,7 +558,7 @@ NSLog( @"expandable" );
[o_outline_view selectRow: i_row byExtendingSelection: NO]; [o_outline_view selectRow: i_row byExtendingSelection: NO];
[o_outline_view scrollRowToVisible: i_row]; [o_outline_view scrollRowToVisible: i_row];
vlc_object_release(p_playlist); vlc_object_release( p_playlist );
/* update our info-panel to reflect the new item */ /* update our info-panel to reflect the new item */
[[[VLCMain sharedInstance] getInfo] updatePanel]; [[[VLCMain sharedInstance] getInfo] updatePanel];
...@@ -602,15 +573,9 @@ NSLog( @"expandable" ); ...@@ -602,15 +573,9 @@ NSLog( @"expandable" );
checkItemExistence:(BOOL)b_check checkItemExistence:(BOOL)b_check
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
playlist_item_t *p_temp_item = p_item; playlist_item_t *p_temp_item = p_item;
if( p_playlist == NULL )
{
return NO;
}
if( p_node == p_item ) if( p_node == p_item )
{ {
vlc_object_release(p_playlist); vlc_object_release(p_playlist);
...@@ -693,8 +658,7 @@ NSLog( @"expandable" ); ...@@ -693,8 +658,7 @@ NSLog( @"expandable" );
- (IBAction)savePlaylist:(id)sender - (IBAction)savePlaylist:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
NSSavePanel *o_save_panel = [NSSavePanel savePanel]; NSSavePanel *o_save_panel = [NSSavePanel savePanel];
NSString * o_name = [NSString stringWithFormat: @"%@", _NS("Untitled")]; NSString * o_name = [NSString stringWithFormat: @"%@", _NS("Untitled")];
...@@ -757,39 +721,35 @@ NSLog( @"expandable" ); ...@@ -757,39 +721,35 @@ NSLog( @"expandable" );
- (IBAction)playItem:(id)sender - (IBAction)playItem:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist != NULL ) playlist_item_t *p_item;
{ playlist_item_t *p_node = NULL;
playlist_item_t *p_item;
playlist_item_t *p_node = NULL;
p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue]; p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
if( p_item ) if( p_item )
{
if( p_item->i_children == -1 )
{ {
if( p_item->i_children == -1 ) p_node = p_item->p_parent;
{
p_node = p_item->p_parent;
}
else
{
p_node = p_item;
if( p_node->i_children > 0 && p_node->pp_children[0]->i_children == -1 )
{
p_item = p_node->pp_children[0];
} }
else else
{ {
p_node = p_item; p_item = NULL;
if( p_node->i_children > 0 && p_node->pp_children[0]->i_children == -1 )
{
p_item = p_node->pp_children[0];
}
else
{
p_item = NULL;
}
} }
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_node, p_item );
} }
vlc_object_release( p_playlist ); playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_node, p_item );
} }
vlc_object_release( p_playlist );
} }
/* When called retrieves the selected outlineview row and plays that node or item */ /* When called retrieves the selected outlineview row and plays that node or item */
...@@ -798,40 +758,36 @@ NSLog( @"expandable" ); ...@@ -798,40 +758,36 @@ NSLog( @"expandable" );
int i_count; int i_count;
NSMutableArray *o_to_preparse; NSMutableArray *o_to_preparse;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]]; o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
i_count = [o_to_preparse count]; i_count = [o_to_preparse count];
if( p_playlist != NULL ) int i, i_row;
NSNumber *o_number;
playlist_item_t *p_item = NULL;
for( i = 0; i < i_count; i++ )
{ {
int i, i_row; o_number = [o_to_preparse lastObject];
NSNumber *o_number; i_row = [o_number intValue];
playlist_item_t *p_item = NULL; p_item = [[o_outline_view itemAtRow:i_row] pointerValue];
[o_to_preparse removeObject: o_number];
[o_outline_view deselectRow: i_row];
for( i = 0; i < i_count; i++ ) if( p_item )
{ {
o_number = [o_to_preparse lastObject]; if( p_item->i_children == -1 )
i_row = [o_number intValue];
p_item = [[o_outline_view itemAtRow:i_row] pointerValue];
[o_to_preparse removeObject: o_number];
[o_outline_view deselectRow: i_row];
if( p_item )
{ {
if( p_item->i_children == -1 ) playlist_PreparseEnqueue( p_playlist, p_item->p_input );
{ }
playlist_PreparseEnqueue( p_playlist, p_item->p_input ); else
} {
else msg_Dbg( p_intf, "preparse of nodes not yet implemented" );
{
msg_Dbg( p_intf, "preparse of nodes not yet implemented" );
}
} }
} }
vlc_object_release( p_playlist );
} }
vlc_object_release( p_playlist );
[self playlistUpdated]; [self playlistUpdated];
} }
...@@ -839,8 +795,7 @@ NSLog( @"expandable" ); ...@@ -839,8 +795,7 @@ NSLog( @"expandable" );
{ {
NSMenuItem *o_mi = (NSMenuItem *)sender; NSMenuItem *o_mi = (NSMenuItem *)sender;
NSString *o_string = [o_mi representedObject]; NSString *o_string = [o_mi representedObject];
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( !playlist_IsServicesDiscoveryLoaded( p_playlist, [o_string cString] ) ) if( !playlist_IsServicesDiscoveryLoaded( p_playlist, [o_string cString] ) )
playlist_ServicesDiscoveryAdd( p_playlist, [o_string cString] ); playlist_ServicesDiscoveryAdd( p_playlist, [o_string cString] );
else else
...@@ -868,13 +823,8 @@ NSLog( @"expandable" ); ...@@ -868,13 +823,8 @@ NSLog( @"expandable" );
playlist_t * p_playlist; playlist_t * p_playlist;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if ( p_playlist == NULL )
{
return;
}
o_to_delete = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]]; o_to_delete = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
i_count = [o_to_delete count]; i_count = [o_to_delete count];
...@@ -924,15 +874,9 @@ NSLog( @"expandable" ); ...@@ -924,15 +874,9 @@ NSLog( @"expandable" );
- (void)sortNode:(int)i_mode - (void)sortNode:(int)i_mode
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
playlist_item_t * p_item; playlist_item_t * p_item;
if (p_playlist == NULL)
{
return;
}
if( [o_outline_view selectedRow] > -1 ) if( [o_outline_view selectedRow] > -1 )
{ {
p_item = [[o_outline_view itemAtRow: [o_outline_view selectedRow]] p_item = [[o_outline_view itemAtRow: [o_outline_view selectedRow]]
...@@ -964,13 +908,8 @@ NSLog( @"expandable" ); ...@@ -964,13 +908,8 @@ NSLog( @"expandable" );
- (input_item_t *)createItem:(NSDictionary *)o_one_item - (input_item_t *)createItem:(NSDictionary *)o_one_item
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return NULL;
}
input_item_t *p_input; input_item_t *p_input;
int i; int i;
BOOL b_rem = FALSE, b_dir = FALSE; BOOL b_rem = FALSE, b_dir = FALSE;
...@@ -1056,12 +995,7 @@ NSLog( @"expandable" ); ...@@ -1056,12 +995,7 @@ NSLog( @"expandable" );
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
{ {
int i_item; int i_item;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( i_item = 0; i_item < (int)[o_array count]; i_item++ ) for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
{ {
...@@ -1100,12 +1034,7 @@ NSLog( @"expandable" ); ...@@ -1100,12 +1034,7 @@ NSLog( @"expandable" );
- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue - (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue
{ {
int i_item; int i_item;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( i_item = 0; i_item < (int)[o_array count]; i_item++ ) for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
{ {
...@@ -1149,12 +1078,7 @@ NSLog( @"expandable" ); ...@@ -1149,12 +1078,7 @@ NSLog( @"expandable" );
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
vlc_value_t val1,val2; vlc_value_t val1,val2;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
switch( [o_loop_popup indexOfSelectedItem] ) switch( [o_loop_popup indexOfSelectedItem] )
{ {
...@@ -1193,14 +1117,10 @@ NSLog( @"expandable" ); ...@@ -1193,14 +1117,10 @@ NSLog( @"expandable" );
- (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item - (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item
{ {
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
playlist_item_t *p_selected_item; playlist_item_t *p_selected_item;
int i_current, i_selected_row; int i_current, i_selected_row;
if( !p_playlist )
return NULL;
i_selected_row = [o_outline_view selectedRow]; i_selected_row = [o_outline_view selectedRow];
if (i_selected_row < 0) if (i_selected_row < 0)
i_selected_row = 0; i_selected_row = 0;
...@@ -1264,8 +1184,7 @@ NSLog( @"expandable" ); ...@@ -1264,8 +1184,7 @@ NSLog( @"expandable" );
- (IBAction)searchItem:(id)sender - (IBAction)searchItem:(id)sender
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
id o_result; id o_result;
unsigned int i; unsigned int i;
...@@ -1273,9 +1192,6 @@ NSLog( @"expandable" ); ...@@ -1273,9 +1192,6 @@ NSLog( @"expandable" );
b_selected_item_met = NO; b_selected_item_met = NO;
if( p_playlist == NULL )
return;
/*First, only search after the selected item:* /*First, only search after the selected item:*
*(b_selected_item_met = NO) */ *(b_selected_item_met = NO) */
o_result = [self subSearchItem:p_playlist->p_root_category]; o_result = [self subSearchItem:p_playlist->p_root_category];
...@@ -1360,12 +1276,7 @@ NSLog( @"expandable" ); ...@@ -1360,12 +1276,7 @@ NSLog( @"expandable" );
int i_mode = 0, i_type; int i_mode = 0, i_type;
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
/* Check whether the selected table column header corresponds to a /* Check whether the selected table column header corresponds to a
sortable table column*/ sortable table column*/
...@@ -1430,13 +1341,10 @@ NSLog( @"expandable" ); ...@@ -1430,13 +1341,10 @@ NSLog( @"expandable" );
forTableColumn:(NSTableColumn *)tableColumn forTableColumn:(NSTableColumn *)tableColumn
item:(id)item item:(id)item
{ {
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
id o_playing_item; id o_playing_item;
if( !p_playlist ) return;
o_playing_item = [o_outline_dict objectForKey: o_playing_item = [o_outline_dict objectForKey:
[NSString stringWithFormat:@"%p", p_playlist->status.p_item]]; [NSString stringWithFormat:@"%p", p_playlist->status.p_item]];
...@@ -1468,15 +1376,9 @@ NSLog( @"expandable" ); ...@@ -1468,15 +1376,9 @@ NSLog( @"expandable" );
NSAutoreleasePool * ourPool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * ourPool = [[NSAutoreleasePool alloc] init];
/* simply adds a new node to the end of the playlist */ /* simply adds a new node to the end of the playlist */
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW ); vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW );
if( !p_playlist )
{
return;
}
int ret_v; int ret_v;
char *psz_name = NULL; char *psz_name = NULL;
playlist_item_t * p_item; playlist_item_t * p_item;
...@@ -1503,10 +1405,10 @@ NSLog( @"expandable" ); ...@@ -1503,10 +1405,10 @@ NSLog( @"expandable" );
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
{ {
id o_value = [super outlineView: outlineView child: index ofItem: item]; id o_value = [super outlineView: outlineView child: index ofItem: item];
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
if( !p_playlist ) return nil; /* FIXME: playlist->i_size doesn't provide the correct number of items anymore
* check the playlist API for the fixed function, once zorglub implemented it -- fpk, 9/17/06 */
if( p_playlist->i_size >= 2 ) if( p_playlist->i_size >= 2 )
{ {
...@@ -1528,7 +1430,7 @@ NSLog( @"expandable" ); ...@@ -1528,7 +1430,7 @@ NSLog( @"expandable" );
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p", [o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
[o_value pointerValue]]]; [o_value pointerValue]]];
NSLog( @"add item %p", [o_value pointerValue] ); msg_Dbg( VLCIntf, "adding item %p", [o_value pointerValue] );
return o_value; return o_value;
} }
...@@ -1537,16 +1439,13 @@ NSLog( @"add item %p", [o_value pointerValue] ); ...@@ -1537,16 +1439,13 @@ NSLog( @"add item %p", [o_value pointerValue] );
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
{ {
unsigned int i; unsigned int i;
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
/* First remove the items that were moved during the last drag & drop /* First remove the items that were moved during the last drag & drop
operation */ operation */
[o_items_array removeAllObjects]; [o_items_array removeAllObjects];
[o_nodes_array removeAllObjects]; [o_nodes_array removeAllObjects];
if( !p_playlist ) return NO;
for( i = 0 ; i < [items count] ; i++ ) for( i = 0 ; i < [items count] ; i++ )
{ {
id o_item = [items objectAtIndex: i]; id o_item = [items objectAtIndex: i];
...@@ -1584,8 +1483,7 @@ NSLog( @"add item %p", [o_value pointerValue] ); ...@@ -1584,8 +1483,7 @@ NSLog( @"add item %p", [o_value pointerValue] );
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
{ {
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
NSPasteboard *o_pasteboard = [info draggingPasteboard]; NSPasteboard *o_pasteboard = [info draggingPasteboard];
if( !p_playlist ) return NSDragOperationNone; if( !p_playlist ) return NSDragOperationNone;
...@@ -1626,28 +1524,25 @@ NSLog( @"add item %p", [o_value pointerValue] ); ...@@ -1626,28 +1524,25 @@ NSLog( @"add item %p", [o_value pointerValue] );
return NSDragOperationNone; return NSDragOperationNone;
} }
} }
vlc_object_release(p_playlist); vlc_object_release( p_playlist );
return NSDragOperationMove; return NSDragOperationMove;
} }
/* Drop from the Finder */ /* Drop from the Finder */
else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] ) else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
{ {
vlc_object_release(p_playlist); vlc_object_release( p_playlist );
return NSDragOperationGeneric; return NSDragOperationGeneric;
} }
vlc_object_release(p_playlist); vlc_object_release( p_playlist );
return NSDragOperationNone; return NSDragOperationNone;
} }
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index
{ {
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( VLCIntf );
FIND_ANYWHERE );
NSPasteboard *o_pasteboard = [info draggingPasteboard]; NSPasteboard *o_pasteboard = [info draggingPasteboard];
if( !p_playlist ) return NO;
/* Drag & Drop inside the playlist */ /* Drag & Drop inside the playlist */
if( [[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] ) if( [[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] )
{ {
...@@ -1733,7 +1628,7 @@ NSLog( @"add item %p", [o_value pointerValue] ); ...@@ -1733,7 +1628,7 @@ NSLog( @"add item %p", [o_value pointerValue] );
[o_outline_view selectRow: i_row byExtendingSelection: NO]; [o_outline_view selectRow: i_row byExtendingSelection: NO];
[o_outline_view scrollRowToVisible: i_row]; [o_outline_view scrollRowToVisible: i_row];
vlc_object_release(p_playlist); vlc_object_release( p_playlist );
return YES; return YES;
} }
......
...@@ -135,15 +135,11 @@ ...@@ -135,15 +135,11 @@
else else
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist )
{
p_item = p_playlist->status.p_item;
vlc_object_release( p_playlist );
}
p_item = p_playlist->status.p_item;
vlc_object_release( p_playlist );
[self initPanel:sender]; [self initPanel:sender];
} }
} }
...@@ -173,14 +169,10 @@ ...@@ -173,14 +169,10 @@
{ {
/* make sure that we got the current item and not an outdated one */ /* make sure that we got the current item and not an outdated one */
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
if( p_playlist ) p_item = p_playlist->status.p_item;
{ vlc_object_release( p_playlist );
p_item = p_playlist->status.p_item;
vlc_object_release( p_playlist );
}
/* check whether our item is valid, because we would crash if not */ /* check whether our item is valid, because we would crash if not */
if(! [self isItemInPlaylist: p_item] ) return; if(! [self isItemInPlaylist: p_item] ) return;
...@@ -287,8 +279,7 @@ ...@@ -287,8 +279,7 @@
- (IBAction)infoOk:(id)sender - (IBAction)infoOk:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
vlc_value_t val; vlc_value_t val;
if( [self isItemInPlaylist: p_item] ) if( [self isItemInPlaylist: p_item] )
...@@ -316,15 +307,9 @@ ...@@ -316,15 +307,9 @@
- (BOOL)isItemInPlaylist:(playlist_item_t *)p_local_item - (BOOL)isItemInPlaylist:(playlist_item_t *)p_local_item
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = pl_Yield( p_intf );
FIND_ANYWHERE );
int i; int i;
if( p_playlist == NULL )
{
return NO;
}
for( i = 0 ; i < p_playlist->i_all_size ; i++ ) for( i = 0 ; i < p_playlist->i_all_size ; i++ )
{ {
if( p_playlist->pp_all_items[i] == p_local_item ) if( p_playlist->pp_all_items[i] == p_local_item )
...@@ -430,7 +415,8 @@ static VLCInfoTreeItem *o_root_item = nil; ...@@ -430,7 +415,8 @@ static VLCInfoTreeItem *o_root_item = nil;
} }
+ (VLCInfoTreeItem *)rootItem { + (VLCInfoTreeItem *)rootItem {
if (o_root_item == nil) o_root_item = [[VLCInfoTreeItem alloc] initWithName:@"main" value: @"" ID: 0 parent:nil]; if( o_root_item == nil )
o_root_item = [[VLCInfoTreeItem alloc] initWithName:@"main" value: @"" ID: 0 parent:nil];
return o_root_item; return o_root_item;
} }
......
...@@ -1277,63 +1277,58 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1277,63 +1277,58 @@ static VLCWizard *_o_sharedInstance = nil;
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = (playlist_t *)vlc_object_find( p_intf, playlist_t * p_playlist = pl_Yield( p_intf );
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
if( p_playlist ) int x = 0;
int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
while( x != y )
{ {
int x = 0; /* we need a temp. variable here to work-around a GCC4-bug */
int y = [[o_userSelections objectForKey:@"pathToStrm"] count]; NSString *tempString = [NSString stringWithFormat: \
while( x != y ) @"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"), \
( x + 1 ), y];
input_item_t *p_input = input_ItemNew( p_playlist, \
[[[o_userSelections objectForKey:@"pathToStrm"] \
objectAtIndex:x] UTF8String], \
[tempString UTF8String] );
vlc_input_item_AddOption( p_input, [[[o_userSelections \
objectForKey:@"opts"] objectAtIndex: x] UTF8String]);
if(! [[o_userSelections objectForKey:@"partExtractFrom"] \
isEqualToString:@""] )
{ {
/* we need a temp. variable here to work-around a GCC4-bug */ vlc_input_item_AddOption( p_input, [[NSString \
NSString *tempString = [NSString stringWithFormat: \ stringWithFormat: @"start-time=%@", [o_userSelections \
@"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"), \ objectForKey: @"partExtractFrom"]] UTF8String] );
( x + 1 ), y]; }
input_item_t *p_input = input_ItemNew( p_playlist, \
[[[o_userSelections objectForKey:@"pathToStrm"] \
objectAtIndex:x] UTF8String], \
[tempString UTF8String] );
vlc_input_item_AddOption( p_input, [[[o_userSelections \
objectForKey:@"opts"] objectAtIndex: x] UTF8String]);
if(! [[o_userSelections objectForKey:@"partExtractFrom"] \
isEqualToString:@""] )
{
vlc_input_item_AddOption( p_input, [[NSString \
stringWithFormat: @"start-time=%@", [o_userSelections \
objectForKey: @"partExtractFrom"]] UTF8String] );
}
if(! [[o_userSelections objectForKey:@"partExtractTo"] \
isEqualToString:@""] )
{
vlc_input_item_AddOption( p_input, [[NSString \
stringWithFormat: @"stop-time=%@", [o_userSelections \
objectForKey: @"partExtractTo"]] UTF8String] );
}
vlc_input_item_AddOption( p_input, [[NSString stringWithFormat: \ if(! [[o_userSelections objectForKey:@"partExtractTo"] \
@"ttl=%@", [o_userSelections objectForKey:@"ttl"]] \ isEqualToString:@""] )
UTF8String] ); {
vlc_input_item_AddOption( p_input, [[NSString \
stringWithFormat: @"stop-time=%@", [o_userSelections \
objectForKey: @"partExtractTo"]] UTF8String] );
}
playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END ); vlc_input_item_AddOption( p_input, [[NSString stringWithFormat: \
@"ttl=%@", [o_userSelections objectForKey:@"ttl"]] \
UTF8String] );
if( x == 0 ) playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END );
{
/* play the first item and add the others afterwards */
playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, NULL,
p_item );
}
x += 1; if( x == 0 )
{
/* play the first item and add the others afterwards */
playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, NULL,
p_item );
} }
vlc_object_release(p_playlist); x += 1;
} else {
msg_Err( p_intf, "unable to find playlist" );
} }
vlc_object_release( p_playlist );
/* close the window, since we are done */ /* close the window, since we are done */
[o_wizard_window close]; [o_wizard_window close];
} }
......
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