summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Sarakeev <sarakusha@gmail.com>2014-11-26 10:33:09 +0300
committerSebastian Dröge <sebastian@centricular.com>2014-12-01 15:27:41 +0100
commit8f10ed99d812e31339d095b6c64cbb10e90958be (patch)
treedee5a81c100e05e87c22d67f94843f61296af21f
parentb3e132d2d7a759215cc3b183102b7d0e6f678699 (diff)
aspectratiocrop: Handle resolution changes properly
When an caps-event is received, we must immediately change the crop to videocrop correctly changed caps-event dimension, otherwise the videocrop will first use the previous value of the crop that when resizing video to a smaller resolution may cause an error. https://bugzilla.gnome.org/show_bug.cgi?id=740671
-rw-r--r--gst/videocrop/gstaspectratiocrop.c12
-rw-r--r--gst/videocrop/gstaspectratiocrop.h1
2 files changed, 2 insertions, 11 deletions
diff --git a/gst/videocrop/gstaspectratiocrop.c b/gst/videocrop/gstaspectratiocrop.c
index a4a65537e..62e96441d 100644
--- a/gst/videocrop/gstaspectratiocrop.c
+++ b/gst/videocrop/gstaspectratiocrop.c
@@ -152,28 +152,22 @@ static gboolean
gst_aspect_ratio_crop_sink_event (GstPad * pad, GstObject * parent,
GstEvent * evt)
{
- gboolean ret;
GstAspectRatioCrop *aspect_ratio_crop = GST_ASPECT_RATIO_CROP (parent);
- ret =
- aspect_ratio_crop->sinkpad_old_eventfunc (pad, parent,
- gst_event_ref (evt));
-
switch (GST_EVENT_TYPE (evt)) {
case GST_EVENT_CAPS:
{
GstCaps *caps;
gst_event_parse_caps (evt, &caps);
- ret = gst_aspect_ratio_crop_set_caps (aspect_ratio_crop, caps);
+ gst_aspect_ratio_crop_set_caps (aspect_ratio_crop, caps);
break;
}
default:
break;
}
- gst_event_unref (evt);
- return ret;
+ return gst_pad_event_default (pad, parent, evt);
}
static void
@@ -253,8 +247,6 @@ gst_aspect_ratio_crop_init (GstAspectRatioCrop * aspect_ratio_crop)
aspect_ratio_crop->sink);
gst_object_unref (link_pad);
- aspect_ratio_crop->sinkpad_old_eventfunc =
- GST_PAD_EVENTFUNC (aspect_ratio_crop->sink);
gst_pad_set_event_function (aspect_ratio_crop->sink,
GST_DEBUG_FUNCPTR (gst_aspect_ratio_crop_sink_event));
}
diff --git a/gst/videocrop/gstaspectratiocrop.h b/gst/videocrop/gstaspectratiocrop.h
index 5e108402b..2caeb5ce9 100644
--- a/gst/videocrop/gstaspectratiocrop.h
+++ b/gst/videocrop/gstaspectratiocrop.h
@@ -46,7 +46,6 @@ struct _GstAspectRatioCrop
GstElement *videocrop;
GstPad *sink;
- GstPadEventFunction sinkpad_old_eventfunc;
/* target aspect ratio */
gint ar_num; /* if < 1 then don't change ar */