From 1bcffbaa9339034098958e93594b2439d86a0ba3 Mon Sep 17 00:00:00 2001 From: materus Date: Wed, 22 Nov 2023 00:52:41 +0100 Subject: [PATCH] obs-studio: update to 30.0.0 --- flake.lock | 18 ++--- pkgs/apps/obs/7206.patch | 115 +++++++++++++++++++------------ pkgs/apps/obs/default.nix | 14 ++-- pkgs/apps/obs/libdatachannel.nix | 60 ++++++++++++++++ pkgs/apps/obs/onevpl.nix | 44 ++++++++++++ pkgs/apps/obs/qrcodegencpp.nix | 27 ++++++++ 6 files changed, 220 insertions(+), 58 deletions(-) create mode 100644 pkgs/apps/obs/libdatachannel.nix create mode 100644 pkgs/apps/obs/onevpl.nix create mode 100644 pkgs/apps/obs/qrcodegencpp.nix diff --git a/flake.lock b/flake.lock index d470b92..15a2723 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1696737557, - "narHash": "sha256-YD/pjDjj/BNmisEvRdM/vspkCU3xyyeGVAUWhvVSi5Y=", + "lastModified": 1700553346, + "narHash": "sha256-kW7uWsCv/lxuA824Ng6EYD9hlVYRyjuFn0xBbYltAeQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "3c1d8758ac3f55ab96dcaf4d271c39da4b6e836d", + "rev": "1aabb0a31b25ad83cfaa37c3fe29053417cd9a0f", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1696604326, - "narHash": "sha256-YXUNI0kLEcI5g8lqGMb0nh67fY9f2YoJsILafh6zlMo=", + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "87828a0e03d1418e848d3dd3f3014a632e4a4f64", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", "type": "github" }, "original": { @@ -39,11 +39,11 @@ }, "nur": { "locked": { - "lastModified": 1696758426, - "narHash": "sha256-8ebGev/aEoy9NUhexXLg1gFtcdgT+pmYXoc1rg4U5TM=", + "lastModified": 1700603363, + "narHash": "sha256-0f/qOTj4lOsdYUDoxQg1gH9RgCRz5yy+H1bYK1CYOSc=", "owner": "nix-community", "repo": "NUR", - "rev": "2a1a76ccc91abc61c09521931253f9fe9e012a85", + "rev": "73a121a8cef922a2f65898af1953c206757589e1", "type": "github" }, "original": { diff --git a/pkgs/apps/obs/7206.patch b/pkgs/apps/obs/7206.patch index 521b7ec..a7f054f 100644 --- a/pkgs/apps/obs/7206.patch +++ b/pkgs/apps/obs/7206.patch @@ -1,10 +1,10 @@ diff --git a/plugins/obs-ffmpeg/CMakeLists.txt b/plugins/obs-ffmpeg/CMakeLists.txt -index 3eba00932..778d93ffb 100644 +index 04530ef39..51409f413 100644 --- a/plugins/obs-ffmpeg/CMakeLists.txt +++ b/plugins/obs-ffmpeg/CMakeLists.txt -@@ -108,10 +108,12 @@ if(OS_WINDOWS) - jim-nvenc-ver.h - obs-ffmpeg.rc) +@@ -103,10 +103,12 @@ if(OS_WINDOWS) + target_sources(obs-ffmpeg PRIVATE obs-nvenc-helpers.c obs-nvenc.c obs-nvenc.h obs-ffmpeg.rc texture-amf-opts.hpp + texture-amf.cpp) elseif(OS_LINUX OR OS_FREEBSD) + add_subdirectory(obs-amf-test) + @@ -17,10 +17,10 @@ index 3eba00932..778d93ffb 100644 endif() diff --git a/plugins/obs-ffmpeg/cmake/legacy.cmake b/plugins/obs-ffmpeg/cmake/legacy.cmake -index 5540676ea..78b8c30a1 100644 +index 4cc75b341..3319e8039 100644 --- a/plugins/obs-ffmpeg/cmake/legacy.cmake +++ b/plugins/obs-ffmpeg/cmake/legacy.cmake -@@ -106,9 +106,10 @@ if(OS_WINDOWS) +@@ -107,9 +107,10 @@ if(OS_WINDOWS) obs-ffmpeg.rc) elseif(OS_POSIX AND NOT OS_MACOS) @@ -33,15 +33,38 @@ index 5540676ea..78b8c30a1 100644 endif() diff --git a/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt b/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt -index e00cef1cf..07cf1e0fc 100644 +index 6221c69df..13068f813 100644 --- a/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt +++ b/plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt -@@ -6,8 +6,14 @@ find_package(AMF 1.4.29 REQUIRED) +@@ -7,9 +7,14 @@ find_package(AMF 1.4.29 REQUIRED) + add_executable(obs-amf-test) + add_executable(OBS::amf-test ALIAS obs-amf-test) + +-target_sources(obs-amf-test PRIVATE obs-amf-test.cpp) +-target_link_libraries(obs-amf-test PRIVATE OBS::COMutils AMF::AMF d3d11 dxgi dxguid) +- ++if(OS_WINDOWS) ++ target_sources(obs-amf-test PRIVATE obs-amf-test.cpp) ++ target_link_libraries(obs-amf-test PRIVATE OBS::COMutils AMF::AMF d3d11 dxgi dxguid) ++elseif(OS_POSIX AND NOT OS_MACOS) ++ find_package(Vulkan REQUIRED) ++ target_sources(obs-amf-test PRIVATE obs-amf-test-linux.cpp) ++ target_link_libraries(obs-amf-test dl Vulkan::Vulkan AMF::AMF) ++endif() + # cmake-format: off + set_target_properties_obs(obs-amf-test PROPERTIES FOLDER plugins/obs-ffmpeg) + # cmake-format: on +diff --git a/plugins/obs-ffmpeg/obs-amf-test/cmake/legacy.cmake b/plugins/obs-ffmpeg/obs-amf-test/cmake/legacy.cmake +index e00cef1cf..6620e359d 100644 +--- a/plugins/obs-ffmpeg/obs-amf-test/cmake/legacy.cmake ++++ b/plugins/obs-ffmpeg/obs-amf-test/cmake/legacy.cmake +@@ -6,9 +6,14 @@ find_package(AMF 1.4.29 REQUIRED) target_include_directories(obs-amf-test PRIVATE ${CMAKE_SOURCE_DIR}/libobs) -target_sources(obs-amf-test PRIVATE obs-amf-test.cpp) -target_link_libraries(obs-amf-test d3d11 dxgi dxguid AMF::AMF) +- +if(OS_WINDOWS) + target_sources(obs-amf-test PRIVATE obs-amf-test.cpp) + target_link_libraries(obs-amf-test d3d11 dxgi dxguid AMF::AMF) @@ -50,9 +73,9 @@ index e00cef1cf..07cf1e0fc 100644 + target_sources(obs-amf-test PRIVATE obs-amf-test-linux.cpp) + target_link_libraries(obs-amf-test dl Vulkan::Vulkan AMF::AMF) +endif() - set_target_properties(obs-amf-test PROPERTIES FOLDER "plugins/obs-ffmpeg") + setup_binary_target(obs-amf-test) diff --git a/plugins/obs-ffmpeg/obs-amf-test/obs-amf-test-linux.cpp b/plugins/obs-ffmpeg/obs-amf-test/obs-amf-test-linux.cpp new file mode 100644 index 000000000..db437d851 @@ -200,20 +223,20 @@ index 000000000..db437d851 + return 0; +} diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c -index da0b2c2b4..92421c6f3 100644 +index 7eb9a876d..7b5c9bdc9 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg.c -@@ -360,6 +360,9 @@ static bool hevc_vaapi_supported(void) +@@ -355,6 +355,9 @@ static bool hevc_vaapi_supported(void) #ifdef _WIN32 - extern void jim_nvenc_load(bool h264, bool hevc, bool av1); - extern void jim_nvenc_unload(void); + extern void obs_nvenc_load(bool h264, bool hevc, bool av1); + extern void obs_nvenc_unload(void); +#endif + +#if defined(_WIN32) || defined(__linux__) extern void amf_load(void); extern void amf_unload(void); #endif -@@ -434,7 +437,7 @@ bool obs_module_load(void) +@@ -429,7 +432,7 @@ bool obs_module_load(void) #endif } @@ -222,7 +245,7 @@ index da0b2c2b4..92421c6f3 100644 amf_load(); #endif -@@ -475,8 +478,11 @@ void obs_module_unload(void) +@@ -470,8 +473,11 @@ void obs_module_unload(void) obs_ffmpeg_unload_logging(); #endif @@ -231,8 +254,8 @@ index da0b2c2b4..92421c6f3 100644 amf_unload(); +#endif + -+#ifdef _WIN32 - jim_nvenc_unload(); ++#ifdef _WIN32 + obs_nvenc_unload(); #endif } diff --git a/plugins/obs-ffmpeg/texture-amf-opts.hpp b/plugins/obs-ffmpeg/texture-amf-opts.hpp @@ -249,7 +272,7 @@ index b1c37d200..d28e3f77e 100644 bool bool_val = (bool)val; set_amf_property(enc, wname, bool_val); diff --git a/plugins/obs-ffmpeg/texture-amf.cpp b/plugins/obs-ffmpeg/texture-amf.cpp -index abd1d6f92..871087710 100644 +index 7f45a8cc9..2c0b44c4e 100644 --- a/plugins/obs-ffmpeg/texture-amf.cpp +++ b/plugins/obs-ffmpeg/texture-amf.cpp @@ -11,6 +11,7 @@ @@ -297,7 +320,7 @@ index abd1d6f92..871087710 100644 static uint64_t amf_version = 0; /* ========================================================================= */ -@@ -120,9 +126,11 @@ struct amf_base { +@@ -121,9 +127,11 @@ struct amf_base { virtual void init() = 0; }; @@ -310,7 +333,7 @@ index abd1d6f92..871087710 100644 struct amf_texencode : amf_base, public AMFSurfaceObserver { volatile bool destroying = false; -@@ -159,6 +167,7 @@ struct amf_texencode : amf_base, public AMFSurfaceObserver { +@@ -160,6 +168,7 @@ struct amf_texencode : amf_base, public AMFSurfaceObserver { throw amf_error("InitDX11 failed", res); } }; @@ -318,7 +341,7 @@ index abd1d6f92..871087710 100644 struct amf_fallback : amf_base, public AMFSurfaceObserver { volatile bool destroying = false; -@@ -186,9 +195,21 @@ struct amf_fallback : amf_base, public AMFSurfaceObserver { +@@ -187,9 +196,21 @@ struct amf_fallback : amf_base, public AMFSurfaceObserver { void init() override { @@ -340,7 +363,7 @@ index abd1d6f92..871087710 100644 } }; -@@ -230,13 +251,18 @@ static void set_amf_property(amf_base *enc, const wchar_t *name, const T &value) +@@ -231,13 +252,18 @@ static void set_amf_property(amf_base *enc, const wchar_t *name, const T &value) : (enc->codec == amf_codec_type::HEVC) \ ? AMF_VIDEO_ENCODER_HEVC_##name \ : AMF_VIDEO_ENCODER_AV1_##name) @@ -360,7 +383,7 @@ index abd1d6f92..871087710 100644 #define set_avc_enum(name, value) \ set_avc_property(enc, name, AMF_VIDEO_ENCODER_##name##_##value) #define set_hevc_enum(name, value) \ -@@ -247,6 +273,7 @@ static void set_amf_property(amf_base *enc, const wchar_t *name, const T &value) +@@ -248,6 +274,7 @@ static void set_amf_property(amf_base *enc, const wchar_t *name, const T &value) /* ------------------------------------------------------------------------- */ /* Implementation */ @@ -368,7 +391,7 @@ index abd1d6f92..871087710 100644 static HMODULE get_lib(const char *lib) { HMODULE mod = GetModuleHandleA(lib); -@@ -393,6 +420,7 @@ static void get_tex_from_handle(amf_texencode *enc, uint32_t handle, +@@ -394,6 +421,7 @@ static void get_tex_from_handle(amf_texencode *enc, uint32_t handle, *km_out = km.Detach(); *tex_out = tex.Detach(); } @@ -376,7 +399,7 @@ index abd1d6f92..871087710 100644 static constexpr amf_int64 macroblock_size = 16; -@@ -504,7 +532,7 @@ static void convert_to_encoder_packet(amf_base *enc, AMFDataPtr &data, +@@ -510,7 +538,7 @@ static void convert_to_encoder_packet(amf_base *enc, AMFDataPtr &data, enc->packet_data = AMFBufferPtr(data); data->GetProperty(L"PTS", &packet->pts); @@ -385,7 +408,7 @@ index abd1d6f92..871087710 100644 switch (enc->codec) { case amf_codec_type::AVC: get_output_type = AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE; -@@ -638,6 +666,7 @@ static void amf_encode_base(amf_base *enc, AMFSurface *amf_surf, +@@ -644,6 +672,7 @@ static void amf_encode_base(amf_base *enc, AMFSurface *amf_surf, static bool amf_encode_tex(void *data, uint32_t handle, int64_t pts, uint64_t lock_key, uint64_t *next_key, encoder_packet *packet, bool *received_packet) @@ -393,7 +416,7 @@ index abd1d6f92..871087710 100644 try { amf_texencode *enc = (amf_texencode *)data; ID3D11DeviceContext *context = enc->context; -@@ -714,6 +743,18 @@ try { +@@ -720,6 +749,18 @@ try { *received_packet = false; return false; } @@ -412,7 +435,7 @@ index abd1d6f92..871087710 100644 static buf_t alloc_buf(amf_fallback *enc) { -@@ -1177,6 +1218,7 @@ static const char *amf_avc_get_name(void *) +@@ -1184,6 +1225,7 @@ static const char *amf_avc_get_name(void *) static inline int get_avc_preset(amf_base *enc, const char *preset) { @@ -420,7 +443,7 @@ index abd1d6f92..871087710 100644 if (astrcmpi(preset, "quality") == 0) return AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY; else if (astrcmpi(preset, "speed") == 0) -@@ -1287,7 +1329,7 @@ static bool amf_avc_init(void *data, obs_data_t *settings) +@@ -1298,7 +1340,7 @@ static bool amf_avc_init(void *data, obs_data_t *settings) set_avc_property(enc, B_PIC_PATTERN, bf); } else if (bf != 0) { @@ -429,7 +452,7 @@ index abd1d6f92..871087710 100644 "supported by this device", bf); bf = 0; -@@ -1332,12 +1374,12 @@ static bool amf_avc_init(void *data, obs_data_t *settings) +@@ -1343,12 +1385,12 @@ static bool amf_avc_init(void *data, obs_data_t *settings) info("settings:\n" "\trate_control: %s\n" @@ -445,7 +468,7 @@ index abd1d6f92..871087710 100644 "\twidth: %d\n" "\theight: %d\n" "\tparams: %s", -@@ -1407,6 +1449,7 @@ static void amf_avc_create_internal(amf_base *enc, obs_data_t *settings) +@@ -1420,6 +1462,7 @@ static void amf_avc_create_internal(amf_base *enc, obs_data_t *settings) static void *amf_avc_create_texencode(obs_data_t *settings, obs_encoder_t *encoder) @@ -453,7 +476,7 @@ index abd1d6f92..871087710 100644 try { check_texture_encode_capability(encoder, amf_codec_type::AVC); -@@ -1429,6 +1472,12 @@ try { +@@ -1442,6 +1485,12 @@ try { blog(LOG_ERROR, "[texture-amf-h264] %s: %s", __FUNCTION__, err); return obs_encoder_create_rerouted(encoder, "h264_fallback_amf"); } @@ -466,7 +489,7 @@ index abd1d6f92..871087710 100644 static void *amf_avc_create_fallback(obs_data_t *settings, obs_encoder_t *encoder) -@@ -1521,6 +1570,7 @@ static const char *amf_hevc_get_name(void *) +@@ -1534,6 +1583,7 @@ static const char *amf_hevc_get_name(void *) static inline int get_hevc_preset(amf_base *enc, const char *preset) { @@ -474,7 +497,7 @@ index abd1d6f92..871087710 100644 if (astrcmpi(preset, "balanced") == 0) return AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_BALANCED; else if (astrcmpi(preset, "speed") == 0) -@@ -1640,8 +1690,8 @@ static bool amf_hevc_init(void *data, obs_data_t *settings) +@@ -1657,8 +1707,8 @@ static bool amf_hevc_init(void *data, obs_data_t *settings) info("settings:\n" "\trate_control: %s\n" @@ -485,7 +508,7 @@ index abd1d6f92..871087710 100644 "\tkeyint: %d\n" "\tpreset: %s\n" "\tprofile: %s\n" -@@ -1758,6 +1808,7 @@ static void amf_hevc_create_internal(amf_base *enc, obs_data_t *settings) +@@ -1778,6 +1828,7 @@ static void amf_hevc_create_internal(amf_base *enc, obs_data_t *settings) static void *amf_hevc_create_texencode(obs_data_t *settings, obs_encoder_t *encoder) @@ -493,7 +516,7 @@ index abd1d6f92..871087710 100644 try { check_texture_encode_capability(encoder, amf_codec_type::HEVC); -@@ -1780,6 +1831,12 @@ try { +@@ -1800,6 +1851,12 @@ try { blog(LOG_ERROR, "[texture-amf-h265] %s: %s", __FUNCTION__, err); return obs_encoder_create_rerouted(encoder, "h265_fallback_amf"); } @@ -506,7 +529,7 @@ index abd1d6f92..871087710 100644 static void *amf_hevc_create_fallback(obs_data_t *settings, obs_encoder_t *encoder) -@@ -1868,6 +1925,7 @@ static const char *amf_av1_get_name(void *) +@@ -1888,6 +1945,7 @@ static const char *amf_av1_get_name(void *) static inline int get_av1_preset(amf_base *enc, const char *preset) { @@ -514,7 +537,7 @@ index abd1d6f92..871087710 100644 if (astrcmpi(preset, "highquality") == 0) return AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_HIGH_QUALITY; else if (astrcmpi(preset, "quality") == 0) -@@ -2001,8 +2059,8 @@ static bool amf_av1_init(void *data, obs_data_t *settings) +@@ -2026,8 +2084,8 @@ static bool amf_av1_init(void *data, obs_data_t *settings) info("settings:\n" "\trate_control: %s\n" @@ -525,7 +548,7 @@ index abd1d6f92..871087710 100644 "\tkeyint: %d\n" "\tpreset: %s\n" "\tprofile: %s\n" -@@ -2066,6 +2124,7 @@ static void amf_av1_create_internal(amf_base *enc, obs_data_t *settings) +@@ -2094,6 +2152,7 @@ static void amf_av1_create_internal(amf_base *enc, obs_data_t *settings) static void *amf_av1_create_texencode(obs_data_t *settings, obs_encoder_t *encoder) @@ -533,7 +556,7 @@ index abd1d6f92..871087710 100644 try { check_texture_encode_capability(encoder, amf_codec_type::AV1); -@@ -2088,6 +2147,12 @@ try { +@@ -2116,6 +2175,12 @@ try { blog(LOG_ERROR, "[texture-amf-av1] %s: %s", __FUNCTION__, err); return obs_encoder_create_rerouted(encoder, "av1_fallback_amf"); } @@ -546,7 +569,7 @@ index abd1d6f92..871087710 100644 static void *amf_av1_create_fallback(obs_data_t *settings, obs_encoder_t *encoder) -@@ -2185,9 +2250,16 @@ static bool enum_luids(void *param, uint32_t idx, uint64_t luid) +@@ -2213,9 +2278,16 @@ static bool enum_luids(void *param, uint32_t idx, uint64_t luid) return true; } @@ -563,7 +586,7 @@ index abd1d6f92..871087710 100644 HMODULE amf_module_test; /* Check if the DLL is present before running the more expensive */ -@@ -2197,16 +2269,24 @@ try { +@@ -2225,18 +2297,26 @@ try { if (!amf_module_test) throw "No AMF library"; FreeLibrary(amf_module_test); @@ -582,14 +605,16 @@ index abd1d6f92..871087710 100644 std::stringstream cmd; std::string caps_str; + cmd << '"'; cmd << test_exe; + cmd << '"'; +#ifdef _WIN32 enum_graphics_device_luids(enum_luids, &cmd); +#endif os_process_pipe_t *pp = os_process_pipe_create(cmd.str().c_str(), "r"); if (!pp) -@@ -2266,12 +2346,12 @@ try { +@@ -2296,12 +2376,12 @@ try { /* ----------------------------------- */ /* Init AMF */ @@ -604,7 +629,7 @@ index abd1d6f92..871087710 100644 if (!init) throw "Failed to get AMFInit address"; -@@ -2283,7 +2363,7 @@ try { +@@ -2313,7 +2393,7 @@ try { if (res != AMF_OK) throw amf_error("GetTrace failed", res); @@ -613,7 +638,7 @@ index abd1d6f92..871087710 100644 amf_module, AMF_QUERY_VERSION_FUNCTION_NAME); if (!get_ver) throw "Failed to get AMFQueryVersion address"; -@@ -2322,7 +2402,7 @@ try { +@@ -2352,7 +2432,7 @@ try { } catch (const amf_error &err) { /* doing an error here because it means at least the library has loaded * successfully, so they probably have AMD at this point */ diff --git a/pkgs/apps/obs/default.nix b/pkgs/apps/obs/default.nix index 72ffc17..d243d2d 100644 --- a/pkgs/apps/obs/default.nix +++ b/pkgs/apps/obs/default.nix @@ -50,6 +50,10 @@ , decklinkSupport ? false , blackmagic-desktop-video ? null , libcef +, libdatachannel ? pkgs.callPackage ./libdatachannel.nix {} +, pkgs +, qrcodegencpp ? pkgs.callPackage ./qrcodegencpp.nix {} +, onevpl ? pkgs.callPackage ./onevpl.nix {} }: assert (!decklinkSupport || blackmagic-desktop-video!=null) || builtins.throw "decklinkSupport enabled but blackmagic-desktop-video is null"; let @@ -57,13 +61,12 @@ let in stdenv.mkDerivation rec { pname = "obs-studio-amf"; - version = "29.1.3"; - + version = "30.0.0"; src = fetchFromGitHub { owner = "obsproject"; repo = "obs-studio"; rev = version; - sha256 = "sha256-D0DPueMtopwz5rLgM8QcPT7DgTKcJKQHnst69EY9V6Q="; + sha256 = "sha256-ce2qYtR+L8afT5qSoItltEbLtuPZQtWyS6PiN+UwATc="; fetchSubmodules = true; }; @@ -110,6 +113,9 @@ stdenv.mkDerivation rec { libva srt qtwayland + libdatachannel + qrcodegencpp + onevpl ] ++ optionals scriptingSupport [ luajit python3 ] ++ optional alsaSupport alsa-lib @@ -143,7 +149,7 @@ stdenv.mkDerivation rec { ]; in '' - #Remove libs from libcef, they are symlinks and can't be patchelfed + #Remove libs from libcef, they are symlinks and can't be patchelfed rm $out/lib/obs-plugins/libcef.so $out/lib/obs-plugins/libEGL.so $out/lib/obs-plugins/libGLESv2.so $out/lib/obs-plugins/libvk_swiftshader.so #Suffix on libgl and vulkan-loader so it can be overriden by helper scripts from amdgpu-pro diff --git a/pkgs/apps/obs/libdatachannel.nix b/pkgs/apps/obs/libdatachannel.nix new file mode 100644 index 0000000..4093d67 --- /dev/null +++ b/pkgs/apps/obs/libdatachannel.nix @@ -0,0 +1,60 @@ +{ stdenv +, lib +, fetchFromGitHub +, srcOnly +, cmake +, ninja +, pkg-config +, libnice +, openssl +, plog +, srtp +, usrsctp +}: + +stdenv.mkDerivation rec { + pname = "libdatachannel"; + version = "0.19.3"; + + src = fetchFromGitHub { + owner = "paullouisageneau"; + repo = pname; + rev = "v${version}"; + hash = "sha256-Cx+AfoeLOcqlrEVNuvMPJaY6K7ufu07p9XdjNwtPYf0="; + }; + + outputs = [ "out" "dev" ]; + + strictDeps = true; + nativeBuildInputs = [ + cmake + ninja + pkg-config + ]; + buildInputs = [ + libnice + openssl + srtp + usrsctp + plog + ]; + + cmakeFlags = [ + "-DUSE_NICE=ON" + "-DPREFER_SYSTEM_LIB=ON" + "-DNO_EXAMPLES=ON" + ]; + + postFixup = '' + # Fix include path that will be incorrect due to the "dev" output + substituteInPlace "$dev/lib/cmake/LibDataChannel/LibDataChannelTargets.cmake" \ + --replace "\''${_IMPORT_PREFIX}/include" "$dev/include" + ''; + + meta = with lib; { + description = "C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets"; + homepage = "https://libdatachannel.org/"; + license = with licenses; [ mpl20 ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/apps/obs/onevpl.nix b/pkgs/apps/obs/onevpl.nix new file mode 100644 index 0000000..5f81c8f --- /dev/null +++ b/pkgs/apps/obs/onevpl.nix @@ -0,0 +1,44 @@ +{ stdenv +, fetchFromGitHub +, wayland +, wayland-protocols +, xorg +, libva +, libdrm +, cmake +, pkg-config +}: + +stdenv.mkDerivation rec { + pname = "onevpl"; + version = "v2023.3.1"; + + src = fetchFromGitHub { + owner = "oneapi-src"; + repo = "oneVPL"; + rev = version; + hash = "sha256-kFW5n3uGTS+7ATKAuVff5fK3LwEKdCQVgGElgypmrG4="; + }; + nativeBuildInputs = [ + cmake + pkg-config + ]; + buildInputs = [ + wayland + wayland-protocols + xorg.libxcb + xorg.libX11 + xorg.libpciaccess + libva + libdrm + ]; + cmakeFlags = [ + "-DCMAKE_BUILD_TYPE=Release" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DENABLE_DRI3=ON" + "-DENABLE_DRM=ON" + "-DENABLE_VA=ON" + "-DENABLE_WAYLAND=ON" + "-DENABLE_X11=ON" + ]; +} diff --git a/pkgs/apps/obs/qrcodegencpp.nix b/pkgs/apps/obs/qrcodegencpp.nix new file mode 100644 index 0000000..9e64e2e --- /dev/null +++ b/pkgs/apps/obs/qrcodegencpp.nix @@ -0,0 +1,27 @@ +{ lib +, stdenv +, qrcodegen +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "qrcodegencpp"; + version = qrcodegen.version; + + src = qrcodegen.src; + + sourceRoot = "${finalAttrs.src.name}/cpp"; + + nativeBuildInputs = lib.optionals stdenv.cc.isClang [ + stdenv.cc.cc.libllvm.out + ]; + + makeFlags = lib.optionals stdenv.cc.isClang [ "AR=llvm-ar" ]; + installPhase = '' + runHook preInstall + + install -Dt $out/lib/ libqrcodegencpp.a + install -Dt $out/include/qrcodegen/ qrcodegen.hpp + + runHook postInstall + ''; +})