mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
glvideomixer: Handle pads which have no caps set on mouse events
And directly use the pad vinfo instead of getting current caps Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6265>
This commit is contained in:
parent
9acf4fc139
commit
41f8276c2b
1 changed files with 10 additions and 9 deletions
|
@ -1722,23 +1722,25 @@ src_pad_mouse_event (GstElement * element, GstPad * pad, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstGLVideoMixer *mix = GST_GL_VIDEO_MIXER (element);
|
GstGLVideoMixer *mix = GST_GL_VIDEO_MIXER (element);
|
||||||
GstGLVideoMixerPad *mix_pad = GST_GL_VIDEO_MIXER_PAD (pad);
|
GstGLVideoMixerPad *mix_pad = GST_GL_VIDEO_MIXER_PAD (pad);
|
||||||
GstCaps *caps = gst_pad_get_current_caps (pad);
|
GstVideoAggregatorPad *vagg_pad = GST_VIDEO_AGGREGATOR_PAD (mix_pad);
|
||||||
GstStructure *event_st, *caps_st;
|
GstStructure *event_st;
|
||||||
gint par_n = 1, par_d = 1;
|
|
||||||
gdouble event_x, event_y;
|
gdouble event_x, event_y;
|
||||||
GstVideoRectangle rect;
|
GstVideoRectangle rect;
|
||||||
|
|
||||||
|
if (!vagg_pad->info.finfo
|
||||||
|
|| vagg_pad->info.finfo->format == GST_VIDEO_FORMAT_UNKNOWN) {
|
||||||
|
GST_DEBUG_OBJECT (mix_pad, "Have no caps yet");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
event_st =
|
event_st =
|
||||||
gst_structure_copy (gst_event_get_structure (GST_EVENT_CAST (user_data)));
|
gst_structure_copy (gst_event_get_structure (GST_EVENT_CAST (user_data)));
|
||||||
caps_st = gst_structure_copy (gst_caps_get_structure (caps, 0));
|
|
||||||
|
|
||||||
gst_structure_get (event_st, "pointer_x", G_TYPE_DOUBLE, &event_x,
|
gst_structure_get (event_st, "pointer_x", G_TYPE_DOUBLE, &event_x,
|
||||||
"pointer_y", G_TYPE_DOUBLE, &event_y, NULL);
|
"pointer_y", G_TYPE_DOUBLE, &event_y, NULL);
|
||||||
|
|
||||||
/* Find output rectangle of this pad */
|
/* Find output rectangle of this pad */
|
||||||
gst_structure_get_fraction (caps_st, "pixel-aspect-ratio", &par_n, &par_d);
|
_mixer_pad_get_output_size (mix, mix_pad, vagg_pad->info.par_n,
|
||||||
_mixer_pad_get_output_size (mix, mix_pad, par_n, par_d, &(rect.w), &(rect.h),
|
vagg_pad->info.par_d, &(rect.w), &(rect.h), &(rect.x), &(rect.y));
|
||||||
&(rect.x), &(rect.y));
|
|
||||||
rect.x += mix_pad->xpos;
|
rect.x += mix_pad->xpos;
|
||||||
rect.y += mix_pad->ypos;
|
rect.y += mix_pad->ypos;
|
||||||
|
|
||||||
|
@ -1759,7 +1761,6 @@ src_pad_mouse_event (GstElement * element, GstPad * pad, gpointer user_data)
|
||||||
gst_structure_free (event_st);
|
gst_structure_free (event_st);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_structure_free (caps_st);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue