v4l2: support meta_videotransform on buffers

Advertise support for the videotransform metadata.
Make a new meta.videotransform.transform property to configure the
desired video transformation in the metadata.

This makes it possible for a session manager or other rules to set
a custom transformation on the source.

See #4034
This commit is contained in:
Wim Taymans 2024-06-07 10:52:39 +02:00
parent 6bb1d0476d
commit 4d7c81bd90
2 changed files with 27 additions and 7 deletions

View file

@ -1400,6 +1400,9 @@ static int mmap_read(struct impl *this)
b->h->pts = pts;
b->h->dts_offset = 0;
}
if (b->vt) {
b->vt->transform = this->transform;
}
d = b->outbuf->datas;
d[0].chunk->offset = 0;
@ -1507,6 +1510,7 @@ static int spa_v4l2_use_buffers(struct impl *this, struct spa_buffer **buffers,
b->outbuf = buffers[i];
b->flags = BUFFER_FLAG_OUTSTANDING;
b->h = spa_buffer_find_meta_data(buffers[i], SPA_META_Header, sizeof(*b->h));
b->vt = spa_buffer_find_meta_data(buffers[i], SPA_META_VideoTransform, sizeof(*b->vt));
spa_log_debug(this->log, "import buffer %p", buffers[i]);
@ -1602,6 +1606,7 @@ mmap_init(struct impl *this,
b->outbuf = buffers[i];
b->flags = BUFFER_FLAG_OUTSTANDING;
b->h = spa_buffer_find_meta_data(buffers[i], SPA_META_Header, sizeof(*b->h));
b->vt = spa_buffer_find_meta_data(buffers[i], SPA_META_VideoTransform, sizeof(*b->vt));
spa_zero(b->v4l2_buffer);
b->v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;