| Message ID | 20260908073640.39654-1-barnabas.pocze@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Quoting Barnabás Pőcze (2026-09-08 08:36:38) > Currently, only the size, the pixel format, and the color space is included > when a `V4L2DeviceFormat` is formatted into a stream. > > Print the data about the planes as well (size and bytes-per-line), as it can > immensely help debugging if it is readily available in the log. > > Example: > > 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited I like this: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > where the <size>/<bpl> pairs are printed inside the "[]" separated by ':'. > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > --- > src/libcamera/v4l2_videodevice.cpp | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > index 41dc5d0f65..bc539884e5 100644 > --- a/src/libcamera/v4l2_videodevice.cpp > +++ b/src/libcamera/v4l2_videodevice.cpp > @@ -447,8 +447,19 @@ std::string V4L2DeviceFormat::toString() const > */ > std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f) > { > - out << f.size << "-" << f.fourcc << "/" > - << ColorSpace::toString(f.colorSpace); > + out << f.size << '-' << f.fourcc << '['; > + > + for (size_t i = 0; i < f.planesCount; i++) { > + const auto &p = f.planes[i]; > + > + out << p.size << '/' << p.bpl; > + > + if (i + 1 < f.planesCount) > + out << ':'; > + } > + > + out << "]/" << ColorSpace::toString(f.colorSpace); > + > return out; > } > > -- > 2.55.0 >
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 41dc5d0f65..bc539884e5 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -447,8 +447,19 @@ std::string V4L2DeviceFormat::toString() const */ std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f) { - out << f.size << "-" << f.fourcc << "/" - << ColorSpace::toString(f.colorSpace); + out << f.size << '-' << f.fourcc << '['; + + for (size_t i = 0; i < f.planesCount; i++) { + const auto &p = f.planes[i]; + + out << p.size << '/' << p.bpl; + + if (i + 1 < f.planesCount) + out << ':'; + } + + out << "]/" << ColorSpace::toString(f.colorSpace); + return out; }
Currently, only the size, the pixel format, and the color space is included when a `V4L2DeviceFormat` is formatted into a stream. Print the data about the planes as well (size and bytes-per-line), as it can immensely help debugging if it is readily available in the log. Example: 640x480-YUYV[614400/1280]/Rec709/Rec709/Rec601/Limited where the <size>/<bpl> pairs are printed inside the "[]" separated by ':'. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/libcamera/v4l2_videodevice.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)