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: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent fd75aab3
......@@ -639,6 +639,7 @@
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>"; };
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; };
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>"; };
......@@ -1148,6 +1149,7 @@
CC6C01BA0DDF3EEC00C7D754 /* auhal.c */,
CCC895830D9A8A82005AE59C /* eyetv.m */,
CC9E3E7913D1CFCF00429A71 /* qtcapture.m */,
DC1A176914E2778A001477C6 /* qtsound.m */,
CCDBA3B313D32E200006127B /* macosx.m */,
);
name = "OSX-specific source files";
......
......@@ -200,6 +200,9 @@
IBOutlet id o_qtk_long_lbl;
IBOutlet id o_qtk_device_pop;
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_fld;
IBOutlet id o_capture_width_stp;
......@@ -208,7 +211,9 @@
IBOutlet id o_capture_height_stp;
NSArray *qtkvideoDevices;
NSArray *qtkaudioDevices;
NSString *qtk_currdevice_uid;
NSString *qtkaudio_currdevice_uid;
BOOL b_autoplay;
BOOL b_nodvdmenus;
......@@ -230,7 +235,10 @@
- (NSString *)MRL;
- (NSArray *)qtkvideoDevices;
- (void)qtkrefreshDevices;
- (void)qtkrefreshVideoDevices;
- (NSArray *)qtkaudioDevices;
- (void)qtkrefreshAudioDevices;
- (void)setSubPanel;
- (void)openTarget:(int)i_type;
......@@ -262,6 +270,7 @@
- (void)showCaptureView: theView;
- (IBAction)openCaptureModeChanged:(id)sender;
- (IBAction)qtkChanged:(id)sender;
- (IBAction)qtkAudioChanged:(id)sender;
- (IBAction)eyetvSwitchChannel:(id)sender;
- (IBAction)eyetvLaunch:(id)sender;
- (IBAction)eyetvGetPlugin:(id)sender;
......
......@@ -50,7 +50,8 @@
#import <vlc_url.h>
NSArray *qtkvideoDevices;
NSArray *qtkvideoDevices;
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.")]; \
......@@ -88,7 +89,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
_o_sharedMainInstance = [super init];
p_intf = VLCIntf;
}
return _o_sharedMainInstance;
}
......@@ -186,6 +187,8 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_capture_mode_pop removeAllItems];
[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)
if( NSAppKitVersionNumber < 1115.2 )
......@@ -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_launchEyeTV_btn setTitle: _NS("Launch EyeTV now")];
[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_height_lbl setStringValue: _NS("Image height:")];
[self qtkvideoDevices];
[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)
{
......@@ -237,6 +240,32 @@ static VLCOpen *_o_sharedMainInstance = nil;
[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];
[[NSNotificationCenter defaultCenter] addObserver: self
......@@ -378,7 +407,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_tabview selectTabViewItemAtIndex: i_type];
[o_file_sub_ckbox setState: NSOffState];
i_result = [NSApp runModalForWindow: o_panel];
[o_panel close];
......@@ -439,7 +468,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
else
[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-height=%i", [o_capture_height_fld intValue]]];
......@@ -458,18 +487,21 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (IBAction)qtkChanged:(id)sender
{
NSInteger i_selectedDevice = [o_qtk_device_pop indexOfSelectedItem];
NSValue *sizes = [[[[qtkvideoDevices objectAtIndex:i_selectedDevice] formatDescriptions] objectAtIndex: 0] attributeForKey: QTFormatDescriptionVideoEncodedPixelsSizeAttribute];
[o_capture_width_fld setIntValue: [sizes sizeValue].width];
[o_capture_height_fld setIntValue: [sizes sizeValue].height];
[o_capture_width_stp setIntValue: [o_capture_width_fld intValue]];
[o_capture_height_stp setIntValue: [o_capture_height_fld intValue]];
qtk_currdevice_uid = [[(QTCaptureDevice *)[qtkvideoDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
[self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]];
}
if (i_selectedDevice >= ([qtkvideoDevices count] - 1))
{
NSValue *sizes = [[[[qtkvideoDevices objectAtIndex:i_selectedDevice] formatDescriptions] objectAtIndex: 0] attributeForKey: QTFormatDescriptionVideoEncodedPixelsSizeAttribute];
[o_capture_width_fld setIntValue: [sizes sizeValue].width];
[o_capture_height_fld setIntValue: [sizes sizeValue].height];
[o_capture_width_stp setIntValue: [o_capture_width_fld intValue]];
[o_capture_height_stp setIntValue: [o_capture_height_fld intValue]];
qtk_currdevice_uid = [[(QTCaptureDevice *)[qtkvideoDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
[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
......@@ -624,7 +656,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (IBAction)openFileBrowse:(id)sender
{
NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
[o_open_panel setAllowsMultipleSelection: NO];
[o_open_panel setCanChooseDirectories: YES];
[o_open_panel setTitle: _NS("Open File")];
......@@ -1126,7 +1158,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[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];
......@@ -1171,7 +1203,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_currentCaptureView release];
}
else
[[[[o_tabview tabViewItemAtIndex: 3] view] animator] addSubview: theView];
{
[[[[o_tabview tabViewItemAtIndex: 3] view] animator] addSubview: theView];
}
o_currentCaptureView = theView;
[o_currentCaptureView retain];
}
......@@ -1195,7 +1229,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
else
[self showCaptureView: o_eyetv_notLaunched_view];
[self setMRL: @""];
}
}
else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Screen")] )
{
[self showCaptureView: o_screen_view];
......@@ -1207,7 +1241,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_screen_top_fld setIntValue: config_GetInt( p_intf, "screen-top" )];
[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];
if ([o_capture_width_fld intValue] <= 0)
......@@ -1218,6 +1252,16 @@ static VLCOpen *_o_sharedMainInstance = nil;
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];
if(!qtkaudio_currdevice_uid)
[self setMRL: @""];
else
[self setMRL:[NSString stringWithFormat:@"qtsound://%@", qtkaudio_currdevice_uid]];
}
}
- (IBAction)screenStepperChanged:(id)sender
......@@ -1307,7 +1351,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[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] eyeTVController] allChannels];
int x = -2;
......@@ -1317,7 +1361,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[[[o_eyetv_channels_pop menu] addItemWithTitle: _NS("S-Video input")
action: nil
keyEquivalent: @""] setTag:x++];
if( channels )
if( channels )
{
NSString *channel;
[[o_eyetv_channels_pop menu] addItem: [NSMenuItem separatorItem]];
......@@ -1332,7 +1376,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
/* make Tuner the default */
[o_eyetv_channels_pop selectItemWithTag:[[[VLCMain sharedInstance] eyeTVController] currentChannel]];
}
/* clean up GUI */
[o_eyetv_chn_bgbar setHidden: YES];
[o_eyetv_chn_status_txt setHidden: YES];
......@@ -1434,17 +1478,30 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (NSArray *)qtkvideoDevices
{
if (!qtkvideoDevices)
[self qtkrefreshDevices];
if ( !qtkvideoDevices )
[self qtkrefreshVideoDevices];
return qtkvideoDevices;
}
- (void)qtkrefreshDevices
- (void)qtkrefreshVideoDevices
{
[qtkvideoDevices release];
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
@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