[libcamera-devel] v4l2: Extend device caps with V4L2_CAP_STREAMING

Message ID 20200118213123.27096-1-nicolas@ndufresne.ca
State Accepted
Commit 632e0fc09f4e7f32307c101ef9ee970669e1ccf2
Headers show
Series
  • [libcamera-devel] v4l2: Extend device caps with V4L2_CAP_STREAMING
Related show

Commit Message

Nicolas Dufresne Jan. 18, 2020, 9:31 p.m. UTC
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>

This capability tells the application that mmap() is supported. GStreamer
would return an error saying there there is no input/output method supported
by this device otherwise. This was tested with:

LD_PRELOAD=$(pwd)/build/src/v4l2/v4l2-compat.so GST_DEBUG="v4l2*:7" gst-launch-1.0 v4l2src ! videoconvert ! autovideosink

With this patch, GStreamer will reach playing state. It then blocks waiting on
poll() which is not implemented yet on our side.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 src/v4l2/v4l2_camera_proxy.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Jan. 18, 2020, 9:34 p.m. UTC | #1
Hi Nicolas,

Thank you for the patch.

On Sat, Jan 18, 2020 at 04:31:23PM -0500, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> This capability tells the application that mmap() is supported. GStreamer
> would return an error saying there there is no input/output method supported
> by this device otherwise. This was tested with:
> 
> LD_PRELOAD=$(pwd)/build/src/v4l2/v4l2-compat.so GST_DEBUG="v4l2*:7" gst-launch-1.0 v4l2src ! videoconvert ! autovideosink
> 
> With this patch, GStreamer will reach playing state. It then blocks waiting on
> poll() which is not implemented yet on our side.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

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

> ---
>  src/v4l2/v4l2_camera_proxy.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> index 3013a3d..e58fd6a 100644
> --- a/src/v4l2/v4l2_camera_proxy.cpp
> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> @@ -179,7 +179,7 @@ void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)
>  		       sizeof(capabilities_.bus_info));
>  	/* \todo Put this in a header/config somewhere. */
>  	capabilities_.version = KERNEL_VERSION(5, 2, 0);
> -	capabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE;
> +	capabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
>  	capabilities_.capabilities = capabilities_.device_caps
>  				   | V4L2_CAP_DEVICE_CAPS;
>  	memset(capabilities_.reserved, 0, sizeof(capabilities_.reserved));
Kieran Bingham Jan. 20, 2020, 10:09 a.m. UTC | #2
Hi Nicolas,

On 18/01/2020 21:31, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> This capability tells the application that mmap() is supported. GStreamer
> would return an error saying there there is no input/output method supported
> by this device otherwise. This was tested with:
> 
> LD_PRELOAD=$(pwd)/build/src/v4l2/v4l2-compat.so GST_DEBUG="v4l2*:7" gst-launch-1.0 v4l2src ! videoconvert ! autovideosink
> 

We should start documenting these commands in an FAQ or some
documentation somewhere so we can track examples.


> With this patch, GStreamer will reach playing state. It then blocks waiting on
> poll() which is not implemented yet on our side.

Sounds like good progress all the same

> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
>  src/v4l2/v4l2_camera_proxy.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> index 3013a3d..e58fd6a 100644
> --- a/src/v4l2/v4l2_camera_proxy.cpp
> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> @@ -179,7 +179,7 @@ void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)
>  		       sizeof(capabilities_.bus_info));
>  	/* \todo Put this in a header/config somewhere. */
>  	capabilities_.version = KERNEL_VERSION(5, 2, 0);
> -	capabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE;
> +	capabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
>  	capabilities_.capabilities = capabilities_.device_caps
>  				   | V4L2_CAP_DEVICE_CAPS;
>  	memset(capabilities_.reserved, 0, sizeof(capabilities_.reserved));


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

Patch

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 3013a3d..e58fd6a 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -179,7 +179,7 @@  void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)
 		       sizeof(capabilities_.bus_info));
 	/* \todo Put this in a header/config somewhere. */
 	capabilities_.version = KERNEL_VERSION(5, 2, 0);
-	capabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE;
+	capabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
 	capabilities_.capabilities = capabilities_.device_caps
 				   | V4L2_CAP_DEVICE_CAPS;
 	memset(capabilities_.reserved, 0, sizeof(capabilities_.reserved));