rip out media_kit, use better_player and audioplayers
This also let us rip out cocoapods stuff. Needs testing on Windows, MacOS, and ideally, iOS.
This commit is contained in:
parent
161d39322c
commit
37a2c150f3
5 changed files with 375 additions and 604 deletions
|
|
@ -7,11 +7,11 @@
|
|||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <app_links_linux/app_links_plugin_linux.h>
|
||||
#include <audioplayers_linux/audioplayers_linux_plugin.h>
|
||||
#include <better_player_linux/better_player_linux_plugin.h>
|
||||
#include <dynamic_color/dynamic_color_plugin.h>
|
||||
#include <file_selector_linux/file_selector_plugin.h>
|
||||
#include <location/location_plugin.h>
|
||||
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
|
||||
#include <media_kit_video/media_kit_video_plugin.h>
|
||||
#include <pasteboard/pasteboard_plugin.h>
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
|
||||
|
|
@ -19,6 +19,12 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||
g_autoptr(FlPluginRegistrar) app_links_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "AppLinksPluginLinux");
|
||||
app_links_plugin_linux_register_with_registrar(app_links_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin");
|
||||
audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) better_player_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "BetterPlayerLinuxPlugin");
|
||||
better_player_linux_plugin_register_with_registrar(better_player_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||
|
|
@ -28,12 +34,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||
g_autoptr(FlPluginRegistrar) location_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "LocationPlugin");
|
||||
location_plugin_register_with_registrar(location_registrar);
|
||||
g_autoptr(FlPluginRegistrar) media_kit_libs_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitLibsLinuxPlugin");
|
||||
media_kit_libs_linux_plugin_register_with_registrar(media_kit_libs_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) media_kit_video_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin");
|
||||
media_kit_video_plugin_register_with_registrar(media_kit_video_registrar);
|
||||
g_autoptr(FlPluginRegistrar) pasteboard_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin");
|
||||
pasteboard_plugin_register_with_registrar(pasteboard_registrar);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
app_links_linux
|
||||
audioplayers_linux
|
||||
better_player_linux
|
||||
dynamic_color
|
||||
file_selector_linux
|
||||
location
|
||||
media_kit_libs_linux
|
||||
media_kit_video
|
||||
pasteboard
|
||||
url_launcher_linux
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@
|
|||
stdenv.cc
|
||||
go
|
||||
git
|
||||
ffmpeg-headless
|
||||
|
||||
libGL
|
||||
(flutter.override {
|
||||
# audioplayers plays audio through GStreamer
|
||||
extraPkgConfigPackages = [
|
||||
mpv-unwrapped
|
||||
libass
|
||||
gst_all_1.gstreamer
|
||||
gst_all_1.gst-plugins-base
|
||||
];
|
||||
})
|
||||
]
|
||||
|
|
@ -25,6 +27,27 @@
|
|||
];
|
||||
|
||||
env = lib.optionalAttrs pkgs.stdenv.isLinux {
|
||||
LD_LIBRARY_PATH = "./build/native_assets/linux:${lib.makeLibraryPath [ pkgs.zlib ]}";
|
||||
# better_player loads libmpv at runtime to play videos
|
||||
LD_LIBRARY_PATH = "./build/native_assets/linux:${
|
||||
lib.makeLibraryPath [
|
||||
pkgs.zlib
|
||||
pkgs.mpv-unwrapped
|
||||
]
|
||||
}";
|
||||
# audioplayers links GStreamer by name only, without its library directory
|
||||
LIBRARY_PATH = lib.makeLibraryPath [
|
||||
pkgs.gst_all_1.gstreamer
|
||||
pkgs.gst_all_1.gst-plugins-base
|
||||
pkgs.glib
|
||||
];
|
||||
GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (
|
||||
with pkgs.gst_all_1;
|
||||
[
|
||||
gstreamer
|
||||
gst-plugins-base
|
||||
gst-plugins-good
|
||||
gst-libav
|
||||
]
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
lib,
|
||||
callPackage,
|
||||
mpv-unwrapped,
|
||||
libass,
|
||||
gst_all_1,
|
||||
ffmpeg-headless,
|
||||
libxext,
|
||||
libxfixes,
|
||||
libclang,
|
||||
|
|
@ -39,8 +40,9 @@ flutter.buildFlutterApplication {
|
|||
nativeBuildInputs = [ (callPackage ./hook_pkg_config.nix { }) ];
|
||||
|
||||
buildInputs = [
|
||||
mpv-unwrapped
|
||||
libass
|
||||
# audioplayers plays audio through GStreamer
|
||||
gst_all_1.gstreamer
|
||||
gst_all_1.gst-plugins-base
|
||||
# nativeapi includes XInput2.h, which needs these, but xi.pc only lists them privately
|
||||
libxext
|
||||
libxfixes
|
||||
|
|
@ -54,6 +56,7 @@ flutter.buildFlutterApplication {
|
|||
|
||||
gitHashes = {
|
||||
linkify = "sha256-TpMD6+0zyY6i9l+6d8ErnVufmepCv362rCtnbOht/z4=";
|
||||
location = "sha256-zWnffXiK1LD4Ln23coPozBjYfTlhZmBhC5Z8mCdAgwQ=";
|
||||
fab_m3e = "sha256-5V9m6yY0jimx2gh7lQHYg4HDKQ4Wrl0ATmBhw5DkQMI=";
|
||||
fluttertagger = "sha256-tHUNU2+fBPkq5UK5YRi3SWs1zF2PIPz6RgSbwignU/I=";
|
||||
m3e_design = "sha256-5V9m6yY0jimx2gh7lQHYg4HDKQ4Wrl0ATmBhw5DkQMI=";
|
||||
|
|
@ -69,8 +72,24 @@ flutter.buildFlutterApplication {
|
|||
install -D assets/bundled/icon.svg $out/share/icons/hicolor/scalable/apps/nexus.svg
|
||||
install -Dm755 linux/*.desktop -t $out/share/applications
|
||||
install -Dm644 linux/*.service -t $out/share/dbus-1/services
|
||||
# better_player loads libmpv at runtime to play videos, and audioplayers
|
||||
# needs GStreamer's plugins to decode audio
|
||||
# gomuks uses ffmpeg and ffprobe for video thumbnails and metadata
|
||||
wrapProgram $out/bin/nexus \
|
||||
--suffix LD_LIBRARY_PATH : $out/app/nexus/lib
|
||||
--suffix LD_LIBRARY_PATH : $out/app/nexus/lib \
|
||||
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ mpv-unwrapped ]} \
|
||||
--prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]} \
|
||||
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : ${
|
||||
lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (
|
||||
with gst_all_1;
|
||||
[
|
||||
gstreamer
|
||||
gst-plugins-base
|
||||
gst-plugins-good
|
||||
gst-libav
|
||||
]
|
||||
)
|
||||
}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "my_application.h"
|
||||
|
||||
#include <clocale>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
|
|
@ -301,6 +302,9 @@ static void my_application_startup(
|
|||
G_APPLICATION_CLASS(
|
||||
my_application_parent_class)
|
||||
->startup(application);
|
||||
|
||||
// mpv hates normal locales
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
}
|
||||
|
||||
static void my_application_shutdown(
|
||||
|
|
|
|||
Loading…
Reference in a new issue