Commit 684c2815 authored by Michael Feurstein's avatar Michael Feurstein Committed by Felix Paul Kühne

qtsound: added GUI integration for capturing audio devices on MAC OS X

audio devices can now be selected in the capture dialog
fixes a bug where video and audio devices don't update the MRL
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent fd75aab3
...@@ -639,6 +639,7 @@ ...@@ -639,6 +639,7 @@
CCF0777A13659A8000AF19FD /* SPInvocationGrabbing.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPInvocationGrabbing.m; path = ../../../modules/gui/macosx/SPInvocationGrabbing.m; sourceTree = "<group>"; }; CCF0777A13659A8000AF19FD /* SPInvocationGrabbing.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPInvocationGrabbing.m; path = ../../../modules/gui/macosx/SPInvocationGrabbing.m; sourceTree = "<group>"; };
CCF0777B13659A8000AF19FD /* SPMediaKeyTap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPMediaKeyTap.h; path = ../../../modules/gui/macosx/SPMediaKeyTap.h; sourceTree = "<group>"; }; CCF0777B13659A8000AF19FD /* SPMediaKeyTap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPMediaKeyTap.h; path = ../../../modules/gui/macosx/SPMediaKeyTap.h; sourceTree = "<group>"; };
CCF0777C13659A8000AF19FD /* SPMediaKeyTap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPMediaKeyTap.m; path = ../../../modules/gui/macosx/SPMediaKeyTap.m; sourceTree = "<group>"; }; CCF0777C13659A8000AF19FD /* SPMediaKeyTap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPMediaKeyTap.m; path = ../../../modules/gui/macosx/SPMediaKeyTap.m; sourceTree = "<group>"; };
DC1A176914E2778A001477C6 /* qtsound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = qtsound.m; path = ../../../modules/access/qtsound.m; sourceTree = "<group>"; };
DC769AB7085DF0DB001A838D /* wizard.m */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; name = wizard.m; path = ../../../modules/gui/macosx/wizard.m; sourceTree = SOURCE_ROOT; tabWidth = 4; usesTabs = 0; }; DC769AB7085DF0DB001A838D /* wizard.m */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; name = wizard.m; path = ../../../modules/gui/macosx/wizard.m; sourceTree = SOURCE_ROOT; tabWidth = 4; usesTabs = 0; };
DC769AB8085DF0DB001A838D /* wizard.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = wizard.h; path = ../../../modules/gui/macosx/wizard.h; sourceTree = SOURCE_ROOT; }; DC769AB8085DF0DB001A838D /* wizard.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = wizard.h; path = ../../../modules/gui/macosx/wizard.h; sourceTree = SOURCE_ROOT; };
DCDA5E6408F94518009D93A8 /* about_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = about_bg.png; path = Resources/about_bg.png; sourceTree = "<group>"; }; DCDA5E6408F94518009D93A8 /* about_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = about_bg.png; path = Resources/about_bg.png; sourceTree = "<group>"; };
...@@ -1148,6 +1149,7 @@ ...@@ -1148,6 +1149,7 @@
CC6C01BA0DDF3EEC00C7D754 /* auhal.c */, CC6C01BA0DDF3EEC00C7D754 /* auhal.c */,
CCC895830D9A8A82005AE59C /* eyetv.m */, CCC895830D9A8A82005AE59C /* eyetv.m */,
CC9E3E7913D1CFCF00429A71 /* qtcapture.m */, CC9E3E7913D1CFCF00429A71 /* qtcapture.m */,
DC1A176914E2778A001477C6 /* qtsound.m */,
CCDBA3B313D32E200006127B /* macosx.m */, CCDBA3B313D32E200006127B /* macosx.m */,
); );
name = "OSX-specific source files"; name = "OSX-specific source files";
......
...@@ -200,6 +200,9 @@ ...@@ -200,6 +200,9 @@
IBOutlet id o_qtk_long_lbl; IBOutlet id o_qtk_long_lbl;
IBOutlet id o_qtk_device_pop; IBOutlet id o_qtk_device_pop;
IBOutlet id o_qtk_label_view; IBOutlet id o_qtk_label_view;
IBOutlet id o_qtkaudio_view;
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;
...@@ -208,7 +211,9 @@ ...@@ -208,7 +211,9 @@
IBOutlet id o_capture_height_stp; IBOutlet id o_capture_height_stp;
NSArray *qtkvideoDevices; NSArray *qtkvideoDevices;
NSArray *qtkaudioDevices;
NSString *qtk_currdevice_uid; NSString *qtk_currdevice_uid;
NSString *qtkaudio_currdevice_uid;
BOOL b_autoplay; BOOL b_autoplay;
BOOL b_nodvdmenus; BOOL b_nodvdmenus;
...@@ -230,7 +235,10 @@ ...@@ -230,7 +235,10 @@
- (NSString *)MRL; - (NSString *)MRL;
- (NSArray *)qtkvideoDevices; - (NSArray *)qtkvideoDevices;
- (void)qtkrefreshDevices; - (void)qtkrefreshVideoDevices;
- (NSArray *)qtkaudioDevices;
- (void)qtkrefreshAudioDevices;
- (void)setSubPanel; - (void)setSubPanel;
- (void)openTarget:(int)i_type; - (void)openTarget:(int)i_type;
...@@ -262,6 +270,7 @@ ...@@ -262,6 +270,7 @@
- (void)showCaptureView: theView; - (void)showCaptureView: theView;
- (IBAction)openCaptureModeChanged:(id)sender; - (IBAction)openCaptureModeChanged:(id)sender;
- (IBAction)qtkChanged:(id)sender; - (IBAction)qtkChanged:(id)sender;
- (IBAction)qtkAudioChanged:(id)sender;
- (IBAction)eyetvSwitchChannel:(id)sender; - (IBAction)eyetvSwitchChannel:(id)sender;
- (IBAction)eyetvLaunch:(id)sender; - (IBAction)eyetvLaunch:(id)sender;
- (IBAction)eyetvGetPlugin:(id)sender; - (IBAction)eyetvGetPlugin:(id)sender;
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#import <vlc_url.h> #import <vlc_url.h>
NSArray *qtkvideoDevices; NSArray *qtkvideoDevices;
NSArray *qtkaudioDevices;
#define setEyeTVUnconnected \ #define setEyeTVUnconnected \
[o_capture_lbl setStringValue: _NS("No device is selected")]; \ [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.")]; \
...@@ -186,6 +187,8 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -186,6 +187,8 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_capture_mode_pop removeAllItems]; [o_capture_mode_pop removeAllItems];
[o_capture_mode_pop addItemWithTitle: _NS("Capture Device")]; [o_capture_mode_pop addItemWithTitle: _NS("Capture Device")];
[o_capture_mode_pop addItemWithTitle: _NS("Video Device")];
[o_capture_mode_pop addItemWithTitle: _NS("Audio Device")];
// our screen capture module isn't Lion-compatible, so let's hide it from the user if needed (trac #4799) // our screen capture module isn't Lion-compatible, so let's hide it from the user if needed (trac #4799)
if( NSAppKitVersionNumber < 1115.2 ) if( NSAppKitVersionNumber < 1115.2 )
...@@ -207,13 +210,13 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -207,13 +210,13 @@ 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.\nLive Audio input is not supported.")]; [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_device_pop removeAllItems];
msg_Dbg( VLCIntf, "Found %lu capture devices", [qtkvideoDevices count] ); msg_Dbg( VLCIntf, "Found %lu video capture devices", [qtkvideoDevices count] );
if([qtkvideoDevices count] >= 1) if([qtkvideoDevices count] >= 1)
{ {
...@@ -237,6 +240,32 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -237,6 +240,32 @@ static VLCOpen *_o_sharedMainInstance = nil;
[qtk_currdevice_uid release]; [qtk_currdevice_uid release];
} }
[self qtkaudioDevices];
[o_qtkaudio_device_pop removeAllItems];
msg_Dbg( VLCIntf, "Found %lu audio capture devices", [qtkaudioDevices count] );
if([qtkaudioDevices count] >= 1)
{
if (!qtkaudio_currdevice_uid) {
qtkaudio_currdevice_uid = [[[QTCaptureDevice defaultInputDeviceWithMediaType: QTMediaTypeSound] uniqueID]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
}
NSUInteger deviceCount = [qtkaudioDevices count];
for(int iaudio = 0; iaudio < deviceCount; iaudio++){
QTCaptureDevice *qtkaudio_device;
qtkaudio_device = [qtkaudioDevices objectAtIndex:iaudio];
[o_qtkaudio_device_pop addItemWithTitle: [qtkaudio_device localizedDisplayName]];
if([[[qtkaudio_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtkaudio_currdevice_uid]){
[o_qtkaudio_device_pop selectItemAtIndex:iaudio];
}
}
}
else
{
[o_qtkaudio_device_pop addItemWithTitle: _NS("None")];
[qtkaudio_currdevice_uid release];
}
[self setSubPanel]; [self setSubPanel];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
...@@ -439,7 +468,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -439,7 +468,7 @@ 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("Capture Device")] ) else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Video Device")] )
{ {
[o_options addObject: [NSString stringWithFormat: @"qtcapture-width=%i", [o_capture_width_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]]]; [o_options addObject: [NSString stringWithFormat: @"qtcapture-height=%i", [o_capture_height_fld intValue]]];
...@@ -458,18 +487,21 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -458,18 +487,21 @@ 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_device_pop indexOfSelectedItem];
if (i_selectedDevice >= ([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];
[o_capture_width_fld setIntValue: [sizes sizeValue].width]; [o_capture_width_fld setIntValue: [sizes sizeValue].width];
[o_capture_height_fld setIntValue: [sizes sizeValue].height]; [o_capture_height_fld setIntValue: [sizes sizeValue].height];
[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]]; [self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]];
} }
- (IBAction)qtkAudioChanged:(id)sender
{
NSInteger i_selectedDevice = [o_qtkaudio_device_pop indexOfSelectedItem];
qtkaudio_currdevice_uid = [[(QTCaptureDevice *)[qtkaudioDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
[self setMRL:[NSString stringWithFormat:@"qtsound://%@", qtkaudio_currdevice_uid]];
} }
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi - (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
...@@ -1171,7 +1203,9 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1171,7 +1203,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_currentCaptureView release]; [o_currentCaptureView release];
} }
else else
{
[[[[o_tabview tabViewItemAtIndex: 3] view] animator] addSubview: theView]; [[[[o_tabview tabViewItemAtIndex: 3] view] animator] addSubview: theView];
}
o_currentCaptureView = theView; o_currentCaptureView = theView;
[o_currentCaptureView retain]; [o_currentCaptureView retain];
} }
...@@ -1207,7 +1241,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1207,7 +1241,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_screen_top_fld setIntValue: config_GetInt( p_intf, "screen-top" )]; [o_screen_top_fld setIntValue: config_GetInt( p_intf, "screen-top" )];
[o_screen_follow_mouse_ckb setIntValue: config_GetInt( p_intf, "screen-follow-mouse" )]; [o_screen_follow_mouse_ckb setIntValue: config_GetInt( p_intf, "screen-follow-mouse" )];
} }
else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Capture Device")] ) else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Video Device")] )
{ {
[self showCaptureView: o_qtk_view]; [self showCaptureView: o_qtk_view];
if ([o_capture_width_fld intValue] <= 0) if ([o_capture_width_fld intValue] <= 0)
...@@ -1218,6 +1252,16 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1218,6 +1252,16 @@ static VLCOpen *_o_sharedMainInstance = nil;
else else
[self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]]; [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];
if(!qtkaudio_currdevice_uid)
[self setMRL: @""];
else
[self setMRL:[NSString stringWithFormat:@"qtsound://%@", qtkaudio_currdevice_uid]];
}
} }
- (IBAction)screenStepperChanged:(id)sender - (IBAction)screenStepperChanged:(id)sender
...@@ -1434,17 +1478,30 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1434,17 +1478,30 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (NSArray *)qtkvideoDevices - (NSArray *)qtkvideoDevices
{ {
if (!qtkvideoDevices) if ( !qtkvideoDevices )
[self qtkrefreshDevices]; [self qtkrefreshVideoDevices];
return qtkvideoDevices; return qtkvideoDevices;
} }
- (void)qtkrefreshDevices - (void)qtkrefreshVideoDevices
{ {
[qtkvideoDevices release]; [qtkvideoDevices release];
qtkvideoDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo] arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain]; qtkvideoDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo] arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain];
} }
- (NSArray *)qtkaudioDevices
{
if ( !qtkaudioDevices )
[self qtkrefreshAudioDevices];
return qtkaudioDevices;
}
- (void)qtkrefreshAudioDevices
{
[qtkaudioDevices release];
qtkaudioDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeSound] arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain];
}
@end @end
@implementation VLCOpenTextField @implementation VLCOpenTextField
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment