1 /*****************************************************************************
2 * playlist.m: MacOS X interface module
3 *****************************************************************************
4 * Copyright (C) 2002-2008 the VideoLAN team
7 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8 * Derk-Jan Hartman <hartman at videola/n dot org>
9 * Benjamin Pracht <bigben at videolab dot org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
27 * add 'icons' for different types of nodes? (http://www.cocoadev.com/index.pl?IconAndTextInTableCell)
28 * reimplement enable/disable item
29 * create a new 'tool' button (see the gear button in the Finder window) for 'actions'
30 (adding service discovery, other views, new node/playlist, save node/playlist) stuff like that
34 /*****************************************************************************
36 *****************************************************************************/
37 #include <stdlib.h> /* malloc(), free() */
38 #include <sys/param.h> /* for MAXPATHLEN */
41 #include <sys/mount.h>
47 #import "playlistinfo.h"
52 #import <vlc_interface.h>
54 /*****************************************************************************
55 * VLCPlaylistView implementation
56 *****************************************************************************/
57 @implementation VLCPlaylistView
59 - (NSMenu *)menuForEvent:(NSEvent *)o_event
61 return( [[self delegate] menuForEvent: o_event] );
64 - (void)keyDown:(NSEvent *)o_event
68 if( [[o_event characters] length] )
70 key = [[o_event characters] characterAtIndex: 0];
75 case NSDeleteCharacter:
76 case NSDeleteFunctionKey:
77 case NSDeleteCharFunctionKey:
78 case NSBackspaceCharacter:
79 [[self delegate] deleteItem:self];
82 case NSEnterCharacter:
83 case NSCarriageReturnCharacter:
84 [(VLCPlaylist *)[[VLCMain sharedInstance] getPlaylist] playItem:self];
88 [super keyDown: o_event];
95 /*****************************************************************************
96 * VLCPlaylistCommon implementation
98 * This class the superclass of the VLCPlaylist and VLCPlaylistWizard.
99 * It contains the common methods and elements of these 2 entities.
100 *****************************************************************************/
101 @implementation VLCPlaylistCommon
108 o_outline_dict = [[NSMutableDictionary alloc] init];
114 playlist_t * p_playlist = pl_Yield( VLCIntf );
115 [o_outline_view setTarget: self];
116 [o_outline_view setDelegate: self];
117 [o_outline_view setDataSource: self];
118 [o_outline_view setAllowsEmptySelection: NO];
120 vlc_object_release( p_playlist );
126 [[o_tc_name headerCell] setStringValue:_NS("Name")];
127 [[o_tc_author headerCell] setStringValue:_NS("Author")];
128 [[o_tc_duration headerCell] setStringValue:_NS("Duration")];
131 - (NSOutlineView *)outlineView
133 return o_outline_view;
136 - (playlist_item_t *)selectedPlaylistItem
138 return [[o_outline_view itemAtRow: [o_outline_view selectedRow]]
144 @implementation VLCPlaylistCommon (NSOutlineViewDataSource)
146 /* return the number of children for Obj-C pointer item */ /* DONE */
147 - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
150 playlist_item_t *p_item = NULL;
151 playlist_t * p_playlist = pl_Yield( VLCIntf );
152 assert( outlineView == o_outline_view );
155 p_item = p_playlist->p_root_category;
157 p_item = (playlist_item_t *)[item pointerValue];
160 i_return = p_item->i_children;
162 pl_Release( VLCIntf );
164 return i_return > 0 ? i_return : 0;
167 /* return the child at index for the Obj-C pointer item */ /* DONE */
168 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
170 playlist_item_t *p_return = NULL, *p_item = NULL;
172 playlist_t * p_playlist = pl_Yield( VLCIntf );
177 p_item = p_playlist->p_root_category;
181 p_item = (playlist_item_t *)[item pointerValue];
183 if( p_item && index < p_item->i_children && index >= 0 )
184 p_return = p_item->pp_children[index];
186 vlc_object_release( p_playlist );
188 o_value = [o_outline_dict objectForKey:[NSString stringWithFormat: @"%p", p_return]];
192 /* Why is there a warning if that happens all the time and seems
193 * to be normal? Add an assert and fix it.
194 * msg_Warn( VLCIntf, "playlist item misses pointer value, adding one" ); */
195 o_value = [[NSValue valueWithPointer: p_return] retain];
200 /* is the item expandable */
201 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
204 playlist_t *p_playlist = pl_Yield( VLCIntf );
209 if( p_playlist->p_root_category )
211 i_return = p_playlist->p_root_category->i_children;
216 playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
218 i_return = p_item->i_children;
220 vlc_object_release( p_playlist );
222 return (i_return > 0);
225 /* retrieve the string values for the cells */
226 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)o_tc byItem:(id)item
229 playlist_item_t *p_item;
231 /* For error handling */
232 static BOOL attempted_reload = NO;
234 if( item == nil || ![item isKindOfClass: [NSValue class]] )
236 /* Attempt to fix the error by asking for a data redisplay
237 * This might cause infinite loop, so add a small check */
238 if( !attempted_reload )
240 attempted_reload = YES;
241 [outlineView reloadData];
246 p_item = (playlist_item_t *)[item pointerValue];
247 if( !p_item || !p_item->p_input )
249 /* Attempt to fix the error by asking for a data redisplay
250 * This might cause infinite loop, so add a small check */
251 if( !attempted_reload )
253 attempted_reload = YES;
254 [outlineView reloadData];
259 attempted_reload = NO;
261 if( [[o_tc identifier] isEqualToString:@"1"] )
263 /* sanity check to prevent the NSString class from crashing */
264 char *psz_title = input_item_GetTitle( p_item->p_input );
265 if( !EMPTY_STR( psz_title ) )
267 o_value = [NSString stringWithUTF8String: psz_title];
271 char *psz_name = input_item_GetName( p_item->p_input );
272 if( !EMPTY_STR( psz_name ) )
274 o_value = [NSString stringWithUTF8String: psz_name];
282 char *psz_artist = input_item_GetArtist( p_item->p_input );
283 if( [[o_tc identifier] isEqualToString:@"2"] && !EMPTY_STR( psz_artist ) )
285 o_value = [NSString stringWithUTF8String: psz_artist];
287 else if( [[o_tc identifier] isEqualToString:@"3"] )
289 char psz_duration[MSTRTIME_MAX_SIZE];
290 mtime_t dur = input_item_GetDuration( p_item->p_input );
293 secstotimestr( psz_duration, dur/1000000 );
294 o_value = [NSString stringWithUTF8String: psz_duration];
308 /*****************************************************************************
309 * VLCPlaylistWizard implementation
310 *****************************************************************************/
311 @implementation VLCPlaylistWizard
313 - (IBAction)reloadOutlineView
315 /* Only reload the outlineview if the wizard window is open since this can
316 be quite long on big playlists */
317 if( [[o_outline_view window] isVisible] )
319 [o_outline_view reloadData];
325 /*****************************************************************************
326 * extension to NSOutlineView's interface to fix compilation warnings
327 * and let us access these 2 functions properly
328 * this uses a private Apple-API, but works fine on all current OSX releases
329 * keep checking for compatiblity with future releases though
330 *****************************************************************************/
332 @interface NSOutlineView (UndocumentedSortImages)
333 + (NSImage *)_defaultTableHeaderSortImage;
334 + (NSImage *)_defaultTableHeaderReverseSortImage;
338 /*****************************************************************************
339 * VLCPlaylist implementation
340 *****************************************************************************/
341 @implementation VLCPlaylist
348 o_nodes_array = [[NSMutableArray alloc] init];
349 o_items_array = [[NSMutableArray alloc] init];
356 playlist_t * p_playlist = pl_Yield( VLCIntf );
360 [super awakeFromNib];
362 [o_outline_view setDoubleAction: @selector(playItem:)];
364 [o_outline_view registerForDraggedTypes:
365 [NSArray arrayWithObjects: NSFilenamesPboardType,
366 @"VLCPlaylistItemPboardType", nil]];
367 [o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
369 /* This uses private Apple API which works fine until 10.5.
370 * We need to keep checking in the future!
371 * These methods are being added artificially to NSOutlineView's interface above */
372 o_ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
373 o_descendingSortingImage = [[NSOutlineView class] _defaultTableHeaderReverseSortImage];
375 o_tc_sortColumn = nil;
378 char ** ppsz_services = services_discovery_GetServicesNames( p_playlist, &ppsz_name );
381 vlc_object_release( p_playlist );
385 for( i = 0; ppsz_services[i]; i++ )
390 char * name = ppsz_name[i] ? ppsz_name[i] : ppsz_services[i];
391 /* Check whether to enable these menuitems */
392 b_enabled = playlist_IsServicesDiscoveryLoaded( p_playlist, ppsz_services[i] );
394 /* Create the menu entries used in the playlist menu */
395 o_lmi = [[o_mi_services submenu] addItemWithTitle:
396 [NSString stringWithUTF8String: name]
397 action: @selector(servicesChange:)
399 [o_lmi setTarget: self];
400 [o_lmi setRepresentedObject: [NSString stringWithUTF8String: ppsz_services[i]]];
401 if( b_enabled ) [o_lmi setState: NSOnState];
403 /* Create the menu entries for the main menu */
404 o_lmi = [[o_mm_mi_services submenu] addItemWithTitle:
405 [NSString stringWithUTF8String: name]
406 action: @selector(servicesChange:)
408 [o_lmi setTarget: self];
409 [o_lmi setRepresentedObject: [NSString stringWithUTF8String: ppsz_services[i]]];
410 if( b_enabled ) [o_lmi setState: NSOnState];
412 free( ppsz_services[i] );
413 free( ppsz_name[i] );
415 free( ppsz_services );
418 vlc_object_release( p_playlist );
421 - (void)searchfieldChanged:(NSNotification *)o_notification
423 [o_search_field setStringValue:[[o_notification object] stringValue]];
430 [o_mi_save_playlist setTitle: _NS("Save Playlist...")];
431 [o_mi_play setTitle: _NS("Play")];
432 [o_mi_delete setTitle: _NS("Delete")];
433 [o_mi_recursive_expand setTitle: _NS("Expand Node")];
434 [o_mi_selectall setTitle: _NS("Select All")];
435 [o_mi_info setTitle: _NS("Information...")];
436 [o_mi_preparse setTitle: _NS("Fetch Meta Data")];
437 [o_mi_sort_name setTitle: _NS("Sort Node by Name")];
438 [o_mi_sort_author setTitle: _NS("Sort Node by Author")];
439 [o_mi_services setTitle: _NS("Services discovery")];
440 [o_status_field setStringValue: _NS("No items in the playlist")];
442 [o_search_field setToolTip: _NS("Search in Playlist")];
443 [o_mi_addNode setTitle: _NS("Add Folder to Playlist")];
445 [o_save_accessory_text setStringValue: _NS("File Format:")];
446 [[o_save_accessory_popup itemAtIndex:0] setTitle: _NS("Extended M3U")];
447 [[o_save_accessory_popup itemAtIndex:1] setTitle: _NS("XML Shareable Playlist Format (XSPF)")];
450 - (void)playlistUpdated
452 /* Clear indications of any existing column sorting */
453 for( unsigned int i = 0 ; i < [[o_outline_view tableColumns] count] ; i++ )
455 [o_outline_view setIndicatorImage:nil inTableColumn:
456 [[o_outline_view tableColumns] objectAtIndex:i]];
459 [o_outline_view setHighlightedTableColumn:nil];
460 o_tc_sortColumn = nil;
461 // TODO Find a way to keep the dict size to a minimum
462 //[o_outline_dict removeAllObjects];
463 [o_outline_view reloadData];
464 [[[[VLCMain sharedInstance] getWizard] getPlaylistWizard] reloadOutlineView];
465 [[[[VLCMain sharedInstance] getBookmarks] getDataTable] reloadData];
467 playlist_t *p_playlist = pl_Yield( VLCIntf );
469 if( playlist_CurrentSize( p_playlist ) >= 2 )
471 [o_status_field setStringValue: [NSString stringWithFormat:
473 playlist_CurrentSize( p_playlist )]];
477 if( playlist_IsEmpty( p_playlist ) )
478 [o_status_field setStringValue: _NS("No items in the playlist")];
480 [o_status_field setStringValue: _NS("1 item")];
482 vlc_object_release( p_playlist );
484 [self outlineViewSelectionDidChange: nil];
487 - (void)playModeUpdated
489 playlist_t *p_playlist = pl_Yield( VLCIntf );
491 bool loop = var_GetBool( p_playlist, "loop" );
492 bool repeat = var_GetBool( p_playlist, "repeat" );
494 [[[VLCMain sharedInstance] getControls] repeatOne];
496 [[[VLCMain sharedInstance] getControls] repeatAll];
498 [[[VLCMain sharedInstance] getControls] repeatOff];
500 [[[VLCMain sharedInstance] getControls] shuffle];
502 vlc_object_release( p_playlist );
505 - (void)outlineViewSelectionDidChange:(NSNotification *)notification
508 playlist_item_t * p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
512 /* update our info-panel to reflect the new item */
513 [[[VLCMain sharedInstance] getInfo] updatePanelWithItem:p_item->p_input];
517 - (BOOL)isSelectionEmpty
519 return [o_outline_view selectedRow] == -1;
522 - (void)updateRowSelection
528 playlist_t *p_playlist = pl_Yield( VLCIntf );
529 playlist_item_t *p_item, *p_temp_item;
530 NSMutableArray *o_array = [NSMutableArray array];
532 p_item = p_playlist->status.p_item;
535 vlc_object_release(p_playlist);
539 p_temp_item = p_item;
540 while( p_temp_item->p_parent )
542 [o_array insertObject: [NSValue valueWithPointer: p_temp_item] atIndex: 0];
543 p_temp_item = p_temp_item->p_parent;
546 for( j = 0; j < [o_array count] - 1; j++ )
549 if( ( o_item = [o_outline_dict objectForKey:
550 [NSString stringWithFormat: @"%p",
551 [[o_array objectAtIndex:j] pointerValue]]] ) != nil )
553 [o_outline_view expandItem: o_item];
558 vlc_object_release( p_playlist );
562 /* Check if p_item is a child of p_node recursively. We need to check the item
563 existence first since OSX sometimes tries to redraw items that have been
564 deleted. We don't do it when not required since this verification takes
565 quite a long time on big playlists (yes, pretty hacky). */
567 - (BOOL)isItem: (playlist_item_t *)p_item
568 inNode: (playlist_item_t *)p_node
569 checkItemExistence:(BOOL)b_check
570 locked:(BOOL)b_locked
573 playlist_t * p_playlist = pl_Yield( VLCIntf );
574 playlist_item_t *p_temp_item = p_item;
576 if( p_node == p_item )
578 vlc_object_release(p_playlist);
582 if( p_node->i_children < 1)
584 vlc_object_release(p_playlist);
591 if(!b_locked) PL_LOCK;
595 /* Since outlineView: willDisplayCell:... may call this function with
596 p_items that don't exist anymore, first check if the item is still
597 in the playlist. Any cleaner solution welcomed. */
598 for( i = 0; i < p_playlist->all_items.i_size; i++ )
600 if( ARRAY_VAL( p_playlist->all_items, i) == p_item ) break;
601 else if ( i == p_playlist->all_items.i_size - 1 )
603 if(!b_locked) PL_UNLOCK;
604 vlc_object_release( p_playlist );
612 p_temp_item = p_temp_item->p_parent;
613 if( p_temp_item == p_node )
615 if(!b_locked) PL_UNLOCK;
616 vlc_object_release( p_playlist );
620 if(!b_locked) PL_UNLOCK;
623 vlc_object_release( p_playlist );
627 - (BOOL)isItem: (playlist_item_t *)p_item
628 inNode: (playlist_item_t *)p_node
629 checkItemExistence:(BOOL)b_check
631 [self isItem:p_item inNode:p_node checkItemExistence:b_check locked:NO];
634 /* This method is usefull for instance to remove the selected children of an
635 already selected node */
636 - (void)removeItemsFrom:(id)o_items ifChildrenOf:(id)o_nodes
639 for( i = 0 ; i < [o_items count] ; i++ )
641 for ( j = 0 ; j < [o_nodes count] ; j++ )
643 if( o_items == o_nodes)
645 if( j == i ) continue;
647 if( [self isItem: [[o_items objectAtIndex:i] pointerValue]
648 inNode: [[o_nodes objectAtIndex:j] pointerValue]
649 checkItemExistence: NO locked:NO] )
651 [o_items removeObjectAtIndex:i];
652 /* We need to execute the next iteration with the same index
653 since the current item has been deleted */
661 - (IBAction)savePlaylist:(id)sender
663 playlist_t * p_playlist = pl_Yield( VLCIntf );
665 NSSavePanel *o_save_panel = [NSSavePanel savePanel];
666 NSString * o_name = [NSString stringWithFormat: @"%@", _NS("Untitled")];
668 //[o_save_panel setAllowedFileTypes: [NSArray arrayWithObjects: @"m3u", @"xpf", nil] ];
669 [o_save_panel setTitle: _NS("Save Playlist")];
670 [o_save_panel setPrompt: _NS("Save")];
671 [o_save_panel setAccessoryView: o_save_accessory_view];
673 if( [o_save_panel runModalForDirectory: nil
674 file: o_name] == NSOKButton )
676 NSString *o_filename = [o_save_panel filename];
678 if( [o_save_accessory_popup indexOfSelectedItem] == 1 )
680 NSString * o_real_filename;
682 range.location = [o_filename length] - [@".xspf" length];
683 range.length = [@".xspf" length];
685 if( [o_filename compare:@".xspf" options: NSCaseInsensitiveSearch
686 range: range] != NSOrderedSame )
688 o_real_filename = [NSString stringWithFormat: @"%@.xspf", o_filename];
692 o_real_filename = o_filename;
694 playlist_Export( p_playlist,
695 [o_real_filename fileSystemRepresentation],
696 p_playlist->p_local_category, "export-xspf" );
700 NSString * o_real_filename;
702 range.location = [o_filename length] - [@".m3u" length];
703 range.length = [@".m3u" length];
705 if( [o_filename compare:@".m3u" options: NSCaseInsensitiveSearch
706 range: range] != NSOrderedSame )
708 o_real_filename = [NSString stringWithFormat: @"%@.m3u", o_filename];
712 o_real_filename = o_filename;
714 playlist_Export( p_playlist,
715 [o_real_filename fileSystemRepresentation],
716 p_playlist->p_local_category, "export-m3u" );
719 vlc_object_release( p_playlist );
722 /* When called retrieves the selected outlineview row and plays that node or item */
723 - (IBAction)playItem:(id)sender
725 intf_thread_t * p_intf = VLCIntf;
726 playlist_t * p_playlist = pl_Yield( p_intf );
728 playlist_item_t *p_item;
729 playlist_item_t *p_node = NULL;
731 p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
735 if( p_item->i_children == -1 )
737 p_node = p_item->p_parent;
743 if( p_node->i_children > 0 && p_node->pp_children[0]->i_children == -1 )
745 p_item = p_node->pp_children[0];
752 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Unlocked, p_node, p_item );
754 vlc_object_release( p_playlist );
757 /* When called retrieves the selected outlineview row and plays that node or item */
758 - (IBAction)preparseItem:(id)sender
761 NSMutableArray *o_to_preparse;
762 intf_thread_t * p_intf = VLCIntf;
763 playlist_t * p_playlist = pl_Yield( p_intf );
765 o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
766 i_count = [o_to_preparse count];
770 playlist_item_t *p_item = NULL;
772 for( i = 0; i < i_count; i++ )
774 o_number = [o_to_preparse lastObject];
775 i_row = [o_number intValue];
776 p_item = [[o_outline_view itemAtRow:i_row] pointerValue];
777 [o_to_preparse removeObject: o_number];
778 [o_outline_view deselectRow: i_row];
782 if( p_item->i_children == -1 )
784 playlist_PreparseEnqueue( p_playlist, p_item->p_input );
788 msg_Dbg( p_intf, "preparsing nodes not implemented" );
792 vlc_object_release( p_playlist );
793 [self playlistUpdated];
796 - (IBAction)servicesChange:(id)sender
798 NSMenuItem *o_mi = (NSMenuItem *)sender;
799 NSString *o_string = [o_mi representedObject];
800 playlist_t * p_playlist = pl_Yield( VLCIntf );
801 if( !playlist_IsServicesDiscoveryLoaded( p_playlist, [o_string UTF8String] ) )
802 playlist_ServicesDiscoveryAdd( p_playlist, [o_string UTF8String] );
804 playlist_ServicesDiscoveryRemove( p_playlist, [o_string UTF8String] );
806 [o_mi setState: playlist_IsServicesDiscoveryLoaded( p_playlist,
807 [o_string UTF8String] ) ? YES : NO];
809 vlc_object_release( p_playlist );
810 [self playlistUpdated];
814 - (IBAction)selectAll:(id)sender
816 [o_outline_view selectAll: nil];
819 - (IBAction)deleteItem:(id)sender
822 NSMutableArray *o_to_delete;
825 playlist_t * p_playlist;
826 intf_thread_t * p_intf = VLCIntf;
828 o_to_delete = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
829 i_count = [o_to_delete count];
831 p_playlist = pl_Yield( p_intf );
834 for( int i = 0; i < i_count; i++ )
836 o_number = [o_to_delete lastObject];
837 i_row = [o_number intValue];
838 id o_item = [o_outline_view itemAtRow: i_row];
839 playlist_item_t *p_item = [o_item pointerValue];
841 msg_Dbg( p_intf, "deleting item %i (of %i) with id \"%i\", pointerValue \"%p\" and %i children", i+1, i_count,
842 p_item->p_input->i_id, [o_item pointerValue], p_item->i_children +1 );
844 [o_to_delete removeObject: o_number];
845 [o_outline_view deselectRow: i_row];
847 if( p_item->i_children != -1 )
848 //is a node and not an item
850 if( p_playlist->status.i_status != PLAYLIST_STOPPED &&
851 [self isItem: p_playlist->status.p_item inNode:
852 ((playlist_item_t *)[o_item pointerValue])
853 checkItemExistence: NO locked:YES] == YES )
854 // if current item is in selected node and is playing then stop playlist
855 playlist_Control(p_playlist, PLAYLIST_STOP, pl_Locked );
857 playlist_NodeDelete( p_playlist, p_item, true, false );
860 playlist_DeleteFromInput( p_playlist, p_item->p_input->i_id, pl_Locked );
864 [self playlistUpdated];
865 vlc_object_release( p_playlist );
868 - (IBAction)sortNodeByName:(id)sender
870 [self sortNode: SORT_TITLE];
873 - (IBAction)sortNodeByAuthor:(id)sender
875 [self sortNode: SORT_ARTIST];
878 - (void)sortNode:(int)i_mode
880 playlist_t * p_playlist = pl_Yield( VLCIntf );
881 playlist_item_t * p_item;
883 if( [o_outline_view selectedRow] > -1 )
885 p_item = [[o_outline_view itemAtRow: [o_outline_view selectedRow]] pointerValue];
888 /*If no item is selected, sort the whole playlist*/
890 p_item = p_playlist->p_root_category;
893 if( p_item->i_children > -1 ) // the item is a node
896 playlist_RecursiveNodeSort( p_playlist, p_item, i_mode, ORDER_NORMAL );
902 playlist_RecursiveNodeSort( p_playlist,
903 p_item->p_parent, i_mode, ORDER_NORMAL );
906 vlc_object_release( p_playlist );
907 [self playlistUpdated];
910 - (input_item_t *)createItem:(NSDictionary *)o_one_item
912 intf_thread_t * p_intf = VLCIntf;
913 playlist_t * p_playlist = pl_Yield( p_intf );
915 input_item_t *p_input;
917 BOOL b_rem = FALSE, b_dir = FALSE;
918 NSString *o_uri, *o_name;
923 o_uri = (NSString *)[o_one_item objectForKey: @"ITEM_URL"];
924 o_name = (NSString *)[o_one_item objectForKey: @"ITEM_NAME"];
925 o_options = (NSArray *)[o_one_item objectForKey: @"ITEM_OPTIONS"];
927 /* Find the name for a disc entry (i know, can you believe the trouble?) */
928 if( ( !o_name || [o_name isEqualToString:@""] ) && [o_uri rangeOfString: @"/dev/"].location != NSNotFound )
930 int i_count, i_index;
931 struct statfs *mounts = NULL;
933 i_count = getmntinfo (&mounts, MNT_NOWAIT);
934 /* getmntinfo returns a pointer to static data. Do not free. */
935 for( i_index = 0 ; i_index < i_count; i_index++ )
937 NSMutableString *o_temp, *o_temp2;
938 o_temp = [NSMutableString stringWithString: o_uri];
939 o_temp2 = [NSMutableString stringWithUTF8String: mounts[i_index].f_mntfromname];
940 [o_temp replaceOccurrencesOfString: @"/dev/rdisk" withString: @"/dev/disk" options:NSLiteralSearch range:NSMakeRange(0, [o_temp length]) ];
941 [o_temp2 replaceOccurrencesOfString: @"s0" withString: @"" options:NSLiteralSearch range:NSMakeRange(0, [o_temp2 length]) ];
942 [o_temp2 replaceOccurrencesOfString: @"s1" withString: @"" options:NSLiteralSearch range:NSMakeRange(0, [o_temp2 length]) ];
944 if( strstr( [o_temp fileSystemRepresentation], [o_temp2 fileSystemRepresentation] ) != NULL )
946 o_name = [[NSFileManager defaultManager] displayNameAtPath: [NSString stringWithUTF8String:mounts[i_index].f_mntonname]];
950 /* If no name, then make a guess */
951 if( !o_name) o_name = [[NSFileManager defaultManager] displayNameAtPath: o_uri];
953 if( [[NSFileManager defaultManager] fileExistsAtPath:o_uri isDirectory:&b_dir] && b_dir &&
954 [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath: o_uri isRemovable: &b_rem
955 isWritable:NULL isUnmountable:NULL description:NULL type:NULL] && b_rem )
957 /* All of this is to make sure CD's play when you D&D them on VLC */
958 /* Converts mountpoint to a /dev file */
961 NSMutableString *o_temp;
963 buf = (struct statfs *) malloc (sizeof(struct statfs));
964 statfs( [o_uri fileSystemRepresentation], buf );
965 psz_dev = strdup(buf->f_mntfromname);
966 o_temp = [NSMutableString stringWithUTF8String: psz_dev ];
967 [o_temp replaceOccurrencesOfString: @"/dev/disk" withString: @"/dev/rdisk" options:NSLiteralSearch range:NSMakeRange(0, [o_temp length]) ];
968 [o_temp replaceOccurrencesOfString: @"s0" withString: @"" options:NSLiteralSearch range:NSMakeRange(0, [o_temp length]) ];
969 [o_temp replaceOccurrencesOfString: @"s1" withString: @"" options:NSLiteralSearch range:NSMakeRange(0, [o_temp length]) ];
973 p_input = input_ItemNew( p_playlist, [o_uri fileSystemRepresentation], [o_name UTF8String] );
979 for( i = 0; i < (int)[o_options count]; i++ )
981 input_ItemAddOption( p_input, strdup( [[o_options objectAtIndex:i] UTF8String] ) );
985 /* Recent documents menu */
986 o_true_file = [NSURL fileURLWithPath: o_uri];
987 if( o_true_file != nil && (BOOL)config_GetInt( p_playlist, "macosx-recentitems" ) == YES )
989 [[NSDocumentController sharedDocumentController]
990 noteNewRecentDocumentURL: o_true_file];
993 vlc_object_release( p_playlist );
997 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
1000 playlist_t * p_playlist = pl_Yield( VLCIntf );
1003 for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
1005 input_item_t *p_input;
1006 NSDictionary *o_one_item;
1009 o_one_item = [o_array objectAtIndex: i_item];
1010 p_input = [self createItem: o_one_item];
1017 /* FIXME: playlist_AddInput() can fail */
1019 playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
1020 i_position == -1 ? PLAYLIST_END : i_position + i_item, true,
1023 if( i_item == 0 && !b_enqueue )
1025 playlist_item_t *p_item;
1026 p_item = playlist_ItemGetByInput( p_playlist, p_input, pl_Locked );
1027 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL, p_item );
1029 vlc_gc_decref( p_input );
1033 [self playlistUpdated];
1034 vlc_object_release( p_playlist );
1037 - (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue
1040 playlist_t * p_playlist = pl_Yield( VLCIntf );
1042 for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
1044 input_item_t *p_input;
1045 NSDictionary *o_one_item;
1048 o_one_item = [o_array objectAtIndex: i_item];
1049 p_input = [self createItem: o_one_item];
1051 if( !p_input ) continue;
1054 /* FIXME: playlist_BothAddInput() can fail */
1056 playlist_BothAddInput( p_playlist, p_input, p_node,
1059 PLAYLIST_END : i_position + i_item,
1060 NULL, NULL, pl_Locked );
1063 if( i_item == 0 && !b_enqueue )
1065 playlist_item_t *p_item;
1066 p_item = playlist_ItemGetByInput( p_playlist, p_input, pl_Locked );
1067 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL, p_item );
1070 vlc_gc_decref( p_input );
1072 [self playlistUpdated];
1073 vlc_object_release( p_playlist );
1076 - (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item
1078 playlist_t *p_playlist = pl_Yield( VLCIntf );
1079 playlist_item_t *p_selected_item;
1080 int i_current, i_selected_row;
1082 i_selected_row = [o_outline_view selectedRow];
1083 if (i_selected_row < 0)
1086 p_selected_item = (playlist_item_t *)[[o_outline_view itemAtRow:
1087 i_selected_row] pointerValue];
1089 for( i_current = 0; i_current < p_item->i_children ; i_current++ )
1092 NSString *o_current_name, *o_current_author;
1095 o_current_name = [NSString stringWithUTF8String:
1096 p_item->pp_children[i_current]->p_input->psz_name];
1097 psz_temp = input_ItemGetInfo( p_item->p_input ,
1098 _("Meta-information"),_("Artist") );
1099 o_current_author = [NSString stringWithUTF8String: psz_temp];
1103 if( p_selected_item == p_item->pp_children[i_current] &&
1104 b_selected_item_met == NO )
1106 b_selected_item_met = YES;
1108 else if( p_selected_item == p_item->pp_children[i_current] &&
1109 b_selected_item_met == YES )
1111 vlc_object_release( p_playlist );
1114 else if( b_selected_item_met == YES &&
1115 ( [o_current_name rangeOfString:[o_search_field
1116 stringValue] options:NSCaseInsensitiveSearch].length ||
1117 [o_current_author rangeOfString:[o_search_field
1118 stringValue] options:NSCaseInsensitiveSearch].length ) )
1120 vlc_object_release( p_playlist );
1121 /*Adds the parent items in the result array as well, so that we can
1123 return [NSMutableArray arrayWithObject: [NSValue
1124 valueWithPointer: p_item->pp_children[i_current]]];
1126 if( p_item->pp_children[i_current]->i_children > 0 )
1128 id o_result = [self subSearchItem:
1129 p_item->pp_children[i_current]];
1130 if( o_result != NULL )
1132 vlc_object_release( p_playlist );
1133 [o_result insertObject: [NSValue valueWithPointer:
1134 p_item->pp_children[i_current]] atIndex:0];
1139 vlc_object_release( p_playlist );
1143 - (IBAction)searchItem:(id)sender
1145 playlist_t * p_playlist = pl_Yield( VLCIntf );
1151 b_selected_item_met = NO;
1153 /*First, only search after the selected item:*
1154 *(b_selected_item_met = NO) */
1155 o_result = [self subSearchItem:p_playlist->p_root_category];
1156 if( o_result == NULL )
1158 /* If the first search failed, search again from the beginning */
1159 o_result = [self subSearchItem:p_playlist->p_root_category];
1161 if( o_result != NULL )
1164 if( [[o_result objectAtIndex: 0] pointerValue] ==
1165 p_playlist->p_local_category )
1170 for( i = i_start ; i < [o_result count] - 1 ; i++ )
1172 [o_outline_view expandItem: [o_outline_dict objectForKey:
1173 [NSString stringWithFormat: @"%p",
1174 [[o_result objectAtIndex: i] pointerValue]]]];
1176 i_row = [o_outline_view rowForItem: [o_outline_dict objectForKey:
1177 [NSString stringWithFormat: @"%p",
1178 [[o_result objectAtIndex: [o_result count] - 1 ]
1183 [o_outline_view selectRow:i_row byExtendingSelection: NO];
1184 [o_outline_view scrollRowToVisible: i_row];
1186 vlc_object_release( p_playlist );
1189 - (IBAction)recursiveExpandNode:(id)sender
1191 id o_item = [o_outline_view itemAtRow: [o_outline_view selectedRow]];
1192 playlist_item_t *p_item = (playlist_item_t *)[o_item pointerValue];
1194 if( ![[o_outline_view dataSource] outlineView: o_outline_view
1195 isItemExpandable: o_item] )
1197 o_item = [o_outline_dict objectForKey: [NSString
1198 stringWithFormat: @"%p", p_item->p_parent]];
1201 /* We need to collapse the node first, since OSX refuses to recursively
1202 expand an already expanded node, even if children nodes are collapsed. */
1203 [o_outline_view collapseItem: o_item collapseChildren: YES];
1204 [o_outline_view expandItem: o_item expandChildren: YES];
1207 - (NSMenu *)menuForEvent:(NSEvent *)o_event
1213 pt = [o_outline_view convertPoint: [o_event locationInWindow]
1215 NSInteger row = [o_outline_view rowAtPoint:pt];
1217 [o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
1219 b_item_sel = ( row != -1 && [o_outline_view selectedRow] != -1 );
1220 b_rows = [o_outline_view numberOfRows] != 0;
1222 [o_mi_play setEnabled: b_item_sel];
1223 [o_mi_delete setEnabled: b_item_sel];
1224 [o_mi_selectall setEnabled: b_rows];
1225 [o_mi_info setEnabled: b_item_sel];
1226 [o_mi_preparse setEnabled: b_item_sel];
1227 [o_mi_recursive_expand setEnabled: b_item_sel];
1228 [o_mi_sort_name setEnabled: b_item_sel];
1229 [o_mi_sort_author setEnabled: b_item_sel];
1231 return( o_ctx_menu );
1234 - (void)outlineView: (NSTableView*)o_tv
1235 didClickTableColumn:(NSTableColumn *)o_tc
1237 int i_mode = 0, i_type;
1238 intf_thread_t *p_intf = VLCIntf;
1240 playlist_t *p_playlist = pl_Yield( p_intf );
1242 /* Check whether the selected table column header corresponds to a
1243 sortable table column*/
1244 if( !( o_tc == o_tc_name || o_tc == o_tc_author ) )
1246 vlc_object_release( p_playlist );
1250 if( o_tc_sortColumn == o_tc )
1252 b_isSortDescending = !b_isSortDescending;
1256 b_isSortDescending = false;
1259 if( o_tc == o_tc_name )
1261 i_mode = SORT_TITLE;
1263 else if( o_tc == o_tc_author )
1265 i_mode = SORT_ARTIST;
1268 if( b_isSortDescending )
1270 i_type = ORDER_REVERSE;
1274 i_type = ORDER_NORMAL;
1277 vlc_object_lock( p_playlist );
1278 playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
1279 vlc_object_unlock( p_playlist );
1281 vlc_object_release( p_playlist );
1282 [self playlistUpdated];
1284 o_tc_sortColumn = o_tc;
1285 [o_outline_view setHighlightedTableColumn:o_tc];
1287 if( b_isSortDescending )
1289 [o_outline_view setIndicatorImage:o_descendingSortingImage
1290 inTableColumn:o_tc];
1294 [o_outline_view setIndicatorImage:o_ascendingSortingImage
1295 inTableColumn:o_tc];
1300 - (void)outlineView:(NSOutlineView *)outlineView
1301 willDisplayCell:(id)cell
1302 forTableColumn:(NSTableColumn *)tableColumn
1305 playlist_t *p_playlist = pl_Yield( VLCIntf );
1309 o_playing_item = [o_outline_dict objectForKey:
1310 [NSString stringWithFormat:@"%p", p_playlist->status.p_item]];
1312 if( [self isItem: [o_playing_item pointerValue] inNode:
1313 [item pointerValue] checkItemExistence: YES]
1314 || [o_playing_item isEqual: item] )
1316 [cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toHaveTrait:NSBoldFontMask]];
1320 [cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toNotHaveTrait:NSBoldFontMask]];
1322 vlc_object_release( p_playlist );
1325 - (IBAction)addNode:(id)sender
1327 /* we have to create a new thread here because otherwise we would block the
1328 * interface since the interaction-stuff and this code would run in the same
1330 [NSThread detachNewThreadSelector: @selector(addNodeThreadedly)
1331 toTarget: self withObject:nil];
1332 [self playlistUpdated];
1335 - (void)addNodeThreadedly
1337 NSAutoreleasePool * ourPool = [[NSAutoreleasePool alloc] init];
1339 /* simply adds a new node to the end of the playlist */
1340 playlist_t * p_playlist = pl_Yield( VLCIntf );
1341 vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW );
1344 char *psz_name = NULL;
1345 playlist_item_t * p_item;
1346 ret_v = intf_UserStringInput( p_playlist, _("New Node"),
1347 _("Please enter a name for the new node."), &psz_name );
1349 if( ret_v != DIALOG_CANCELLED && psz_name && *psz_name )
1350 p_item = playlist_NodeCreate( p_playlist, psz_name,
1351 p_playlist->p_local_category, 0, NULL );
1352 else if(! config_GetInt( p_playlist, "interact" ) )
1354 /* in case that the interaction is disabled, just give it a bogus name */
1355 p_item = playlist_NodeCreate( p_playlist, _("Empty Folder"),
1356 p_playlist->p_local_category, 0, NULL );
1360 msg_Warn( VLCIntf, "node creation failed or cancelled by user" );
1362 vlc_object_release( p_playlist );
1368 @implementation VLCPlaylist (NSOutlineViewDataSource)
1370 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
1372 id o_value = [super outlineView: outlineView child: index ofItem: item];
1373 playlist_t *p_playlist = pl_Yield( VLCIntf );
1375 if( playlist_CurrentSize( p_playlist ) >= 2 )
1377 [o_status_field setStringValue: [NSString stringWithFormat:
1379 playlist_CurrentSize( p_playlist )]];
1383 if( playlist_IsEmpty( p_playlist ) )
1385 [o_status_field setStringValue: _NS("No items in the playlist")];
1389 [o_status_field setStringValue: _NS("1 item")];
1392 vlc_object_release( p_playlist );
1394 [o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
1395 [o_value pointerValue]]];
1400 /* Required for drag & drop and reordering */
1401 - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
1404 playlist_t *p_playlist = pl_Yield( VLCIntf );
1406 /* First remove the items that were moved during the last drag & drop
1408 [o_items_array removeAllObjects];
1409 [o_nodes_array removeAllObjects];
1411 for( i = 0 ; i < [items count] ; i++ )
1413 id o_item = [items objectAtIndex: i];
1415 /* Refuse to move items that are not in the General Node
1416 (Service Discovery) */
1417 if( ![self isItem: [o_item pointerValue] inNode:
1418 p_playlist->p_local_category checkItemExistence: NO] &&
1419 ( var_CreateGetBool( p_playlist, "media-library" ) &&
1420 ![self isItem: [o_item pointerValue] inNode:
1421 p_playlist->p_ml_category checkItemExistence: NO]) )
1423 vlc_object_release(p_playlist);
1426 /* Fill the items and nodes to move in 2 different arrays */
1427 if( ((playlist_item_t *)[o_item pointerValue])->i_children > 0 )
1428 [o_nodes_array addObject: o_item];
1430 [o_items_array addObject: o_item];
1433 /* Now we need to check if there are selected items that are in already
1434 selected nodes. In that case, we only want to move the nodes */
1435 [self removeItemsFrom: o_nodes_array ifChildrenOf: o_nodes_array];
1436 [self removeItemsFrom: o_items_array ifChildrenOf: o_nodes_array];
1438 /* We add the "VLCPlaylistItemPboardType" type to be able to recognize
1439 a Drop operation coming from the playlist. */
1441 [pboard declareTypes: [NSArray arrayWithObjects:
1442 @"VLCPlaylistItemPboardType", nil] owner: self];
1443 [pboard setData:[NSData data] forType:@"VLCPlaylistItemPboardType"];
1445 vlc_object_release(p_playlist);
1449 - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
1451 playlist_t *p_playlist = pl_Yield( VLCIntf );
1452 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1454 if( !p_playlist ) return NSDragOperationNone;
1456 /* Dropping ON items is not allowed if item is not a node */
1459 if( index == NSOutlineViewDropOnItemIndex &&
1460 ((playlist_item_t *)[item pointerValue])->i_children == -1 )
1462 vlc_object_release( p_playlist );
1463 return NSDragOperationNone;
1467 /* Don't allow on drop on playlist root element's child */
1468 if( !item && index != NSOutlineViewDropOnItemIndex)
1470 vlc_object_release( p_playlist );
1471 return NSDragOperationNone;
1474 /* We refuse to drop an item in anything else than a child of the General
1475 Node. We still accept items that would be root nodes of the outlineview
1476 however, to allow drop in an empty playlist. */
1477 if( !( ([self isItem: [item pointerValue] inNode: p_playlist->p_local_category checkItemExistence: NO] ||
1478 ( var_CreateGetBool( p_playlist, "media-library" ) && [self isItem: [item pointerValue] inNode: p_playlist->p_ml_category checkItemExistence: NO] ) ) || item == nil ) )
1480 vlc_object_release( p_playlist );
1481 return NSDragOperationNone;
1484 /* Drop from the Playlist */
1485 if( [[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] )
1488 for( i = 0 ; i < [o_nodes_array count] ; i++ )
1490 /* We refuse to Drop in a child of an item we are moving */
1491 if( [self isItem: [item pointerValue] inNode:
1492 [[o_nodes_array objectAtIndex: i] pointerValue]
1493 checkItemExistence: NO] )
1495 vlc_object_release( p_playlist );
1496 return NSDragOperationNone;
1499 vlc_object_release( p_playlist );
1500 return NSDragOperationMove;
1503 /* Drop from the Finder */
1504 else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
1506 vlc_object_release( p_playlist );
1507 return NSDragOperationGeneric;
1509 vlc_object_release( p_playlist );
1510 return NSDragOperationNone;
1513 - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index
1515 playlist_t * p_playlist = pl_Yield( VLCIntf );
1516 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1518 /* Drag & Drop inside the playlist */
1519 if( [[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] )
1521 int i_row, i_removed_from_node = 0;
1523 playlist_item_t *p_new_parent, *p_item = NULL;
1524 NSArray *o_all_items = [o_nodes_array arrayByAddingObjectsFromArray:
1526 /* If the item is to be dropped as root item of the outline, make it a
1527 child of the General node.
1528 Else, choose the proposed parent as parent. */
1529 if( item == nil ) p_new_parent = p_playlist->p_local_category;
1530 else p_new_parent = [item pointerValue];
1532 /* Make sure the proposed parent is a node.
1533 (This should never be true) */
1534 if( p_new_parent->i_children < 0 )
1536 vlc_object_release( p_playlist );
1540 for( i = 0; i < [o_all_items count]; i++ )
1542 playlist_item_t *p_old_parent = NULL;
1543 int i_old_index = 0;
1545 p_item = [[o_all_items objectAtIndex:i] pointerValue];
1546 p_old_parent = p_item->p_parent;
1549 /* We may need the old index later */
1550 if( p_new_parent == p_old_parent )
1553 for( j = 0; j < p_old_parent->i_children; j++ )
1555 if( p_old_parent->pp_children[j] == p_item )
1564 // Actually detach the item from the old position
1565 if( playlist_NodeRemoveItem( p_playlist, p_item, p_old_parent ) ==
1569 /* Calculate the new index */
1572 /* If we move the item in the same node, we need to take into
1573 account that one item will be deleted */
1576 if ((p_new_parent == p_old_parent &&
1577 i_old_index < index + (int)i) )
1579 i_removed_from_node++;
1581 i_new_index = index + i - i_removed_from_node;
1583 // Reattach the item to the new position
1584 playlist_NodeInsert( p_playlist, p_item, p_new_parent, i_new_index );
1588 [self playlistUpdated];
1589 i_row = [o_outline_view rowForItem:[o_outline_dict
1590 objectForKey:[NSString stringWithFormat: @"%p",
1591 [[o_all_items objectAtIndex: 0] pointerValue]]]];
1595 i_row = [o_outline_view rowForItem:[o_outline_dict
1596 objectForKey:[NSString stringWithFormat: @"%p", p_new_parent]]];
1599 [o_outline_view deselectAll: self];
1600 [o_outline_view selectRow: i_row byExtendingSelection: NO];
1601 [o_outline_view scrollRowToVisible: i_row];
1603 vlc_object_release( p_playlist );
1607 else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
1610 playlist_item_t *p_node = [item pointerValue];
1612 NSArray *o_array = [NSArray array];
1613 NSArray *o_values = [[o_pasteboard propertyListForType:
1614 NSFilenamesPboardType]
1615 sortedArrayUsingSelector:
1616 @selector(caseInsensitiveCompare:)];
1618 for( i = 0; i < (int)[o_values count]; i++)
1620 NSDictionary *o_dic;
1621 o_dic = [NSDictionary dictionaryWithObject:[o_values
1622 objectAtIndex:i] forKey:@"ITEM_URL"];
1623 o_array = [o_array arrayByAddingObject: o_dic];
1628 [self appendArray:o_array atPos:index enqueue: YES];
1632 assert( p_node->i_children != -1 );
1633 [self appendNodeArray:o_array inNode: p_node
1634 atPos:index enqueue:YES];
1636 vlc_object_release( p_playlist );
1639 vlc_object_release( p_playlist );