unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#45707] [PATCH] gnu: Add obs-v4l2sink.
@ 2021-01-06 23:36 Evan Straw
  2021-01-06 23:42 ` Nicolò Balzarotti
  2021-01-06 23:47 ` [bug#45707] [PATCH v2] " Evan Straw
  0 siblings, 2 replies; 13+ messages in thread
From: Evan Straw @ 2021-01-06 23:36 UTC (permalink / raw)
  To: 45707


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: [PATCH] gnu: Add obs-v4l2sink. --]
[-- Type: text/x-patch, Size: 2740 bytes --]

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(+)

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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH] gnu: Add obs-v4l2sink.
  2021-01-06 23:36 [bug#45707] [PATCH] gnu: Add obs-v4l2sink Evan Straw
@ 2021-01-06 23:42 ` Nicolò Balzarotti
  2021-01-06 23:45   ` Evan Straw
  2021-01-06 23:47 ` [bug#45707] [PATCH v2] " Evan Straw
  1 sibling, 1 reply; 13+ messages in thread
From: Nicolò Balzarotti @ 2021-01-06 23:42 UTC (permalink / raw)
  To: Evan Straw, 45707

Evan Straw <evan.straw99@gmail.com> writes:

> +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.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH] gnu: Add obs-v4l2sink.
  2021-01-06 23:42 ` Nicolò Balzarotti
@ 2021-01-06 23:45   ` Evan Straw
  0 siblings, 0 replies; 13+ messages in thread
From: Evan Straw @ 2021-01-06 23:45 UTC (permalink / raw)
  To: Nicolò Balzarotti; +Cc: 45707


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




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
  2021-01-06 23:36 [bug#45707] [PATCH] gnu: Add obs-v4l2sink Evan Straw
  2021-01-06 23:42 ` Nicolò Balzarotti
@ 2021-01-06 23:47 ` Evan Straw
  2021-01-07  0:11   ` Nicolò Balzarotti
                     ` (2 more replies)
  1 sibling, 3 replies; 13+ messages in thread
From: Evan Straw @ 2021-01-06 23:47 UTC (permalink / raw)
  To: 45707


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: [PATCH] gnu: Add obs-v4l2sink. --]
[-- Type: text/x-patch, Size: 2702 bytes --]

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(+)

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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
  2021-01-06 23:47 ` [bug#45707] [PATCH v2] " Evan Straw
@ 2021-01-07  0:11   ` Nicolò Balzarotti
  2021-01-07  4:37   ` Evan
  2021-01-15 17:10   ` [bug#45707] [PATCH v2] " pelzflorian (Florian Pelz)
  2 siblings, 0 replies; 13+ messages in thread
From: Nicolò Balzarotti @ 2021-01-07  0:11 UTC (permalink / raw)
  To: Evan Straw, 45707

Thanks for the update.

Evan Straw <evan.straw99@gmail.com> writes:
> +              (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).

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

> +    (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




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
  2021-01-06 23:47 ` [bug#45707] [PATCH v2] " Evan Straw
  2021-01-07  0:11   ` Nicolò Balzarotti
@ 2021-01-07  4:37   ` Evan
  2021-01-07  8:19     ` Alexey Abramov
  2021-01-15 17:10   ` [bug#45707] [PATCH v2] " pelzflorian (Florian Pelz)
  2 siblings, 1 reply; 13+ messages in thread
From: Evan @ 2021-01-07  4:37 UTC (permalink / raw)
  To: 45707

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

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>:

>  

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
  2021-01-07  4:37   ` Evan
@ 2021-01-07  8:19     ` Alexey Abramov
  2021-01-13 14:35       ` [bug#45707] [PATCH] " Ludovic Courtès
  0 siblings, 1 reply; 13+ messages in thread
From: Alexey Abramov @ 2021-01-07  8:19 UTC (permalink / raw)
  To: Evan; +Cc: 45707

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)

--8<---------------cut here---------------start------------->8---
  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
  }
--8<---------------cut here---------------end--------------->8---


So what I am currently have is this:

--8<---------------cut here---------------start------------->8---
  λ 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
--8<---------------cut here---------------end--------------->8---

where the library is a symlink

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

-- 
Alexey




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH] gnu: Add obs-v4l2sink.
  2021-01-07  8:19     ` Alexey Abramov
@ 2021-01-13 14:35       ` Ludovic Courtès
  2021-01-15 16:47         ` Alexey Abramov
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2021-01-13 14:35 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: Evan, 45707

Hi,

Alexey Abramov <levenson@mmer.org> skribis:

> 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’.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH] gnu: Add obs-v4l2sink.
  2021-01-13 14:35       ` [bug#45707] [PATCH] " Ludovic Courtès
@ 2021-01-15 16:47         ` Alexey Abramov
  2021-01-16 21:47           ` Ludovic Courtès
  0 siblings, 1 reply; 13+ messages in thread
From: Alexey Abramov @ 2021-01-15 16:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Evan, 45707

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-obs-Use-an-environment-variable-for-plugins-loca.patch --]
[-- Type: text/x-patch, Size: 3879 bytes --]

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

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
  2021-01-06 23:47 ` [bug#45707] [PATCH v2] " Evan Straw
  2021-01-07  0:11   ` Nicolò Balzarotti
  2021-01-07  4:37   ` Evan
@ 2021-01-15 17:10   ` pelzflorian (Florian Pelz)
  2021-01-15 19:25     ` Evan Straw
  2 siblings, 1 reply; 13+ messages in thread
From: pelzflorian (Florian Pelz) @ 2021-01-15 17:10 UTC (permalink / raw)
  To: Evan Straw; +Cc: 45707

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




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH v2] gnu: Add obs-v4l2sink.
  2021-01-15 17:10   ` [bug#45707] [PATCH v2] " pelzflorian (Florian Pelz)
@ 2021-01-15 19:25     ` Evan Straw
  0 siblings, 0 replies; 13+ messages in thread
From: Evan Straw @ 2021-01-15 19:25 UTC (permalink / raw)
  To: pelzflorian (Florian Pelz); +Cc: 45707

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

Hi Florian,

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

> 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



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH] gnu: Add obs-v4l2sink.
  2021-01-15 16:47         ` Alexey Abramov
@ 2021-01-16 21:47           ` Ludovic Courtès
  2021-01-20  8:28             ` Alexey Abramov
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2021-01-16 21:47 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: Evan, 45707

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?

> 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.

> @@ -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?

> +    (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’.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#45707] [PATCH] gnu: Add obs-v4l2sink.
  2021-01-16 21:47           ` Ludovic Courtès
@ 2021-01-20  8:28             ` Alexey Abramov
  0 siblings, 0 replies; 13+ messages in thread
From: Alexey Abramov @ 2021-01-20  8:28 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Evan, 45707

[-- Attachment #1: Type: text/plain, Size: 5649 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> 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.

>
>> 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.

>> @@ -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.

>
>> +    (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.

>
> 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.

--8<---------------cut here---------------start------------->8---
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
--8<---------------cut here---------------end--------------->8---


Footnotes:
[1]  https://issues.guix.gnu.org/45960
[2]  https://issues.guix.gnu.org/45961

-- 
Alexey


[-- Attachment #2: 0001-gnu-obs-Use-an-environment-variable-for-plugins-loca.patch --]
[-- Type: text/x-patch, Size: 4450 bytes --]

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

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-01-20  8:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 23:36 [bug#45707] [PATCH] gnu: Add obs-v4l2sink Evan Straw
2021-01-06 23:42 ` Nicolò Balzarotti
2021-01-06 23:45   ` Evan Straw
2021-01-06 23:47 ` [bug#45707] [PATCH v2] " Evan Straw
2021-01-07  0:11   ` Nicolò Balzarotti
2021-01-07  4:37   ` Evan
2021-01-07  8:19     ` Alexey Abramov
2021-01-13 14:35       ` [bug#45707] [PATCH] " Ludovic Courtès
2021-01-15 16:47         ` Alexey Abramov
2021-01-16 21:47           ` Ludovic Courtès
2021-01-20  8:28             ` Alexey Abramov
2021-01-15 17:10   ` [bug#45707] [PATCH v2] " pelzflorian (Florian Pelz)
2021-01-15 19:25     ` Evan Straw

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git