1 /*****************************************************************************
2 * open.m: MacOS X module for vlc
3 *****************************************************************************
4 * Copyright (C) 2002-2006 the VideoLAN team
7 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8 * Christophe Massiot <massiot@via.ecp.fr>
9 * Derk-Jan Hartman <thedj@users.sourceforge.net>
10 * Benjamin Pracht <bigben at videolan dot org>
11 * Felix K
\9fhne <fkuehne at videolan dot org>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
28 /*****************************************************************************
30 *****************************************************************************/
31 #include <stdlib.h> /* malloc(), free() */
32 #include <sys/param.h> /* for MAXPATHLEN */
36 #include <IOKit/IOKitLib.h>
37 #include <IOKit/IOBSD.h>
38 #include <IOKit/storage/IOMedia.h>
39 #include <IOKit/storage/IOCDMedia.h>
40 #include <IOKit/storage/IODVDMedia.h>
46 #import <vlc_interface.h>
48 /*****************************************************************************
49 * GetEjectableMediaOfClass
50 *****************************************************************************/
51 NSArray *GetEjectableMediaOfClass( const char *psz_class )
53 io_object_t next_media;
54 mach_port_t master_port;
55 kern_return_t kern_result;
56 NSArray *o_devices = nil;
57 NSMutableArray *p_list = nil;
58 io_iterator_t media_iterator;
59 CFMutableDictionaryRef classes_to_match;
61 kern_result = IOMasterPort( MACH_PORT_NULL, &master_port );
62 if( kern_result != KERN_SUCCESS )
67 classes_to_match = IOServiceMatching( psz_class );
68 if( classes_to_match == NULL )
73 CFDictionarySetValue( classes_to_match, CFSTR( kIOMediaEjectableKey ),
76 kern_result = IOServiceGetMatchingServices( master_port, classes_to_match,
78 if( kern_result != KERN_SUCCESS )
83 p_list = [NSMutableArray arrayWithCapacity: 1];
85 next_media = IOIteratorNext( media_iterator );
86 if( next_media != nil )
89 size_t dev_path_length;
90 CFTypeRef str_bsd_path;
94 str_bsd_path = IORegistryEntryCreateCFProperty( next_media,
95 CFSTR( kIOBSDNameKey ),
98 if( str_bsd_path == NULL )
100 IOObjectRelease( next_media );
104 snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
105 dev_path_length = strlen( psz_buf );
107 if( CFStringGetCString( str_bsd_path,
108 (char*)&psz_buf + dev_path_length,
109 sizeof(psz_buf) - dev_path_length,
110 kCFStringEncodingASCII ) )
112 [p_list addObject: [NSString stringWithCString: psz_buf]];
115 CFRelease( str_bsd_path );
117 IOObjectRelease( next_media );
119 } while( ( next_media = IOIteratorNext( media_iterator ) ) != nil );
122 IOObjectRelease( media_iterator );
124 o_devices = [NSArray arrayWithArray: p_list];
129 /*****************************************************************************
130 * VLCOpen implementation
131 *****************************************************************************/
132 @implementation VLCOpen
134 static VLCOpen *_o_sharedMainInstance = nil;
136 + (VLCOpen *)sharedInstance
138 return _o_sharedMainInstance ? _o_sharedMainInstance : [[self alloc] init];
143 if( _o_sharedMainInstance) {
146 _o_sharedMainInstance = [super init];
149 return _o_sharedMainInstance;
154 intf_thread_t * p_intf = VLCIntf;
156 [o_panel setTitle: _NS("Open Source")];
157 [o_mrl_lbl setTitle: _NS("Media Resource Locator (MRL)")];
159 [o_btn_ok setTitle: _NS("OK")];
160 [o_btn_cancel setTitle: _NS("Cancel")];
162 [[o_tabview tabViewItemAtIndex: 0] setLabel: _NS("File")];
163 [[o_tabview tabViewItemAtIndex: 1] setLabel: _NS("Disc")];
164 [[o_tabview tabViewItemAtIndex: 2] setLabel: _NS("Network")];
166 [o_file_btn_browse setTitle: _NS("Browse...")];
167 [o_file_stream setTitle: _NS("Treat as a pipe rather than as a file")];
169 [o_disc_device_lbl setStringValue: _NS("Device name")];
170 [o_disc_title_lbl setStringValue: _NS("Title")];
171 [o_disc_chapter_lbl setStringValue: _NS("Chapter")];
172 [o_disc_videots_btn_browse setTitle: _NS("Browse...")];
173 [o_disc_dvd_menus setTitle: _NS("Use DVD menus")];
175 [[o_disc_type cellAtRow:0 column:0] setTitle: _NS("VIDEO_TS directory")];
176 [[o_disc_type cellAtRow:1 column:0] setTitle: _NS("DVD")];
177 [[o_disc_type cellAtRow:2 column:0] setTitle: _NS("VCD")];
178 [[o_disc_type cellAtRow:3 column:0] setTitle: _NS("Audio CD")];
180 [o_net_udp_port_lbl setStringValue: _NS("Port")];
181 [o_net_udpm_addr_lbl setStringValue: _NS("Address")];
182 [o_net_udpm_port_lbl setStringValue: _NS("Port")];
183 [o_net_http_url_lbl setStringValue: _NS("URL")];
185 [[o_net_mode cellAtRow:0 column:0] setTitle: _NS("UDP/RTP")];
186 [[o_net_mode cellAtRow:1 column:0] setTitle: _NS("UDP/RTP Multicast")];
187 [[o_net_mode cellAtRow:2 column:0] setTitle: _NS("HTTP/FTP/MMS/RTSP")];
188 [o_net_timeshift_ckbox setTitle: _NS("Allow timeshifting")];
190 [o_net_udp_port setIntValue: config_GetInt( p_intf, "server-port" )];
191 [o_net_udp_port_stp setIntValue: config_GetInt( p_intf, "server-port" )];
196 [[NSNotificationCenter defaultCenter] addObserver: self
197 selector: @selector(openFilePathChanged:)
198 name: NSControlTextDidChangeNotification
199 object: o_file_path];
201 [[NSNotificationCenter defaultCenter] addObserver: self
202 selector: @selector(openDiscInfoChanged:)
203 name: NSControlTextDidChangeNotification
204 object: o_disc_device];
205 [[NSNotificationCenter defaultCenter] addObserver: self
206 selector: @selector(openDiscInfoChanged:)
207 name: NSControlTextDidChangeNotification
208 object: o_disc_title];
209 [[NSNotificationCenter defaultCenter] addObserver: self
210 selector: @selector(openDiscInfoChanged:)
211 name: NSControlTextDidChangeNotification
212 object: o_disc_chapter];
213 [[NSNotificationCenter defaultCenter] addObserver: self
214 selector: @selector(openDiscInfoChanged:)
215 name: NSControlTextDidChangeNotification
216 object: o_disc_videots_folder];
218 [[NSNotificationCenter defaultCenter] addObserver: self
219 selector: @selector(openNetInfoChanged:)
220 name: NSControlTextDidChangeNotification
221 object: o_net_udp_port];
222 [[NSNotificationCenter defaultCenter] addObserver: self
223 selector: @selector(openNetInfoChanged:)
224 name: NSControlTextDidChangeNotification
225 object: o_net_udpm_addr];
226 [[NSNotificationCenter defaultCenter] addObserver: self
227 selector: @selector(openNetInfoChanged:)
228 name: NSControlTextDidChangeNotification
229 object: o_net_udpm_port];
230 [[NSNotificationCenter defaultCenter] addObserver: self
231 selector: @selector(openNetInfoChanged:)
232 name: NSControlTextDidChangeNotification
233 object: o_net_http_url];
238 intf_thread_t * p_intf = VLCIntf;
240 module_config_t * p_item;
242 [o_file_sub_ckbox setTitle: _NS("Load subtitles file:")];
243 [o_file_sub_btn_settings setTitle: _NS("Settings...")];
244 [o_file_sub_btn_browse setTitle: _NS("Browse...")];
245 [o_file_sub_override setTitle: _NS("Override parametters")];
246 [o_file_sub_delay_lbl setStringValue: _NS("Delay")];
247 [o_file_sub_delay_stp setEnabled: NO];
248 [o_file_sub_fps_lbl setStringValue: _NS("FPS")];
249 [o_file_sub_fps_stp setEnabled: NO];
250 [o_file_sub_encoding_lbl setStringValue: _NS("Subtitles encoding")];
251 [o_file_sub_encoding_pop removeAllItems];
252 [o_file_sub_size_lbl setStringValue: _NS("Font size")];
253 [o_file_sub_size_pop removeAllItems];
254 [o_file_sub_align_lbl setStringValue: _NS("Subtitles alignment")];
255 [o_file_sub_align_pop removeAllItems];
256 [o_file_sub_ok_btn setStringValue: _NS("OK")];
257 [o_file_sub_font_box setTitle: _NS("Font Properties")];
258 [o_file_sub_file_box setTitle: _NS("Subtitle File")];
260 p_item = config_FindConfig( VLC_OBJECT(p_intf), "subsdec-encoding" );
264 for( i_index = 0; p_item->ppsz_list && p_item->ppsz_list[i_index];
267 [o_file_sub_encoding_pop addItemWithTitle:
268 [NSString stringWithCString:
269 p_item->ppsz_list[i_index]]];
271 [o_file_sub_encoding_pop selectItemWithTitle:
272 [NSString stringWithCString:
276 p_item = config_FindConfig( VLC_OBJECT(p_intf), "subsdec-align" );
280 for ( i_index = 0; i_index < p_item->i_list; i_index++ )
282 [o_file_sub_align_pop addItemWithTitle:
283 [NSString stringWithUTF8String:
284 p_item->ppsz_list_text[i_index]]];
286 [o_file_sub_align_pop selectItemAtIndex: p_item->value.i];
289 p_item = config_FindConfig( VLC_OBJECT(p_intf), "freetype-rel-fontsize" );
293 for ( i_index = 0; i_index < p_item->i_list; i_index++ )
295 [o_file_sub_size_pop addItemWithTitle:
296 [NSString stringWithUTF8String:
297 p_item->ppsz_list_text[i_index]]];
298 if ( p_item->value.i == p_item->pi_list[i_index] )
300 [o_file_sub_size_pop selectItemAtIndex: i_index];
306 - (void)openTarget:(int)i_type
309 intf_thread_t * p_intf = VLCIntf;
311 b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" );
313 [o_tabview selectTabViewItemAtIndex: i_type];
314 [o_file_sub_ckbox setState: NSOffState];
316 i_result = [NSApp runModalForWindow: o_panel];
321 NSMutableDictionary *o_dic;
322 NSMutableArray *o_options = [NSMutableArray array];
325 o_dic = [NSMutableDictionary dictionaryWithObject: [o_mrl stringValue] forKey: @"ITEM_URL"];
326 if( [o_file_sub_ckbox state] == NSOnState )
328 module_config_t * p_item;
330 [o_options addObject: [NSString stringWithFormat: @"sub-file=%@", [o_file_sub_path stringValue]]];
331 if( [o_file_sub_override state] == NSOnState )
333 [o_options addObject: [NSString stringWithFormat: @"sub-delay=%i", (int)( [o_file_sub_delay intValue] * 10 )]];
334 [o_options addObject: [NSString stringWithFormat: @"sub-fps=%f", [o_file_sub_fps floatValue]]];
336 [o_options addObject: [NSString stringWithFormat:
337 @"subsdec-encoding=%@",
338 [o_file_sub_encoding_pop titleOfSelectedItem]]];
339 [o_options addObject: [NSString stringWithFormat:
341 [o_file_sub_align_pop indexOfSelectedItem]]];
343 p_item = config_FindConfig( VLC_OBJECT(p_intf),
344 "freetype-rel-fontsize" );
348 [o_options addObject: [NSString stringWithFormat:
349 @"freetype-rel-fontsize=%i",
350 p_item->pi_list[[o_file_sub_size_pop indexOfSelectedItem]]]];
353 if( [o_output_ckbox state] == NSOnState )
355 for (i = 0 ; i < [[o_sout_options getMRL] count] ; i++)
357 [o_options addObject: [NSString stringWithString:
358 [[(VLCOutput *)o_sout_options getMRL] objectAtIndex: i]]];
361 if( [o_net_timeshift_ckbox state] == NSOnState )
363 [o_options addObject: [NSString stringWithString:
364 @"access-filter=timeshift"]];
366 [o_dic setObject: (NSArray *)[o_options copy] forKey: @"ITEM_OPTIONS"];
368 [o_playlist appendArray: [NSArray arrayWithObject: o_dic] atPos: -1 enqueue:NO];
370 [o_playlist appendArray: [NSArray arrayWithObject: o_dic] atPos: -1 enqueue:YES];
374 - (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
376 NSString *o_label = [o_tvi label];
378 if( [o_label isEqualToString: _NS("File")] )
380 [self openFilePathChanged: nil];
382 else if( [o_label isEqualToString: _NS("Disc")] )
384 [self openDiscTypeChanged: nil];
386 else if( [o_label isEqualToString: _NS("Network")] )
388 [self openNetModeChanged: nil];
392 - (void)openFileGeneric
394 [self openFilePathChanged: nil];
395 [self openTarget: 0];
400 [self openDiscTypeChanged: nil];
401 [self openTarget: 1];
406 [self openNetModeChanged: nil];
407 [self openTarget: 2];
410 - (void)openFilePathChanged:(NSNotification *)o_notification
412 NSString *o_mrl_string;
413 NSString *o_filename = [o_file_path stringValue];
414 NSString *o_ext = [o_filename pathExtension];
415 vlc_bool_t b_stream = [o_file_stream state];
418 [[NSFileManager defaultManager] fileExistsAtPath:o_filename isDirectory:&b_dir];
422 o_mrl_string = [NSString stringWithFormat: @"dir:%@", o_filename];
424 else if( [o_ext isEqualToString: @"bin"] ||
425 [o_ext isEqualToString: @"cue"] ||
426 [o_ext isEqualToString: @"vob"] ||
427 [o_ext isEqualToString: @"iso"] )
429 o_mrl_string = o_filename;
433 o_mrl_string = [NSString stringWithFormat: @"%s://%@",
434 b_stream ? "stream" : "file",
437 [o_mrl setStringValue: o_mrl_string];
440 - (IBAction)openFileBrowse:(id)sender
442 NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
444 [o_open_panel setAllowsMultipleSelection: NO];
445 [o_open_panel setCanChooseDirectories: YES];
446 [o_open_panel setTitle: _NS("Open File")];
447 [o_open_panel setPrompt: _NS("Open")];
449 [o_open_panel beginSheetForDirectory:nil
452 modalForWindow:[sender window]
454 didEndSelector: @selector(pathChosenInPanel:
460 - (void)pathChosenInPanel: (NSOpenPanel *) sheet withReturn:(int)returnCode contextInfo:(void *)contextInfo
462 if (returnCode == NSFileHandlingPanelOKButton)
464 NSString *o_filename = [[sheet filenames] objectAtIndex: 0];
465 [o_file_path setStringValue: o_filename];
466 [self openFilePathChanged: nil];
470 - (IBAction)openFileStreamChanged:(id)sender
472 [self openFilePathChanged: nil];
475 - (IBAction)openDiscTypeChanged:(id)sender
478 vlc_bool_t b_device, b_menus, b_title_chapter;
480 [o_disc_device removeAllItems];
481 b_title_chapter = ![o_disc_dvd_menus state];
483 o_type = [[o_disc_type selectedCell] title];
485 if ( [o_type isEqualToString: _NS("VIDEO_TS directory")] )
487 b_device = 0; b_menus = 1;
493 const char *psz_class = NULL;
496 if ( [o_type isEqualToString: _NS("VCD")] )
498 psz_class = kIOCDMediaClass;
500 b_menus = 0; b_title_chapter = 1;
501 [o_disc_dvd_menus setState: FALSE];
503 else if ( [o_type isEqualToString: _NS("Audio CD")])
505 psz_class = kIOCDMediaClass;
507 b_menus = 0; b_title_chapter = 0;
508 [o_disc_dvd_menus setState: FALSE];
512 psz_class = kIODVDMediaClass;
517 o_devices = GetEjectableMediaOfClass( psz_class );
518 if ( o_devices != nil )
520 int i_devices = [o_devices count];
526 for( i = 0; i < i_devices; i++ )
529 addItemWithObjectValue: [o_devices objectAtIndex: i]];
532 [o_disc_device selectItemAtIndex: 0];
536 [o_disc_device setStringValue:
537 [NSString stringWithFormat: _NS("No %@s found"), o_disc]];
542 [o_disc_device setEnabled: b_device];
543 [o_disc_title setEnabled: b_title_chapter];
544 [o_disc_title_stp setEnabled: b_title_chapter];
545 [o_disc_chapter setEnabled: b_title_chapter];
546 [o_disc_chapter_stp setEnabled: b_title_chapter];
547 [o_disc_videots_folder setEnabled: !b_device];
548 [o_disc_videots_btn_browse setEnabled: !b_device];
549 [o_disc_dvd_menus setEnabled: b_menus];
551 [self openDiscInfoChanged: nil];
554 - (IBAction)openDiscStepperChanged:(id)sender
556 int i_tag = [sender tag];
560 [o_disc_title setIntValue: [o_disc_title_stp intValue]];
562 else if( i_tag == 1 )
564 [o_disc_chapter setIntValue: [o_disc_chapter_stp intValue]];
567 [self openDiscInfoChanged: nil];
570 - (void)openDiscInfoChanged:(NSNotification *)o_notification
575 NSString *o_mrl_string;
576 int i_title, i_chapter;
579 o_type = [[o_disc_type selectedCell] title];
580 o_device = [o_disc_device stringValue];
581 i_title = [o_disc_title intValue];
582 i_chapter = [o_disc_chapter intValue];
583 o_videots = [o_disc_videots_folder stringValue];
584 b_menus = [o_disc_dvd_menus state];
586 if ( [o_type isEqualToString: _NS("VCD")] )
588 if ( [o_device isEqualToString:
589 [NSString stringWithFormat: _NS("No %@s found"), o_type]] )
591 o_mrl_string = [NSString stringWithFormat: @"vcd://%@@%i:%i",
592 o_device, i_title, i_chapter];
594 else if ( [o_type isEqualToString: _NS("Audio CD")] )
596 if ( [o_device isEqualToString:
597 [NSString stringWithFormat: _NS("No %@s found"), o_type]] )
599 o_mrl_string = [NSString stringWithFormat: @"cdda://%@",
602 else if ( [o_type isEqualToString: _NS("DVD")] )
604 if ( [o_device isEqualToString:
605 [NSString stringWithFormat: _NS("No %@s found"), o_type]] )
608 o_mrl_string = [NSString stringWithFormat: @"dvdnav://%@",
611 o_mrl_string = [NSString stringWithFormat: @"dvdread://%@@%i:%i-",
612 o_device, i_title, i_chapter];
614 else /* VIDEO_TS folder */
617 o_mrl_string = [NSString stringWithFormat: @"dvdnav://%@",
620 o_mrl_string = [NSString stringWithFormat: @"dvdread://%@@%i:%i",
621 o_videots, i_title, i_chapter];
624 [o_mrl setStringValue: o_mrl_string];
627 - (IBAction)openDiscMenusChanged:(id)sender
629 [self openDiscInfoChanged: nil];
630 [self openDiscTypeChanged: nil];
633 - (IBAction)openVTSBrowse:(id)sender
635 NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
637 [o_open_panel setAllowsMultipleSelection: NO];
638 [o_open_panel setCanChooseFiles: NO];
639 [o_open_panel setCanChooseDirectories: YES];
640 [o_open_panel setTitle: _NS("Open VIDEO_TS Directory")];
641 [o_open_panel setPrompt: _NS("Open")];
643 if( [o_open_panel runModalForDirectory: nil
644 file: nil types: nil] == NSOKButton )
646 NSString *o_dirname = [[o_open_panel filenames] objectAtIndex: 0];
647 [o_disc_videots_folder setStringValue: o_dirname];
648 [self openDiscInfoChanged: nil];
652 - (IBAction)openNetModeChanged:(id)sender
659 o_mode = [[o_net_mode selectedCell] title];
661 if( [o_mode isEqualToString: _NS("UDP/RTP")] ) b_udp = TRUE;
662 else if( [o_mode isEqualToString: _NS("UDP/RTP Multicast")] ) b_udpm = TRUE;
663 else if( [o_mode isEqualToString: _NS("HTTP/FTP/MMS/RTSP")] ) b_http = TRUE;
665 [o_net_udp_port setEnabled: b_udp];
666 [o_net_udp_port_stp setEnabled: b_udp];
667 [o_net_udpm_addr setEnabled: b_udpm];
668 [o_net_udpm_port setEnabled: b_udpm];
669 [o_net_udpm_port_stp setEnabled: b_udpm];
670 [o_net_http_url setEnabled: b_http];
672 [self openNetInfoChanged: nil];
675 - (IBAction)openNetStepperChanged:(id)sender
677 int i_tag = [sender tag];
681 [o_net_udp_port setIntValue: [o_net_udp_port_stp intValue]];
683 else if( i_tag == 1 )
685 [o_net_udpm_port setIntValue: [o_net_udpm_port_stp intValue]];
688 [self openNetInfoChanged: nil];
691 - (void)openNetInfoChanged:(NSNotification *)o_notification
694 NSString *o_mrl_string = [NSString string];
695 intf_thread_t * p_intf = VLCIntf;
697 o_mode = [[o_net_mode selectedCell] title];
699 if( [o_mode isEqualToString: _NS("UDP/RTP")] )
701 int i_port = [o_net_udp_port intValue];
703 o_mrl_string = [NSString stringWithString: @"udp://"];
705 if( i_port != config_GetInt( p_intf, "server-port" ) )
708 [o_mrl_string stringByAppendingFormat: @"@:%i", i_port];
711 else if( [o_mode isEqualToString: _NS("UDP/RTP Multicast")] )
713 NSString *o_addr = [o_net_udpm_addr stringValue];
714 int i_port = [o_net_udpm_port intValue];
716 o_mrl_string = [NSString stringWithFormat: @"udp://@%@", o_addr];
718 if( i_port != config_GetInt( p_intf, "server-port" ) )
721 [o_mrl_string stringByAppendingFormat: @":%i", i_port];
724 else if( [o_mode isEqualToString: _NS("HTTP/FTP/MMS/RTSP")] )
726 NSString *o_url = [o_net_http_url stringValue];
728 if ( ![o_url hasPrefix:@"http:"] && ![o_url hasPrefix:@"ftp:"]
729 && ![o_url hasPrefix:@"mms"] && ![o_url hasPrefix:@"rtsp"] )
730 o_mrl_string = [NSString stringWithFormat: @"http://%@", o_url];
732 o_mrl_string = o_url;
734 [o_mrl setStringValue: o_mrl_string];
739 NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
741 b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" );
743 [o_open_panel setAllowsMultipleSelection: YES];
744 [o_open_panel setCanChooseDirectories: YES];
745 [o_open_panel setTitle: _NS("Open File")];
746 [o_open_panel setPrompt: _NS("Open")];
748 if( [o_open_panel runModalForDirectory: nil
749 file: nil types: nil] == NSOKButton )
751 NSArray *o_array = [NSArray array];
752 NSArray *o_values = [[o_open_panel filenames]
753 sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
755 for( i = 0; i < (int)[o_values count]; i++)
758 o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
759 o_array = [o_array arrayByAddingObject: o_dic];
762 [o_playlist appendArray: o_array atPos: -1 enqueue:NO];
764 [o_playlist appendArray: o_array atPos: -1 enqueue:YES];
768 - (IBAction)subsChanged:(id)sender
770 if ([o_file_sub_ckbox state] == NSOnState)
772 [o_file_sub_btn_settings setEnabled:YES];
776 [o_file_sub_btn_settings setEnabled:NO];
780 - (IBAction)subSettings:(id)sender
782 [NSApp beginSheet: o_file_sub_sheet
783 modalForWindow: [sender window]
789 - (IBAction)subFileBrowse:(id)sender
791 NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
793 [o_open_panel setAllowsMultipleSelection: NO];
794 [o_open_panel setTitle: _NS("Open File")];
795 [o_open_panel setPrompt: _NS("Open")];
797 if( [o_open_panel runModalForDirectory: nil
798 file: nil types: nil] == NSOKButton )
800 NSString *o_filename = [[o_open_panel filenames] objectAtIndex: 0];
801 [o_file_sub_path setStringValue: o_filename];
805 - (IBAction)subOverride:(id)sender
807 BOOL b_state = [o_file_sub_override state];
808 [o_file_sub_delay setEnabled: b_state];
809 [o_file_sub_delay_stp setEnabled: b_state];
810 [o_file_sub_fps setEnabled: b_state];
811 [o_file_sub_fps_stp setEnabled: b_state];
814 - (IBAction)subDelayStepperChanged:(id)sender
816 [o_file_sub_delay setIntValue: [o_file_sub_delay_stp intValue]];
819 - (IBAction)subFpsStepperChanged:(id)sender;
821 [o_file_sub_fps setFloatValue: [o_file_sub_fps_stp floatValue]];
824 - (IBAction)subCloseSheet:(id)sender
826 [o_file_sub_sheet orderOut:sender];
827 [NSApp endSheet: o_file_sub_sheet];
830 - (IBAction)panelCancel:(id)sender
832 [NSApp stopModalWithCode: 0];
835 - (IBAction)panelOk:(id)sender
837 if( [[o_mrl stringValue] length] )
839 [NSApp stopModalWithCode: 1];