NSArray *qtkaudioDevices;
#define setEyeTVUnconnected \
[o_capture_lbl setStringValue: _NS("No device is selected")]; \
-[o_capture_long_lbl setStringValue: _NS("No device is selected.\n\nChoose available device in above pull-down menu\n.")]; \
+[o_capture_long_lbl setStringValue: _NS("No device is selected.\n\nChoose available device in above pull-down menu.\n")]; \
[o_capture_lbl displayIfNeeded]; \
[o_capture_long_lbl displayIfNeeded]; \
[self showCaptureView: o_capture_label_view]
*****************************************************************************/
@implementation VLCOpen
+#pragma mark -
+#pragma mark Init
+
static VLCOpen *_o_sharedMainInstance = nil;
+ (VLCOpen *)sharedInstance
[o_file_slave_icon_well setImage: NULL];
[o_file_subtitles_filename_lbl setStringValue: @""];
[o_file_subtitles_icon_well setImage: NULL];
+ [o_file_custom_timing_ckb setTitle: _NS("Custom playback")];
+ [o_file_starttime_lbl setStringValue: _NS("Start time")];
+ [o_file_starttime_fld setStringValue: @""];
+ [o_file_stoptime_lbl setStringValue: _NS("Stop time")];
+ [o_file_stoptime_fld setStringValue: @""];
[o_disc_selector_pop removeAllItems];
[o_disc_selector_pop setHidden: NO];
if( p_item )
{
- for( i_index = 0; p_item->ppsz_list && p_item->ppsz_list[i_index];
+ for( i_index = 0; p_item->list.psz && p_item->list.psz[i_index];
i_index++ )
{
[o_file_sub_encoding_pop addItemWithTitle:
- [NSString stringWithUTF8String: p_item->ppsz_list[i_index]]];
+ [NSString stringWithUTF8String: p_item->list.psz[i_index]]];
}
[o_file_sub_encoding_pop selectItemWithTitle:
[NSString stringWithUTF8String: p_item->value.psz]];
if ( p_item )
{
- for ( i_index = 0; i_index < p_item->i_list; i_index++ )
+ for ( i_index = 0; i_index < p_item->list_count; i_index++ )
{
[o_file_sub_align_pop addItemWithTitle:
- _NS(p_item->ppsz_list_text[i_index])];
+ _NS(p_item->list_text[i_index])];
}
[o_file_sub_align_pop selectItemAtIndex: p_item->value.i];
}
if ( p_item )
{
- for ( i_index = 0; i_index < p_item->i_list; i_index++ )
+ for ( i_index = 0; i_index < p_item->list_count; i_index++ )
{
- [o_file_sub_size_pop addItemWithTitle: _NS(p_item->ppsz_list_text[i_index])];
- if ( p_item->value.i == p_item->pi_list[i_index] )
+ [o_file_sub_size_pop addItemWithTitle: _NS(p_item->list_text[i_index])];
+ if ( p_item->value.i == p_item->list.i[i_index] )
{
[o_file_sub_size_pop selectItemAtIndex: i_index];
}
{
[o_options addObject: [NSString stringWithFormat:
@"freetype-rel-fontsize=%i",
- p_item->pi_list[[o_file_sub_size_pop indexOfSelectedItem]]]];
+ p_item->list.i[[o_file_sub_size_pop indexOfSelectedItem]]]];
}
}
+ NSArray * components = [[o_file_starttime_fld stringValue] componentsSeparatedByString:@":"];
+ NSUInteger componentCount = [components count];
+ NSInteger tempValue;
+ if( componentCount == 1 )
+ tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] );
+ else if( componentCount == 2 )
+ tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue] );
+ else if( componentCount == 3 )
+ tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue] );
+ if (tempValue > 0)
+ [o_options addObject: [NSString stringWithFormat:@"start-time=%li", tempValue]];
+ components = [[o_file_stoptime_fld stringValue] componentsSeparatedByString:@":"];
+ componentCount = [components count];
+ if( componentCount == 1 )
+ tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] );
+ else if( componentCount == 2 )
+ tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue] );
+ else if( componentCount == 3 )
+ tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue] );
+ if (tempValue > 0)
+ [o_options addObject: [NSString stringWithFormat:@"stop-time=%li", tempValue]];
if( [o_output_ckbox state] == NSOnState )
{
NSUInteger count = [[o_sout_options mrl] count];
}
}
+#pragma mark -
+#pragma mark Main Actions
+
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
{
NSString *o_label = [o_tvi label];
[[o_panel contentView] addSubview: o_mrl_view];
}
-- (IBAction)inputSlaveAction:(id)sender
-{
- if( sender == o_file_slave_ckbox )
- [o_file_slave_select_btn setEnabled: [o_file_slave_ckbox state]];
- else
- {
- NSOpenPanel *o_open_panel;
- o_open_panel = [NSOpenPanel openPanel];
- [o_open_panel setCanChooseFiles: YES];
- [o_open_panel setCanChooseDirectories: NO];
- if( [o_open_panel runModal] == NSOKButton )
- {
- if( o_file_slave_path )
- [o_file_slave_path release];
- o_file_slave_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
- [o_file_slave_path retain];
- }
- }
- if( o_file_slave_path && [o_file_slave_ckbox state] == NSOnState)
- {
- [o_file_slave_filename_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath:o_file_slave_path]];
- [o_file_slave_icon_well setImage: [[NSWorkspace sharedWorkspace] iconForFile: o_file_slave_path]];
- }
- else
- {
- [o_file_slave_filename_lbl setStringValue: @""];
- [o_file_slave_icon_well setImage: NULL];
- }
-}
-
- (void)openFileGeneric
{
[self openFilePathChanged: nil];
[self openTarget: 3];
}
+- (void)openFile
+{
+ NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
+ b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" );
+
+ [o_open_panel setAllowsMultipleSelection: YES];
+ [o_open_panel setCanChooseDirectories: YES];
+ [o_open_panel setTitle: _NS("Open File")];
+ [o_open_panel setPrompt: _NS("Open")];
+
+ if( [o_open_panel runModal] == NSOKButton )
+ {
+ NSArray * o_urls = [o_open_panel URLs];
+ NSUInteger count = [o_urls count];
+ NSMutableArray *o_values = [NSMutableArray arrayWithCapacity:count];
+ NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
+ for( NSUInteger i = 0; i < count; i++ )
+ {
+ [o_values addObject: [[o_urls objectAtIndex: i] path]];
+ }
+ [o_values sortUsingSelector:@selector(caseInsensitiveCompare:)];
+
+ for( NSUInteger i = 0; i < count; i++ )
+ {
+ NSDictionary *o_dic;
+ char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], "file");
+ if( !psz_uri )
+ continue;
+
+ o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
+
+ free( psz_uri );
+
+ [o_array addObject: o_dic];
+ }
+ if( b_autoplay )
+ [[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:NO];
+ else
+ [[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:YES];
+ }
+}
+
+#pragma mark -
+#pragma mark File Panel
+
- (void)openFilePathChanged:(NSNotification *)o_notification
{
if ( o_file_path && [o_file_path length] > 0 )
[self openFilePathChanged: nil];
}
+- (IBAction)inputSlaveAction:(id)sender
+{
+ if( sender == o_file_slave_ckbox )
+ [o_file_slave_select_btn setEnabled: [o_file_slave_ckbox state]];
+ else
+ {
+ NSOpenPanel *o_open_panel;
+ o_open_panel = [NSOpenPanel openPanel];
+ [o_open_panel setCanChooseFiles: YES];
+ [o_open_panel setCanChooseDirectories: NO];
+ if( [o_open_panel runModal] == NSOKButton )
+ {
+ if( o_file_slave_path )
+ [o_file_slave_path release];
+ o_file_slave_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
+ [o_file_slave_path retain];
+ }
+ }
+ if( o_file_slave_path && [o_file_slave_ckbox state] == NSOnState)
+ {
+ [o_file_slave_filename_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath:o_file_slave_path]];
+ [o_file_slave_icon_well setImage: [[NSWorkspace sharedWorkspace] iconForFile: o_file_slave_path]];
+ }
+ else
+ {
+ [o_file_slave_filename_lbl setStringValue: @""];
+ [o_file_slave_icon_well setImage: NULL];
+ }
+}
+
+- (IBAction)fileTimeCustomization:(id)sender
+{
+ BOOL b_value = [o_file_custom_timing_ckb state];
+ [o_file_starttime_fld setEnabled: b_value];
+ [o_file_starttime_lbl setEnabled: b_value];
+ [o_file_stoptime_fld setEnabled: b_value];
+ [o_file_stoptime_lbl setEnabled: b_value];
+}
+
+#pragma mark -
+#pragma mark Optical Media Panel
+
- (void)showOpticalMediaView: theView withIcon:(NSImage *)icon
{
NSRect o_view_rect;
GetVolParmsInfoBuffer volumeParms;
err = FSGetVolumeParms( actualVolume, &volumeParms, sizeof(volumeParms) );
- if ( noErr != err ) {
- msg_Err( p_intf, "error retrieving volume params, bailing out" );
- return @"";
+ if ( noErr == err )
+ {
+ NSString *bsdName = [NSString stringWithUTF8String:(char *)volumeParms.vMDeviceID];
+ return [NSString stringWithFormat:@"/dev/r%@", bsdName];
}
- NSString *bsdName = [NSString stringWithUTF8String:(char *)volumeParms.vMDeviceID];
- return [NSString stringWithFormat:@"/dev/r%@", bsdName];
+ return @"";
}
- (char *)getVolumeTypeFromMountPath:(NSString *)mountPath
{
// NSFileManager is not thread-safe, don't use defaultManager outside of the main thread
NSFileManager * fm = [[NSFileManager alloc] init];
- NSArray * topLevelItems;
- topLevelItems = [fm subpathsOfDirectoryAtPath: mountPath error: NULL];
- [fm release];
- NSUInteger itemCount = [topLevelItems count];
- for (int i = 0; i < itemCount; i++) {
- if([[topLevelItems objectAtIndex:i] rangeOfString:@"SVCD"].location != NSNotFound) {
- returnValue = kVLCMediaSVCD;
- break;
- }
- if([[topLevelItems objectAtIndex:i] rangeOfString:@"VCD"].location != NSNotFound) {
- returnValue = kVLCMediaVCD;
- break;
+ NSArray *dirContents = [fm contentsOfDirectoryAtPath:mountPath error:nil];
+ for (int i = 0; i < [dirContents count]; i++)
+ {
+ NSString *currentFile = [dirContents objectAtIndex:i];
+ NSString *fullPath = [mountPath stringByAppendingPathComponent:currentFile];
+
+ BOOL isDir;
+ if ([fm fileExistsAtPath:fullPath isDirectory:&isDir] && isDir)
+ {
+ if ([currentFile caseInsensitiveCompare:@"SVCD"] == NSOrderedSame)
+ {
+ returnValue = kVLCMediaSVCD;
+ break;
+ }
+ if ([currentFile caseInsensitiveCompare:@"VCD"] == NSOrderedSame)
+ {
+ returnValue = kVLCMediaVCD;
+ break;
+ }
+ if ([currentFile caseInsensitiveCompare:@"BDMV"] == NSOrderedSame)
+ {
+ returnValue = kVLCMediaBDMVFolder;
+ break;
+ }
+ if ([currentFile caseInsensitiveCompare:@"VIDEO_TS"] == NSOrderedSame)
+ {
+ returnValue = kVLCMediaVideoTSFolder;
+ break;
+ }
}
}
+
+ [fm release];
+
if(!returnValue)
returnValue = kVLCMediaVideoTSFolder;
}
[self setMRL: [NSString stringWithFormat: @"vcd://%@@%i:%i", [self getBSDNodeFromMountPath:[o_opticalDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]]], [o_disc_vcd_title intValue], [o_disc_vcd_chapter intValue]]];
}
+#pragma mark -
+#pragma mark Network Panel
+
- (void)textFieldWasClicked:(NSNotification *)o_notification
{
if( [o_notification object] == o_net_udp_port )
}
}
-- (void)openFile
-{
- NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
- b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" );
-
- [o_open_panel setAllowsMultipleSelection: YES];
- [o_open_panel setCanChooseDirectories: YES];
- [o_open_panel setTitle: _NS("Open File")];
- [o_open_panel setPrompt: _NS("Open")];
-
- if( [o_open_panel runModal] == NSOKButton )
- {
- NSArray * o_urls = [o_open_panel URLs];
- NSUInteger count = [o_urls count];
- NSMutableArray *o_values = [NSMutableArray arrayWithCapacity:count];
- NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
- for( NSUInteger i = 0; i < count; i++ )
- {
- [o_values addObject: [[o_urls objectAtIndex: i] path]];
- }
- [o_values sortUsingSelector:@selector(caseInsensitiveCompare:)];
-
- for( NSUInteger i = 0; i < count; i++ )
- {
- NSDictionary *o_dic;
- char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], "file");
- if( !psz_uri )
- continue;
-
- o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
-
- free( psz_uri );
-
- [o_array addObject: o_dic];
- }
- if( b_autoplay )
- [[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:NO];
- else
- [[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:YES];
- }
-}
+#pragma mark -
+#pragma mark Capture Panel
- (void)showCaptureView: theView
{
[o_eyetv_chn_status_txt setHidden: YES];
}
+#pragma mark -
+#pragma mark Subtitle Settings
+
- (IBAction)subsChanged:(id)sender
{
if ([o_file_sub_ckbox state] == NSOnState)
[o_file_sub_fps setFloatValue: [o_file_sub_fps_stp floatValue]];
}
+#pragma mark -
+#pragma mark Miscellaneous
+
- (IBAction)panelCancel:(id)sender
{
[NSApp stopModalWithCode: 0];