[Android] VlcMigration: remove HWDecoderUtil for vlc 4
Duncan McNamara
git at videolan.org
Wed Nov 20 06:47:53 UTC 2024
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed Sep 18 17:11:18 2024 +0200| [96f9642a876e378687793bef6df21abee8ab9d34] | committer: Duncan McNamara
VlcMigration: remove HWDecoderUtil for vlc 4
In vlc4 HWDecoderUtil log is moved in audio_output/android/device.c so
it is not needed anymore
See vlc#24982, vlc!5680, and !1948
> https://code.videolan.org/videolan/vlc-android/commit/96f9642a876e378687793bef6df21abee8ab9d34
---
.../src/main/java/org/videolan/resources/VLCOptions.kt | 6 +++---
.../videolan/television/ui/preferences/PreferencesAudio.kt | 6 +++---
.../org/videolan/vlc/gui/preferences/PreferencesAudio.kt | 6 +++---
.../vlc3/src/org/videolan/vlc/VlcMigrationHelper.java | 14 ++++++++++++++
.../vlc4/src/org/videolan/vlc/VlcMigrationHelper.java | 8 ++++++++
5 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/application/resources/src/main/java/org/videolan/resources/VLCOptions.kt b/application/resources/src/main/java/org/videolan/resources/VLCOptions.kt
index 229f0f4ad7..d8d161d259 100644
--- a/application/resources/src/main/java/org/videolan/resources/VLCOptions.kt
+++ b/application/resources/src/main/java/org/videolan/resources/VLCOptions.kt
@@ -32,12 +32,12 @@ import androidx.core.content.getSystemService
import org.videolan.libvlc.MediaPlayer
import org.videolan.libvlc.interfaces.IMedia
import org.videolan.libvlc.util.AndroidUtil
-import org.videolan.libvlc.util.HWDecoderUtil
import org.videolan.libvlc.util.VLCUtil
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.tools.Preferences
import org.videolan.tools.Settings
import org.videolan.tools.putSingle
+import org.videolan.vlc.VlcMigrationHelper
import org.videolan.vlc.isVLC4
import java.io.File
import java.util.*
@@ -204,8 +204,8 @@ object VLCOptions {
} catch (ignored: NumberFormatException) {
}
- val hwaout = HWDecoderUtil.getAudioOutputFromDevice()
- if (hwaout == HWDecoderUtil.AudioOutput.OPENSLES)
+ val hwaout = VlcMigrationHelper.getAudioOutputFromDevice()
+ if (hwaout == VlcMigrationHelper.AudioOutput.OPENSLES)
aout = AOUT_OPENSLES
return if (aout == AOUT_OPENSLES) "opensles" else if (aout == AOUT_AUDIOTRACK) "audiotrack" else null /* aaudio is the default */
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAudio.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAudio.kt
index cf59a61d60..62b5a67459 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAudio.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAudio.kt
@@ -40,7 +40,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import org.videolan.libvlc.util.AndroidUtil
-import org.videolan.libvlc.util.HWDecoderUtil
import org.videolan.resources.VLCInstance
import org.videolan.tools.AUDIO_DUCKING
import org.videolan.tools.KEY_PLAYBACK_RATE
@@ -51,6 +50,7 @@ import org.videolan.tools.Settings
import org.videolan.tools.putSingle
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.R
+import org.videolan.vlc.VlcMigrationHelper
import org.videolan.vlc.gui.browser.EXTRA_MRL
import org.videolan.vlc.gui.browser.FilePickerActivity
import org.videolan.vlc.gui.browser.KEY_PICKER_TYPE
@@ -92,8 +92,8 @@ class PreferencesAudio : BasePreferenceFragment(), SharedPreferences.OnSharedPre
findPreference<Preference>(RESUME_PLAYBACK)?.isVisible = false
findPreference<Preference>(AUDIO_DUCKING)?.isVisible = !AndroidUtil.isOOrLater
- val aout = HWDecoderUtil.getAudioOutputFromDevice()
- if (aout != HWDecoderUtil.AudioOutput.ALL) {
+ val aout = VlcMigrationHelper.getAudioOutputFromDevice()
+ if (aout != VlcMigrationHelper.AudioOutput.ALL) {
/* no AudioOutput choice */
aoutPref?.isVisible = false
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt
index 59cc38d40e..aa29c25db9 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt
@@ -39,7 +39,6 @@ import androidx.preference.Preference
import androidx.preference.TwoStatePreference
import kotlinx.coroutines.launch
import org.videolan.libvlc.util.AndroidUtil
-import org.videolan.libvlc.util.HWDecoderUtil
import org.videolan.resources.AndroidDevices
import org.videolan.resources.VLCInstance
import org.videolan.tools.AUDIO_DUCKING
@@ -51,6 +50,7 @@ import org.videolan.tools.Settings
import org.videolan.tools.putSingle
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.R
+import org.videolan.vlc.VlcMigrationHelper
import org.videolan.vlc.gui.browser.EXTRA_MRL
import org.videolan.vlc.gui.browser.FilePickerActivity
import org.videolan.vlc.gui.browser.KEY_PICKER_TYPE
@@ -80,8 +80,8 @@ class PreferencesAudio : BasePreferenceFragment(), SharedPreferences.OnSharedPre
findPreference<Preference>(AUDIO_DUCKING)?.isVisible = !AndroidUtil.isOOrLater
findPreference<Preference>(RESUME_PLAYBACK)?.isVisible = AndroidDevices.isPhone
val aoutPref = findPreference<ListPreference>("aout")
- val aout = HWDecoderUtil.getAudioOutputFromDevice()
- if (aout != HWDecoderUtil.AudioOutput.ALL) {
+ val aout = VlcMigrationHelper.getAudioOutputFromDevice()
+ if (aout != VlcMigrationHelper.AudioOutput.ALL) {
/* no AudioOutput choice */
aoutPref?.isVisible = false
}
diff --git a/medialibrary/vlc3/src/org/videolan/vlc/VlcMigrationHelper.java b/medialibrary/vlc3/src/org/videolan/vlc/VlcMigrationHelper.java
index 025e50ca6e..7651da4a62 100644
--- a/medialibrary/vlc3/src/org/videolan/vlc/VlcMigrationHelper.java
+++ b/medialibrary/vlc3/src/org/videolan/vlc/VlcMigrationHelper.java
@@ -29,6 +29,7 @@ import static org.videolan.libvlc.util.AndroidUtil.isMarshMallowOrLater;
import android.os.Build;
import org.videolan.libvlc.interfaces.IMedia;
+import org.videolan.libvlc.util.HWDecoderUtil;
import java.util.ArrayList;
import java.util.List;
@@ -45,4 +46,17 @@ public class VlcMigrationHelper {
public static final boolean isLolliPopOrLater = isMarshMallowOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
public static final boolean isKitKatOrLater = isLolliPopOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
public static final boolean isJellyBeanMR2OrLater = isKitKatOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
+
+ public enum AudioOutput {
+ OPENSLES, AUDIOTRACK, ALL
+ }
+
+ public static AudioOutput getAudioOutputFromDevice() {
+ HWDecoderUtil.AudioOutput aout = HWDecoderUtil.getAudioOutputFromDevice();
+ if (aout == HWDecoderUtil.AudioOutput.OPENSLES)
+ return AudioOutput.OPENSLES;
+ else if (aout == HWDecoderUtil.AudioOutput.AUDIOTRACK)
+ return AudioOutput.AUDIOTRACK;
+ return AudioOutput.ALL;
+ }
}
diff --git a/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java b/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java
index 9d125e7a3a..80de3c80ca 100644
--- a/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java
+++ b/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java
@@ -42,4 +42,12 @@ public class VlcMigrationHelper {
public static final boolean isLolliPopOrLater = true;
public static final boolean isKitKatOrLater = true;
public static final boolean isJellyBeanMR2OrLater = true;
+
+ public enum AudioOutput {
+ OPENSLES, AUDIOTRACK, ALL
+ }
+
+ public static AudioOutput getAudioOutputFromDevice() {
+ return AudioOutput.ALL;
+ }
}
More information about the Android
mailing list