/*****************************************************************************
* open.m: MacOS X module for vlc
*****************************************************************************
- * Copyright (C) 2002-2007 the VideoLAN team
+ * Copyright (C) 2002-2008 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
#import "output.h"
#import "eyetv.h"
+#define setEyeTVUnconnected \
+[o_capture_lbl setStringValue: _NS("No device connected")]; \
+[o_capture_long_lbl setStringValue: _NS("VLC could not detect any EyeTV compatible device.\n\nCheck the device's connection, make sure that the latest EyeTV software is installed and try again.")]; \
+[o_capture_lbl displayIfNeeded]; \
+[o_capture_long_lbl displayIfNeeded]; \
+[self showCaptureView: o_capture_label_view]
+
+
/*****************************************************************************
* GetEjectableMediaOfClass
*****************************************************************************/
[[o_tabview tabViewItemAtIndex: 0] setLabel: _NS("File")];
[[o_tabview tabViewItemAtIndex: 1] setLabel: _NS("Disc")];
[[o_tabview tabViewItemAtIndex: 2] setLabel: _NS("Network")];
+ [[o_tabview tabViewItemAtIndex: 3] setLabel: _NS("Capture")];
[o_file_btn_browse setTitle: _NS("Browse...")];
[o_file_stream setTitle: _NS("Treat as a pipe rather than as a file")];
[o_disc_dvd_menus setTitle: _NS("No DVD menus")];
[[o_disc_type cellAtRow:0 column:0] setTitle: _NS("VIDEO_TS directory")];
- [[o_disc_type cellAtRow:1 column:0] setTitle: _NS("DVD")];
- [[o_disc_type cellAtRow:2 column:0] setTitle: _NS("VCD")];
+ [[o_disc_type cellAtRow:1 column:0] setTitle: @"DVD"];
+ [[o_disc_type cellAtRow:2 column:0] setTitle: @"VCD"];
[[o_disc_type cellAtRow:3 column:0] setTitle: _NS("Audio CD")];
[o_net_udp_port_lbl setStringValue: _NS("Port")];
[o_net_udpm_port_lbl setStringValue: _NS("Port")];
[o_net_http_url_lbl setStringValue: _NS("URL")];
- [[o_net_mode cellAtRow:0 column:0] setTitle: _NS("UDP/RTP")];
+ [[o_net_mode cellAtRow:0 column:0] setTitle: @"UDP/RTP"];
[[o_net_mode cellAtRow:1 column:0] setTitle: _NS("UDP/RTP Multicast")];
- [[o_net_mode cellAtRow:2 column:0] setTitle: _NS("HTTP/FTP/MMS/RTSP")];
+ [[o_net_mode cellAtRow:2 column:0] setTitle: @"HTTP/FTP/MMS/RTSP"];
[o_net_timeshift_ckbox setTitle: _NS("Allow timeshifting")];
[o_net_udp_port setIntValue: config_GetInt( p_intf, "server-port" )];
[o_net_udp_port_stp setIntValue: config_GetInt( p_intf, "server-port" )];
-
+
[o_eyetv_chn_bgbar setUsesThreadedAnimation: YES];
- /* FIXME: implement EyeTV l10n here */
-
- [self setSubPanel];
+ [o_capture_mode_pop removeAllItems];
+ if( MACOS_VERSION > 10.4f )
+ [o_capture_mode_pop addItemWithTitle: @"iSight"];
+ [o_capture_mode_pop addItemWithTitle: _NS("Screen")];
+ [o_capture_mode_pop addItemWithTitle: @"EyeTV"];
+ [o_screen_lbl setStringValue: _NS("Screen Capture Input")];
+ [o_screen_long_lbl setStringValue: _NS("This facility allows you to process your screen's output.")];
+ [o_screen_fps_lbl setStringValue: _NS("Frames per Second:")];
+ [o_eyetv_currentChannel_lbl setStringValue: _NS("Current channel:")];
+ [o_eyetv_previousProgram_btn setTitle: _NS("Previous Channel")];
+ [o_eyetv_nextProgram_btn setTitle: _NS("Next Channel")];
+ [o_eyetv_chn_status_txt setStringValue: _NS("Retrieving Channel Info...")];
+ [o_eyetv_noInstance_lbl setStringValue: _NS("EyeTV is not launched")];
+ [o_eyetv_noInstanceLong_lbl setStringValue: _NS("VLC could not connect to EyeTV.\nMake sure that you installed VLC's EyeTV plugin.")];
+ [o_eyetv_launchEyeTV_btn setTitle: _NS("Launch EyeTV now")];
+
+ [self setSubPanel];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openFilePathChanged:)
name: NSControlTextDidChangeNotification
object: o_net_http_url];
- /* wake up with the correct EyeTV GUI */
- if( [[[VLCMain sharedInstance] getEyeTVController] isEyeTVrunning] == YES )
- {
- if( [[[VLCMain sharedInstance] getEyeTVController] isDeviceConnected] == YES )
- {
- [o_eyetv_tabView selectTabViewItemWithIdentifier:@"eyetvup"];
- [self setupChannelInfo];
- }
- else
- [o_eyetv_tabView selectTabViewItemWithIdentifier:@"nodevice"];
- }
- else
- [o_eyetv_tabView selectTabViewItemWithIdentifier:@"noeyetv"];
-
[[NSDistributedNotificationCenter defaultCenter] addObserver: self
selector: @selector(eyetvChanged:)
name: NULL
object: @"VLCEyeTVSupport"
suspensionBehavior: NSNotificationSuspensionBehaviorDeliverImmediately];
-
+
+ [[NSNotificationCenter defaultCenter] addObserver: self
+ selector: @selector(screenFPSfieldChanged:)
+ name: NSControlTextDidChangeNotification
+ object: o_screen_fps_fld];
+
/* register clicks on text fields */
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(textFieldWasClicked:)
{
[self openNetInfoChanged: nil];
}
- else if( [o_label isEqualToString: _NS("EyeTV")] )
+ else if( [o_label isEqualToString: _NS("Capture")] )
{
- [o_mrl setStringValue: @"eyetv://"];
+ [self openCaptureModeChanged: nil];
}
}
[self openTarget: 2];
}
+- (void)openCapture
+{
+ [self openCaptureModeChanged: nil];
+ [self showCaptureView: o_capture_label_view];
+ [self openTarget: 3];
+}
+
- (void)openFilePathChanged:(NSNotification *)o_notification
{
NSString *o_mrl_string;
}
}
+- (void)showCaptureView: theView
+{
+ NSRect o_view_rect;
+ o_view_rect = [theView frame];
+ if( o_currentCaptureView )
+ {
+ [o_currentCaptureView removeFromSuperviewWithoutNeedingDisplay];
+ [o_currentCaptureView release];
+ }
+ [theView setFrame: NSMakeRect( 0, 10, o_view_rect.size.width, o_view_rect.size.height)];
+ [theView setNeedsDisplay: YES];
+ [theView setAutoresizesSubviews: YES];
+ [[[o_tabview tabViewItemAtIndex: 3] view] addSubview: theView];
+ [theView displayIfNeeded];
+ o_currentCaptureView = theView;
+ [o_currentCaptureView retain];
+}
+
+- (IBAction)openCaptureModeChanged:(id)sender
+{
+ if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: @"EyeTV"] )
+ {
+ if( [[[VLCMain sharedInstance] getEyeTVController] isEyeTVrunning] == YES )
+ {
+ if( [[[VLCMain sharedInstance] getEyeTVController] isDeviceConnected] == YES )
+ {
+ [self showCaptureView: o_eyetv_running_view];
+ [self setupChannelInfo];
+ }
+ else
+ {
+ setEyeTVUnconnected;
+ }
+ }
+ else
+ [self showCaptureView: o_eyetv_notLaunched_view];
+ [o_mrl setStringValue: @""];
+ }
+ else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Screen")] )
+ {
+ [self showCaptureView: o_screen_view];
+ [o_mrl setStringValue: [NSString stringWithFormat:@"screen:// :screen-fps=%@", [o_screen_fps_fld stringValue]]];
+ }
+ else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: @"iSight"] )
+ {
+ [o_capture_lbl setStringValue: _NS("iSight Capture Input")];
+ [o_capture_long_lbl setStringValue: _NS("This facility allows you to process your iSight's input signal.\n\nNo settings are available in this version, so you will be provided a 640px*480px raw video stream.\n\nLive Audio input is not supported.")];
+ [o_capture_lbl displayIfNeeded];
+ [o_capture_long_lbl displayIfNeeded];
+
+ [self showCaptureView: o_capture_label_view];
+ [o_mrl setStringValue: @"qtcapture://"];
+ }
+}
+
+- (IBAction)screenStepperChanged:(id)sender
+{
+ [o_screen_fps_fld setIntValue: [o_screen_fps_stp intValue]];
+ [o_panel makeFirstResponder: o_screen_fps_fld];
+ [o_mrl setStringValue: [NSString stringWithFormat:@"screen:// :screen-fps=%@", [o_screen_fps_fld stringValue]]];
+}
+
+- (void)screenFPSfieldChanged:(NSNotification *)o_notification
+{
+ [o_screen_fps_stp setIntValue: [o_screen_fps_fld intValue]];
+ if( [[o_screen_fps_fld stringValue] isEqualToString: @""] )
+ [o_screen_fps_fld setIntValue: 1];
+ [o_mrl setStringValue: [NSString stringWithFormat:@"screen:// :screen-fps=%i", [o_screen_fps_fld intValue]]];
+}
+
- (IBAction)eyetvSwitchChannel:(id)sender
{
if( sender == o_eyetv_nextProgram_btn )
if( [[o_notification name] isEqualToString: @"DeviceAdded"] )
{
msg_Dbg( VLCIntf, "eyetv device was added" );
- [o_eyetv_tabView selectTabViewItemWithIdentifier:@"eyetvup"];
+ [self showCaptureView: o_eyetv_running_view];
[self setupChannelInfo];
}
else if( [[o_notification name] isEqualToString: @"DeviceRemoved"] )
/* leave the channel selection like that,
* switch to our "no device" tab */
msg_Dbg( VLCIntf, "eyetv device was removed" );
- [o_eyetv_tabView selectTabViewItemWithIdentifier:@"nodevice"];
+ setEyeTVUnconnected;
}
else if( [[o_notification name] isEqualToString: @"PluginQuit"] )
{
/* switch to the "launch eyetv" tab */
msg_Dbg( VLCIntf, "eyetv was terminated" );
- [o_eyetv_tabView selectTabViewItemWithIdentifier:@"noeyetv"];
+ [self showCaptureView: o_eyetv_notLaunched_view];
}
else if( [[o_notification name] isEqualToString: @"PluginInit"] )
{
/* we got no device yet */
msg_Dbg( VLCIntf, "eyetv was launched, no device yet" );
- [o_eyetv_tabView selectTabViewItemWithIdentifier:@"nodevice"];
+ setEyeTVUnconnected;
}
else
msg_Warn( VLCIntf, "unknown external notify '%s' received", [[o_notification name] UTF8String] );
-}
+}
/* little helper method, since this code needs to be run by multiple objects */
- (void)setupChannelInfo