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

David Fuhrmann git at videolan.org
Wed Mar 31 21:57:43 UTC 2021


vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Wed Mar 31 22:51:17 2021 +0200| [f2e872c78dfdadf8dbbbc4db0a2aa6a3cfb353db] | 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.

(manual bp of c21bf10646a6c432a0d1fb695256778a84c83a13)

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

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

diff --git a/modules/gui/macosx/VLCOpenWindowController.m b/modules/gui/macosx/VLCOpenWindowController.m
index 57920bc09d..b93faeb5c4 100644
--- a/modules/gui/macosx/VLCOpenWindowController.m
+++ b/modules/gui/macosx/VLCOpenWindowController.m
@@ -1156,15 +1156,8 @@ static NSString *kCaptureTabViewId  = @"capture";
     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];
     }
 }
 
@@ -1199,6 +1192,17 @@ static NSString *kCaptureTabViewId  = @"capture";
 }
 
 // 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];
@@ -1206,6 +1210,7 @@ static NSString *kCaptureTabViewId  = @"capture";
         return;
 
     _avCurrentDeviceUID = [[(AVCaptureDevice *)[_avvideoDevices objectAtIndex:selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
+    [self updateInputDevicesUrl];
 }
 
 - (IBAction)qtkAudioChanged:(id)sender
@@ -1215,16 +1220,16 @@ static NSString *kCaptureTabViewId  = @"capture";
         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