Commit 582da694 authored by Geoffrey Métais's avatar Geoffrey Métais

Apply Chromecast options to LibVLC

parent 9ecc93b7
......@@ -22,11 +22,28 @@
*/
package org.videolan.vlc.gui.preferences
import android.content.SharedPreferences
import android.os.Bundle
import org.videolan.vlc.R
import org.videolan.vlc.util.VLCInstance
class PreferencesCasting : BasePreferenceFragment() {
class PreferencesCasting : BasePreferenceFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
override fun getTitleId() = R.string.casting_category
override fun getXml() = R.xml.preferences_casting
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
when (key) {
"casting_passthrough", "casting_quality" -> {
VLCInstance.restart()
(activity as? PreferencesActivity)?.restartMediaPlayer()
}
}
}
}
\ No newline at end of file
......@@ -31,10 +31,10 @@ import org.videolan.libvlc.MediaPlayer;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.libvlc.util.HWDecoderUtil;
import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.media.MediaWrapper;
import org.videolan.vlc.R;
import org.videolan.vlc.RendererDelegate;
import org.videolan.vlc.VLCApplication;
import org.videolan.medialibrary.media.MediaWrapper;
import java.io.File;
import java.util.ArrayList;
......@@ -126,7 +126,11 @@ public class VLCOptions {
options.add("--keystore-file");
options.add(new File(context.getDir("keystore", Context.MODE_PRIVATE), "file").getAbsolutePath());
//Chromecast
options.add(verboseMode ? "-vv" : "-v");
if (pref.getBoolean("casting_passthrough", true)) options.add("--sout-chromecast-audio-passthrough");
else options.add("--no-sout-chromecast-audio-passthrough");
options.add("--sout-chromecast-conversion-quality="+pref.getString("casting_quality", "2"));
return options;
}
......@@ -204,8 +208,8 @@ public class VLCOptions {
if (prefs.getBoolean("media_fast_seek", false)) media.addOption(":input-fast-seek");
if (RendererDelegate.INSTANCE.getSelectedRenderer() != null) {
media.addOption(":sout-chromecast-audio-passthrough="+pref.getBoolean("casting_passthrough", true));
media.addOption(":sout-chromecast-conversion-quality="+pref.getString("casting_quality", "2"));
media.addOption(":sout-chromecast-audio-passthrough="+prefs.getBoolean("casting_passthrough", true));
media.addOption(":sout-chromecast-conversion-quality="+prefs.getString("casting_quality", "2"));
}
}
......
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