libcamera: Implement SPA_META_VideoTransform support

libcamera can detect camera transforms/rotation, e.g. from the device
tree, and makes that information usable for clients via
`CameraConfiguration::transform`.
Advertise this information via the VideoTransform meta so Pipewire
clients can adjust their output accordingly.

Rotated cameras are common in mobile devices such as the Pinephone Pro,
which was used to test this feature.
This commit is contained in:
Robert Mader 2022-12-03 23:54:30 +01:00
parent 9f2abea480
commit fa799aac86
2 changed files with 41 additions and 0 deletions

View file

@ -78,6 +78,7 @@ struct buffer {
struct spa_list link;
struct spa_buffer *outbuf;
struct spa_meta_header *h;
struct spa_meta_videotransform *videotransform;
void *ptr;
};
@ -589,6 +590,12 @@ next:
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)));
break;
case 1:
param = (struct spa_pod*)spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamMeta, id,
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoTransform),
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_videotransform)));
break;
default:
return 0;
}