summary refs log tree commit diff
path: root/pkgs/applications/video/obs-studio/plugins/obs-vaapi/default.nix
blob: 9b7ec4090dd552d79b4f2bb95b1b4848b30309a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, stdenv
, fetchFromGitHub
, gst_all_1
, pciutils
, pkg-config
, meson
, ninja
, obs-studio
}:

stdenv.mkDerivation rec {
  pname = "obs-vaapi";
  version = "0.4.1";

  src = fetchFromGitHub {
    owner = "fzwoch";
    repo = pname;
    rev = version;
    hash = "sha256-PpGNLIOz+fCpcP/nvjcJ+1fkduxjcbZjb7yx8TUO25s=";
  };

  nativeBuildInputs = [ pkg-config meson ninja ];
  buildInputs = with gst_all_1; [ gstreamer gst-plugins-base obs-studio pciutils ];

  # - We need "getLib" instead of default derivation, otherwise it brings gstreamer-bin;
  # - without gst-plugins-base it won't even show proper errors in logs;
  # - Without gst-plugins-bad it won't find element "vapostproc";
  # - gst-vaapi adds "VA-API" to "Encoder type";
  # Tip: "could not link appsrc to videoconvert1" can mean a lot of things, enable GST_DEBUG=2 for help.
  passthru.obsWrapperArguments =
    let
      gstreamerHook = package: "--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : ${lib.getLib package}/lib/gstreamer-1.0";
    in
    with gst_all_1; builtins.map gstreamerHook [
      gstreamer
      gst-plugins-base
      gst-plugins-bad
      gst-vaapi
    ];

  # Fix output directory
  postInstall = ''
    mkdir $out/lib/obs-plugins
    mv $out/lib/obs-vaapi.so $out/lib/obs-plugins/
  '';

  meta = with lib; {
    description = "OBS Studio VAAPI support via GStreamer";
    homepage = "https://github.com/fzwoch/obs-vaapi";
    changelog = "https://github.com/fzwoch/obs-vaapi/releases/tag/${version}";
    maintainers = with maintainers; [ ahuzik pedrohlc ];
    license = licenses.gpl2Plus;
    platforms = [ "x86_64-linux" "i686-linux" ];
  };
}