[libcamera-devel] libcamera: pipeline: simple: converter: Improve error message
diff mbox series

Message ID 20210627190009.12272-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 12809ff171aee57b306a9b29d6593793ea984ae6
Headers show
Series
  • [libcamera-devel] libcamera: pipeline: simple: converter: Improve error message
Related show

Commit Message

Laurent Pinchart June 27, 2021, 7 p.m. UTC
When the configuration of the converter fails due to format mismatch,
the error messages only indicates that a failure occurred. Improve it to
ease debugging by printing the requested and obtained formats.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/simple/converter.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Umang Jain June 28, 2021, 4:28 a.m. UTC | #1
Hi Laurent,

Thank you for the patch.

On 6/28/21 12:30 AM, Laurent Pinchart wrote:
> When the configuration of the converter fails due to format mismatch,
> the error messages only indicates that a failure occurred. Improve it to
> ease debugging by printing the requested and obtained formats.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   src/libcamera/pipeline/simple/converter.cpp | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp
> index 9af1096be834..3baf78f9364c 100644
> --- a/src/libcamera/pipeline/simple/converter.cpp
> +++ b/src/libcamera/pipeline/simple/converter.cpp
> @@ -64,7 +64,9 @@ int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg,
>   	if (format.fourcc != videoFormat || format.size != inputCfg.size ||
>   	    format.planes[0].bpl != inputCfg.stride) {
>   		LOG(SimplePipeline, Error)
> -			<< "Input format not supported";
> +			<< "Input format not supported (requested "
> +			<< inputCfg.size.toString() << "-" << videoFormat.toString()
> +			<< ", got " << format.toString() << ")";
>   		return -EINVAL;
>   	}
>
Paul Elder June 28, 2021, 4:57 a.m. UTC | #2
Hi Laurent,

On Sun, Jun 27, 2021 at 10:00:09PM +0300, Laurent Pinchart wrote:
> When the configuration of the converter fails due to format mismatch,
> the error messages only indicates that a failure occurred. Improve it to
> ease debugging by printing the requested and obtained formats.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/pipeline/simple/converter.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp
> index 9af1096be834..3baf78f9364c 100644
> --- a/src/libcamera/pipeline/simple/converter.cpp
> +++ b/src/libcamera/pipeline/simple/converter.cpp
> @@ -64,7 +64,9 @@ int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg,
>  	if (format.fourcc != videoFormat || format.size != inputCfg.size ||
>  	    format.planes[0].bpl != inputCfg.stride) {
>  		LOG(SimplePipeline, Error)
> -			<< "Input format not supported";
> +			<< "Input format not supported (requested "
> +			<< inputCfg.size.toString() << "-" << videoFormat.toString()
> +			<< ", got " << format.toString() << ")";
>  		return -EINVAL;
>  	}
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp
index 9af1096be834..3baf78f9364c 100644
--- a/src/libcamera/pipeline/simple/converter.cpp
+++ b/src/libcamera/pipeline/simple/converter.cpp
@@ -64,7 +64,9 @@  int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg,
 	if (format.fourcc != videoFormat || format.size != inputCfg.size ||
 	    format.planes[0].bpl != inputCfg.stride) {
 		LOG(SimplePipeline, Error)
-			<< "Input format not supported";
+			<< "Input format not supported (requested "
+			<< inputCfg.size.toString() << "-" << videoFormat.toString()
+			<< ", got " << format.toString() << ")";
 		return -EINVAL;
 	}