about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/mediastreamer
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mediastreamer')
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/default.nix111
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch18
3 files changed, 178 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mediastreamer/default.nix b/nixpkgs/pkgs/development/libraries/mediastreamer/default.nix
new file mode 100644
index 000000000000..81c7c8fcacf3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/default.nix
@@ -0,0 +1,111 @@
+{ alsaLib
+, bctoolbox
+, bzrtp
+, cmake
+, doxygen
+, fetchFromGitLab
+, fetchpatch
+, ffmpeg_3
+, glew
+, gsm
+, intltool
+, libGL
+, libGLU
+, libX11
+, libXext
+, libXv
+, libmatroska
+, libopus
+, libpcap
+, libpulseaudio
+, libtheora
+, libupnp
+, libv4l
+, libvpx
+, ortp
+, pkgconfig
+, python
+, SDL
+, speex
+, srtp
+, stdenv
+}:
+
+stdenv.mkDerivation rec {
+  pname = "mediastreamer2";
+  # Using master branch for linphone-desktop caused a chain reaction that many
+  # of its dependencies needed to use master branch too.
+  version = "unstable-2020-03-20";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.linphone.org";
+    owner = "public";
+    group = "BC";
+    repo = pname;
+    rev = "c5eecb72cb44376d142949051dd0cb7c982608fb";
+    sha256 = "1vp260jxvjlmrmjdl4p23prg4cjln20a7z6zq8dqvfh4iq3ya033";
+  };
+
+  patches = [
+    # Plugins directory is normally fixed during compile time. This patch makes
+    # it possible to set the plugins directory run time with an environment
+    # variable MEDIASTREAMER_PLUGINS_DIR. This makes it possible to construct a
+    # plugin directory with desired plugins and wrap executables so that the
+    # environment variable points to that directory.
+    ./plugins_dir.patch
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    doxygen
+    intltool
+    pkgconfig
+    python
+  ];
+
+  propagatedBuildInputs = [
+    alsaLib
+    bctoolbox
+    bzrtp
+    ffmpeg_3
+    glew
+    gsm
+    libGL
+    libGLU
+    libX11
+    libXext
+    libXv
+    libmatroska
+    libopus
+    libpcap
+    libpulseaudio
+    libtheora
+    libupnp
+    libv4l
+    libvpx
+    ortp
+    SDL
+    speex
+    srtp
+  ];
+
+  # Do not build static libraries
+  cmakeFlags = [ "-DENABLE_STATIC=NO" ];
+
+  NIX_CFLAGS_COMPILE = toString [
+    "-DGIT_VERSION=\"v${version}\""
+    "-Wno-error=deprecated-declarations"
+    "-Wno-error=cast-function-type"
+    "-Wno-error=stringop-truncation"
+    "-Wno-error=stringop-overflow"
+  ];
+  NIX_LDFLAGS = "-lXext";
+
+  meta = with stdenv.lib; {
+    description = "A powerful and lightweight streaming engine specialized for voice/video telephony applications";
+    homepage = "http://www.linphone.org/technical-corner/mediastreamer2";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ jluttine ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix b/nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix
new file mode 100644
index 000000000000..45b3c83bfe24
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix
@@ -0,0 +1,49 @@
+{ autoreconfHook
+, cmake
+, fetchFromGitLab
+, fetchpatch
+, mediastreamer
+, openh264
+, pkgconfig
+, stdenv
+}:
+
+stdenv.mkDerivation rec {
+  pname = "msopenh264";
+  # Using master branch for linphone-desktop caused a chain reaction that many
+  # of its dependencies needed to use master branch too.
+  version = "unstable-2020-03-03";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.linphone.org";
+    owner = "public";
+    group = "BC";
+    repo = pname;
+    rev = "2c3abf52824ad23a4caae7565ef158ef91767704";
+    sha256 = "140hs5lzpshzswvl39klcypankq3v2qck41696j22my7s4wsa0hr";
+  };
+
+  nativeBuildInputs = [ autoreconfHook cmake pkgconfig ];
+  buildInputs = [ mediastreamer openh264 ];
+
+  # Do not build static libraries
+  cmakeFlags = [
+    "-DENABLE_STATIC=NO"
+    "-DCMAKE_SKIP_INSTALL_RPATH=ON"
+  ];
+
+  # CMAKE_INSTALL_PREFIX has no effect so let's install manually. See:
+  # https://gitlab.linphone.org/BC/public/msopenh264/issues/1
+  installPhase = ''
+    mkdir -p $out/lib/mediastreamer/plugins
+    cp src/libmsopenh264.so $out/lib/mediastreamer/plugins/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "H.264 encoder/decoder plugin for mediastreamer2";
+    homepage = "https://www.linphone.org/technical-corner/mediastreamer2";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ jluttine ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch b/nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch
new file mode 100644
index 000000000000..43e398aafee4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch
@@ -0,0 +1,18 @@
+diff --git a/src/base/msfactory.c b/src/base/msfactory.c
+index 14f868e3..2e3445a1 100644
+--- a/src/base/msfactory.c
++++ b/src/base/msfactory.c
+@@ -770,7 +770,12 @@ void ms_factory_uninit_plugins(MSFactory *factory){
+ }
+ 
+ void ms_factory_init_plugins(MSFactory *obj) {
+-	if (obj->plugins_dir == NULL) {
++	char *package_plugins_dir;
++	// Force plugin dir from environment variable if set
++	package_plugins_dir = getenv("MEDIASTREAMER_PLUGINS_DIR");
++	if (package_plugins_dir != NULL) {
++		ms_factory_set_plugins_dir(obj, package_plugins_dir);
++	} else if (obj->plugins_dir == NULL) {
+ #ifdef __APPLE__
+ 	char *dir = getPluginsDir();
+ 	if (dir != NULL) {