mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Start working on support for the FFmpeg plugin
This commit is contained in:
parent
780e88dcc1
commit
75ca093c51
@ -120,5 +120,7 @@
|
|||||||
android:name=".services.GameService"
|
android:name=".services.GameService"
|
||||||
android:process=":game" />
|
android:process=":game" />
|
||||||
</application>
|
</application>
|
||||||
|
<queries>
|
||||||
|
<package android:name="net.kdt.pojavlaunch.ffmpeg"/>
|
||||||
|
</queries>
|
||||||
</manifest>
|
</manifest>
|
@ -18,6 +18,7 @@ import java.util.*;
|
|||||||
import net.kdt.pojavlaunch.extra.ExtraConstants;
|
import net.kdt.pojavlaunch.extra.ExtraConstants;
|
||||||
import net.kdt.pojavlaunch.extra.ExtraCore;
|
import net.kdt.pojavlaunch.extra.ExtraCore;
|
||||||
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
|
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
|
||||||
|
import net.kdt.pojavlaunch.plugins.FFmpegPlugin;
|
||||||
import net.kdt.pojavlaunch.prefs.*;
|
import net.kdt.pojavlaunch.prefs.*;
|
||||||
import net.kdt.pojavlaunch.utils.*;
|
import net.kdt.pojavlaunch.utils.*;
|
||||||
import net.kdt.pojavlaunch.value.*;
|
import net.kdt.pojavlaunch.value.*;
|
||||||
@ -179,6 +180,7 @@ public final class Tools {
|
|||||||
javaArgList.add(versionInfo.mainClass);
|
javaArgList.add(versionInfo.mainClass);
|
||||||
javaArgList.addAll(Arrays.asList(launchArgs));
|
javaArgList.addAll(Arrays.asList(launchArgs));
|
||||||
// ctx.appendlnToLog("full args: "+javaArgList.toString());
|
// ctx.appendlnToLog("full args: "+javaArgList.toString());
|
||||||
|
FFmpegPlugin.discover(activity);
|
||||||
JREUtils.launchJavaVM(activity, gamedirPath, javaArgList);
|
JREUtils.launchJavaVM(activity, gamedirPath, javaArgList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package net.kdt.pojavlaunch.plugins;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import net.kdt.pojavlaunch.Tools;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class FFmpegPlugin {
|
||||||
|
public static boolean isAvailable = false;
|
||||||
|
public static String libraryPath;
|
||||||
|
public static void discover(Context context) {
|
||||||
|
PackageManager manager = context.getPackageManager();
|
||||||
|
try {
|
||||||
|
PackageInfo ffmpegPluginInfo = manager.getPackageInfo("net.kdt.pojavlaunch.ffmpeg", PackageManager.GET_SHARED_LIBRARY_FILES);
|
||||||
|
libraryPath = ffmpegPluginInfo.applicationInfo.nativeLibraryDir;
|
||||||
|
isAvailable = true;
|
||||||
|
}catch (Exception e) {
|
||||||
|
Log.i("FFmpegPlugin", "Failed to discover plugin", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ import java.util.*;
|
|||||||
import net.kdt.pojavlaunch.*;
|
import net.kdt.pojavlaunch.*;
|
||||||
import net.kdt.pojavlaunch.extra.ExtraConstants;
|
import net.kdt.pojavlaunch.extra.ExtraConstants;
|
||||||
import net.kdt.pojavlaunch.extra.ExtraCore;
|
import net.kdt.pojavlaunch.extra.ExtraCore;
|
||||||
|
import net.kdt.pojavlaunch.plugins.FFmpegPlugin;
|
||||||
import net.kdt.pojavlaunch.prefs.*;
|
import net.kdt.pojavlaunch.prefs.*;
|
||||||
import org.lwjgl.glfw.*;
|
import org.lwjgl.glfw.*;
|
||||||
|
|
||||||
@ -174,6 +175,9 @@ public class JREUtils {
|
|||||||
|
|
||||||
String libName = is64BitsDevice() ? "lib64" : "lib";
|
String libName = is64BitsDevice() ? "lib64" : "lib";
|
||||||
StringBuilder ldLibraryPath = new StringBuilder();
|
StringBuilder ldLibraryPath = new StringBuilder();
|
||||||
|
if(FFmpegPlugin.isAvailable) {
|
||||||
|
ldLibraryPath.append(FFmpegPlugin.libraryPath+":");
|
||||||
|
}
|
||||||
ldLibraryPath.append(
|
ldLibraryPath.append(
|
||||||
Tools.DIR_HOME_JRE + "/" + Tools.DIRNAME_HOME_JRE + "/jli:" +
|
Tools.DIR_HOME_JRE + "/" + Tools.DIRNAME_HOME_JRE + "/jli:" +
|
||||||
Tools.DIR_HOME_JRE + "/" + Tools.DIRNAME_HOME_JRE + ":"
|
Tools.DIR_HOME_JRE + "/" + Tools.DIRNAME_HOME_JRE + ":"
|
||||||
@ -223,6 +227,9 @@ public class JREUtils {
|
|||||||
|
|
||||||
envMap.put("LD_LIBRARY_PATH", LD_LIBRARY_PATH);
|
envMap.put("LD_LIBRARY_PATH", LD_LIBRARY_PATH);
|
||||||
envMap.put("PATH", Tools.DIR_HOME_JRE + "/bin:" + Os.getenv("PATH"));
|
envMap.put("PATH", Tools.DIR_HOME_JRE + "/bin:" + Os.getenv("PATH"));
|
||||||
|
if(FFmpegPlugin.isAvailable) {
|
||||||
|
envMap.put("PATH", FFmpegPlugin.libraryPath+":"+envMap.get("PATH"));
|
||||||
|
}
|
||||||
|
|
||||||
envMap.put("REGAL_GL_VENDOR", "Android");
|
envMap.put("REGAL_GL_VENDOR", "Android");
|
||||||
envMap.put("REGAL_GL_RENDERER", "Regal");
|
envMap.put("REGAL_GL_RENDERER", "Regal");
|
||||||
@ -317,6 +324,7 @@ public class JREUtils {
|
|||||||
initJavaRuntime();
|
initJavaRuntime();
|
||||||
setupExitTrap(activity.getApplication());
|
setupExitTrap(activity.getApplication());
|
||||||
chdir(gameDirectory == null ? Tools.DIR_GAME_NEW : gameDirectory);
|
chdir(gameDirectory == null ? Tools.DIR_GAME_NEW : gameDirectory);
|
||||||
|
FFmpegPlugin.selfTest();
|
||||||
userArgs.add(0,"java"); //argv[0] is the program name according to C standard.
|
userArgs.add(0,"java"); //argv[0] is the program name according to C standard.
|
||||||
|
|
||||||
final int exitCode = VMLauncher.launchJVM(userArgs.toArray(new String[0]));
|
final int exitCode = VMLauncher.launchJVM(userArgs.toArray(new String[0]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user