bazzite/spec_files/pipewire/0002-Revert-spa-libcamera-use-CameraConfiguration-orienta.patch
2024-02-03 14:05:57 -08:00

72 lines
3.2 KiB
Diff

From 20dd33d5b68f6007c41a7ffccf37aeb25aa9a920 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 31 Jan 2024 12:21:08 +0100
Subject: [PATCH 2/2] Revert "spa: libcamera: use
`CameraConfiguration::orientation`"
This reverts commit fd33d2d3bb6333c7d6e74cbaa806bff2d908f589.
---
spa/plugins/libcamera/libcamera-utils.cpp | 36 ++++++++++++-----------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/spa/plugins/libcamera/libcamera-utils.cpp b/spa/plugins/libcamera/libcamera-utils.cpp
index c197248d3..2b1aea5a7 100644
--- a/spa/plugins/libcamera/libcamera-utils.cpp
+++ b/spa/plugins/libcamera/libcamera-utils.cpp
@@ -716,23 +716,25 @@ static int spa_libcamera_use_buffers(struct impl *impl, struct port *port,
}
static const struct {
- Orientation libcamera_orientation; /* clockwise rotation then horizontal mirroring */
- uint32_t spa_transform_value; /* horizontal mirroring then counter-clockwise rotation */
-} orientation_map[] = {
- { Orientation::Rotate0, SPA_META_TRANSFORMATION_None },
- { Orientation::Rotate0Mirror, SPA_META_TRANSFORMATION_Flipped },
- { Orientation::Rotate90, SPA_META_TRANSFORMATION_270 },
- { Orientation::Rotate90Mirror, SPA_META_TRANSFORMATION_Flipped90 },
- { Orientation::Rotate180, SPA_META_TRANSFORMATION_180 },
- { Orientation::Rotate180Mirror, SPA_META_TRANSFORMATION_Flipped180 },
- { Orientation::Rotate270, SPA_META_TRANSFORMATION_90 },
- { Orientation::Rotate270Mirror, SPA_META_TRANSFORMATION_Flipped270 },
+ Transform libcamera_transform;
+ uint32_t spa_transform_value;
+} transform_map[] = {
+ { Transform::Identity, SPA_META_TRANSFORMATION_None },
+ { Transform::Rot0, SPA_META_TRANSFORMATION_None },
+ { Transform::HFlip, SPA_META_TRANSFORMATION_Flipped },
+ { Transform::VFlip, SPA_META_TRANSFORMATION_Flipped180 },
+ { Transform::HVFlip, SPA_META_TRANSFORMATION_180 },
+ { Transform::Rot180, SPA_META_TRANSFORMATION_180 },
+ { Transform::Transpose, SPA_META_TRANSFORMATION_Flipped90 },
+ { Transform::Rot90, SPA_META_TRANSFORMATION_90 },
+ { Transform::Rot270, SPA_META_TRANSFORMATION_270 },
+ { Transform::Rot180Transpose, SPA_META_TRANSFORMATION_Flipped270 },
};
-static uint32_t libcamera_orientation_to_spa_transform_value(Orientation orientation)
+static uint32_t libcamera_transform_to_spa_transform_value(Transform transform)
{
- for (const auto& t : orientation_map) {
- if (t.libcamera_orientation == orientation)
+ for (const auto& t : transform_map) {
+ if (t.libcamera_transform == transform)
return t.spa_transform_value;
}
return SPA_META_TRANSFORMATION_None;
@@ -786,9 +788,9 @@ mmap_init(struct impl *impl, struct port *port,
buffers[i], SPA_META_VideoTransform, sizeof(*b->videotransform));
if (b->videotransform) {
b->videotransform->transform =
- libcamera_orientation_to_spa_transform_value(impl->config->orientation);
- spa_log_debug(impl->log, "Setting videotransform for buffer %u to %u",
- i, b->videotransform->transform);
+ libcamera_transform_to_spa_transform_value(impl->config->transform);
+ spa_log_debug(impl->log, "Setting videotransform for buffer %d to %u (from %s)",
+ i, b->videotransform->transform, transformToString(impl->config->transform));
}
--
2.43.0