[libcamera-devel,v2,1/2] gstreamer: Add meson devenv support
diff mbox series

Message ID 20240119200848.358298-1-nicolas@ndufresne.ca
State Accepted
Headers show
Series
  • [libcamera-devel,v2,1/2] gstreamer: Add meson devenv support
Related show

Commit Message

Nicolas Dufresne Jan. 19, 2024, 8:08 p.m. UTC
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>

This change to the build system will prepend the plugin build directory
to GST_PLUGIN_PATH environment. This makes the built plugin visible to
GStreamer inside meson devenv enabling uninstalled testing. In order to avoid
pulluting the user registry, the GST_REGISTRY environement is also set.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
Changes in V2:
  - Use gst_ prefix for the path and env
  - Don't call fs.parent twice
  - Set GST_REGISTRY
  - Update the documentation

 README.rst                |  7 ++++---
 src/gstreamer/meson.build | 11 +++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart Jan. 22, 2024, 10:52 a.m. UTC | #1
Hi Nicolas,

Thank you for the patch.

On Fri, Jan 19, 2024 at 03:08:47PM -0500, Nicolas Dufresne via libcamera-devel wrote:
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> This change to the build system will prepend the plugin build directory
> to GST_PLUGIN_PATH environment. This makes the built plugin visible to
> GStreamer inside meson devenv enabling uninstalled testing. In order to avoid
> pulluting the user registry, the GST_REGISTRY environement is also set.

s/pulluting/polluting/

> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> Changes in V2:
>   - Use gst_ prefix for the path and env
>   - Don't call fs.parent twice
>   - Set GST_REGISTRY
>   - Update the documentation
> 
>  README.rst                |  7 ++++---
>  src/gstreamer/meson.build | 11 +++++++++++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/README.rst b/README.rst
> index 315738ee..a7e0561f 100644
> --- a/README.rst
> +++ b/README.rst
> @@ -120,12 +120,13 @@ setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:
>  Using GStreamer plugin
>  ~~~~~~~~~~~~~~~~~~~~~~
>  
> -To use GStreamer plugin from source tree, set the following environment so that
> -GStreamer can find it. This isn't necessary when libcamera is installed.
> +To use GStreamer plugin from source tree, use meson ``devenv`` command.

s/use meson/use the meson/

> +This will create a new shell instance with ``GST_PLUGIN_PATH`` environment set

s/with/with the/

> +accordingly.
>  
>  .. code::
>  
> -  export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer
> +  meson devenv -C build
>  
>  The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and
>  test it. The following pipeline will stream from the camera named "Camera 1"
> diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
> index 20784b71..1536fd23 100644
> --- a/src/gstreamer/meson.build
> +++ b/src/gstreamer/meson.build
> @@ -46,3 +46,14 @@ libcamera_gst = shared_library('gstlibcamera',
>      install : true,
>      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
>  )
> +
> +# Makes the plugin visible to GStreamer inside meson devenv

s/Makes/Make/
s/$/./

> +fs = import('fs')
> +gst_plugin_path = fs.parent(libcamera_gst.full_path())
> +
> +gst_env = environment()
> +gst_env.prepend('GST_PLUGIN_PATH', gst_plugin_path)
> +# Avoid polluting the system registry

s/$/./

I'll fix those when applying. Looking forward to start using meson
devenv :-)

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +gst_env.set('GST_REGISTRY', gst_plugin_path / 'registry.data')
> +
> +meson.add_devenv(gst_env)
Kieran Bingham Jan. 22, 2024, 3:55 p.m. UTC | #2
Quoting Laurent Pinchart (2024-01-22 10:52:46)
> Hi Nicolas,
> 
> Thank you for the patch.
> 
> On Fri, Jan 19, 2024 at 03:08:47PM -0500, Nicolas Dufresne via libcamera-devel wrote:
> > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> > 
> > This change to the build system will prepend the plugin build directory
> > to GST_PLUGIN_PATH environment. This makes the built plugin visible to
> > GStreamer inside meson devenv enabling uninstalled testing. In order to avoid
> > pulluting the user registry, the GST_REGISTRY environement is also set.
> 
> s/pulluting/polluting/
> 

