[libcamera-devel,2/2] libcamera: pipeline: uvcvideo: set a default format

Message ID 20190204185521.23471-3-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: pipeline: uvcvideo: set a default format
Related show

Commit Message

Niklas Söderlund Feb. 4, 2019, 6:55 p.m. UTC
Pick a default format for the UVC one stream in a UVC camera. This is
just a starting point to define a good default format for the UVC camera
it's expected to evolve over time as the capabilities of the library
grows.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/pipeline/uvcvideo.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Kieran Bingham Feb. 4, 2019, 7:11 p.m. UTC | #1
Hi Niklas,

On 04/02/2019 19:55, Niklas Söderlund wrote:
> Pick a default format for the UVC one stream in a UVC camera. This is
> just a starting point to define a good default format for the UVC camera
> it's expected to evolve over time as the capabilities of the library
> grows.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

This is fine by me.

I would have expected this to obtain the default information from the
driver, as different devices may have different restrictions, and it
might not even support YUYV or that particular width and height.

 - but we can consider that later.

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


> ---
>  src/libcamera/pipeline/uvcvideo.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
> index 821e4c2189caabd0..ad4d45d0698519b6 100644
> --- a/src/libcamera/pipeline/uvcvideo.cpp
> +++ b/src/libcamera/pipeline/uvcvideo.cpp
> @@ -60,7 +60,11 @@ PipelineHandlerUVC::streamConfiguration(Camera *camera,
>  
>  	StreamConfiguration config{};
>  
> -	LOG(UVC, Info) << "TODO: Return a good default format";
> +	LOG(UVC, Debug) << "Retrieving default format";
> +	config.width = 640;
> +	config.height = 480;
> +	config.pixelFormat = V4L2_PIX_FMT_YUYV;
> +	config.bufferCount = 4;
>  
>  	configs[&stream_] = config;
>  
>

Patch

diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 821e4c2189caabd0..ad4d45d0698519b6 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -60,7 +60,11 @@  PipelineHandlerUVC::streamConfiguration(Camera *camera,
 
 	StreamConfiguration config{};
 
-	LOG(UVC, Info) << "TODO: Return a good default format";
+	LOG(UVC, Debug) << "Retrieving default format";
+	config.width = 640;
+	config.height = 480;
+	config.pixelFormat = V4L2_PIX_FMT_YUYV;
+	config.bufferCount = 4;
 
 	configs[&stream_] = config;