Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
2f3a4815
Commit
2f3a4815
authored
Jan 24, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: implement audio device selection using the new aout core API (close #8036)
parent
ece19198
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
17 deletions
+71
-17
modules/gui/macosx/MainMenu.h
modules/gui/macosx/MainMenu.h
+3
-1
modules/gui/macosx/MainMenu.m
modules/gui/macosx/MainMenu.m
+67
-9
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+1
-7
No files found.
modules/gui/macosx/MainMenu.h
View file @
2f3a4815
/*****************************************************************************
* MainMenu.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2011-201
2
Felix Paul Kühne
* Copyright (C) 2011-201
3
Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
...
...
@@ -237,6 +237,8 @@
-
(
void
)
updatePlaybackRate
;
-
(
IBAction
)
toggleAtoBloop
:(
id
)
sender
;
-
(
IBAction
)
toggleAudioDevice
:(
id
)
sender
;
-
(
IBAction
)
toggleFullscreen
:(
id
)
sender
;
-
(
IBAction
)
resizeVideoWindow
:(
id
)
sender
;
-
(
IBAction
)
floatOnTop
:(
id
)
sender
;
...
...
modules/gui/macosx/MainMenu.m
View file @
2f3a4815
/*****************************************************************************
* MainMenu.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2011-201
2
Felix Paul Kühne
* Copyright (C) 2011-201
3
Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
...
...
@@ -261,6 +261,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
var:
"intf-add"
selector
:
@selector
(
toggleVar
:
)];
[
self
setupExtensionsMenu
];
[
self
refreshAudioDeviceList
];
}
-
(
void
)
initStrings
...
...
@@ -507,9 +509,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
[
self
setupVarMenuItem
:
o_mi_channels
target
:
(
vlc_object_t
*
)
p_aout
var:
"stereo-mode"
selector
:
@selector
(
toggleVar
:
)];
[
self
setupVarMenuItem
:
o_mi_device
target
:
(
vlc_object_t
*
)
p_aout
var:
"audio-device"
selector
:
@selector
(
toggleVar
:
)];
[
self
setupVarMenuItem
:
o_mi_visual
target
:
(
vlc_object_t
*
)
p_aout
var:
"visual"
selector
:
@selector
(
toggleVar
:
)];
vlc_object_release
(
p_aout
);
...
...
@@ -587,7 +586,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
[
o_mi_deinterlace
setEnabled
:
b_enabled
];
[
o_mi_deinterlace_mode
setEnabled
:
b_enabled
];
[
o_mi_ffmpeg_pp
setEnabled
:
b_enabled
];
[
o_mi_device
setEnabled
:
b_enabled
];
[
o_mi_screen
setEnabled
:
b_enabled
];
[
o_mi_aspect_ratio
setEnabled
:
b_enabled
];
[
o_mi_crop
setEnabled
:
b_enabled
];
...
...
@@ -718,6 +716,70 @@ static VLCMainMenu *_o_sharedInstance = nil;
[[
VLCCoreInteraction
sharedInstance
]
setAtoB
];
}
#pragma mark -
#pragma mark audio menu
-
(
void
)
refreshAudioDeviceList
{
char
**
ids
,
**
names
;
char
*
currentDevice
;
[
o_mu_device
removeAllItems
];
audio_output_t
*
p_aout
=
getAout
();
if
(
!
p_aout
)
return
;
int
n
=
aout_DevicesList
(
p_aout
,
&
ids
,
&
names
);
if
(
n
==
-
1
)
return
;
currentDevice
=
aout_DeviceGet
(
p_aout
);
NSMenuItem
*
o_mi_tmp
;
o_mi_tmp
=
[
o_mu_device
addItemWithTitle
:
_NS
(
"Default"
)
action
:
@selector
(
toggleAudioDevice
:
)
keyEquivalent
:
@""
];
[
o_mi_tmp
setTarget
:
self
];
if
(
!
currentDevice
)
[
o_mi_tmp
setState
:
NSOnState
];
for
(
NSUInteger
x
=
0
;
x
<
n
;
x
++
)
{
o_mi_tmp
=
[
o_mu_device
addItemWithTitle
:[
NSString
stringWithFormat
:
@"%s"
,
names
[
x
]]
action
:
@selector
(
toggleAudioDevice
:
)
keyEquivalent
:
@""
];
[
o_mi_tmp
setTarget
:
self
];
[
o_mi_tmp
setTag
:[[
NSString
stringWithFormat
:
@"%s"
,
ids
[
x
]]
intValue
]];
if
(
currentDevice
)
{
if
(
!
strcmp
(
ids
[
x
],
currentDevice
))
[
o_mi_tmp
setState
:
NSOnState
];
}
}
vlc_object_release
(
p_aout
);
for
(
NSUInteger
x
=
0
;
x
<
n
;
x
++
)
{
free
(
ids
[
x
]);
free
(
names
[
x
]);
}
free
(
ids
);
free
(
names
);
[
o_mu_device
setAutoenablesItems
:
YES
];
[
o_mi_device
setEnabled
:
YES
];
}
-
(
IBAction
)
toggleAudioDevice
:(
id
)
sender
{
audio_output_t
*
p_aout
=
getAout
();
int
returnValue
=
0
;
if
([
sender
tag
]
>
0
)
aout_DeviceSet
(
p_aout
,
[[
NSString
stringWithFormat
:
@"%li"
,
[
sender
tag
]]
UTF8String
]);
else
aout_DeviceSet
(
p_aout
,
NULL
);
if
(
returnValue
!=
0
)
msg_Warn
(
VLCIntf
,
"failed to set audio device %li"
,
[
sender
tag
]);
[
self
refreshAudioDeviceList
];
}
#pragma mark -
#pragma mark video menu
...
...
@@ -1214,10 +1276,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
if
(
!
strcmp
([
menuContent
name
],
"fullscreen"
)
||
!
strcmp
([
menuContent
name
],
"video-on-top"
))
var_Set
(
pl_Get
(
VLCIntf
),
[
menuContent
name
]
,
[
menuContent
value
]);
/* save our audio device across multiple sessions */
if
(
!
strcmp
([
menuContent
name
],
"audio-device"
))
config_PutInt
(
VLCIntf
,
"macosx-audio-device"
,
[
menuContent
value
].
i_int
);
p_object
=
[
menuContent
vlcObject
];
if
(
p_object
!=
NULL
)
{
...
...
modules/gui/macosx/intf.m
View file @
2f3a4815
/*****************************************************************************
* intf.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-201
2
VLC authors and VideoLAN
* Copyright (C) 2002-201
3
VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
...
...
@@ -712,12 +712,6 @@ static VLCMain *_o_sharedMainInstance = nil;
b_nativeFullscreenMode
=
var_InheritBool
(
p_intf
,
"macosx-nativefullscreenmode"
);
#endif
/* recover stored audio device, if set
* in case it was unplugged in the meantime, auhal will fall back on the default */
int
i_value
=
config_GetInt
(
p_intf
,
"macosx-audio-device"
);
if
(
i_value
>
0
)
var_SetInteger
(
pl_Get
(
VLCIntf
),
"audio-device"
,
i_value
);
if
(
config_GetInt
(
VLCIntf
,
"macosx-icon-change"
))
{
/* After day 354 of the year, the usual VLC cone is replaced by another cone
* wearing a Father Xmas hat.
...
...
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