Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
59609879
Commit
59609879
authored
Mar 09, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: automagically update the audio device list when the OS tells us to (close #8282)
parent
c1fd92f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
modules/gui/macosx/MainMenu.m
modules/gui/macosx/MainMenu.m
+26
-0
No files found.
modules/gui/macosx/MainMenu.m
View file @
59609879
...
...
@@ -24,6 +24,7 @@
#import "MainMenu.h"
#import <vlc_common.h>
#import <vlc_playlist.h>
#import <CoreAudio/CoreAudio.h>
#import "intf.h"
#import "open.h"
...
...
@@ -45,6 +46,19 @@
#import "ExtensionsManager.h"
#import "ConvertAndSave.h"
static
OSStatus
HardwareListener
(
AudioObjectID
,
UInt32
,
const
AudioObjectPropertyAddress
*
,
void
*
);
static
OSStatus
HardwareListener
(
AudioObjectID
inObjectID
,
UInt32
inNumberAddresses
,
const
AudioObjectPropertyAddress
inAddresses
[],
void
*
inClientData
)
{
VLC_UNUSED
(
inObjectID
);
VLC_UNUSED
(
inNumberAddresses
);
VLC_UNUSED
(
inAddresses
);
// give the core some time update its internal structure for the new device setup
[[
VLCMainMenu
sharedInstance
]
performSelector
:
@selector
(
refreshAudioDeviceList
)
withObject
:
nil
afterDelay
:
.
5
];
return
noErr
;
}
@implementation
VLCMainMenu
static
VLCMainMenu
*
_o_sharedInstance
=
nil
;
...
...
@@ -86,6 +100,11 @@ static VLCMainMenu *_o_sharedInstance = nil;
-
(
void
)
dealloc
{
AudioObjectPropertyAddress
audioDevicesAddress
=
{
kAudioHardwarePropertyDevices
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElementMaster
};
OSStatus
err
=
AudioObjectRemovePropertyListener
(
kAudioObjectSystemObject
,
&
audioDevicesAddress
,
HardwareListener
,
nil
);
if
(
err
!=
noErr
)
msg_Err
(
p_intf
,
"failed to add audio hardware listener (%i)"
,
err
);
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
if
(
b_nib_about_loaded
)
...
...
@@ -263,6 +282,13 @@ static VLCMainMenu *_o_sharedInstance = nil;
[
self
setupExtensionsMenu
];
[
self
refreshAudioDeviceList
];
AudioObjectPropertyAddress
audioDevicesAddress
=
{
kAudioHardwarePropertyDevices
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElementMaster
};
OSStatus
err
=
AudioObjectAddPropertyListener
(
kAudioObjectSystemObject
,
&
audioDevicesAddress
,
HardwareListener
,
nil
);
if
(
err
!=
noErr
)
msg_Err
(
p_intf
,
"failed to add audio hardware listener (%i)"
,
err
);
}
-
(
void
)
initStrings
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment