[Android] VLCOptions: remove HWDecoderUtil.AudioOutput.AUDIOTRACK handling

Nicolas Pomepuy git at videolan.org
Fri Nov 18 12:29:45 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Oct 27 14:04:41 2022 +0200| [ddeb099076defbc1f03cff11fba747f5f2c01fe0] | committer: Nicolas Pomepuy

VLCOptions: remove HWDecoderUtil.AudioOutput.AUDIOTRACK handling

HWDecoderUtil.getAudioOutputFromDevice() can only return OPENSLES or ALL.

> https://code.videolan.org/videolan/vlc-android/commit/ddeb099076defbc1f03cff11fba747f5f2c01fe0
---

 application/resources/build.gradle                 |  4 +++
 .../videolan/resources/ExampleInstrumentedTest.kt  | 24 ------------------
 .../main/java/org/videolan/resources/VLCOptions.kt | 20 +++++++++------
 .../vlc3/src/org/videolan/vlc/MainVersion.kt       | 29 ++++++++++++++++++++++
 .../vlc4/src/org/videolan/vlc/MainVersion.kt       | 28 +++++++++++++++++++++
 .../vlc3/src/org/videolan/vlc/VersionDependant.kt  |  3 ---
 .../vlc4/src/org/videolan/vlc/VersionDependant.kt  |  2 --
 buildsystem/compile.sh                             |  4 +--
 8 files changed, 75 insertions(+), 39 deletions(-)

diff --git a/application/resources/build.gradle b/application/resources/build.gradle
index 001d8b7262..e550feb9b1 100644
--- a/application/resources/build.gradle
+++ b/application/resources/build.gradle
@@ -35,6 +35,10 @@ android {
 
     }
 
+    sourceSets.main {
+        java.srcDirs = rootProject.ext.vlcMajorVersion == 4 ? ['src', 'vlc4/src'] : ['src', 'vlc3/src']
+    }
+
     sourceSets.debug {
         res.srcDirs = ['flavors/debug/res']
     }
diff --git a/application/resources/src/androidTest/java/org/videolan/resources/ExampleInstrumentedTest.kt b/application/resources/src/androidTest/java/org/videolan/resources/ExampleInstrumentedTest.kt
deleted file mode 100644
index 6ea2fb7c7e..0000000000
--- a/application/resources/src/androidTest/java/org/videolan/resources/ExampleInstrumentedTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.videolan.resources
-
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.ext.junit.runners.AndroidJUnit4
-
-import org.junit.Test
-import org.junit.runner.RunWith
-
-import org.junit.Assert.*
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
- at RunWith(AndroidJUnit4::class)
-class ExampleInstrumentedTest {
-    @Test
-    fun useAppContext() {
-        // Context of the app under test.
-        val appContext = InstrumentationRegistry.getInstrumentation().targetContext
-        assertEquals("org.videolan.resources", appContext.packageName)
-    }
-}
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 ca93eb5bb4..0424a4a55a 100644
--- a/application/resources/src/main/java/org/videolan/resources/VLCOptions.kt
+++ b/application/resources/src/main/java/org/videolan/resources/VLCOptions.kt
@@ -38,6 +38,7 @@ 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.isVLC4
 import java.io.File
 import java.util.*
 
@@ -119,7 +120,7 @@ object VLCOptions {
             options.add("soxr")
             options.add("--audiotrack-session-id=$audiotrackSessionId")
 
-            options.add("--freetype-rel-fontsize=" + freetypeRelFontsize!!)
+            if (isVLC4()) options.add("--sub-text-scale=" + (1600 / freetypeRelFontsize!!.toFloat()).toString()) else options.add("--freetype-rel-fontsize=" + freetypeRelFontsize!!)
             if (freetypeBold) options.add("--freetype-bold")
             options.add("--freetype-color=$freetypeColor")
             options.add("--freetype-opacity=$freetypeColorOpacity")
@@ -147,11 +148,14 @@ object VLCOptions {
             options.add("--keystore-file")
             options.add(File(context.getDir("keystore", Context.MODE_PRIVATE), "file").absolutePath)
             options.add(if (verboseMode) "-vv" else "-v")
-            if (pref.getBoolean("casting_passthrough", false))
-                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")!!)
+            // fixme comment temporarily
+            if (!isVLC4()) {
+                if (pref.getBoolean("casting_passthrough", false))
+                    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")!!)
+            }
             options.add("--sout-keep")
 
             val customOptions = pref.getString("custom_libvlc_options", null)
@@ -201,8 +205,8 @@ object VLCOptions {
         }
 
         val hwaout = HWDecoderUtil.getAudioOutputFromDevice()
-        if (hwaout == HWDecoderUtil.AudioOutput.AUDIOTRACK || hwaout == HWDecoderUtil.AudioOutput.OPENSLES)
-            aout = if (hwaout == HWDecoderUtil.AudioOutput.OPENSLES) AOUT_OPENSLES else AOUT_AUDIOTRACK
+        if (hwaout == HWDecoderUtil.AudioOutput.OPENSLES)
+            aout = AOUT_OPENSLES
 
         return if (aout == AOUT_OPENSLES) "opensles_android" else null /* audiotrack is the default */
     }
diff --git a/application/resources/vlc3/src/org/videolan/vlc/MainVersion.kt b/application/resources/vlc3/src/org/videolan/vlc/MainVersion.kt
new file mode 100644
index 0000000000..07c7eaa8c7
--- /dev/null
+++ b/application/resources/vlc3/src/org/videolan/vlc/MainVersion.kt
@@ -0,0 +1,29 @@
+package org.videolan.vlc
+
+/*
+ * ************************************************************************
+ *  Vlc3.kt
+ * *************************************************************************
+ * Copyright © 2022 VLC authors and VideoLAN
+ * Author: Nicolas POMEPUY
+ * 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.
+ * **************************************************************************
+ *
+ *
+ */
+
+
+
+fun isVLC4() = false
\ No newline at end of file
diff --git a/application/resources/vlc4/src/org/videolan/vlc/MainVersion.kt b/application/resources/vlc4/src/org/videolan/vlc/MainVersion.kt
new file mode 100644
index 0000000000..69d603ae8e
--- /dev/null
+++ b/application/resources/vlc4/src/org/videolan/vlc/MainVersion.kt
@@ -0,0 +1,28 @@
+package org.videolan.vlc
+
+/*
+ * ************************************************************************
+ *  Verlc3.kt
+ * *************************************************************************
+ * Copyright © 2022 VLC authors and VideoLAN
+ * Author: Nicolas POMEPUY
+ * 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.
+ * **************************************************************************
+ *
+ *
+ */
+
+
+fun isVLC4() = true
\ No newline at end of file
diff --git a/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt b/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt
index aa1177335e..573ea46b3d 100644
--- a/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt
+++ b/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt
@@ -95,6 +95,3 @@ fun MediaPlayer.unselectTrackType(type: Int) {
 fun getDisableTrack(context: Context) : VlcTrack {
     throw IllegalStateException("This is a VLC 4 only API. It should not be called by VLC 3")
 }
-
-
-fun isVLC4() = false
\ No newline at end of file
diff --git a/application/vlc-android/vlc4/src/org/videolan/vlc/VersionDependant.kt b/application/vlc-android/vlc4/src/org/videolan/vlc/VersionDependant.kt
index ff4764c461..bd5c1d13ed 100644
--- a/application/vlc-android/vlc4/src/org/videolan/vlc/VersionDependant.kt
+++ b/application/vlc-android/vlc4/src/org/videolan/vlc/VersionDependant.kt
@@ -101,5 +101,3 @@ fun getDisableTrack(context: Context) = object : VlcTrack {
 
     override fun getFrameRateNum() = 0
 }
-
-fun isVLC4() = true
\ No newline at end of file
diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh
index 053d9c8a1e..8165ef4e91 100755
--- a/buildsystem/compile.sh
+++ b/buildsystem/compile.sh
@@ -259,9 +259,9 @@ fi
 
 
 if [ "$FORCE_VLC_4" = 1 ]; then
-    LIBVLCJNI_TESTED_HASH=965402da3c2004dcef4f6575406ace343b2f1b15
+    LIBVLCJNI_TESTED_HASH=e4b4ba27687f781e01e09ad687cfc9613d3abac6
 else
-    LIBVLCJNI_TESTED_HASH=6c512862228c833234068b50abb67ea03ec8dcde
+    LIBVLCJNI_TESTED_HASH=cc744e179ec245053ff57602744e8d5d5d17fdc4
 fi
 LIBVLCJNI_REPOSITORY=https://code.videolan.org/videolan/libvlcjni
 if [ ! -d "libvlcjni" ] || [ ! -d "libvlcjni/.git" ]; then



More information about the Android mailing list