d3d11compositor: Fix negative position handling
Negative positions should be cropped out Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9158>
This commit is contained in:
parent
aa0c257d4c
commit
6efe987d5c
@ -2083,6 +2083,8 @@ gst_d3d11_compositor_aggregate_frames (GstVideoAggregator * vagg,
|
|||||||
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;
|
gint x, y, w, h;
|
||||||
|
gint x_offset = 0;
|
||||||
|
gint y_offset = 0;
|
||||||
GstVideoCropMeta *crop_meta;
|
GstVideoCropMeta *crop_meta;
|
||||||
|
|
||||||
if (!prepared_frame)
|
if (!prepared_frame)
|
||||||
@ -2094,6 +2096,12 @@ gst_d3d11_compositor_aggregate_frames (GstVideoAggregator * vagg,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cpad->xpos < 0)
|
||||||
|
x_offset = cpad->xpos;
|
||||||
|
|
||||||
|
if (cpad->ypos < 0)
|
||||||
|
y_offset = cpad->ypos;
|
||||||
|
|
||||||
crop_meta = gst_buffer_get_video_crop_meta (prepared_frame->buffer);
|
crop_meta = gst_buffer_get_video_crop_meta (prepared_frame->buffer);
|
||||||
if (crop_meta) {
|
if (crop_meta) {
|
||||||
x = crop_meta->x;
|
x = crop_meta->x;
|
||||||
@ -2106,8 +2114,8 @@ gst_d3d11_compositor_aggregate_frames (GstVideoAggregator * vagg,
|
|||||||
h = pad->info.height;
|
h = pad->info.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_set (cpad->convert, "src-x", x, "src-y", y, "src-width", w,
|
g_object_set (cpad->convert, "src-x", x - x_offset, "src-y", y - y_offset,
|
||||||
"src-height", h, nullptr);
|
"src-width", w + x_offset, "src-height", h + y_offset, 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)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user