Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
c5cb324d
Commit
c5cb324d
authored
Mar 26, 2018
by
Thomas Guillem
Committed by
Geoffrey Métais
Mar 26, 2018
Browse files
LibVLC: MediaPlayer: add setAudioDigitalOutputEnabled
parent
bfa84f3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
libvlc/src/org/videolan/libvlc/MediaPlayer.java
View file @
c5cb324d
...
...
@@ -369,6 +369,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
private
String
mAudioOutputDevice
=
null
;
private
boolean
mAudioPlugRegistered
=
false
;
private
boolean
mAudioDigitalOutputEnabled
=
false
;
private
String
mAudioPlugOutputDevice
=
"stereo"
;
private
final
AWindow
mWindow
=
new
AWindow
(
new
AWindow
.
SurfaceCallback
()
{
...
...
@@ -400,8 +401,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
}
});
private
void
updateAudioOutputDevice
(
long
encodingFlags
,
String
defaultDevice
)
{
final
String
newDeviceId
=
encodingFlags
!=
0
?
"encoded:"
+
encodingFlags
:
defaultDevice
;
private
synchronized
void
updateAudioOutputDevice
(
long
encodingFlags
,
String
defaultDevice
)
{
final
String
newDeviceId
=
mAudioDigitalOutputEnabled
&&
encodingFlags
!=
0
?
"encoded:"
+
encodingFlags
:
defaultDevice
;
if
(!
newDeviceId
.
equals
(
mAudioPlugOutputDevice
))
{
mAudioPlugOutputDevice
=
newDeviceId
;
setAudioOutputDeviceInternal
(
mAudioPlugOutputDevice
,
false
);
...
...
@@ -742,6 +743,27 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
return
ret
;
}
/**
* Enable or disable Digital Output
*
* Works only with AudioTrack AudioOutput.
* If {@link #setAudioOutputDevice} was previously called, this method won't have any effects.
*
* @param enabled true to enable Digital Output
* @return true on success
*/
public
synchronized
boolean
setAudioDigitalOutputEnabled
(
boolean
enabled
)
{
if
(
enabled
==
mAudioDigitalOutputEnabled
)
return
true
;
if
(!
mListenAudioPlug
||
!
isAudioTrack
())
return
false
;
registerAudioPlug
(
false
);
mAudioDigitalOutputEnabled
=
enabled
;
registerAudioPlug
(
true
);
return
true
;
}
private
synchronized
boolean
setAudioOutputDeviceInternal
(
String
id
,
boolean
fromUser
)
{
mAudioOutputDevice
=
id
;
if
(
fromUser
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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