<div dir="ltr">Because it's not effective on media atm.<br><br><div class="gmail_quote"><div dir="ltr">Le mar. 23 janv. 2018 à 19:45, Jean-Baptiste Kempf <<a href="mailto:jb@videolan.org" target="_blank">jb@videolan.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Why not on the media?<br>
<br>
On Tue, 23 Jan 2018, at 18:31, Geoffrey Métais wrote:<br>
> vlc-android | branch: chromecast | Geoffrey Métais<br>
> <<a href="mailto:geoffrey.metais@gmail.com" target="_blank">geoffrey.metais@gmail.com</a>> | Tue Jan 23 10:51:43 2018 +0100|<br>
> [7e8506d0f60e0f79245cfad69c742f7ab229632e] | committer: Geoffrey Métais<br>
><br>
> Apply Chromecast options to LibVLC<br>
><br>
> > <a href="https://code.videolan.org/videolan/vlc-android/commit/7e8506d0f60e0f79245cfad69c742f7ab229632e" rel="noreferrer" target="_blank">https://code.videolan.org/videolan/vlc-android/commit/7e8506d0f60e0f79245cfad69c742f7ab229632e</a><br>
> ---<br>
><br>
> .../vlc/gui/preferences/PreferencesCasting.kt | 19 ++++++++++++++++++-<br>
> vlc-android/src/org/videolan/vlc/util/VLCOptions.java | 15 ++++++---------<br>
> 2 files changed, 24 insertions(+), 10 deletions(-)<br>
><br>
> diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/<br>
> PreferencesCasting.kt b/vlc-android/src/org/videolan/vlc/gui/<br>
> preferences/PreferencesCasting.kt<br>
> index 2137dbced..2d15c34cf 100644<br>
> --- a/vlc-android/src/org/videolan/vlc/gui/preferences/<br>
> PreferencesCasting.kt<br>
> +++ b/vlc-android/src/org/videolan/vlc/gui/preferences/<br>
> PreferencesCasting.kt<br>
> @@ -22,11 +22,28 @@<br>
> */<br>
> package org.videolan.vlc.gui.preferences<br>
><br>
> +import android.content.SharedPreferences<br>
> +import android.os.Bundle<br>
> import org.videolan.vlc.R<br>
> +import org.videolan.vlc.util.VLCInstance<br>
><br>
> -class PreferencesCasting : BasePreferenceFragment() {<br>
> +class PreferencesCasting : BasePreferenceFragment(),<br>
> SharedPreferences.OnSharedPreferenceChangeListener {<br>
><br>
> override fun getTitleId() = R.string.casting_category<br>
><br>
> override fun getXml() = R.xml.preferences_casting<br>
> +<br>
> + override fun onCreate(savedInstanceState: Bundle?) {<br>
> + super.onCreate(savedInstanceState)<br>
> +<br>
> preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this)<br>
> + }<br>
> +<br>
> + override fun onSharedPreferenceChanged(sharedPreferences:<br>
> SharedPreferences?, key: String?) {<br>
> + when (key) {<br>
> + "casting_passthrough", "casting_quality" -> {<br>
> + VLCInstance.restart()<br>
> + (activity as?<br>
> PreferencesActivity)?.restartMediaPlayer()<br>
> + }<br>
> + }<br>
> + }<br>
> }<br>
> \ No newline at end of file<br>
> diff --git a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java b/<br>
> vlc-android/src/org/videolan/vlc/util/VLCOptions.java<br>
> index 1438e9efc..e10677ad7 100644<br>
> --- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java<br>
> +++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java<br>
> @@ -31,10 +31,9 @@ import org.videolan.libvlc.MediaPlayer;<br>
> import org.videolan.libvlc.util.AndroidUtil;<br>
> import org.videolan.libvlc.util.HWDecoderUtil;<br>
> import org.videolan.libvlc.util.VLCUtil;<br>
> +import org.videolan.medialibrary.media.MediaWrapper;<br>
> import org.videolan.vlc.R;<br>
> -import org.videolan.vlc.RendererDelegate;<br>
> import org.videolan.vlc.VLCApplication;<br>
> -import org.videolan.medialibrary.media.MediaWrapper;<br>
><br>
> import java.io.File;<br>
> import java.util.ArrayList;<br>
> @@ -126,7 +125,11 @@ public class VLCOptions {<br>
> options.add("--keystore-file");<br>
> options.add(new File(context.getDir("keystore",<br>
> Context.MODE_PRIVATE), "file").getAbsolutePath());<br>
><br>
> + //Chromecast<br>
> options.add(verboseMode ? "-vv" : "-v");<br>
> + if (pref.getBoolean("casting_passthrough", true))<br>
> options.add("--sout-chromecast-audio-passthrough");<br>
> + else options.add("--no-sout-chromecast-audio-passthrough");<br>
> + options.add("--sout-chromecast-conversion-<br>
> quality="+pref.getString("casting_quality", "2"));<br>
><br>
> return options;<br>
> }<br>
> @@ -181,10 +184,10 @@ public class VLCOptions {<br>
> boolean noVideo = (flags & MediaWrapper.MEDIA_VIDEO) == 0;<br>
> final boolean paused = (flags & MediaWrapper.MEDIA_PAUSED) !=<br>
> 0;<br>
> int hardwareAcceleration = HW_ACCELERATION_DISABLED;<br>
> + final SharedPreferences pref =<br>
> PreferenceManager.getDefaultSharedPreferences(context);<br>
><br>
> if (!noHardwareAcceleration) {<br>
> try {<br>
> - final SharedPreferences pref =<br>
> PreferenceManager.getDefaultSharedPreferences(context);<br>
> hardwareAcceleration =<br>
> Integer.parseInt(pref.getString("hardware_acceleration", "-1"));<br>
> } catch (NumberFormatException ignored) {}<br>
> }<br>
> @@ -200,12 +203,6 @@ public class VLCOptions {<br>
><br>
> if (noVideo) media.addOption(":no-video");<br>
> if (paused) media.addOption(":start-paused");<br>
> -<br>
> - if (RendererDelegate.INSTANCE.getSelectedRenderer() != null) {<br>
> - final SharedPreferences pref =<br>
> PreferenceManager.getDefaultSharedPreferences(context);<br>
> - media.addOption(":sout-chromecast-audio-<br>
> passthrough="+pref.getBoolean("casting_passthrough", true));<br>
> - media.addOption(":sout-chromecast-conversion-<br>
> quality="+pref.getString("casting_quality", "2"));<br>
> - }<br>
> }<br>
><br>
> private static MediaPlayer.Equalizer<br>
> getEqualizerSetFromSettings(SharedPreferences pref) {<br>
><br>
> _______________________________________________<br>
> Android mailing list<br>
> <a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
<br>
<br>
--<br>
Jean-Baptiste Kempf - President<br>
+33 672 704 734<br>
_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
</blockquote></div></div>