[PATCH] gnu: Add obs-v4l2sink.

  • Done
  • quality assurance status badge
Details
6 participants
  • Andrew Tropin
  • Nicolò Balzarotti
  • Evan Straw
  • Alexey Abramov
  • Ludovic Courtès
  • pelzflorian (Florian Pelz)
Owner
unassigned
Submitted by
Evan Straw
Severity
normal
E
E
Evan Straw wrote on 7 Jan 2021 00:36
(address . guix-patches@gnu.org)
875z4963kf.fsf@gmail.com
From 0aa683242ae591d0ddac8b4b23163805dc4414c9 Mon Sep 17 00:00:00 2001
From: Evan Straw <evan.straw99@gmail.com>
Date: Wed, 6 Jan 2021 15:33:25 -0800
Subject: [PATCH] gnu: Add obs-v4l2sink.
To: guix-patches@gnu.org

* gnu/packages/video.scm (obs-v4l2sink): New variable.
---
gnu/packages/video.scm | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)

Toggle diff (52 lines)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 2b1b111e97..6d64d03e44 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -3133,6 +3133,45 @@ and JACK.")
(home-page "https://obsproject.com")
(license license:gpl2+)))
+(define-public obs-v4l2sink
+ (package
+ (name "obs-v4l2sink")
+ (version "0.1.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/CatxFish/obs-v4l2sink")
+ (commit version)))
+ (file-name (string-append name "-" version))
+ (sha256
+ (base32
+ "0l4lavaywih5lzwgxcbnvdrxhpvkrmh56li06s3aryikngxwsk3z"))))
+ (build-system cmake-build-system)
+ (arguments `(#:tests? #f ;; obs-v4l2sink does not have tests
+ #:phases
+ (modify-phases %standard-phases
+ ;; The CMakeLists.txt file for obs-v4l2sink attempts to use
+ ;; its own method to search for libobs which uses a lot of
+ ;; hardcoded paths and ultimately fails under Guix. OBS
+ ;; already comes with its own CMake configuration, so
+ ;; remove the line that uses the hardcoded method and just
+ ;; let CMake locate OBS.
+ (add-before 'configure 'fix-libobs
+ (lambda* _
+ (substitute* "CMakeLists.txt"
+ (("^.*FindLibObs.*$") ""))
+ #t)))))
+ (inputs `(("qtbase" ,qtbase)
+ ("obs" ,obs)))
+ (home-page "https://github.com/CatxFish/obs-v4l2sink")
+ (synopsis "OBS Studio output plugin for Video4Linux2 device")
+ (description "An @dfn{Open Broadcaster Software} (OBS) Studio plugin that
+provides output capabilities to a @dfn{Video4Linux2} (v4l2) device. It can be
+used with @code{v4l2loopback} to achieve cross-program video transfer between
+OBS Studio and third party software supporting Video4Linux2, e.g. to present
+an OBS session in proprietary browser-based conferencing systems by selecting
+the OBS session as a webcam.")
+ (license license:gpl2+)))
+
(define-public libvdpau
(package
(name "libvdpau")
--
2.25.1
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE6f/SZXb4DLdwy+VR9TDDtKKp8G0FAl/2SXAACgkQ9TDDtKKp
8G1BkA//cStrKj++4xIbAKSID48uRkVJA6jhb1WKTZ/Yt7iohbiMhO1fExb4XZVL
39/4vBi3Qvr8g3SPnOaUJz111vMSB7zXpLWjQq57gWi2rfQALVNM5gxj04t2w4LV
jQrtm7s+tOzdA7IDqGsJj5PR2auonpxyEDl7eq2lwFBUx1mwI5cjlbKffcunCuLt
/UCzcCIV6D6okGc06BQo/zxkvmtjkl8eGMAFHhAVa7qenZ7sLCSxl4AnWZMPUyQC
/a61E00mgmW6SjNrgzjyL/2qJRwR7f2+CgLI+HvSzzPJNbt/Fe73cEcGQnmSsBmV
Z0fhPrUz8yubNH5vFMgfjb3oQLqhH3OY5XUR3OgBrs9GI90oePNpVtordlbohVlz
XQbyy4KN/PUKqnE8Q/X2b/3WsX5abWmBUHJM6/UxhR9hLfC8C3vGfK8V3Ofh+JCb
mowtoXqAEVmPs74qMYDWIYB7k3TjdmTUNnaEuxpKP4rsdW4/GIhon7+hKz1me226
4TDcwjljrpe70070G3DOW2ddlUb4v09OoYEWfoa1rT8C3HWNOCPu6zAs/kzttrff
B0kUWZXLJN4wiLgIVfNZsyPR4KnKLPW5NQelXisL2MCqvVrN+0/D7vRDAnN3YrEW
7ydYYmItK+JH1wiBZcSvjc2494BXg+1FGswyCFRt9nm9f3xRQ44=
=oji3
-----END PGP SIGNATURE-----

N
N
Nicolò Balzarotti wrote on 7 Jan 2021 00:42
871rexk4xv.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me
Evan Straw <evan.straw99@gmail.com> writes:

Toggle quote (4 lines)
> +OBS Studio and third party software supporting Video4Linux2, e.g. to present
> +an OBS session in proprietary browser-based conferencing systems by selecting
> +the OBS session as a webcam.")

Seems like a proprietary software endorsement. I guess it works also
with libre browser-based conferencing systems like BBB, nextcloud talk
or jitsi, so I'd remove proprietary from the description.
E
E
Evan Straw wrote on 7 Jan 2021 00:45
(name . Nicolò Balzarotti)(address . anothersms@gmail.com)(address . 45707@debbugs.gnu.org)
87y2h54okg.fsf@gmail.com
Yeah, I was also a little unsure about that part as well. I will remove
that from the description. Should have another patch to send in a
minute.

-- Evan
E
E
Evan Straw wrote on 7 Jan 2021 00:47
[PATCH v2] gnu: Add obs-v4l2sink.
(address . 45707@debbugs.gnu.org)
87turt4ogl.fsf@gmail.com
From 7bcaffb15f1f6697310a4c4bacb8dea1eca2a4e8 Mon Sep 17 00:00:00 2001
From: Evan Straw <evan.straw99@gmail.com>
Date: Wed, 6 Jan 2021 15:33:25 -0800
Subject: [PATCH] gnu: Add obs-v4l2sink.

* gnu/packages/video.scm (obs-v4l2sink): New variable.
---
gnu/packages/video.scm | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)

Toggle diff (52 lines)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 2b1b111e97..194699dd23 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -3133,6 +3133,45 @@ and JACK.")
(home-page "https://obsproject.com")
(license license:gpl2+)))
+(define-public obs-v4l2sink
+ (package
+ (name "obs-v4l2sink")
+ (version "0.1.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/CatxFish/obs-v4l2sink")
+ (commit version)))
+ (file-name (string-append name "-" version))
+ (sha256
+ (base32
+ "0l4lavaywih5lzwgxcbnvdrxhpvkrmh56li06s3aryikngxwsk3z"))))
+ (build-system cmake-build-system)
+ (arguments `(#:tests? #f ;; obs-v4l2sink does not have tests
+ #:phases
+ (modify-phases %standard-phases
+ ;; The CMakeLists.txt file for obs-v4l2sink attempts to use
+ ;; its own method to search for libobs which uses a lot of
+ ;; hardcoded paths and ultimately fails under Guix. OBS
+ ;; already comes with its own CMake configuration, so
+ ;; remove the line that uses the hardcoded method and just
+ ;; let CMake locate OBS.
+ (add-before 'configure 'fix-libobs
+ (lambda* _
+ (substitute* "CMakeLists.txt"
+ (("^.*FindLibObs.*$") ""))
+ #t)))))
+ (inputs `(("qtbase" ,qtbase)
+ ("obs" ,obs)))
+ (home-page "https://github.com/CatxFish/obs-v4l2sink")
+ (synopsis "OBS Studio output plugin for Video4Linux2 device")
+ (description "An @dfn{Open Broadcaster Software} (OBS) Studio plugin that
+provides output capabilities to a @dfn{Video4Linux2} (v4l2) device. It can be
+used with @code{v4l2loopback} to achieve cross-program video transfer between
+OBS Studio and third party software supporting Video4Linux2, e.g. to present
+an OBS session in browser-based conferencing systems by selecting the OBS
+session as a webcam.")
+ (license license:gpl2+)))
+
(define-public libvdpau
(package
(name "libvdpau")
--
2.25.1
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE6f/SZXb4DLdwy+VR9TDDtKKp8G0FAl/2TCoACgkQ9TDDtKKp
8G2QJBAAhnfxUh0dkpc6HKZpIT+98KI3GuGLzmWL0gHKnDk2CvUhK6geTOtXDb0l
6HnxYdwUt2mThiQkHiDIN8Mi6Bhu4rhsg+QECkWVFSBO7IPeX8DucyG163T/2i4+
AQHiXnnQpdaUy5PwdG+DyxqiX+FSEFd4i6nL1gK42WuRuKRbYD10HFN1QFYtV9HB
ngFnRXzo+kw42a6XhwUwTOuxZC7qTkfEDzqTJgBCtnAzHQm0l915hTlh8xmHis7h
qdesm5nzU5F8qfb8l1k3tYYWtjYJ/g2kP1qcrqBLvKHLjaXYad1ZTSxWR6JMf8eP
FPI7lLTa6/Dgm81GWuDlrH18A5SoD1FEvGc40SvjPi82S6MTtLnwyqt+YaIZ8aSJ
f6rbuvltNquhmjreZuu7b6lYb5B+VoAATRywAYJfOKg6cvfjRXwMMUzydy/ompHw
5VxR/oZNI3e1Hdup+pZfzZ/+DJB0DvG9dgt4VgulqO1JBsSPYzTjMldaZFqfdyuV
m5cUmK5jBQEhyxP2mj95555mTtNT1ML4EWF9F1fhC4aIWkGWbJlqc/j3YqAKvrpo
Zt1beMiN8Sgq3HvWBJMSPDxGqP8u+cIe28vHA9GmlybFztfOcur/kjkxjLMUFBZh
mJNyszYMmnmizG66e8sQt4R4R8R0xPGRbOk75uDzOtWV+wZOuR0=
=gL7U
-----END PGP SIGNATURE-----

N
N
Nicolò Balzarotti wrote on 7 Jan 2021 01:11
87y2h5ip22.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me
Thanks for the update.

Evan Straw <evan.straw99@gmail.com> writes:
Toggle quote (5 lines)
> + (method git-fetch)
> + (uri (git-reference (url "https://github.com/CatxFish/obs-v4l2sink")
> + (commit version)))


I'm not 100% sure (I usually don't do patch review) but I think the
indentation is wrong (line should break after git-reference).

Toggle quote (2 lines)
> + (inputs `(("qtbase" ,qtbase)
> + ("obs" ,obs)))
I think it's the same after inputs..

Toggle quote (3 lines)
> + (description "An @dfn{Open Broadcaster Software} (OBS) Studio plugin that
> +provides output capabilities to a @dfn{Video4Linux2} (v4l2) device. It can be
> +used with @code{v4l2loopback} to achieve cross-program video transfer between
I think that instead of definitions, those are acronyms, so it should be
@acronym{OBS, Open Broadcaster Software} and @acronym{Video 4 Linux 2,
vl42}.

I'd say that you should wait for somebody that knows better than me
before applying my suggestions.

It builds and lint is ok, but obs does not work on my laptop (video card
too old) so I cannot test that it run.

Nicolo
E
Re: [PATCH v2] gnu: Add obs-v4l2sink.
(address . 45707@debbugs.gnu.org)
cd43c295-5e37-4d9e-8baa-000c83d386ca@gmail.com
On further investigation, I'm not even sure this package will work correctly because of the way OBS handles plugins. To install plugins, OBS requires that you add their .so files to a plugins directory under the OBS share directory, which under Guix should be immutable. As far as I'm aware, there doesn't seem to be a way to get OBS to use a different directory or use an environment variable containing search paths. Not sure if there is a way to even get plugins for OBS to work at all under Guix if this is the case.

Apologies for creating this patch without having really done this research first. If there's really no way to get this to work under Guix, then feel free to just close this ticket.

--Evan

Jan 6, 2021 3:47:55 PM Evan Straw <evan.straw99@gmail.com>:

Toggle quote (1 lines)
>
Attachment: signature.asc
A
A
Alexey Abramov wrote on 7 Jan 2021 09:19
Re: [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
(name . Evan)(address . evan.straw99@gmail.com)(address . 45707@debbugs.gnu.org)
87turt2m7v.fsf@delta.lan
Hi Evan,

You can make it work.

In order to provide plugins for obs via $XDG_CONFIG_HOME (~/.config) you need to provide the following structure:

"$XDG_CONFIG_HOME/obs-studio/plugins/<module-name>/bin/<arch>/"

As it implemented in obs-studio (~/obs-studio/UI/window-basic-main.cpp)

Toggle snippet (35 lines)
static void AddExtraModulePaths()
{
char base_module_dir[512];
#if defined(_WIN32) || defined(__APPLE__)
int ret = GetProgramDataPath(base_module_dir, sizeof(base_module_dir),
"obs-studio/plugins/%module%");
#else
int ret = GetConfigPath(base_module_dir, sizeof(base_module_dir),
"obs-studio/plugins/%module%");
#endif

if (ret <= 0)
return;

string path = base_module_dir;
#if defined(__APPLE__)
obs_add_module_path((path + "/bin").c_str(), (path + "/data").c_str());

BPtr<char> config_bin =
os_get_config_path_ptr("obs-studio/plugins/%module%/bin");
BPtr<char> config_data =
os_get_config_path_ptr("obs-studio/plugins/%module%/data");
obs_add_module_path(config_bin, config_data);

#elif ARCH_BITS == 64
obs_add_module_path((path + "/bin/64bit").c_str(),
(path + "/data").c_str());
#else
obs_add_module_path((path + "/bin/32bit").c_str(),
(path + "/data").c_str());
#endif
}


So what I am currently have is this:

Toggle snippet (8 lines)
λ find ~/.config/obs-studio/plugins
/home/levenson/.config/obs-studio/plugins
/home/levenson/.config/obs-studio/plugins/v4l2sink
/home/levenson/.config/obs-studio/plugins/v4l2sink/bin
/home/levenson/.config/obs-studio/plugins/v4l2sink/bin/64bit
/home/levenson/.config/obs-studio/plugins/v4l2sink/bin/64bit/v4l2sink.so

where the library is a symlink

v4l2sink.so -> /home/levenson/.guix-profile/lib/obs-plugins/v4l2sink.so

--
Alexey
L
L
Ludovic Courtès wrote on 13 Jan 2021 15:35
Re: bug#45707: [PATCH] gnu: Add obs-v4l2sink.
(name . Alexey Abramov)(address . levenson@mmer.org)
87pn28aoqi.fsf_-_@gnu.org
Hi,

Alexey Abramov <levenson@mmer.org> skribis:

Toggle quote (17 lines)
> In order to provide plugins for obs via $XDG_CONFIG_HOME (~/.config) you need to provide the following structure:
>
> "$XDG_CONFIG_HOME/obs-studio/plugins/<module-name>/bin/<arch>/"
>
> As it implemented in obs-studio (~/obs-studio/UI/window-basic-main.cpp)
>
> static void AddExtraModulePaths()
> {
> char base_module_dir[512];
> #if defined(_WIN32) || defined(__APPLE__)
> int ret = GetProgramDataPath(base_module_dir, sizeof(base_module_dir),
> "obs-studio/plugins/%module%");
> #else
> int ret = GetConfigPath(base_module_dir, sizeof(base_module_dir),
> "obs-studio/plugins/%module%");
> #endif

What about patching this function so that it honors, say, an
‘OBS_PLUGIN_PATH’ environment variable?

We’d put plugins under $prefix/lib/obs-studio/plugins and define a
‘search-path-specification’ for it.

My 2¢,
Ludo’.
A
A
Alexey Abramov wrote on 15 Jan 2021 17:47
(name . Ludovic Courtès)(address . ludo@gnu.org)
87k0setadp.fsf@delta.lan
Hi,

Thanks Ludo. With this patch, obs will check OBS_PLUGINS_PATH environment variable for a *default* location of modules.

Plugins might also have some data. I am not sure if it is safe to use relative path thought. Would it be better to use OBS_PLUGINS_DATA_PATH var?

--
Alexey
From 9ade5607aab510cc88561efb7c0b08567b5e19fe Mon Sep 17 00:00:00 2001
From: Alexey Abramov <levenson@mmer.org>
Date: Fri, 15 Jan 2021 17:26:37 +0100
Subject: [PATCH] gnu: obs: Use an environment variable for plugins location.

* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/video.scm (obs): Use it.
* gnu/packages/patches/obs-override-default-modules-location.patch: Patch it.
---
gnu/local.mk | 1 +
...bs-override-default-modules-location.patch | 32 +++++++++++++++++++
gnu/packages/video.scm | 9 +++++-
3 files changed, 41 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/obs-override-default-modules-location.patch

Toggle diff (79 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index eb28104add..cd4085890b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1404,6 +1404,7 @@ dist_patch_DATA = \
%D%/packages/patches/nvi-dbpagesize-binpower.patch \
%D%/packages/patches/nvi-db4.patch \
%D%/packages/patches/nyacc-binary-literals.patch \
+ %D%/packages/patches/obs-override-default-modules-location.patch \
%D%/packages/patches/ocaml-bitstring-fix-configure.patch \
%D%/packages/patches/ocaml-cairo2-caml_ba_array-fix.patch \
%D%/packages/patches/ocaml-CVE-2015-8869.patch \
diff --git a/gnu/packages/patches/obs-override-default-modules-location.patch b/gnu/packages/patches/obs-override-default-modules-location.patch
new file mode 100644
index 0000000000..88adb4a8c1
--- /dev/null
+++ b/gnu/packages/patches/obs-override-default-modules-location.patch
@@ -0,0 +1,32 @@
+From 96e3c05043eb6b682b105e9080b45efeee33dcd0 Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Fri, 15 Jan 2021 17:07:17 +0100
+Subject: [PATCH] Use an environment variable for a default modules location
+
+---
+ libobs/obs-nix.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/libobs/obs-nix.c b/libobs/obs-nix.c
+index 382fa0546..d58a0b48a 100644
+--- a/libobs/obs-nix.c
++++ b/libobs/obs-nix.c
+@@ -66,8 +66,14 @@ static const int module_patterns_size =
+
+ void add_default_module_paths(void)
+ {
+- for (int i = 0; i < module_patterns_size; i++)
+- obs_add_module_path(module_bin[i], module_data[i]);
++ char *obs_plugins_path = getenv("OBS_PLUGINS_PATH");
++ if (obs_plugins_path) {
++ struct dstr obs_plugins_data_path;
++ dstr_init_copy(&obs_plugins_data_path, obs_plugins_path);
++ dstr_cat(&obs_plugins_data_path, "/../../share/obs/obs-plugins/%module%");
++ obs_add_module_path(obs_plugins_path, obs_plugins_data_path.array);
++ dstr_free(&obs_plugins_data_path);
++ }
+ }
+
+ /*
+--
+2.29.2
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index b314e4903b..15bb2e4d40 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -3087,7 +3087,9 @@ be used for realtime video capture via Linux-specific APIs.")
(file-name (git-file-name name version))
(sha256
(base32
- "1k1asqiqw757v59ayx0w029ril947hs0lcp8n91knzjl891fr4nc"))))
+ "1k1asqiqw757v59ayx0w029ril947hs0lcp8n91knzjl891fr4nc"))
+ (patches
+ (search-patches "obs-override-default-modules-location.patch"))))
(build-system cmake-build-system)
(arguments
`(#:configure-flags
@@ -3102,6 +3104,11 @@ be used for realtime video capture via Linux-specific APIs.")
(wrap-program (string-append out "/bin/obs")
`("QT_PLUGIN_PATH" ":" prefix (,plugin-path))))
#t)))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "OBS_PLUGINS_PATH")
+ (separator #f) ;single entry
+ (files '("lib/obs-plugins")))))
(native-inputs
`(("cmocka" ,cmocka)
("pkg-config" ,pkg-config)))
--
2.29.2
P
P
pelzflorian (Florian Pelz) wrote on 15 Jan 2021 18:10
Re: [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
(name . Evan Straw)(address . evan.straw99@gmail.com)(address . 45707@debbugs.gnu.org)
20210115171044.ozbc4omr56ranvmy@pelzflorian.localdomain
Hello Evan!

Since OBS version 26.1 without any plugins there is a new button
“Start Virtual Camera” in the bottom right.

Is this v4l2sink plugin really still useful? If I tested corrrectly,
it is not.

Making OBS plugins usable by search path is good though.

Regards,
Florian
E
E
Evan Straw wrote on 15 Jan 2021 20:25
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 45707@debbugs.gnu.org)
871rem3svf.fsf@gmail.com
Hi Florian,

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> writes:

Toggle quote (3 lines)
> Since OBS version 26.1 without any plugins there is a new button
> “Start Virtual Camera” in the bottom right.

I was actually not aware of this, I guess I did not have the required
kernel module installed so it didn't show up for me. With that said, I
suppose that this package is indeed not very useful anymore since this
functionality is built into OBS. Apologies, this was some poor research
on my part. Still, maybe it's good to have started the discussion of how
to package OBS plugins for Guix in the future.

-- Evan
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE6f/SZXb4DLdwy+VR9TDDtKKp8G0FAmAB7BQACgkQ9TDDtKKp
8G2G4BAAwDWuz+X22Qc9oZiFYKMr9Iif7D6ic9J7ijLqwk7wFgVnLQPJtR2OgZc3
B5i66aVL4Y0vTsMNW7UeWAX89zpdujbODFvYtSGR3O2NEKRbVQQ6aRkvP8sUiAqa
paS3LhjmOm+9HbwQcvXt/+gvTncJ5HrzKiPX7uPBewLRrmrMZWaQ2yD6Bbr7PyjF
XwEY6ZI1zxMONuNK/CygTB32+JHPEs844IcXB98bCajwnowM8I8042w11Vs5MOc3
gNcGwehjSY3cWBe7pzRhzwILi58mg2KNTK+cUzNy/q0tLEJ0TRST2z5RB0lQ5Xxg
3HK6rE24cG0011ld5qUfOlLK2NaPJX9RQzgdfxoSxoU+s75bY48drAfdqBJMHLQK
3NpPP6tNFd98peYajVRBDGq8038jwqUY3XPrlr0vHg46iRngBWSP+ms3Slhzs3QI
wdT9eTGPZKRn/3CAawpnJby2ALKfWXtN8LG1Tm0prR2ktiH1+l+6ZVkuAtrNiCIc
/MLRp3D0nI5guvLFGZPS0/MNZN0QBNdYEBSwDN+ehROOaYPzKoxKlVOM5TLvJ3B2
uWdGpxeYdTExHmSF8My3zLr8F7zhO6uoAKHq575Osi5huncgxjlPZz/kOjAV4NtH
iERefLWYVfatxsV5UeBQa05noMVqwtNjx9meB+zitJ7RYwsHedQ=
=4ykx
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 16 Jan 2021 22:47
Re: bug#45707: [PATCH] gnu: Add obs-v4l2sink.
(name . Alexey Abramov)(address . levenson@mmer.org)
87a6t8y2ob.fsf@gnu.org
Hi,

Alexey Abramov <levenson@mmer.org> skribis:

Toggle quote (2 lines)
> Thanks Ludo. With this patch, obs will check OBS_PLUGINS_PATH environment variable for a *default* location of modules.

OK.

Toggle quote (2 lines)
> Plugins might also have some data. I am not sure if it is safe to use relative path thought. Would it be better to use OBS_PLUGINS_DATA_PATH var?

I don’t know, how does this patch change the situation wrt. finding a
plugin’s data?

Toggle quote (9 lines)
> From 9ade5607aab510cc88561efb7c0b08567b5e19fe Mon Sep 17 00:00:00 2001
> From: Alexey Abramov <levenson@mmer.org>
> Date: Fri, 15 Jan 2021 17:26:37 +0100
> Subject: [PATCH] gnu: obs: Use an environment variable for plugins location.
>
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/video.scm (obs): Use it.
> * gnu/packages/patches/obs-override-default-modules-location.patch: Patch it.

Some minor issues:

Toggle quote (2 lines)
> +++ b/gnu/packages/patches/obs-override-default-modules-location.patch

‘guix lint’ might complain about the file name length. :-)
Perhaps remove ‘override-default-’ from the file name.

Toggle quote (9 lines)
> @@ -0,0 +1,32 @@
> +From 96e3c05043eb6b682b105e9080b45efeee33dcd0 Mon Sep 17 00:00:00 2001
> +From: Alexey Abramov <levenson@mmer.org>
> +Date: Fri, 15 Jan 2021 17:07:17 +0100
> +Subject: [PATCH] Use an environment variable for a default modules location
> +
> +---
> + libobs/obs-nix.c | 10 ++++++++--

If it comes from another distro, please indicate it clearly at the top
of the file.

Toggle quote (6 lines)
> ++ char *obs_plugins_path = getenv("OBS_PLUGINS_PATH");
> ++ if (obs_plugins_path) {
> ++ struct dstr obs_plugins_data_path;
> ++ dstr_init_copy(&obs_plugins_data_path, obs_plugins_path);
> ++ dstr_cat(&obs_plugins_data_path, "/../../share/obs/obs-plugins/%module%");

Shouldn’t it be lib/obs-plugins, as your ‘search-path-specification’
indicates?

Toggle quote (6 lines)
> + (native-search-paths
> + (list (search-path-specification
> + (variable "OBS_PLUGINS_PATH")
> + (separator #f) ;single entry
> + (files '("lib/obs-plugins")))))

How about renaming the variable to ‘OBS_PLUGINS_DIRECTORY’ given that
it designates a single directory rather than a search path?

Could you send an updated patch?

Thanks!

Ludo’.
A
A
Alexey Abramov wrote on 20 Jan 2021 09:28
(name . Ludovic Courtès)(address . ludo@gnu.org)
87zh14vwq7.fsf@delta.lan
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (15 lines)
> Hi,
>
> Alexey Abramov <levenson@mmer.org> skribis:
>
>> Thanks Ludo. With this patch, obs will check OBS_PLUGINS_PATH environment variable for a *default* location of modules.
>
> OK.
>
>> Plugins might also have some data. I am not sure if it is safe to
>> use relative path thought. Would it be better to use
>> OBS_PLUGINS_DATA_PATH var?
>
> I don’t know, how does this patch change the situation wrt. finding a
> plugin’s data?

They have locals in their data directory at least. And probably something else, yes.

Toggle quote (18 lines)
>
>> From 9ade5607aab510cc88561efb7c0b08567b5e19fe Mon Sep 17 00:00:00 2001
>> From: Alexey Abramov <levenson@mmer.org>
>> Date: Fri, 15 Jan 2021 17:26:37 +0100
>> Subject: [PATCH] gnu: obs: Use an environment variable for plugins location.
>>
>> * gnu/local.mk (dist_patch_DATA): Add it.
>> * gnu/packages/video.scm (obs): Use it.
>> * gnu/packages/patches/obs-override-default-modules-location.patch: Patch it.
>
> Some minor issues:
>
>> +++ b/gnu/packages/patches/obs-override-default-modules-location.patch
>
> ‘guix lint’ might complain about the file name length. :-)
> Perhaps remove ‘override-default-’ from the file name.
>

Done. Passed.

Toggle quote (21 lines)
>> @@ -0,0 +1,32 @@
>> +From 96e3c05043eb6b682b105e9080b45efeee33dcd0 Mon Sep 17 00:00:00 2001
>> +From: Alexey Abramov <levenson@mmer.org>
>> +Date: Fri, 15 Jan 2021 17:07:17 +0100
>> +Subject: [PATCH] Use an environment variable for a default modules location
>> +
>> +---
>> + libobs/obs-nix.c | 10 ++++++++--
>
> If it comes from another distro, please indicate it clearly at the top
> of the file.
>
>> ++ char *obs_plugins_path = getenv("OBS_PLUGINS_PATH");
>> ++ if (obs_plugins_path) {
>> ++ struct dstr obs_plugins_data_path;
>> ++ dstr_init_copy(&obs_plugins_data_path, obs_plugins_path);
>> ++ dstr_cat(&obs_plugins_data_path, "/../../share/obs/obs-plugins/%module%");
>
> Shouldn’t it be lib/obs-plugins, as your ‘search-path-specification’
> indicates?

That is a data directory. With the new patch it will be taken from
OBS_PLUGINS_DATA_DIRECTORY. %module% part is required for data.

Toggle quote (10 lines)
>
>> + (native-search-paths
>> + (list (search-path-specification
>> + (variable "OBS_PLUGINS_PATH")
>> + (separator #f) ;single entry
>> + (files '("lib/obs-plugins")))))
>
> How about renaming the variable to ‘OBS_PLUGINS_DIRECTORY’ given that
> it designates a single directory rather than a search path?

Done.

Toggle quote (3 lines)
>
> Could you send an updated patch?

Attached. I also tested the obs patch with this [1] and this [2] and
haven't seen any erros. obs loads plugins successfully.

Toggle snippet (52 lines)
info: ---------------------------------
info: Loaded Modules:
info: v4l2sink.so <------ this
info: text-freetype2.so
info: spectralizer.so <------ this
info: rtmp-services.so
info: obs-x264.so
info: obs-transitions.so
info: obs-outputs.so
info: obs-filters.so
info: obs-ffmpeg.so
info: linux-v4l2.so
info: linux-pulseaudio.so
info: linux-jack.so
info: linux-decklink.so
info: linux-capture.so
info: linux-alsa.so
info: libwlrobs.so <------ this
info: image-source.so
info: frontend-tools.so
info: decklink-ouput-ui.so
info: decklink-captions.so
info: ---------------------------------


~ master* ?
λ find /gnu/store/3s84wmh9pqcryfzx0rrri8sqff7fqlqn-obs-wlrobs-1.0/
/gnu/store/3s84wmh9pqcryfzx0rrri8sqff7fqlqn-obs-wlrobs-1.0/
/gnu/store/3s84wmh9pqcryfzx0rrri8sqff7fqlqn-obs-wlrobs-1.0/lib
/gnu/store/3s84wmh9pqcryfzx0rrri8sqff7fqlqn-obs-wlrobs-1.0/lib/obs-plugins
/gnu/store/3s84wmh9pqcryfzx0rrri8sqff7fqlqn-obs-wlrobs-1.0/lib/obs-plugins/libwlrobs.so

~ master* ?
λ find /gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/doc
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/doc/obs-spectralizer-1.3.3
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/doc/obs-spectralizer-1.3.3/COPYING.txt
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/obs
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/obs/obs-plugins
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/obs/obs-plugins/spectralizer
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/obs/obs-plugins/spectralizer/locale
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/obs/obs-plugins/spectralizer/locale/ko-KR.ini
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/obs/obs-plugins/spectralizer/locale/ru-RU.ini
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/share/obs/obs-plugins/spectralizer/locale/en-US.ini
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/lib
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/lib/obs-plugins
/gnu/store/rmz58nv5qcwr1pm38nx7aicyfq4jbp4a-obs-spectralizer-1.3.3/lib/obs-plugins/spectralizer.so


From f67bf04b57f45f0ca11cb6b902d22f7c4d44e005 Mon Sep 17 00:00:00 2001
From: Alexey Abramov <levenson@mmer.org>
Date: Fri, 15 Jan 2021 17:26:37 +0100
Subject: [PATCH] gnu: obs: Use an environment variable for plugins location.

* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/video.scm (obs): Use it.
* gnu/packages/patches/obs-modules-location.patch: Patch it.
---
gnu/local.mk | 1 +
.../patches/obs-modules-location.patch | 33 +++++++++++++++++++
gnu/packages/video.scm | 14 +++++++-
3 files changed, 47 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/obs-modules-location.patch

Toggle diff (93 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 6f66021c78..aaf19302be 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1405,6 +1405,7 @@ dist_patch_DATA = \
%D%/packages/patches/nvi-dbpagesize-binpower.patch \
%D%/packages/patches/nvi-db4.patch \
%D%/packages/patches/nyacc-binary-literals.patch \
+ %D%/packages/patches/obs-modules-location.patch \
%D%/packages/patches/ocaml-bitstring-fix-configure.patch \
%D%/packages/patches/ocaml-cairo2-caml_ba_array-fix.patch \
%D%/packages/patches/ocaml-CVE-2015-8869.patch \
diff --git a/gnu/packages/patches/obs-modules-location.patch b/gnu/packages/patches/obs-modules-location.patch
new file mode 100644
index 0000000000..18b286d006
--- /dev/null
+++ b/gnu/packages/patches/obs-modules-location.patch
@@ -0,0 +1,33 @@
+From d250434e6c8eb4f8c8cb47ef3cc6e6de8fa8f828 Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Fri, 15 Jan 2021 17:07:17 +0100
+Subject: [PATCH] Use environment variable for a default module location
+
+diff --git a/libobs/obs-nix.c b/libobs/obs-nix.c
+index 382fa0546..481ea0f14 100644
+*** a/libobs/obs-nix.c
+--- b/libobs/obs-nix.c
+@@ -66,8 +66,19 @@
+
+ void add_default_module_paths(void)
+ {
+- for (int i = 0; i < module_patterns_size; i++)
+- obs_add_module_path(module_bin[i], module_data[i]);
++ char *bin_directory = getenv("OBS_PLUGINS_DIRECTORY");
++ char *data_directory = getenv("OBS_PLUGINS_DATA_DIRECTORY");
++ if (bin_directory && data_directory) {
++ struct dstr dstr_data_directory;
++ dstr_init_copy(&dstr_data_directory, data_directory);
++ dstr_cat(&dstr_data_directory, "/%module%");
++ obs_add_module_path(bin_directory, dstr_data_directory.array);
++ dstr_free(&dstr_data_directory);
++
++ } else {
++ for (int i = 0; i < module_patterns_size; i++)
++ obs_add_module_path(module_bin[i], module_data[i]);
++ }
+ }
+
+ /*
+--
+2.29.2
\ No newline at end of file
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 97cb7d6837..49823e9a88 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -47,6 +47,7 @@
;;; Copyright © 2020 Alexandru-Sergiu Marton <brown121407@posteo.ro>
;;; Copyright © 2020 Ivan Kozlov <kanichos@yandex.ru>
;;; Copyright © 2020 Antoine Côté <antoine.cote@posteo.net>
+;;; Copyright © 2021 Alexey Abramov <levenson@mmer.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -3088,7 +3089,9 @@ be used for realtime video capture via Linux-specific APIs.")
(file-name (git-file-name name version))
(sha256
(base32
- "1k1asqiqw757v59ayx0w029ril947hs0lcp8n91knzjl891fr4nc"))))
+ "1k1asqiqw757v59ayx0w029ril947hs0lcp8n91knzjl891fr4nc"))
+ (patches
+ (search-patches "obs-modules-location.patch"))))
(build-system cmake-build-system)
(arguments
`(#:configure-flags
@@ -3103,6 +3106,15 @@ be used for realtime video capture via Linux-specific APIs.")
(wrap-program (string-append out "/bin/obs")
`("QT_PLUGIN_PATH" ":" prefix (,plugin-path))))
#t)))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "OBS_PLUGINS_DIRECTORY")
+ (separator #f) ;single entry
+ (files '("lib/obs-plugins")))
+ (search-path-specification
+ (variable "OBS_PLUGINS_DATA_DIRECTORY")
+ (separator #f) ;single entry
+ (files '("share/obs/obs-plugins")))))
(native-inputs
`(("cmocka" ,cmocka)
("pkg-config" ,pkg-config)))
--
2.29.2
L
L
Ludovic Courtès wrote on 2 Feb 2021 10:31
(name . Alexey Abramov)(address . levenson@mmer.org)
87o8h2g6ju.fsf_-_@gnu.org
Hi Alexey,

Alexey Abramov <levenson@mmer.org> skribis:

Toggle quote (9 lines)
>>From f67bf04b57f45f0ca11cb6b902d22f7c4d44e005 Mon Sep 17 00:00:00 2001
> From: Alexey Abramov <levenson@mmer.org>
> Date: Fri, 15 Jan 2021 17:26:37 +0100
> Subject: [PATCH] gnu: obs: Use an environment variable for plugins location.
>
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/video.scm (obs): Use it.
> * gnu/packages/patches/obs-modules-location.patch: Patch it.

Applied. Thanks, and apologies for the delay!

Ludo’.
Closed
A
A
Andrew Tropin wrote on 2 Feb 2021 21:00
(no subject)
(address . 45707@debbugs.gnu.org)
8735yetf3x.fsf@trop.in
Hi everyone!

I have been doing the similar work related to obs load path and already
contibuted it to upstream [fn:1]. The patch was accepted and obs
currently support OBS_PLUGINS_PATH and OBS_PLUGINS_DATA_PATH out of the
box.

I've sent a patch with update to OBS version [fn:2] to get those changes
available in guix. Unluckily I was not aware of this thread before
Alexey replied to [fn:2] and also forgot to ask not to apply this patch.

As the changes [fn:1] is already in upstream and do the similar thing,
can we revert this patch and apply [fn:2] instead, please?

Sorry for missing this thread, forgetting to notify you earlier and all
the inconvenience.

* Footnotes



--
Best regards,
Andrew Tropin
A
A
Andrew Tropin wrote on 3 Feb 2021 15:40
[PATCH] gnu: obs: Update obs to fb347c.
(name . Ludovic Courtès)(address . ludo@gnu.org)
87mtwlrz8d.fsf@trop.in
Toggle quote (3 lines)
> Should we wait for the next OBS release instead of packaging an
> arbitrary commit?

I'm not in a hurry, but as I explained earlier in this thread [fn:2] it seems
relatively safe for me to use this commit and getting back later to
26.1.3 or 26.2.0 or whatever next release will be.

Toggle quote (3 lines)
> I am not insist on keeping [1], but I do think that is more cleaner
> solution.

In terms of implememntation I like that [fn:1] prevents double loading
of plugins, by excluding obs installation dir from "load-path". However
double loading of the same plugin doesn't seem to break anything. Also,
OBS_PLUGINS_DIRECTORY variable name maybe a little better than
OBS_PLUGINS_PATH as it contains only one path.

The problem is that now there are two almost identical mechanisms (one
in upstream and one via patch [fn:1]), which can bring some maintanance
problems in the future.

There are two good option in my opinion:
- contribute patch from [fn:1] to upstream (reverting OBS_PLUGINS_PATH)
- revert [fn:1] and use OBS_PLUGINS_PATH from upstream

If Alexey ready to contibute OBS_PLUGINS_DIRECTORY patch to obs
(reverting OBS_PLUGINS_PATH), I would be glad to support it. Otherwise,
I would prefer to revert [fn:1] and apply this one. To prevent
maintanance problems in the future.

* Footnotes



--
Best regards,
Andrew Tropin
Closed
L
L
Ludovic Courtès wrote on 3 Feb 2021 22:11
(name . Andrew Tropin)(address . andrew@trop.in)
87bld0ambl.fsf@gnu.org
Hi!

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (13 lines)
> The problem is that now there are two almost identical mechanisms (one
> in upstream and one via patch [fn:1]), which can bring some maintanance
> problems in the future.
>
> There are two good option in my opinion:
> - contribute patch from [fn:1] to upstream (reverting OBS_PLUGINS_PATH)
> - revert [fn:1] and use OBS_PLUGINS_PATH from upstream
>
> If Alexey ready to contibute OBS_PLUGINS_DIRECTORY patch to obs
> (reverting OBS_PLUGINS_PATH), I would be glad to support it. Otherwise,
> I would prefer to revert [fn:1] and apply this one. To prevent
> maintanance problems in the future.

I think it’s nicer to follow upstream in general, but I also don’t mind
using our OBS_PLUGINS_DIRECTORY patch until we upgrade to the next
release.

So, Andrew and Alexey: lemme know and I’ll apply what you consider best!

Ludo’.
Closed
A
A
Alexey Abramov wrote on 4 Feb 2021 11:45
(name . Andrew Tropin)(address . andrew@trop.in)
878s84861x.fsf@delta.lan
Hi Andrew,

Andrew Tropin <andrew@trop.in> writes:

Toggle quote (23 lines)
>> Should we wait for the next OBS release instead of packaging an
>> arbitrary commit?
>
> I'm not in a hurry, but as I explained earlier in this thread [fn:2] it seems
> relatively safe for me to use this commit and getting back later to
> 26.1.3 or 26.2.0 or whatever next release will be.
>
>> I am not insist on keeping [1], but I do think that is more cleaner
>> solution.
>
> In terms of implememntation I like that [fn:1] prevents double loading
> of plugins, by excluding obs installation dir from "load-path". However
> double loading of the same plugin doesn't seem to break anything. Also,
> OBS_PLUGINS_DIRECTORY variable name maybe a little better than
> OBS_PLUGINS_PATH as it contains only one path.
>
> The problem is that now there are two almost identical mechanisms (one
> in upstream and one via patch [fn:1]), which can bring some maintanance
> problems in the future.
>
> There are two good option in my opinion:
> - contribute patch from [fn:1] to upstream (reverting OBS_PLUGINS_PATH)

I would go with this one. But the thing is that [fn:1] is specific and
makes sense only for guix. At least from my point of view. So I doubt
that the upstream accept it. But you can try for sure.

Toggle quote (7 lines)
> - revert [fn:1] and use OBS_PLUGINS_PATH from upstream
>
> If Alexey ready to contibute OBS_PLUGINS_DIRECTORY patch to obs
> (reverting OBS_PLUGINS_PATH), I would be glad to support it. Otherwise,
> I would prefer to revert [fn:1] and apply this one. To prevent
> maintanance problems in the future.

As I am not a regular obs user, I am afraid I won't be able to find time
for this soon. Feel free to use/delete/revert [fn:1]. It is your call.

Toggle quote (10 lines)
> * Footnotes
>
> [fn:2] http://issues.guix.gnu.org/46113
>
> [fn:1] https://issues.guix.gnu.org/45707
>
> --
> Best regards,
> Andrew Tropin

--
Alexey
Closed
A
A
Andrew Tropin wrote on 4 Feb 2021 13:49
(name . Alexey Abramov)(address . levenson@mmer.org)
CABrWRW397DCu7TFFSNMT3GSP6aZvYJ-FTQeQzbk2n3j3kDt7_A@mail.gmail.com
Toggle quote (11 lines)
> > There are two good option in my opinion:
> > - contribute patch from [fn:1] to upstream (reverting OBS_PLUGINS_PATH)

> I would go with this one. But the thing is that [fn:1] is specific and
> makes sense only for guix. At least from my point of view. So I doubt
> that the upstream accept it. But you can try for sure.

> As I am not a regular obs user, I am afraid I won't be able to find
> time for this soon. Feel free to use/delete/revert [fn:1]. It is your
> call.

Thank you for the response!

Probably I won't find time to contribute a patch from [fn:1] to obs any
time soon too. So I will wait for next obs release and will update
package definition to use upstream solution once a new version is
released.

Thank you for your work, sorry for inconvenience)

--
Best regards,
Andrew Tropin
Closed
?