deps: move exoplayer to app

Move ExoPlayer from a top-level directory to srclibs.
This commit is contained in:
OxygenCobalt 2022-01-26 19:56:38 -07:00
parent d7f34e6b94
commit f2e4a3a369
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
6 changed files with 30 additions and 12 deletions

View file

@ -67,8 +67,9 @@ I primarily built Auxio for myself, but you can use it too, I guess.
Auxio relies on a custom version of ExoPlayer that enables some extra features. So, the build process is as follows: Auxio relies on a custom version of ExoPlayer that enables some extra features. So, the build process is as follows:
1. Enter into the project directory 1. `cd` into the project directory
2. Run `python3 prebuild.py`, which installs ExoPlayer and it's extensions. 2. Run `python3 prebuild.py`, which installs ExoPlayer and it's extensions.
- The pre-build process only works with \*nix systems. On windows, this process must be done manually.
3. Build the project normally in Android Studio. 3. Build the project normally in Android Studio.
## Contributing ## Contributing

View file

@ -60,7 +60,8 @@
</activity> </activity>
<!-- <!--
Workaround to get apps that blindly query for ACTION_MEDIA_BUTTON working Workaround to get apps that blindly query for ACTION_MEDIA_BUTTON working.
See the class for more info.
--> -->
<receiver <receiver
android:name=".playback.system.MediaButtonReceiver" android:name=".playback.system.MediaButtonReceiver"

View file

