+ if( b_autoplay )
+ [o_playlist appendArray: o_array atPos: -1 enqueue:NO];
+ else
+ [o_playlist appendArray: o_array atPos: -1 enqueue:YES];
+ }
+}
+
+- (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 )
+ {
+ int chanNum = [[[VLCMain sharedInstance] getEyeTVController] switchChannelUp: YES];
+ [o_eyetv_channels_pop selectItemWithTag:chanNum];
+ [o_mrl setStringValue: [NSString stringWithFormat:@"eyetv:// :eyetv-channel=%d", chanNum]];
+ }
+ else if( sender == o_eyetv_previousProgram_btn )
+ {
+ int chanNum = [[[VLCMain sharedInstance] getEyeTVController] switchChannelUp: NO];
+ [o_eyetv_channels_pop selectItemWithTag:chanNum];
+ [o_mrl setStringValue: [NSString stringWithFormat:@"eyetv:// :eyetv-channel=%d", chanNum]];
+ }
+ else if( sender == o_eyetv_channels_pop )
+ {
+ int chanNum = [[sender selectedItem] tag];
+ [[[VLCMain sharedInstance] getEyeTVController] selectChannel:chanNum];
+ [o_mrl setStringValue: [NSString stringWithFormat:@"eyetv:// :eyetv-channel=%d", chanNum]];
+ }
+ else
+ msg_Err( VLCIntf, "eyetvSwitchChannel sent by unknown object" );
+}
+
+- (IBAction)eyetvLaunch:(id)sender
+{
+ [[[VLCMain sharedInstance] getEyeTVController] launchEyeTV];
+}
+
+- (void)eyetvChanged:(NSNotification *)o_notification
+{
+ if( [[o_notification name] isEqualToString: @"DeviceAdded"] )
+ {
+ msg_Dbg( VLCIntf, "eyetv device was added" );
+ [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" );
+ setEyeTVUnconnected;
+ }
+ else if( [[o_notification name] isEqualToString: @"PluginQuit"] )
+ {
+ /* switch to the "launch eyetv" tab */
+ msg_Dbg( VLCIntf, "eyetv was terminated" );
+ [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" );
+ 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
+{
+ /* set up channel selection */
+ [o_eyetv_channels_pop removeAllItems];
+ [o_eyetv_chn_bgbar setHidden: NO];
+ [o_eyetv_chn_bgbar animate: self];
+ [o_eyetv_chn_status_txt setStringValue: _NS("Retrieving Channel Info...")];
+ [o_eyetv_chn_status_txt setHidden: NO];
+
+ /* retrieve info */
+ NSEnumerator *channels = [[[VLCMain sharedInstance] getEyeTVController] allChannels];
+ int x = -2;
+ [[[o_eyetv_channels_pop menu] addItemWithTitle: _NS("Composite input")
+ action: nil
+ keyEquivalent: @""] setTag:x++];
+ [[[o_eyetv_channels_pop menu] addItemWithTitle: _NS("S-Video input")
+ action: nil
+ keyEquivalent: @""] setTag:x++];
+ if( channels )
+ {
+ NSString *channel;
+ [[o_eyetv_channels_pop menu] addItem: [NSMenuItem separatorItem]];
+ while( channel = [channels nextObject] )
+ {
+ /* we have to add items this way, because we accept duplicates
+ * additionally, we save a bit of time */
+ [[[o_eyetv_channels_pop menu] addItemWithTitle: channel
+ action: nil
+ keyEquivalent: @""] setTag:++x];
+ }
+ /* make Tuner the default */
+ [o_eyetv_channels_pop selectItemWithTag:[[[VLCMain sharedInstance] getEyeTVController] currentChannel]];