[v1,3/3] libcamera: stream: StreamConfiguration: Adjust formatting
diff mbox series

Message ID 20260908073640.39654-3-barnabas.pocze@ideasonboard.com
State Superseded
Headers show
Series
  • [v1,1/3] libcamera: v4l2_videodevice: V4L2DeviceFormat: Expand formatting
Related show

Commit Message

Barnabás Pőcze Sept. 8, 2026, 7:36 a.m. UTC
Adjust the formatting of how a `StreamConfiguration` is formatted to a stream.
Specifically, print the `frameSize` and `stride` members in a format similar
to how it is done for `V4L2DeviceFormat`.

Example:

  configuring streams: (0) 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/libcamera/stream.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Kieran Bingham Sept. 8, 2026, 10:41 a.m. UTC | #1
Quoting Barnabás Pőcze (2026-09-08 08:36:40)
> Adjust the formatting of how a `StreamConfiguration` is formatted to a stream.
> Specifically, print the `frameSize` and `stride` members in a format similar
> to how it is done for `V4L2DeviceFormat`.
> 
> Example:
> 
>   configuring streams: (0) 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited

So the previous two make this easy:

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

> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  src/libcamera/stream.cpp | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> index be0c80cbcf..af730ff8a5 100644
> --- a/src/libcamera/stream.cpp
> +++ b/src/libcamera/stream.cpp
> @@ -407,8 +407,9 @@ std::string StreamConfiguration::toString() const
>   */
>  std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)
>  {
> -       out << cfg.size << "-" << cfg.pixelFormat << "/"
> -           << ColorSpace::toString(cfg.colorSpace);
> +       out << cfg.size << '-' << cfg.pixelFormat
> +           << '[' << cfg.frameSize << '/' << cfg.stride << ']'

what happens on multi-planar formats here with stride though ? Or do I
recall we still only have a single stride value in the
StreamConfiguration ?

> +           << '/' << ColorSpace::toString(cfg.colorSpace);
>         return out;
>  }
>  
> -- 
> 2.55.0
>
Barnabás Pőcze Sept. 8, 2026, 10:43 a.m. UTC | #2
2026. 09. 08. 12:41 keltezéssel, Kieran Bingham írta:
> Quoting Barnabás Pőcze (2026-09-08 08:36:40)
>> Adjust the formatting of how a `StreamConfiguration` is formatted to a stream.
>> Specifically, print the `frameSize` and `stride` members in a format similar
>> to how it is done for `V4L2DeviceFormat`.
>>
>> Example:
>>
>>    configuring streams: (0) 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited
> 
> So the previous two make this easy:
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
>>
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>> ---
>>   src/libcamera/stream.cpp | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
>> index be0c80cbcf..af730ff8a5 100644
>> --- a/src/libcamera/stream.cpp
>> +++ b/src/libcamera/stream.cpp
>> @@ -407,8 +407,9 @@ std::string StreamConfiguration::toString() const
>>    */
>>   std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)
>>   {
>> -       out << cfg.size << "-" << cfg.pixelFormat << "/"
>> -           << ColorSpace::toString(cfg.colorSpace);
>> +       out << cfg.size << '-' << cfg.pixelFormat
>> +           << '[' << cfg.frameSize << '/' << cfg.stride << ']'
> 
> what happens on multi-planar formats here with stride though ? Or do I
> recall we still only have a single stride value in the
> StreamConfiguration ?

`StreamConfiguration` can only provide these details about the first plane,
it's an unfortunate deficiency that should be addressed at some point.


> 
>> +           << '/' << ColorSpace::toString(cfg.colorSpace);
>>          return out;
>>   }
>>   
>> -- 
>> 2.55.0
>>
Kieran Bingham Sept. 8, 2026, 10:47 a.m. UTC | #3
Quoting Barnabás Pőcze (2026-09-08 11:43:01)
> 2026. 09. 08. 12:41 keltezéssel, Kieran Bingham írta:
> > Quoting Barnabás Pőcze (2026-09-08 08:36:40)
> >> Adjust the formatting of how a `StreamConfiguration` is formatted to a stream.
> >> Specifically, print the `frameSize` and `stride` members in a format similar
> >> to how it is done for `V4L2DeviceFormat`.
> >>
> >> Example:
> >>
> >>    configuring streams: (0) 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited
> > 
> > So the previous two make this easy:
> > 
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > 
> >>
> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> >> ---
> >>   src/libcamera/stream.cpp | 5 +++--
> >>   1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> >> index be0c80cbcf..af730ff8a5 100644
> >> --- a/src/libcamera/stream.cpp
> >> +++ b/src/libcamera/stream.cpp
> >> @@ -407,8 +407,9 @@ std::string StreamConfiguration::toString() const
> >>    */
> >>   std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)
> >>   {
> >> -       out << cfg.size << "-" << cfg.pixelFormat << "/"
> >> -           << ColorSpace::toString(cfg.colorSpace);
> >> +       out << cfg.size << '-' << cfg.pixelFormat
> >> +           << '[' << cfg.frameSize << '/' << cfg.stride << ']'
> > 
> > what happens on multi-planar formats here with stride though ? Or do I
> > recall we still only have a single stride value in the
> > StreamConfiguration ?
> 
> `StreamConfiguration` can only provide these details about the first plane,
> it's an unfortunate deficiency that should be addressed at some point.
> 

Ack, well this helps make it clear :D

Thanks
--
Kieran

> 
> > 
> >> +           << '/' << ColorSpace::toString(cfg.colorSpace);
> >>          return out;
> >>   }
> >>   
> >> -- 
> >> 2.55.0
> >>
>

Patch
diff mbox series

diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
index be0c80cbcf..af730ff8a5 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -407,8 +407,9 @@  std::string StreamConfiguration::toString() const
  */
 std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)
 {
-	out << cfg.size << "-" << cfg.pixelFormat << "/"
-	    << ColorSpace::toString(cfg.colorSpace);
+	out << cfg.size << '-' << cfg.pixelFormat
+	    << '[' << cfg.frameSize << '/' << cfg.stride << ']'
+	    << '/' << ColorSpace::toString(cfg.colorSpace);
 	return out;
 }