@ -1,11 +1,21 @@
package org.oxycblt.auxio.playback.system package org.oxycblt.auxio.playback.system
/**
* Represents the current setting for ReplayGain.
*/
enum class ReplayGainMode { enum class ReplayGainMode {
/** Do not apply ReplayGain. */
OFF, OFF,
/** Apply the track gain, falling back to the album gain if the track gain is not found. */
TRACK, TRACK,
/** Apply the album gain, falling back to the track gain if the album gain is not found. */
ALBUM, ALBUM,
/** Apply the album gain only when playing from an album, defaulting to track gain otherwise. */
DYNAMIC; DYNAMIC;
/**
* Converts this type to an integer constant.
*/
fun toInt(): Int { fun toInt(): Int {
return when (this) { return when (this) {
OFF -> INT_OFF OFF -> INT_OFF
@ -21,6 +31,9 @@ enum class ReplayGainMode {
private const val INT_ALBUM = 0xA112 private const val INT_ALBUM = 0xA112
private const val INT_DYNAMIC = 0xA113 private const val INT_DYNAMIC = 0xA113
/**
* Converts an integer constant to this type.
*/
fun fromInt(value: Int): ReplayGainMode? { fun fromInt(value: Int): ReplayGainMode? {
return when (value) { return when (value) {
INT_OFF -> OFF INT_OFF -> OFF

View file

@ -56,7 +56,7 @@ fun Any.logE(msg: String) {
private fun Any.getName(): String = "Auxio.${this::class.simpleName ?: "Anonymous Object"}" private fun Any.getName(): String = "Auxio.${this::class.simpleName ?: "Anonymous Object"}"
/** /**
* I know that this will not stop you, but consider what you are doing with your life, copycats. * I know that this will not stop you, but consider what you are doing with your life, copiers.
* Do you want to live a fulfilling existence on this planet? Or do you want to spend your life * Do you want to live a fulfilling existence on this planet? Or do you want to spend your life
* taking work others did and making it objectively worse so you could arbitrage a fraction of a * taking work others did and making it objectively worse so you could arbitrage a fraction of a
* penny on every AdMob impression you get? You could do so many great things if you simply had * penny on every AdMob impression you get? You could do so many great things if you simply had

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# This script automatically installs exoplayer with the necessary components. # This script automatically installs exoplayer with the necessary components.
# This is written in version-agnostic python3, because I'd rather # This is written in version-agnostic python 3, because I'd rather not have to
# not have to deal with the insanity of bash. # deal with the insanity of bash.
import os import os
import platform import platform
import sys import sys
@ -16,6 +16,8 @@ INFO="\033[1;94m"
OK="\033[1;92m" OK="\033[1;92m"
NC="\033[0m" NC="\033[0m"
print('curl "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-' + FLAC_VERSION + '.tar.xz" | tar xJ && mv "flac-' + FLAC_VERSION + '" flac')
system = platform.system() system = platform.system()
# We do some shell scripting later on, so we can't support windows. # We do some shell scripting later on, so we can't support windows.
@ -30,7 +32,7 @@ def sh(cmd):
print(FATAL + "fatal:" + NC + " command failed with exit code " + str(code)) print(FATAL + "fatal:" + NC + " command failed with exit code " + str(code))
sys.exit(1) sys.exit(1)
exoplayer_path = os.path.join(os.path.abspath(os.curdir), "srclibs", "exoplayer") exoplayer_path = os.path.join(os.path.abspath(os.curdir), "app", "srclibs", "exoplayer")
if os.path.exists(exoplayer_path): if os.path.exists(exoplayer_path):
reinstall = input(INFO + "info:" + NC + " exoplayer is already installed. would you like to reinstall it? [y/n] ") reinstall = input(INFO + "info:" + NC + " exoplayer is already installed. would you like to reinstall it? [y/n] ")
@ -40,7 +42,7 @@ if os.path.exists(exoplayer_path):
ndk_path = os.getenv("NDK_PATH") ndk_path = os.getenv("NDK_PATH")
if ndk_path is None or not os.path.isfile(os.path.join(ndk_path, "ndk_build")): if ndk_path is None or not os.path.isfile(os.path.join(ndk_path, "ndk-build")):
# We don't have a proper path. Do some digging on the Android SDK directory # We don't have a proper path. Do some digging on the Android SDK directory
# to see if we can find it. # to see if we can find it.
if system == "Linux": if system == "Linux":
@ -61,15 +63,15 @@ if ndk_path is None or not os.path.isfile(os.path.join(ndk_path, "ndk_build")):
print("[" + str(i) + "] " + candidate) print("[" + str(i) + "] " + candidate)
try: try:
ndk_path = candidates[int(input("enter the ndk to use [Default 0]: "))] ndk_path = candidates[int(input("enter the ndk to use [default 0]: "))]
except: except:
ndk_path = candidates[0] ndk_path = candidates[0]
else: else:
print(FATAL + "fatal:" + NC + " NDK_PATH is either not set/invalid, or the android ndk was not installed at a recognized location.") print(FATAL + "fatal:" + NC + " the android ndk was not installed at a recognized location.")
system.exit(1) system.exit(1)
# Now try to install ExoPlayer. # Now try to install ExoPlayer.
sh("rm -rf srclibs") sh("rm -rf " + exoplayer_path)
print(INFO + "info:" + NC + " cloning exoplayer...") print(INFO + "info:" + NC + " cloning exoplayer...")
sh("git clone https://github.com/oxygencobalt/ExoPlayer.git " + exoplayer_path) sh("git clone https://github.com/oxygencobalt/ExoPlayer.git " + exoplayer_path)
@ -78,8 +80,9 @@ sh("git checkout auxio")
print(INFO + "info:" + NC + " installing flac extension...") print(INFO + "info:" + NC + " installing flac extension...")
flac_ext_jni_path = os.path.join("extensions", "flac", "src", "main", "jni") flac_ext_jni_path = os.path.join("extensions", "flac", "src", "main", "jni")
ndk_build_path = os.path.join(ndk_path, "ndk-build")
os.chdir(flac_ext_jni_path) os.chdir(flac_ext_jni_path)
sh('curl "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-' + FLAC_VERSION + '.tar.xz" | tar xJ && mv "flac-' + FLAC_VERSION + '" flac') sh('curl "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-' + FLAC_VERSION + '.tar.xz" | tar xJ && mv "flac-' + FLAC_VERSION + '" flac')
sh(ndk_path + "/ndk-build APP_ABI=all -j4") sh(ndk_build_path + " APP_ABI=all -j4")
print(OK + "success:" + NC + " completed pre-build.") print(OK + "success:" + NC + " completed pre-build.")

View file

@ -1,4 +1,4 @@
include ':app' include ':app'
rootProject.name = "Auxio" rootProject.name = "Auxio"
gradle.ext.exoplayerModulePrefix = 'exoplayer-' gradle.ext.exoplayerModulePrefix = 'exoplayer-'
apply from: file("srclibs/exoplayer/core_settings.gradle") apply from: file("app/srclibs/exoplayer/core_settings.gradle")