mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 01:04:31 +01:00
FFmpeg libs add and Jni Prep
This commit is contained in:
parent
e218458d57
commit
40e9b0a80c
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ terraform.tfvars
|
||||
Gemfile
|
||||
Gemfile.lock
|
||||
/maintenance-tasks/build/
|
||||
/android/.cxx/Debug/5k2s1t1p/x86/
|
||||
|
54
android/CMakeLists.txt
Normal file
54
android/CMakeLists.txt
Normal file
@ -0,0 +1,54 @@
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
set(ffmpeg_dir ${CMAKE_SOURCE_DIR}/../ffmpeg-android-maker/output)
|
||||
set(ffmpeg_libs ${ffmpeg_dir}/lib/${ANDROID_ABI})
|
||||
|
||||
include_directories(${ffmpeg_dir}/include/${ANDROID_ABI})
|
||||
|
||||
set(
|
||||
# List variable name
|
||||
ffmpeg_libs_names
|
||||
# Values in the list
|
||||
avutil avformat avcodec avresample swresample
|
||||
)
|
||||
|
||||
foreach (ffmpeg_lib_name ${ffmpeg_libs_names})
|
||||
add_library(
|
||||
${ffmpeg_lib_name}
|
||||
SHARED
|
||||
IMPORTED
|
||||
)
|
||||
set_target_properties(
|
||||
${ffmpeg_lib_name}
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${ffmpeg_libs}/lib${ffmpeg_lib_name}.so
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
add_library(
|
||||
# Name for a library to build
|
||||
spotiflyer-converter
|
||||
# Type of a library
|
||||
SHARED
|
||||
# All cpp files to compile
|
||||
src/main/cpp/main.cpp
|
||||
# src/main/cpp/media_file_builder.cpp
|
||||
# src/main/cpp/media_file_builder_jni.cpp
|
||||
# src/main/cpp/frame_loader_context.cpp
|
||||
# src/main/cpp/frame_loader_context_jni.cpp
|
||||
# src/main/cpp/frame_extractor.cpp
|
||||
# src/main/cpp/utils.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
# Library to link
|
||||
spotiflyer-converter
|
||||
# List of libraries to link against:
|
||||
# Library for writing messages in LogCat
|
||||
log
|
||||
# Library for processing Bitmap objects
|
||||
jnigraphics
|
||||
# FFmpeg libraries
|
||||
${ffmpeg_libs_names}
|
||||
)
|
@ -16,6 +16,7 @@
|
||||
|
||||
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
|
||||
import org.jetbrains.compose.compose
|
||||
import org.jetbrains.kotlin.kapt.cli.main
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
@ -56,8 +57,21 @@ android {
|
||||
targetSdk = Versions.targetSdkVersion
|
||||
versionCode = Versions.versionCode
|
||||
versionName = Versions.versionName
|
||||
}
|
||||
|
||||
ndk {
|
||||
abiFilters.addAll(setOf("x86", "x86_64", "armeabi-v7a", "arm64-v8a"))
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
named("main") {
|
||||
jniLibs.srcDir("../ffmpeg-android-maker/output/lib")
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path("CMakeLists.txt")
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
getByName("release") {
|
||||
isMinifyEnabled = true
|
||||
@ -65,7 +79,10 @@ android {
|
||||
if (props.containsKey("storeFileDir")) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
kotlinOptions {
|
||||
@ -87,8 +104,13 @@ android {
|
||||
}
|
||||
}
|
||||
packagingOptions {
|
||||
resources.excludes.apply {
|
||||
add("META-INF/*")
|
||||
resources {
|
||||
excludes.apply {
|
||||
add("META-INF/*")
|
||||
}
|
||||
jniLibs.pickFirsts.apply {
|
||||
add("**/*.so")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
android/src/main/cpp/main.cpp
Normal file
18
android/src/main/cpp/main.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <jni.h>
|
||||
#include <string.h>
|
||||
#include <android/log.h>
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
// #include <libavcodec/avcodec.h>
|
||||
JNIEXPORT jint
|
||||
|
||||
JNICALL Java_com_shabinder_spotiflyer_ffmpeg_FFmpeg_testInit(JNIEnv *env, jclass c) {
|
||||
__android_log_print(ANDROID_LOG_DEBUG, "FFmpeg", "%s", avcodec_configuration());
|
||||
return (jint)
|
||||
1;
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ import com.shabinder.common.translations.Strings
|
||||
import com.shabinder.common.uikit.configurations.SpotiFlyerTheme
|
||||
import com.shabinder.common.uikit.configurations.colorOffWhite
|
||||
import com.shabinder.common.uikit.screens.SpotiFlyerRootContent
|
||||
import com.shabinder.spotiflyer.ffmpeg.FFmpeg
|
||||
import com.shabinder.spotiflyer.service.ForegroundService
|
||||
import com.shabinder.spotiflyer.ui.AnalyticsDialog
|
||||
import com.shabinder.spotiflyer.ui.NetworkDialog
|
||||
@ -105,6 +106,8 @@ class MainActivity : ComponentActivity() {
|
||||
// This app draws behind the system bars, so we want to handle fitting system windows
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
rootComponent = spotiFlyerRoot(defaultComponentContext())
|
||||
Log.d("FFmpeg","init")
|
||||
FFmpeg.testInit()
|
||||
setContent {
|
||||
SpotiFlyerTheme {
|
||||
Surface(contentColor = colorOffWhite) {
|
||||
|
@ -0,0 +1,9 @@
|
||||
package com.shabinder.spotiflyer.ffmpeg
|
||||
|
||||
object FFmpeg {
|
||||
external fun testInit(): Long
|
||||
|
||||
init {
|
||||
System.loadLibrary("spotiflyer-converter")
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit be40713aab45168d90f0ac117e454c17d38563b1
|
||||
Subproject commit b1dc4b643dc1c4015fc5f87075f9c135714def9e
|
Loading…
Reference in New Issue
Block a user