[vlc-commits] macosx: open panel: fix MRL generation for multiple input devices

David Fuhrmann git at videolan.org
Wed Mar 31 21:48:01 UTC 2021


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Wed Mar 31 22:58:57 2021 +0200| [c21bf10646a6c432a0d1fb695256778a84c83a13] | committer: David Fuhrmann

macosx: open panel: fix MRL generation for multiple input devices

Fix issue in MRL generation for  multiple audio / video input devices.
Now updates the correct MRL in case the device selection changed.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c21bf10646a6c432a0d1fb695256778a84c83a13
---

 .../gui/macosx/windows/VLCOpenWindowController.m   | 27 +++++++++++++---------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/modules/gui/macosx/windows/VLCOpenWindowController.m b/modules/gui/macosx/windows/VLCOpenWindowController.m
index 2bddc39345..0ca7298b22 100644
--- a/modules/gui/macosx/windows/VLCOpenWindowController.m
+++ b/modules/gui/macosx/windows/VLCOpenWindowController.m
@@ -1122,15 +1122,8 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
     else if ([[[_captureModePopup selectedItem] title] isEqualToString: _NS("Input Devices")]) {
         [_captureTabView selectTabViewItemAtIndex:0];
 
-        [self qtkChanged:nil];
-        [self qtkAudioChanged:nil];
-
         [self setMRL: @""];
-
-        if ([_qtkVideoCheckbox state] && _avCurrentDeviceUID)
-            [self setMRL:[NSString stringWithFormat:@"avcapture://%@", _avCurrentDeviceUID]];
-        else if ([_qtkAudioCheckbox state] && _avCurrentAudioDeviceUID)
-            [self setMRL:[NSString stringWithFormat:@"avaudiocapture://%@", _avCurrentAudioDeviceUID]];
+        [self qtkToggleUIElements: nil];
     }
 }
 
@@ -1166,6 +1159,17 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
 }
 
 // QTKit Recording actions
+
+- (void)updateInputDevicesUrl
+{
+    if ([_qtkVideoCheckbox state] && _avCurrentDeviceUID)
+        [self setMRL:[NSString stringWithFormat:@"avcapture://%@", _avCurrentDeviceUID]];
+    else if ([_qtkAudioCheckbox state] && _avCurrentAudioDeviceUID)
+        [self setMRL:[NSString stringWithFormat:@"avaudiocapture://%@", _avCurrentAudioDeviceUID]];
+    else
+        [self setMRL:@""];
+}
+
 - (IBAction)qtkChanged:(id)sender
 {
     NSInteger selectedDevice = [_qtkVideoDevicePopup indexOfSelectedItem];
@@ -1173,6 +1177,7 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
         return;
 
     _avCurrentDeviceUID = [[(AVCaptureDevice *)[_avvideoDevices objectAtIndex:selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
+    [self updateInputDevicesUrl];
 }
 
 - (IBAction)qtkAudioChanged:(id)sender
@@ -1182,16 +1187,16 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
         return;
 
     _avCurrentAudioDeviceUID = [[(AVCaptureDevice *)[_avaudioDevices objectAtIndex:selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
+    [self updateInputDevicesUrl];
 }
 
 - (IBAction)qtkToggleUIElements:(id)sender
 {
     [_qtkAudioDevicePopup setEnabled:[_qtkAudioCheckbox state]];
-    BOOL b_state = [_qtkVideoCheckbox state];
-    [_qtkVideoDevicePopup setEnabled:b_state];
+    [_qtkVideoDevicePopup setEnabled:[_qtkVideoCheckbox state]];
+
     [self qtkAudioChanged:sender];
     [self qtkChanged:sender];
-    [self openCaptureModeChanged:sender];
 }
 
 #pragma mark -



More information about the vlc-commits mailing list