mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
spa: libcamera: use CameraConfiguration::orientation
libcamera commit cc65629b68d49d ("libcamera: camera: Introduce Orientation") [0]
introduced to the `CameraConfiguration::orientation` member to describe the
orientation of the image in the received memory buffers.
Then c65e40b8480ffb ("libcamera: Use CameraConfiguration::orientation") [1]
removed `CameraConfiguration::transform`, which broke the libcamera plugin.
Fix that by using the new `orientation` member.
[0]: https://git.linuxtv.org/libcamera.git/commit/?id=cc65629b68d49d5f2a4d61537584c56ba510a335
[1]: https://git.linuxtv.org/libcamera.git/commit/?id=c65e40b8480ffb5f50e01a4e6713164c7194a937
This commit is contained in:
parent
3baba76c77
commit
268f4856f8
1 changed files with 17 additions and 19 deletions
|
|
@ -716,25 +716,23 @@ static int spa_libcamera_use_buffers(struct impl *impl, struct port *port,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
Transform libcamera_transform;
|
Orientation libcamera_orientation; /* clockwise rotation then horizontal mirroring */
|
||||||
uint32_t spa_transform_value;
|
uint32_t spa_transform_value; /* horizontal mirroring then counter-clockwise rotation */
|
||||||
} transform_map[] = {
|
} orientation_map[] = {
|
||||||
{ Transform::Identity, SPA_META_TRANSFORMATION_None },
|
{ Orientation::Rotate0, SPA_META_TRANSFORMATION_None },
|
||||||
{ Transform::Rot0, SPA_META_TRANSFORMATION_None },
|
{ Orientation::Rotate0Mirror, SPA_META_TRANSFORMATION_Flipped },
|
||||||
{ Transform::HFlip, SPA_META_TRANSFORMATION_Flipped },
|
{ Orientation::Rotate90, SPA_META_TRANSFORMATION_270 },
|
||||||
{ Transform::VFlip, SPA_META_TRANSFORMATION_Flipped180 },
|
{ Orientation::Rotate90Mirror, SPA_META_TRANSFORMATION_Flipped90 },
|
||||||
{ Transform::HVFlip, SPA_META_TRANSFORMATION_180 },
|
{ Orientation::Rotate180, SPA_META_TRANSFORMATION_180 },
|
||||||
{ Transform::Rot180, SPA_META_TRANSFORMATION_180 },
|
{ Orientation::Rotate180Mirror, SPA_META_TRANSFORMATION_Flipped180 },
|
||||||
{ Transform::Transpose, SPA_META_TRANSFORMATION_Flipped90 },
|
{ Orientation::Rotate270, SPA_META_TRANSFORMATION_90 },
|
||||||
{ Transform::Rot90, SPA_META_TRANSFORMATION_90 },
|
{ Orientation::Rotate270Mirror, SPA_META_TRANSFORMATION_Flipped270 },
|
||||||
{ Transform::Rot270, SPA_META_TRANSFORMATION_270 },
|
|
||||||
{ Transform::Rot180Transpose, SPA_META_TRANSFORMATION_Flipped270 },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t libcamera_transform_to_spa_transform_value(Transform transform)
|
static uint32_t libcamera_orientation_to_spa_transform_value(Orientation orientation)
|
||||||
{
|
{
|
||||||
for (const auto& t : transform_map) {
|
for (const auto& t : orientation_map) {
|
||||||
if (t.libcamera_transform == transform)
|
if (t.libcamera_orientation == orientation)
|
||||||
return t.spa_transform_value;
|
return t.spa_transform_value;
|
||||||
}
|
}
|
||||||
return SPA_META_TRANSFORMATION_None;
|
return SPA_META_TRANSFORMATION_None;
|
||||||
|
|
@ -788,9 +786,9 @@ mmap_init(struct impl *impl, struct port *port,
|
||||||
buffers[i], SPA_META_VideoTransform, sizeof(*b->videotransform));
|
buffers[i], SPA_META_VideoTransform, sizeof(*b->videotransform));
|
||||||
if (b->videotransform) {
|
if (b->videotransform) {
|
||||||
b->videotransform->transform =
|
b->videotransform->transform =
|
||||||
libcamera_transform_to_spa_transform_value(impl->config->transform);
|
libcamera_orientation_to_spa_transform_value(impl->config->orientation);
|
||||||
spa_log_debug(impl->log, "Setting videotransform for buffer %d to %u (from %s)",
|
spa_log_debug(impl->log, "Setting videotransform for buffer %u to %u",
|
||||||
i, b->videotransform->transform, transformToString(impl->config->transform));
|
i, b->videotransform->transform);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue