mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
gst: add buffer video meta support
Fixes video buffer strides handling. This enables passing of image datas with right line padding.
This commit is contained in:
parent
38f88d3d25
commit
023577e391
5 changed files with 93 additions and 0 deletions
|
|
@ -142,6 +142,7 @@ gst_pipewire_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
GstPipeWireSink *pwsink = GST_PIPEWIRE_SINK (bsink);
|
||||
|
||||
gst_query_add_allocation_pool (query, GST_BUFFER_POOL_CAST (pwsink->pool), 0, 0, 0);
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -504,6 +505,19 @@ do_send_buffer (GstPipeWireSink *pwsink, GstBuffer *buffer)
|
|||
d->chunk->stride = 0;
|
||||
}
|
||||
|
||||
GstVideoMeta *meta = gst_buffer_get_video_meta (buffer);
|
||||
if (meta) {
|
||||
if (meta->n_planes == b->n_datas) {
|
||||
for (i = 0; i < meta->n_planes; i++) {
|
||||
struct spa_data *d = &b->datas[i];
|
||||
d->chunk->offset = meta->offset[i];
|
||||
d->chunk->stride = meta->stride[i];
|
||||
}
|
||||
} else {
|
||||
GST_ERROR ("plane num not matching, meta:%d buffer:%d", meta->n_planes, b->n_datas);
|
||||
}
|
||||
}
|
||||
|
||||
if ((res = pw_stream_queue_buffer (pwsink->stream, data->b)) < 0) {
|
||||
g_warning ("can't send buffer %s", spa_strerror(res));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue