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.nix95
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix48
-rw-r--r--nixpkgs/pkgs/development/libraries/mediastreamer/plugins_dir.patch18
3 files changed, 161 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..f1c109b244b3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/default.nix
@@ -0,0 +1,95 @@
+{ bctoolbox
+, bzrtp
+, cmake
+, fetchFromGitLab
+, ffmpeg_4
+, glew
+, gsm
+, lib
+, libX11
+, libXext
+, libopus
+, libpulseaudio
+, libv4l
+, libvpx
+, ortp
+, python3
+, qtbase
+, qtdeclarative
+, speex
+, srtp
+, stdenv
+}:
+
+stdenv.mkDerivation rec {
+  pname = "mediastreamer2";
+  version = "5.2.111";
+
+  dontWrapQtApps = true;
+
+  src = fetchFromGitLab {
+    domain = "gitlab.linphone.org";
+    owner = "public";
+    group = "BC";
+    repo = pname;
+    rev = version;
+    hash = "sha256-Le52tsyzOpepmvb+GOGCPwwTriPUjhYpa6GM+y/6USA=";
+  };
+
+  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
+    python3
+    qtbase
+    qtdeclarative
+  ];
+
+  propagatedBuildInputs = [
+    # Made by BC
+    bctoolbox
+    bzrtp
+    ortp
+
+    ffmpeg_4
+    glew
+    libX11
+    libXext
+    libpulseaudio
+    libv4l
+    speex
+    srtp
+
+    # Optional
+    gsm  # GSM audio codec
+    libopus  # Opus audio codec
+    libvpx  # VP8 video codec
+  ];
+
+  strictDeps = true;
+
+  cmakeFlags = [
+    "-DENABLE_STATIC=NO" # Do not build static libraries
+    "-DENABLE_QT_GL=ON" # Build necessary MSQOGL plugin for Linphone desktop
+    "-DCMAKE_C_FLAGS=-DGIT_VERSION=\"v${version}\""
+    "-DENABLE_STRICT=NO" # Disable -Werror
+    "-DENABLE_UNIT_TESTS=NO" # Do not build test executables
+  ];
+
+  NIX_LDFLAGS = "-lXext";
+
+  meta = with lib; {
+    description = "A powerful and lightweight streaming engine specialized for voice/video telephony applications. Part of the Linphone project";
+    homepage = "https://www.linphone.org/technical-corner/mediastreamer2";
+    license = licenses.gpl3Only;
+    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..83a96175cba5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mediastreamer/msopenh264.nix
@@ -0,0 +1,48 @@
+{ autoreconfHook
+, cmake
+, fetchFromGitLab
+, fetchpatch
+, mediastreamer
+, openh264
+, pkg-config
+, lib
+, stdenv
+}:
+
+stdenv.mkDerivation rec {
+  pname = "msopenh264";
+  version = "linphone-4.4.1";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.linphone.org";
+    owner = "public";
+    group = "BC";
+    repo = pname;
+    rev = "5603a432be2ed10f5d5a5ce068ef83ab2a996d6b";
+    sha256 = "sha256-AqZ7tsNZw2Djgyo1JBJbT/c3eQVyEn6r3CT6DQLD/B8=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  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 lib; {
+    description = "H.264 encoder/decoder plugin for mediastreamer2. Part of the Linphone project.";
+    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) {