s/environement/envronment/ too if you're fixing up while applying.


> > 
> > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> > ---
> > Changes in V2:
> >   - Use gst_ prefix for the path and env
> >   - Don't call fs.parent twice
> >   - Set GST_REGISTRY
> >   - Update the documentation
> > 
> >  README.rst                |  7 ++++---
> >  src/gstreamer/meson.build | 11 +++++++++++
> >  2 files changed, 15 insertions(+), 3 deletions(-)
> > 
> > diff --git a/README.rst b/README.rst
> > index 315738ee..a7e0561f 100644
> > --- a/README.rst
> > +++ b/README.rst
> > @@ -120,12 +120,13 @@ setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:
> >  Using GStreamer plugin
> >  ~~~~~~~~~~~~~~~~~~~~~~
> >  
> > -To use GStreamer plugin from source tree, set the following environment so that
> > -GStreamer can find it. This isn't necessary when libcamera is installed.
> > +To use GStreamer plugin from source tree, use meson ``devenv`` command.
> 

s/from source tree/from the source tree/

> s/use meson/use the meson/
> 
> > +This will create a new shell instance with ``GST_PLUGIN_PATH`` environment set
> 
> s/with/with the/
> 
> > +accordingly.
> >  
> >  .. code::
> >  
> > -  export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer
> > +  meson devenv -C build
> >  
> >  The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and
> >  test it. The following pipeline will stream from the camera named "Camera 1"
> > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
> > index 20784b71..1536fd23 100644
> > --- a/src/gstreamer/meson.build
> > +++ b/src/gstreamer/meson.build
> > @@ -46,3 +46,14 @@ libcamera_gst = shared_library('gstlibcamera',
> >      install : true,
> >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
> >  )
> > +
> > +# Makes the plugin visible to GStreamer inside meson devenv
> 
> s/Makes/Make/
> s/$/./
> 
> > +fs = import('fs')
> > +gst_plugin_path = fs.parent(libcamera_gst.full_path())
> > +
> > +gst_env = environment()
> > +gst_env.prepend('GST_PLUGIN_PATH', gst_plugin_path)

I'd add a blank line here, but I don't care ;D We've nitpicked the rest
of the patch!


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> > +# Avoid polluting the system registry
> 
> s/$/./
> 
> I'll fix those when applying. Looking forward to start using meson
> devenv :-)
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> > +gst_env.set('GST_REGISTRY', gst_plugin_path / 'registry.data')
> > +
> > +meson.add_devenv(gst_env)
> 
> -- 
> Regards,
> 
> Laurent Pinchart
Nicolas Dufresne Jan. 22, 2024, 4:37 p.m. UTC | #3
Le lundi 22 janvier 2024 à 15:55 +0000, Kieran Bingham a écrit :
> Quoting Laurent Pinchart (2024-01-22 10:52:46)
> > Hi Nicolas,
> > 
> > Thank you for the patch.
> > 
> > On Fri, Jan 19, 2024 at 03:08:47PM -0500, Nicolas Dufresne via libcamera-devel wrote:
> > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> > > 
> > > This change to the build system will prepend the plugin build directory
> > > to GST_PLUGIN_PATH environment. This makes the built plugin visible to
> > > GStreamer inside meson devenv enabling uninstalled testing. In order to avoid
> > > pulluting the user registry, the GST_REGISTRY environement is also set.
> > 
> > s/pulluting/polluting/
> > 
> 
> s/environement/envronment/ too if you're fixing up while applying.
                 environment

