summaryrefslogtreecommitdiff
path: root/gst/videocrop/gstaspectratiocrop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/videocrop/gstaspectratiocrop.c')
-rw-r--r--gst/videocrop/gstaspectratiocrop.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/gst/videocrop/gstaspectratiocrop.c b/gst/videocrop/gstaspectratiocrop.c
index 2c1d9d774..c4cffa1c2 100644
--- a/gst/videocrop/gstaspectratiocrop.c
+++ b/gst/videocrop/gstaspectratiocrop.c
@@ -205,10 +205,32 @@ gst_aspect_ratio_crop_finalize (GObject * object)
aspect_ratio_crop = GST_ASPECT_RATIO_CROP (object);
g_mutex_clear (&aspect_ratio_crop->crop_lock);
+ gst_caps_unref (aspect_ratio_crop->renegotiation_caps);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static GstFlowReturn
+gst_aspect_ratio_crop_sink_chain (GstPad * pad, GstObject * parent,
+ GstBuffer * buffer)
+{
+ GstCaps *caps = NULL;
+ GstAspectRatioCrop *aspect_ratio_crop = GST_ASPECT_RATIO_CROP (parent);
+
+ GST_OBJECT_LOCK (parent);
+ caps = aspect_ratio_crop->renegotiation_caps;
+ aspect_ratio_crop->renegotiation_caps = NULL;
+ GST_OBJECT_UNLOCK (parent);
+
+ if (caps) {
+ gst_aspect_ratio_crop_set_caps (GST_ASPECT_RATIO_CROP (parent), caps);
+ gst_caps_unref (caps);
+ }
+
+ return gst_proxy_pad_chain_default (pad, parent, buffer);
+
+}
+
static void
gst_aspect_ratio_crop_init (GstAspectRatioCrop * aspect_ratio_crop)
{
@@ -247,6 +269,8 @@ gst_aspect_ratio_crop_init (GstAspectRatioCrop * aspect_ratio_crop)
gst_pad_set_event_function (aspect_ratio_crop->sink,
GST_DEBUG_FUNCPTR (gst_aspect_ratio_crop_sink_event));
+ gst_pad_set_chain_function (aspect_ratio_crop->sink,
+ GST_DEBUG_FUNCPTR (gst_aspect_ratio_crop_sink_chain));
}
static void
@@ -461,11 +485,11 @@ gst_aspect_ratio_crop_set_property (GObject * object, guint prop_id,
GST_OBJECT_UNLOCK (aspect_ratio_crop);
if (recheck) {
- GstCaps *caps = gst_pad_get_current_caps (aspect_ratio_crop->sink);
- if (caps != NULL) {
- gst_aspect_ratio_crop_set_caps (aspect_ratio_crop, caps);
- gst_caps_unref (caps);
- }
+ GST_OBJECT_LOCK (aspect_ratio_crop);
+ gst_caps_replace (&aspect_ratio_crop->renegotiation_caps, NULL);
+ aspect_ratio_crop->renegotiation_caps =
+ gst_pad_get_current_caps (aspect_ratio_crop->sink);
+ GST_OBJECT_UNLOCK (aspect_ratio_crop);
}
}