Merge pull request #65835 from jorsn/libextractor-gstreamer

This commit is contained in:
Jan Tojnar 2020-04-29 13:29:28 +02:00 committed by GitHub
commit 519b7d24f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 2 deletions

View File

@ -1,8 +1,21 @@
{ fetchurl, stdenv, libtool, gettext, zlib, bzip2, flac, libvorbis { fetchurl, stdenv, substituteAll
, libtool, gettext, zlib, bzip2, flac, libvorbis
, exiv2, libgsf, rpm, pkgconfig, fetchpatch , exiv2, libgsf, rpm, pkgconfig, fetchpatch
, gstreamerSupport ? true, gst_all_1 ? null
# ^ Needed e.g. for proper id3 and FLAC support.
# Set to `false` to decrease package closure size by about 87 MB (53%).
, gstPlugins ? (gst: [ gst.gst-plugins-base gst.gst-plugins-good ])
# If an application needs additional gstreamer plugins it can also make them
# available by adding them to the environment variable
# GST_PLUGIN_SYSTEM_PATH_1_0, e.g. like this:
# postInstall = ''
# wrapProgram $out/bin/extract --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
# '';
# See also <https://nixos.org/nixpkgs/manual/#sec-language-gnome>.
, gtkSupport ? true, glib ? null, gtk3 ? null , gtkSupport ? true, glib ? null, gtk3 ? null
, videoSupport ? true, ffmpeg ? null, libmpeg2 ? null}: , videoSupport ? true, ffmpeg ? null, libmpeg2 ? null}:
assert gstreamerSupport -> gst_all_1 != null && builtins.isList (gstPlugins gst_all_1);
assert gtkSupport -> glib != null && gtk3 != null; assert gtkSupport -> glib != null && gtk3 != null;
assert videoSupport -> ffmpeg != null && libmpeg2 != null; assert videoSupport -> ffmpeg != null && libmpeg2 != null;
@ -28,6 +41,15 @@ stdenv.mkDerivation rec {
sha256 = "01xhcjbzv6p53wz7y2ii76kb8m9iwvnm4ip9w4a0bpgaxqz4b9fw"; sha256 = "01xhcjbzv6p53wz7y2ii76kb8m9iwvnm4ip9w4a0bpgaxqz4b9fw";
excludes = [ "ChangeLog" ]; excludes = [ "ChangeLog" ];
}) })
] ++ stdenv.lib.optionals gstreamerSupport [
# Libraries cannot be wrapped so we need to hardcode the plug-in paths.
(substituteAll {
src = ./gst-hardcode-plugins.patch;
load_gst_plugins = stdenv.lib.concatMapStrings
(plugin: ''gst_registry_scan_path(gst_registry_get(), "${plugin}/lib/gstreamer-1.0");'')
(gstPlugins gst_all_1);
})
]; ];
preConfigure = preConfigure =
@ -40,7 +62,9 @@ stdenv.mkDerivation rec {
[ libtool gettext zlib bzip2 flac libvorbis exiv2 [ libtool gettext zlib bzip2 flac libvorbis exiv2
libgsf rpm libgsf rpm
pkgconfig pkgconfig
] ++ stdenv.lib.optionals gtkSupport [ glib gtk3 ] ] ++ stdenv.lib.optionals gstreamerSupport
([ gst_all_1.gstreamer ] ++ gstPlugins gst_all_1)
++ stdenv.lib.optionals gtkSupport [ glib gtk3 ]
++ stdenv.lib.optionals videoSupport [ ffmpeg libmpeg2 ]; ++ stdenv.lib.optionals videoSupport [ ffmpeg libmpeg2 ];
configureFlags = [ configureFlags = [

View File

@ -0,0 +1,11 @@
--- a/src/plugins/gstreamer_extractor.c
+++ b/src/plugins/gstreamer_extractor.c
@@ -2215,6 +2215,7 @@ void __attribute__ ((constructor))
gstreamer_init ()
{
gst_init (NULL, NULL);
+ @load_gst_plugins@
g_log_set_default_handler (&log_handler, NULL);
g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
&log_handler, NULL);