macosx/Open: merge the QTCapture and QTSound views

This also allows to set QTSound as an input slave for QTCapture to capture both ES at the same time. (close #6851)
This commit is contained in:
Felix Paul Kühne 2012-08-23 11:12:09 +02:00
parent 001e307c5b
commit 97feb8c7ed
4 changed files with 435 additions and 387 deletions

1
NEWS
View File

@ -76,6 +76,7 @@ Mac OS X Port:
Mac OS X Interface: Mac OS X Interface:
* add a GUI for the QTSound access module to process audio captured locally * add a GUI for the QTSound access module to process audio captured locally
- This also allows to capture input from a webcam and a mic at the same time.
* add an option to let the Apple Remote control the system volume instead of * add an option to let the Apple Remote control the system volume instead of
VLC's internal volume level VLC's internal volume level
* add an option to show next / previous buttons * add an option to show next / previous buttons

File diff suppressed because it is too large Load Diff

View File

@ -213,12 +213,10 @@
/* QTK support */ /* QTK support */
IBOutlet id o_qtk_view; IBOutlet id o_qtk_view;
IBOutlet id o_qtk_long_lbl; IBOutlet id o_qtk_video_device_pop;
IBOutlet id o_qtk_device_pop; IBOutlet id o_qtk_video_ckb;
IBOutlet id o_qtk_label_view; IBOutlet id o_qtk_audio_device_pop;
IBOutlet id o_qtkaudio_view; IBOutlet id o_qtk_audio_ckb;
IBOutlet id o_qtkaudio_long_lbl;
IBOutlet id o_qtkaudio_device_pop;
IBOutlet id o_capture_width_lbl; IBOutlet id o_capture_width_lbl;
IBOutlet id o_capture_width_fld; IBOutlet id o_capture_width_fld;
IBOutlet id o_capture_width_stp; IBOutlet id o_capture_width_stp;
@ -291,6 +289,7 @@
- (IBAction)openCaptureModeChanged:(id)sender; - (IBAction)openCaptureModeChanged:(id)sender;
- (IBAction)qtkChanged:(id)sender; - (IBAction)qtkChanged:(id)sender;
- (IBAction)qtkAudioChanged:(id)sender; - (IBAction)qtkAudioChanged:(id)sender;
- (IBAction)qtkToggleUIElements:(id)sender;
- (IBAction)screenChanged:(id)sender; - (IBAction)screenChanged:(id)sender;
- (IBAction)eyetvSwitchChannel:(id)sender; - (IBAction)eyetvSwitchChannel:(id)sender;
- (IBAction)eyetvLaunch:(id)sender; - (IBAction)eyetvLaunch:(id)sender;

View File

@ -199,8 +199,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_eyetv_chn_bgbar setUsesThreadedAnimation: YES]; [o_eyetv_chn_bgbar setUsesThreadedAnimation: YES];
[o_capture_mode_pop removeAllItems]; [o_capture_mode_pop removeAllItems];
[o_capture_mode_pop addItemWithTitle: _NS("Video Device")]; [o_capture_mode_pop addItemWithTitle: _NS("Input Devices")];
[o_capture_mode_pop addItemWithTitle: _NS("Audio Device")];
[o_capture_mode_pop addItemWithTitle: _NS("Screen")]; [o_capture_mode_pop addItemWithTitle: _NS("Screen")];
[o_capture_mode_pop addItemWithTitle: @"EyeTV"]; [o_capture_mode_pop addItemWithTitle: @"EyeTV"];
[o_screen_long_lbl setStringValue: _NS("This input allows you to save, stream or display your current screen contents.")]; [o_screen_long_lbl setStringValue: _NS("This input allows you to save, stream or display your current screen contents.")];
@ -219,12 +218,11 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_eyetv_noInstanceLong_lbl setStringValue: _NS("VLC could not connect to EyeTV.\nMake sure that you installed VLC's EyeTV plugin.")]; [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")]; [o_eyetv_launchEyeTV_btn setTitle: _NS("Launch EyeTV now")];
[o_eyetv_getPlugin_btn setTitle: _NS("Download Plugin")]; [o_eyetv_getPlugin_btn setTitle: _NS("Download Plugin")];
[o_qtk_long_lbl setStringValue: _NS("This input allows you to process input signals from QuickTime-compatible video devices.\nSimultaneous live Audio input is not supported.")];
[o_capture_width_lbl setStringValue: _NS("Image width:")]; [o_capture_width_lbl setStringValue: _NS("Image width:")];
[o_capture_height_lbl setStringValue: _NS("Image height:")]; [o_capture_height_lbl setStringValue: _NS("Image height:")];
[self qtkvideoDevices]; [self qtkvideoDevices];
[o_qtk_device_pop removeAllItems]; [o_qtk_video_device_pop removeAllItems];
msg_Dbg( VLCIntf, "Found %lu video capture devices", [qtkvideoDevices count] ); msg_Dbg( VLCIntf, "Found %lu video capture devices", [qtkvideoDevices count] );
if([qtkvideoDevices count] >= 1) if([qtkvideoDevices count] >= 1)
@ -237,20 +235,20 @@ static VLCOpen *_o_sharedMainInstance = nil;
for(int ivideo = 0; ivideo < deviceCount; ivideo++){ for(int ivideo = 0; ivideo < deviceCount; ivideo++){
QTCaptureDevice *qtk_device; QTCaptureDevice *qtk_device;
qtk_device = [qtkvideoDevices objectAtIndex:ivideo]; qtk_device = [qtkvideoDevices objectAtIndex:ivideo];
[o_qtk_device_pop addItemWithTitle: [qtk_device localizedDisplayName]]; [o_qtk_video_device_pop addItemWithTitle: [qtk_device localizedDisplayName]];
if([[[qtk_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_currdevice_uid]){ if([[[qtk_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_currdevice_uid]){
[o_qtk_device_pop selectItemAtIndex:ivideo]; [o_qtk_video_device_pop selectItemAtIndex:ivideo];
} }
} }
} }
else else
{ {
[o_qtk_device_pop addItemWithTitle: _NS("None")]; [o_qtk_video_device_pop addItemWithTitle: _NS("None")];
[qtk_currdevice_uid release]; [qtk_currdevice_uid release];
} }
[self qtkaudioDevices]; [self qtkaudioDevices];
[o_qtkaudio_device_pop removeAllItems]; [o_qtk_audio_device_pop removeAllItems];
msg_Dbg( VLCIntf, "Found %lu audio capture devices", [qtkaudioDevices count] ); msg_Dbg( VLCIntf, "Found %lu audio capture devices", [qtkaudioDevices count] );
if([qtkaudioDevices count] >= 1) if([qtkaudioDevices count] >= 1)
@ -263,15 +261,15 @@ static VLCOpen *_o_sharedMainInstance = nil;
for(int iaudio = 0; iaudio < deviceCount; iaudio++){ for(int iaudio = 0; iaudio < deviceCount; iaudio++){
QTCaptureDevice *qtkaudio_device; QTCaptureDevice *qtkaudio_device;
qtkaudio_device = [qtkaudioDevices objectAtIndex:iaudio]; qtkaudio_device = [qtkaudioDevices objectAtIndex:iaudio];
[o_qtkaudio_device_pop addItemWithTitle: [qtkaudio_device localizedDisplayName]]; [o_qtk_audio_device_pop addItemWithTitle: [qtkaudio_device localizedDisplayName]];
if([[[qtkaudio_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtkaudio_currdevice_uid]){ if([[[qtkaudio_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtkaudio_currdevice_uid]){
[o_qtkaudio_device_pop selectItemAtIndex:iaudio]; [o_qtk_audio_device_pop selectItemAtIndex:iaudio];
} }
} }
} }
else else
{ {
[o_qtkaudio_device_pop addItemWithTitle: _NS("None")]; [o_qtk_audio_device_pop addItemWithTitle: _NS("None")];
[qtkaudio_currdevice_uid release]; [qtkaudio_currdevice_uid release];
} }
@ -319,19 +317,20 @@ static VLCOpen *_o_sharedMainInstance = nil;
[[sharedWorkspace notificationCenter] addObserver:self selector:@selector(scanOpticalMedia:) name:NSWorkspaceDidMountNotification object:nil]; [[sharedWorkspace notificationCenter] addObserver:self selector:@selector(scanOpticalMedia:) name:NSWorkspaceDidMountNotification object:nil];
[[sharedWorkspace notificationCenter] addObserver:self selector:@selector(scanOpticalMedia:) name:NSWorkspaceDidUnmountNotification object:nil]; [[sharedWorkspace notificationCenter] addObserver:self selector:@selector(scanOpticalMedia:) name:NSWorkspaceDidUnmountNotification object:nil];
[self performSelector:@selector(scanOpticalMedia:) withObject:nil afterDelay:2.0]; [self performSelector:@selector(qtkToggleUIElements:) withObject:nil afterDelay:.3];
[self performSelector:@selector(qtkChanged:) withObject:nil afterDelay:2.5]; [self performSelector:@selector(scanOpticalMedia:) withObject:nil afterDelay:.5];
[self performSelector:@selector(qtkAudioChanged:) withObject:nil afterDelay:3.0];
[self setMRL: @""]; [self setMRL: @""];
} }
- (void)setMRL:(NSString *)newMRL - (void)setMRL:(NSString *)newMRL
{ {
[o_mrl release]; if (o_mrl)
[o_mrl release];
o_mrl = newMRL; o_mrl = newMRL;
[o_mrl retain]; [o_mrl retain];
[o_mrl_fld setStringValue: newMRL]; [o_mrl_fld setStringValue: o_mrl];
if ([o_mrl length] > 0) if ([o_mrl length] > 0)
[o_btn_ok setEnabled: YES]; [o_btn_ok setEnabled: YES];
else else
@ -505,10 +504,15 @@ static VLCOpen *_o_sharedMainInstance = nil;
else else
[o_options addObject: @"no-screen-follow-mouse"]; [o_options addObject: @"no-screen-follow-mouse"];
} }
else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Video Device")] ) else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Input Devices")] )
{ {
[o_options addObject: [NSString stringWithFormat: @"qtcapture-width=%i", [o_capture_width_fld intValue]]]; if ([o_qtk_video_ckb state])
[o_options addObject: [NSString stringWithFormat: @"qtcapture-height=%i", [o_capture_height_fld intValue]]]; {
[o_options addObject: [NSString stringWithFormat: @"qtcapture-width=%i", [o_capture_width_fld intValue]]];
[o_options addObject: [NSString stringWithFormat: @"qtcapture-height=%i", [o_capture_height_fld intValue]]];
if ([o_qtk_audio_ckb state] && qtkaudio_currdevice_uid)
[o_options addObject: [NSString stringWithFormat: @"input-slave=qtsound://%@", qtkaudio_currdevice_uid]];
}
} }
} }
@ -537,7 +541,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (IBAction)qtkChanged:(id)sender - (IBAction)qtkChanged:(id)sender
{ {
NSInteger i_selectedDevice = [o_qtk_device_pop indexOfSelectedItem]; NSInteger i_selectedDevice = [o_qtk_video_device_pop indexOfSelectedItem];
if( [qtkvideoDevices count] >= 1 ) if( [qtkvideoDevices count] >= 1 )
{ {
NSValue *sizes = [[[[qtkvideoDevices objectAtIndex:i_selectedDevice] formatDescriptions] objectAtIndex: 0] attributeForKey: QTFormatDescriptionVideoEncodedPixelsSizeAttribute]; NSValue *sizes = [[[[qtkvideoDevices objectAtIndex:i_selectedDevice] formatDescriptions] objectAtIndex: 0] attributeForKey: QTFormatDescriptionVideoEncodedPixelsSizeAttribute];
@ -547,20 +551,32 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_capture_width_stp setIntValue: [o_capture_width_fld intValue]]; [o_capture_width_stp setIntValue: [o_capture_width_fld intValue]];
[o_capture_height_stp setIntValue: [o_capture_height_fld intValue]]; [o_capture_height_stp setIntValue: [o_capture_height_fld intValue]];
qtk_currdevice_uid = [[(QTCaptureDevice *)[qtkvideoDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; qtk_currdevice_uid = [[(QTCaptureDevice *)[qtkvideoDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
[self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]];
} }
} }
- (IBAction)qtkAudioChanged:(id)sender - (IBAction)qtkAudioChanged:(id)sender
{ {
NSInteger i_selectedDevice = [o_qtkaudio_device_pop indexOfSelectedItem]; NSInteger i_selectedDevice = [o_qtk_audio_device_pop indexOfSelectedItem];
if( [qtkaudioDevices count] >= 1 ) if( [qtkaudioDevices count] >= 1 )
{ {
qtkaudio_currdevice_uid = [[(QTCaptureDevice *)[qtkaudioDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; qtkaudio_currdevice_uid = [[(QTCaptureDevice *)[qtkaudioDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
[self setMRL:[NSString stringWithFormat:@"qtsound://%@", qtkaudio_currdevice_uid]];
} }
} }
- (IBAction)qtkToggleUIElements:(id)sender
{
[o_qtk_audio_device_pop setEnabled:[o_qtk_audio_ckb state]];
BOOL b_state = [o_qtk_video_ckb state];
[o_qtk_video_device_pop setEnabled:b_state];
[o_capture_width_fld setEnabled:b_state];
[o_capture_width_stp setEnabled:b_state];
[o_capture_height_fld setEnabled:b_state];
[o_capture_height_stp setEnabled:b_state];
[self qtkAudioChanged:sender];
[self qtkChanged:sender];
[self openCaptureModeChanged:sender];
}
#pragma mark - #pragma mark -
#pragma mark Main Actions #pragma mark Main Actions
@ -1402,25 +1418,19 @@ static VLCOpen *_o_sharedMainInstance = nil;
free( ids ); free( ids );
} }
} }
else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Video Device")] ) else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Input Devices")] )
{ {
[self showCaptureView: o_qtk_view]; [self showCaptureView: o_qtk_view];
if ([o_capture_width_fld intValue] <= 0) if ([o_capture_width_fld intValue] <= 0)
[self qtkChanged:nil]; [self qtkChanged:nil];
if(!qtk_currdevice_uid)
[self setMRL: @""];
else
[self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]];
}
else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Audio Device")] )
{
[self showCaptureView: o_qtkaudio_view];
[self qtkAudioChanged:nil]; [self qtkAudioChanged:nil];
if(!qtkaudio_currdevice_uid) [self setMRL: @""];
[self setMRL: @""];
else if ([o_qtk_video_ckb state] && qtk_currdevice_uid)
[self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]];
else if([o_qtk_audio_ckb state] && qtkaudio_currdevice_uid)
[self setMRL:[NSString stringWithFormat:@"qtsound://%@", qtkaudio_currdevice_uid]]; [self setMRL:[NSString stringWithFormat:@"qtsound://%@", qtkaudio_currdevice_uid]];
} }
} }