Commit 4f88c1d6 authored by Geoffrey Métais's avatar Geoffrey Métais

Implement Chromecast rendering options

parent ad39c954
......@@ -371,6 +371,19 @@
<item>1</item>
</string-array>
<string-array name="casting_quality">
<item>@string/casting_quality_high</item>
<item>@string/casting_quality_medium</item>
<item>@string/casting_quality_low</item>
<item>@string/casting_quality_lowcpu</item>
</string-array>
<string-array name="casting_quality_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="opengl_list">
<item>@string/opengl_automatic</item>
<item>@string/opengl_on</item>
......
......@@ -369,6 +369,15 @@
<string name="aout_opensles" translatable="false">OpenSL ES</string>
<string name="audio_ducking_title">Lower VLC volume on notifications</string>
<string name="audio_ducking_summary">Helps to hear audio notifications, navigation instructions or assistant talking</string>
<string name="casting_category">Casting</string>
<string name="casting_passthrough_title">Audio Passthrough</string>
<string name="casting_passthrough_summary">Let your TV manage audio rendering</string>
<string name="casting_conversion_quality_title">Conversion quality</string>
<string name="casting_conversion_quality_summary">Select the conversion quality when casting on remote screen</string>
<string name="casting_quality_high">High</string>
<string name="casting_quality_medium">Medium</string>
<string name="casting_quality_low">Low</string>
<string name="casting_quality_lowcpu">Lowest</string>
<string name="extensions_prefs_category">Extensions</string>
<string name="extensions_enable_category">Chose extensions to enable</string>
......
......@@ -59,6 +59,9 @@
<Preference
android:title="@string/audio_prefs_category"
android:key="audio_category" />
<Preference
android:title="@string/casting_category"
android:key="casting_category" />
<Preference
android:title="@string/extensions_prefs_category"
android:key="extensions_category" />
......
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="audio_category"
android:title="@string/casting_category">
<PreferenceCategory android:title="@string/casting_category">
<CheckBoxPreference
android:key="casting_passthrough"
android:defaultValue="true"
android:summary="@string/casting_passthrough_summary"
android:title="@string/casting_passthrough_title" />
<ListPreference
android:defaultValue="2"
android:entries="@array/casting_quality"
android:entryValues="@array/casting_quality_values"
android:key="casting_quality"
android:summary="@string/casting_conversion_quality_summary"
android:title="@string/casting_conversion_quality_title" />
</PreferenceCategory>
</PreferenceScreen>
/*
* *************************************************************************
* PreferencesCasting.kt
* **************************************************************************
* Copyright © 2018 VLC authors and VideoLAN
* Author: Geoffrey Métais
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* ***************************************************************************
*/
package org.videolan.vlc.gui.preferences
import org.videolan.vlc.R
class PreferencesCasting : BasePreferenceFragment() {
override fun getTitleId() = R.string.casting_category
override fun getXml() = R.xml.preferences_casting
}
\ No newline at end of file
......@@ -98,6 +98,9 @@ public class PreferencesFragment extends BasePreferenceFragment {
case "adv_category":
loadFragment(new PreferencesAdvanced());
break;
case "casting_category":
loadFragment(new PreferencesCasting());
break;
case PLAYBACK_HISTORY:
getActivity().setResult(PreferencesActivity.RESULT_RESTART);
return true;
......
......@@ -64,6 +64,7 @@ public class PreferencesFragment extends BasePreferenceFragment {
super.onCreate(savedInstanceState);
findPreference("screen_orientation").setVisible(false);
findPreference("extensions_category").setVisible(false);
findPreference("casting_category").setVisible(false);
findPreference(KEY_VIDEO_APP_SWITCH).setVisible(AndroidDevices.hasPiP);
}
......
......@@ -32,6 +32,7 @@ import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.libvlc.util.HWDecoderUtil;
import org.videolan.libvlc.util.VLCUtil;
import org.videolan.vlc.R;
import org.videolan.vlc.RendererDelegate;
import org.videolan.vlc.VLCApplication;
import org.videolan.medialibrary.media.MediaWrapper;
......@@ -184,8 +185,7 @@ public class VLCOptions {
if (!noHardwareAcceleration) {
try {
final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
hardwareAcceleration = Integer.parseInt(pref.getString("hardware_acceleration", "-1"));
hardwareAcceleration = Integer.parseInt(prefs.getString("hardware_acceleration", "-1"));
} catch (NumberFormatException ignored) {}
}
if (hardwareAcceleration == HW_ACCELERATION_DISABLED)
......@@ -202,6 +202,11 @@ public class VLCOptions {
if (paused) media.addOption(":start-paused");
if (!prefs.getBoolean("subtitles_autoload", true)) media.addOption(":sub-language=none");
if (prefs.getBoolean("media_fast_seek", true)) 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"));
}
}
private static MediaPlayer.Equalizer getEqualizerSetFromSettings(SharedPreferences pref) {
......
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