mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-01 03:52:25 +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);
|
||||
GstGLVideoMixerPad *mix_pad = GST_GL_VIDEO_MIXER_PAD (pad);
|
||||
GstCaps *caps = gst_pad_get_current_caps (pad);
|
||||
GstStructure *event_st, *caps_st;
|
||||
gint par_n = 1, par_d = 1;
|
||||
GstVideoAggregatorPad *vagg_pad = GST_VIDEO_AGGREGATOR_PAD (mix_pad);
|
||||
GstStructure *event_st;
|
||||
gdouble event_x, event_y;
|
||||
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 =
|
||||
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,
|
||||
"pointer_y", G_TYPE_DOUBLE, &event_y, NULL);
|
||||
|
||||
/* 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, par_n, par_d, &(rect.w), &(rect.h),
|
||||
&(rect.x), &(rect.y));
|
||||
_mixer_pad_get_output_size (mix, mix_pad, vagg_pad->info.par_n,
|
||||
vagg_pad->info.par_d, &(rect.w), &(rect.h), &(rect.x), &(rect.y));
|
||||
rect.x += mix_pad->xpos;
|
||||
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 (caps_st);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue