Browse Source

VLCOptions: remove HWDecoderUtil.AudioOutput.AUDIOTRACK handling

HWDecoderUtil.getAudioOutputFromDevice() can only return OPENSLES or ALL.
merge-requests/1648/merge
Nicolas Pomepuy 4 years ago
parent
commit
ddeb099076
  1. 4
      application/resources/build.gradle
  2. 24
      application/resources/src/androidTest/java/org/videolan/resources/ExampleInstrumentedTest.kt
  3. 20
      application/resources/src/main/java/org/videolan/resources/VLCOptions.kt
  4. 29
      application/resources/vlc3/src/org/videolan/vlc/MainVersion.kt
  5. 28
      application/resources/vlc4/src/org/videolan/vlc/MainVersion.kt
  6. 3
      application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt
  7. 2
      application/vlc-android/vlc4/src/org/videolan/vlc/VersionDependant.kt
  8. 4
      buildsystem/compile.sh

4
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']
}

24
application/resources/src/androidTest/java/org/videolan/resources/ExampleInstrumentedTest.kt

@ -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).
*/
@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)
}
}

20
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 */
}

29
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

28
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

3
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

2
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

4
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

Loading…
Cancel
Save