[Android] LibVLC: MediaPlayer: add forceAudioDigitalEncodings()
Thomas Guillem
git at videolan.org
Fri Mar 30 16:51:27 CEST 2018
vlc-android | branch: 3.0.x | Thomas Guillem <thomas at gllm.fr> | Mon Mar 26 15:07:24 2018 +0200| [cfdbb072a3bbaa3ab72bce1ea7ce182d2aeadf62] | committer: Geoffrey Métais
LibVLC: MediaPlayer: add forceAudioDigitalEncodings()
(cherry picked from commit b8fd87d28407c2a62cf08377a5f845cbb3e1ee2c)
> https://code.videolan.org/videolan/vlc-android/commit/cfdbb072a3bbaa3ab72bce1ea7ce182d2aeadf62
---
libvlc/src/org/videolan/libvlc/MediaPlayer.java | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 8bb52e2fa..8f00202b3 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -764,6 +764,28 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
return true;
}
+ /** Convenient method for {@link #setAudioOutputDevice}
+ *
+ * @param encodings list of encodings to play via passthrough (see AudioFormat.ENCODING_*),
+ * null to don't force any.
+ * @return true on success
+ */
+ public synchronized boolean forceAudioDigitalEncodings(int []encodings) {
+ if (!isAudioTrack())
+ return false;
+
+ if (encodings.length == 0)
+ setAudioOutputDeviceInternal(null, true);
+ else {
+ final String newDeviceId = "encoded:" + getEncodingFlags(encodings);
+ if (!newDeviceId.equals(mAudioPlugOutputDevice)) {
+ mAudioPlugOutputDevice = newDeviceId;
+ setAudioOutputDeviceInternal(mAudioPlugOutputDevice, true);
+ }
+ }
+ return true;
+ }
+
private synchronized boolean setAudioOutputDeviceInternal(String id, boolean fromUser) {
mAudioOutputDevice = id;
if (fromUser) {
More information about the Android
mailing list