Difficult to type word clearly,
Nicolas
> 
> 
> > > 
> > > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> > > ---
> > > Changes in V2:
> > >   - Use gst_ prefix for the path and env
> > >   - Don't call fs.parent twice
> > >   - Set GST_REGISTRY
> > >   - Update the documentation
> > > 
> > >  README.rst                |  7 ++++---
> > >  src/gstreamer/meson.build | 11 +++++++++++
> > >  2 files changed, 15 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/README.rst b/README.rst
> > > index 315738ee..a7e0561f 100644
> > > --- a/README.rst
> > > +++ b/README.rst
> > > @@ -120,12 +120,13 @@ setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:
> > >  Using GStreamer plugin
> > >  ~~~~~~~~~~~~~~~~~~~~~~
> > >  
> > > -To use GStreamer plugin from source tree, set the following environment so that
> > > -GStreamer can find it. This isn't necessary when libcamera is installed.
> > > +To use GStreamer plugin from source tree, use meson ``devenv`` command.
> > 
> 
> s/from source tree/from the source tree/
> 
> > s/use meson/use the meson/
> > 
> > > +This will create a new shell instance with ``GST_PLUGIN_PATH`` environment set
> > 
> > s/with/with the/
> > 
> > > +accordingly.
> > >  
> > >  .. code::
> > >  
> > > -  export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer
> > > +  meson devenv -C build
> > >  
> > >  The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and
> > >  test it. The following pipeline will stream from the camera named "Camera 1"
> > > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
> > > index 20784b71..1536fd23 100644
> > > --- a/src/gstreamer/meson.build
> > > +++ b/src/gstreamer/meson.build
> > > @@ -46,3 +46,14 @@ libcamera_gst = shared_library('gstlibcamera',
> > >      install : true,
> > >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
> > >  )
> > > +
> > > +# Makes the plugin visible to GStreamer inside meson devenv
> > 
> > s/Makes/Make/
> > s/$/./
> > 
> > > +fs = import('fs')
> > > +gst_plugin_path = fs.parent(libcamera_gst.full_path())
> > > +
> > > +gst_env = environment()
> > > +gst_env.prepend('GST_PLUGIN_PATH', gst_plugin_path)
> 
> I'd add a blank line here, but I don't care ;D We've nitpicked the rest
> of the patch!
> 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > > +# Avoid polluting the system registry
> > 
> > s/$/./
> > 
> > I'll fix those when applying. Looking forward to start using meson
> > devenv :-)
> > 
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > > +gst_env.set('GST_REGISTRY', gst_plugin_path / 'registry.data')
> > > +
> > > +meson.add_devenv(gst_env)
> > 
> > -- 
> > Regards,
> > 
> > Laurent Pinchart
Kieran Bingham Jan. 22, 2024, 6:15 p.m. UTC | #4
Quoting Nicolas Dufresne (2024-01-22 16:37:56)
> Le lundi 22 janvier 2024 à 15:55 +0000, Kieran Bingham a écrit :
> > Quoting Laurent Pinchart (2024-01-22 10:52:46)
> > > Hi Nicolas,
> > > 
> > > Thank you for the patch.
> > > 
> > > On Fri, Jan 19, 2024 at 03:08:47PM -0500, Nicolas Dufresne via libcamera-devel wrote:
> > > > From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> > > > 
> > > > This change to the build system will prepend the plugin build directory
> > > > to GST_PLUGIN_PATH environment. This makes the built plugin visible to
> > > > GStreamer inside meson devenv enabling uninstalled testing. In order to avoid
> > > > pulluting the user registry, the GST_REGISTRY environement is also set.
> > > 
> > > s/pulluting/polluting/
> > > 
> > 
> > s/environement/envronment/ too if you're fixing up while applying.
>                  environment
> 
> Difficult to type word clearly,

Absuluuutaly. ;-)

Thanks
--
Kieran

