Commit cfdbb072 authored by Thomas Guillem's avatar Thomas Guillem Committed by Geoffrey Métais
Browse files

LibVLC: MediaPlayer: add forceAudioDigitalEncodings()

(cherry picked from commit b8fd87d2)
parent 4b484911
......@@ -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) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment