From 8a845ab078c3fe12ac4edd16c8cbac5b7ec03b98 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 29 Apr 2022 03:59:45 +0300 Subject: libcamera: Replace toString with operator<<() for format classes Now that format classes implement the stream formatting operator<<(), use it instead of the toString() function. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/android/camera_capabilities.cpp | 6 +++--- src/android/camera_device.cpp | 4 ++-- src/android/jpeg/encoder_libjpeg.cpp | 2 +- src/android/jpeg/thumbnailer.cpp | 2 +- src/android/mm/generic_camera_buffer.cpp | 3 +-- src/android/yuv/post_processor_yuv.cpp | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/android') diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index e06a517d..6f197eb8 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -554,7 +554,7 @@ int CameraCapabilities::initializeStreamConfigurations() formatsMap_[androidFormat] = formats::MJPEG; LOG(HAL, Debug) << "Mapped Android format " << camera3Format.name << " to " - << formats::MJPEG.toString() + << formats::MJPEG << " (fixed mapping)"; continue; } @@ -566,7 +566,7 @@ int CameraCapabilities::initializeStreamConfigurations() PixelFormat mappedFormat; for (const PixelFormat &pixelFormat : libcameraFormats) { - LOG(HAL, Debug) << "Testing " << pixelFormat.toString(); + LOG(HAL, Debug) << "Testing " << pixelFormat; /* * The stream configuration size can be adjusted, @@ -605,7 +605,7 @@ int CameraCapabilities::initializeStreamConfigurations() formatsMap_[androidFormat] = mappedFormat; LOG(HAL, Debug) << "Mapped Android format " << camera3Format.name << " to " - << mappedFormat.toString(); + << mappedFormat; std::vector resolutions; const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat); diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index f7ec95eb..8e804d4d 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -575,7 +575,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) << ", crop_rotate_scale_degrees: " << rotationToString(stream->crop_rotate_scale_degrees) #endif - << " (" << format.toString() << ")"; + << " (" << format << ")"; if (!format.isValid()) return -EINVAL; @@ -926,7 +926,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques << camera3Stream->height << ")" << "[" << utils::hex(camera3Stream->format) << "] -> " << "(" << cameraStream->configuration().size << ")[" - << cameraStream->configuration().pixelFormat.toString() << "]"; + << cameraStream->configuration().pixelFormat << "]"; /* * Inspect the camera stream type, create buffers opportunely diff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp index 21a3b33d..fd62bd9c 100644 --- a/src/android/jpeg/encoder_libjpeg.cpp +++ b/src/android/jpeg/encoder_libjpeg.cpp @@ -59,7 +59,7 @@ const struct JPEGPixelFormatInfo &findPixelInfo(const PixelFormat &format) const auto iter = pixelInfo.find(format); if (iter == pixelInfo.end()) { LOG(JPEG, Error) << "Unsupported pixel format for JPEG encoder: " - << format.toString(); + << format; return invalidPixelFormat; } diff --git a/src/android/jpeg/thumbnailer.cpp b/src/android/jpeg/thumbnailer.cpp index 1fab8072..41c71c76 100644 --- a/src/android/jpeg/thumbnailer.cpp +++ b/src/android/jpeg/thumbnailer.cpp @@ -30,7 +30,7 @@ void Thumbnailer::configure(const Size &sourceSize, PixelFormat pixelFormat) if (pixelFormat_ != formats::NV12) { LOG(Thumbnailer, Error) << "Failed to configure: Pixel Format " - << pixelFormat_.toString() << " unsupported."; + << pixelFormat_ << " unsupported."; return; } diff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp index a4349f89..1bd7090d 100644 --- a/src/android/mm/generic_camera_buffer.cpp +++ b/src/android/mm/generic_camera_buffer.cpp @@ -66,8 +66,7 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer, const auto &info = PixelFormatInfo::info(pixelFormat); if (!info.isValid()) { error_ = -EINVAL; - LOG(HAL, Error) << "Invalid pixel format: " - << pixelFormat.toString(); + LOG(HAL, Error) << "Invalid pixel format: " << pixelFormat; return; } diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp index 513c6ef8..ed44e6fe 100644 --- a/src/android/yuv/post_processor_yuv.cpp +++ b/src/android/yuv/post_processor_yuv.cpp @@ -27,8 +27,8 @@ int PostProcessorYuv::configure(const StreamConfiguration &inCfg, { if (inCfg.pixelFormat != outCfg.pixelFormat) { LOG(YUV, Error) << "Pixel format conversion is not supported" - << " (from " << inCfg.pixelFormat.toString() - << " to " << outCfg.pixelFormat.toString() << ")"; + << " (from " << inCfg.pixelFormat + << " to " << outCfg.pixelFormat << ")"; return -EINVAL; } -- cgit v1.2.1