> Nicolas
> > 
> > 
> > > > 
> > > > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> > > > ---
> > > > Changes in V2:
> > > >   - Use gst_ prefix for the path and env
> > > >   - Don't call fs.parent twice
> > > >   - Set GST_REGISTRY
> > > >   - Update the documentation
> > > > 
> > > >  README.rst                |  7 ++++---
> > > >  src/gstreamer/meson.build | 11 +++++++++++
> > > >  2 files changed, 15 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/README.rst b/README.rst
> > > > index 315738ee..a7e0561f 100644
> > > > --- a/README.rst
> > > > +++ b/README.rst
> > > > @@ -120,12 +120,13 @@ setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:
> > > >  Using GStreamer plugin
> > > >  ~~~~~~~~~~~~~~~~~~~~~~
> > > >  
> > > > -To use GStreamer plugin from source tree, set the following environment so that
> > > > -GStreamer can find it. This isn't necessary when libcamera is installed.
> > > > +To use GStreamer plugin from source tree, use meson ``devenv`` command.
> > > 
> > 
> > s/from source tree/from the source tree/
> > 
> > > s/use meson/use the meson/
> > > 
> > > > +This will create a new shell instance with ``GST_PLUGIN_PATH`` environment set
> > > 
> > > s/with/with the/
> > > 
> > > > +accordingly.
> > > >  
> > > >  .. code::
> > > >  
> > > > -  export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer
> > > > +  meson devenv -C build
> > > >  
> > > >  The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and
> > > >  test it. The following pipeline will stream from the camera named "Camera 1"
> > > > diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
> > > > index 20784b71..1536fd23 100644
> > > > --- a/src/gstreamer/meson.build
> > > > +++ b/src/gstreamer/meson.build
> > > > @@ -46,3 +46,14 @@ libcamera_gst = shared_library('gstlibcamera',
> > > >      install : true,
> > > >      install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
> > > >  )
> > > > +
> > > > +# Makes the plugin visible to GStreamer inside meson devenv
> > > 
> > > s/Makes/Make/
> > > s/$/./
> > > 
> > > > +fs = import('fs')
> > > > +gst_plugin_path = fs.parent(libcamera_gst.full_path())
> > > > +
> > > > +gst_env = environment()
> > > > +gst_env.prepend('GST_PLUGIN_PATH', gst_plugin_path)
> > 
> > I'd add a blank line here, but I don't care ;D We've nitpicked the rest
> > of the patch!
> > 
> > 
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > 
> > > > +# Avoid polluting the system registry
> > > 
> > > s/$/./
> > > 
> > > I'll fix those when applying. Looking forward to start using meson
> > > devenv :-)
> > > 
> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > 
> > > > +gst_env.set('GST_REGISTRY', gst_plugin_path / 'registry.data')
> > > > +
> > > > +meson.add_devenv(gst_env)
> > > 
> > > -- 
> > > Regards,
> > > 
> > > Laurent Pinchart
>

Patch
diff mbox series

diff --git a/README.rst b/README.rst
index 315738ee..a7e0561f 100644
--- a/README.rst
+++ b/README.rst
@@ -120,12 +120,13 @@  setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:
 Using GStreamer plugin
 ~~~~~~~~~~~~~~~~~~~~~~
 
-To use GStreamer plugin from source tree, set the following environment so that
-GStreamer can find it. This isn't necessary when libcamera is installed.
+To use GStreamer plugin from source tree, use meson ``devenv`` command.
+This will create a new shell instance with ``GST_PLUGIN_PATH`` environment set
+accordingly.
 
 .. code::
 
-  export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer
+  meson devenv -C build
 
 The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and
 test it. The following pipeline will stream from the camera named "Camera 1"
diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build
index 20784b71..1536fd23 100644
--- a/src/gstreamer/meson.build
+++ b/src/gstreamer/meson.build
@@ -46,3 +46,14 @@  libcamera_gst = shared_library('gstlibcamera',
     install : true,
     install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
 )
+
+# Makes the plugin visible to GStreamer inside meson devenv
+fs = import('fs')
+gst_plugin_path = fs.parent(libcamera_gst.full_path())
+
+gst_env = environment()
+gst_env.prepend('GST_PLUGIN_PATH', gst_plugin_path)
+# Avoid polluting the system registry
+gst_env.set('GST_REGISTRY', gst_plugin_path / 'registry.data')
+
+meson.add_devenv(gst_env)