d3d11compositor: Add support for resolution change

Not only for position update (e.g., xpos, ypos),
we need to configure shader again per resolution change of each
input stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1912>
This commit is contained in:
Seungha Yang 2020-12-27 22:16:13 +09:00 committed by GStreamer Merge Bot
parent 4151e8e052
commit 68a47eb316

View file

@ -377,6 +377,7 @@ struct _GstD3D11CompositorPad
gboolean alpha_updated;
gboolean blend_desc_updated;
ID3D11BlendState *blend;
gboolean caps_updated;
/* properties */
gint xpos;
@ -1144,13 +1145,14 @@ gst_d3d11_compositor_pad_setup_converter (GstVideoAggregatorPad * pad,
guint zorder = 0;
#endif
if (!cpad->convert || cpad->alpha_updated) {
if (!cpad->convert || cpad->alpha_updated || cpad->caps_updated) {
if (cpad->convert)
gst_d3d11_color_converter_free (cpad->convert);
cpad->convert =
gst_d3d11_color_converter_new_with_alpha (self->device,
&pad->info, &vagg->info, cpad->alpha);
cpad->alpha_updated = FALSE;
cpad->caps_updated = FALSE;
if (!cpad->convert) {
GST_ERROR_OBJECT (pad, "Couldn't create converter");
return FALSE;
@ -1268,6 +1270,8 @@ static gboolean gst_d3d11_compositor_propose_allocation (GstAggregator *
GstQuery * query);
static gboolean gst_d3d11_compositor_decide_allocation (GstAggregator *
aggregator, GstQuery * query);
static gboolean gst_d3d11_compositor_sink_event (GstAggregator * agg,
GstAggregatorPad * pad, GstEvent * event);
static GstFlowReturn
gst_d3d11_compositor_aggregate_frames (GstVideoAggregator * vagg,
@ -1321,6 +1325,8 @@ gst_d3d11_compositor_class_init (GstD3D11CompositorClass * klass)
GST_DEBUG_FUNCPTR (gst_d3d11_compositor_propose_allocation);
aggregator_class->decide_allocation =
GST_DEBUG_FUNCPTR (gst_d3d11_compositor_decide_allocation);
aggregator_class->sink_event =
GST_DEBUG_FUNCPTR (gst_d3d11_compositor_sink_event);
vagg_class->aggregate_frames =
GST_DEBUG_FUNCPTR (gst_d3d11_compositor_aggregate_frames);
@ -1830,6 +1836,24 @@ gst_d3d11_compositor_decide_allocation (GstAggregator * aggregator,
return TRUE;
}
static gboolean
gst_d3d11_compositor_sink_event (GstAggregator * agg, GstAggregatorPad * pad,
GstEvent * event)
{
GstD3D11CompositorPad *cpad = GST_D3D11_COMPOSITOR_PAD (pad);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_CAPS:
GST_DEBUG_OBJECT (pad, "Got new caps event %" GST_PTR_FORMAT, event);
cpad->caps_updated = TRUE;
break;
default:
break;
}
return GST_AGGREGATOR_CLASS (parent_class)->sink_event (agg, pad, event);
}
typedef struct
{
struct