[libcamera-devel,v2,1/8] test: v4l2_device: Use VIVID capture stream

Message ID 20190213151027.6376-2-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: v4l2_device buffer sharing
Related show

Commit Message

Kieran Bingham Feb. 13, 2019, 3:10 p.m. UTC
Utilise the VIVID capture device for testing the V4L2Device objects.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 test/v4l2_device/v4l2_device_test.cpp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Laurent Pinchart Feb. 13, 2019, 3:39 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Wed, Feb 13, 2019 at 03:10:20PM +0000, Kieran Bingham wrote:
> Utilise the VIVID capture device for testing the V4L2Device objects.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

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

> ---
>  test/v4l2_device/v4l2_device_test.cpp | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/test/v4l2_device/v4l2_device_test.cpp b/test/v4l2_device/v4l2_device_test.cpp
> index 18d014caf4c8..a2a7ba82612d 100644
> --- a/test/v4l2_device/v4l2_device_test.cpp
> +++ b/test/v4l2_device/v4l2_device_test.cpp
> @@ -39,22 +39,22 @@ int V4L2DeviceTest::init()
>  		return TestFail;
>  	}
>  
> -	DeviceMatch dm("uvcvideo");
> -	media_ = std::move(enumerator_->search(dm));
> +	DeviceMatch dm("vivid");
> +	dm.add("vivid-000-vid-cap");
> +
> +	media_ = enumerator_->search(dm);
>  	if (!media_)
>  		return TestSkip;
>  
>  	media_->acquire();
>  
> -	for (MediaEntity *entity : media_->entities()) {
> -		if (entity->flags() & MEDIA_ENT_FL_DEFAULT) {
> -			dev_ = new V4L2Device(entity);
> -			break;
> -		}
> -	}
> +	MediaEntity *entity = media_->getEntityByName("vivid-000-vid-cap");
> +	if (!entity)
> +		return TestSkip;
>  
> +	dev_ = new V4L2Device(entity);
>  	if (!dev_)
> -		return TestSkip;
> +		return TestFail;
>  
>  	return dev_->open();
>  }

Patch

diff --git a/test/v4l2_device/v4l2_device_test.cpp b/test/v4l2_device/v4l2_device_test.cpp
index 18d014caf4c8..a2a7ba82612d 100644
--- a/test/v4l2_device/v4l2_device_test.cpp
+++ b/test/v4l2_device/v4l2_device_test.cpp
@@ -39,22 +39,22 @@  int V4L2DeviceTest::init()
 		return TestFail;
 	}
 
-	DeviceMatch dm("uvcvideo");
-	media_ = std::move(enumerator_->search(dm));
+	DeviceMatch dm("vivid");
+	dm.add("vivid-000-vid-cap");
+
+	media_ = enumerator_->search(dm);
 	if (!media_)
 		return TestSkip;
 
 	media_->acquire();
 
-	for (MediaEntity *entity : media_->entities()) {
-		if (entity->flags() & MEDIA_ENT_FL_DEFAULT) {
-			dev_ = new V4L2Device(entity);
-			break;
-		}
-	}
+	MediaEntity *entity = media_->getEntityByName("vivid-000-vid-cap");
+	if (!entity)
+		return TestSkip;
 
+	dev_ = new V4L2Device(entity);
 	if (!dev_)
-		return TestSkip;
+		return TestFail;
 
 	return dev_->open();
 }