add support for ffmpeg plugin

This commit is contained in:
ShirosakiMio 2024-04-12 13:45:05 +08:00
parent 5b2e661892
commit 7bee3a8ef3
3 changed files with 28 additions and 2 deletions

View File

@ -126,5 +126,7 @@
android:resource="@xml/provider_paths"/>
</provider>
</application>
<queries>
<package android:name="net.kdt.pojavlaunch.ffmpeg"/>
</queries>
</manifest>

View File

@ -9,6 +9,7 @@ import android.util.ArrayMap;
import com.jaredrummler.android.device.DeviceName;
import com.tungsten.fclauncher.bridge.FCLBridge;
import com.tungsten.fclauncher.plugins.FFmpegPlugin;
import com.tungsten.fclauncher.utils.Architecture;
import java.io.BufferedReader;
@ -110,7 +111,8 @@ public class FCLauncher {
"/hw" +
split +
nativeDir;
nativeDir +
(FFmpegPlugin.isAvailable ? split + FFmpegPlugin.libraryPath : "");
}
private static String[] rebaseArgs(FCLConfig config) throws IOException {
@ -224,6 +226,7 @@ public class FCLauncher {
}
private static void launch(FCLConfig config, FCLBridge bridge, String task) throws IOException {
FFmpegPlugin.discover(config.getContext());
printTaskTitle(bridge, task + " Arguments");
String[] args = rebaseArgs(config);
boolean javaArgs = true;

View File

@ -0,0 +1,21 @@
package com.tungsten.fclauncher.plugins;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;
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);
}
}
}