mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
d3d11compositor: Add support for crop meta
GstD3D11Converter supports cropping already. Cropping is just a matter of setting source rectangle area to converter, from d3d11 point of view Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2782>
This commit is contained in:
parent
aa0b7f3284
commit
ac6577e2a9
1 changed files with 18 additions and 0 deletions
|
@ -1674,6 +1674,7 @@ gst_d3d11_compositor_propose_allocation (GstAggregator * agg,
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, nullptr);
|
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, nullptr);
|
||||||
|
gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE, nullptr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2077,6 +2078,8 @@ gst_d3d11_compositor_aggregate_frames (GstVideoAggregator * vagg,
|
||||||
GstD3D11CompositorPad *cpad = GST_D3D11_COMPOSITOR_PAD (pad);
|
GstD3D11CompositorPad *cpad = GST_D3D11_COMPOSITOR_PAD (pad);
|
||||||
GstVideoFrame *prepared_frame =
|
GstVideoFrame *prepared_frame =
|
||||||
gst_video_aggregator_pad_get_prepared_frame (pad);
|
gst_video_aggregator_pad_get_prepared_frame (pad);
|
||||||
|
gint x, y, w, h;
|
||||||
|
GstVideoCropMeta *crop_meta;
|
||||||
|
|
||||||
if (!prepared_frame)
|
if (!prepared_frame)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2087,6 +2090,21 @@ gst_d3d11_compositor_aggregate_frames (GstVideoAggregator * vagg,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crop_meta = gst_buffer_get_video_crop_meta (prepared_frame->buffer);
|
||||||
|
if (crop_meta) {
|
||||||
|
x = crop_meta->x;
|
||||||
|
y = crop_meta->y;
|
||||||
|
w = crop_meta->width;
|
||||||
|
h = crop_meta->height;
|
||||||
|
} else {
|
||||||
|
x = y = 0;
|
||||||
|
w = pad->info.width;
|
||||||
|
h = pad->info.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_set (cpad->convert, "src-x", x, "src-y", y, "src-width", w,
|
||||||
|
"src-height", h, nullptr);
|
||||||
|
|
||||||
if (!gst_d3d11_converter_convert_buffer_unlocked (cpad->convert,
|
if (!gst_d3d11_converter_convert_buffer_unlocked (cpad->convert,
|
||||||
prepared_frame->buffer, target_buf)) {
|
prepared_frame->buffer, target_buf)) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't convert frame");
|
GST_ERROR_OBJECT (self, "Couldn't convert frame");
|
||||||
|
|
Loading…
Reference in a new issue