From 59d393bd308ee771f134732c12bf8c0e526b5971 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Wed, 7 Dec 2022 12:19:01 +0100 Subject: [PATCH] libcamera: Fix 90/270 degree transforms `Transform::Rot90` means the client should rotate 90 deg. clockwise, which matches `SPA_META_TRANSFORMATION_90`, i.e. the buffer was rotated 90 deg. anti-clockwise. The flipped cases should be correct though. Also add the source value to the debug print for easier future debugging. Fixes fa799aac8674457a --- spa/plugins/libcamera/libcamera-utils.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spa/plugins/libcamera/libcamera-utils.cpp b/spa/plugins/libcamera/libcamera-utils.cpp index ec1c6720a..af07484f2 100644 --- a/spa/plugins/libcamera/libcamera-utils.cpp +++ b/spa/plugins/libcamera/libcamera-utils.cpp @@ -709,8 +709,8 @@ static const struct { { Transform::HVFlip, SPA_META_TRANSFORMATION_180 }, { Transform::Rot180, SPA_META_TRANSFORMATION_180 }, { Transform::Transpose, SPA_META_TRANSFORMATION_Flipped90 }, - { Transform::Rot90, SPA_META_TRANSFORMATION_270 }, - { Transform::Rot270, SPA_META_TRANSFORMATION_90 }, + { Transform::Rot90, SPA_META_TRANSFORMATION_90 }, + { Transform::Rot270, SPA_META_TRANSFORMATION_270 }, { Transform::Rot180Transpose, SPA_META_TRANSFORMATION_Flipped270 }, }; @@ -772,8 +772,9 @@ mmap_init(struct impl *impl, struct port *port, if (b->videotransform) { b->videotransform->transform = libcamera_transform_to_spa_transform_value(impl->config->transform); - spa_log_debug(impl->log, "Setting videotransform for buffer %d to %u", - i, b->videotransform->transform); + spa_log_debug(impl->log, "Setting videotransform for buffer %d to %u (from %s)", + i, b->videotransform->transform, transformToString(impl->config->transform)); + } d = buffers[i]->datas;