GST_DEBUG_FUNCPTR (gst_deinterlace_src_query));
gst_pad_set_getcaps_function (self->srcpad,
GST_DEBUG_FUNCPTR (gst_deinterlace_getcaps));
- gst_pad_set_setcaps_function (self->srcpad,
- GST_DEBUG_FUNCPTR (gst_deinterlace_setcaps));
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
self->mode = DEFAULT_MODE;
gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
- if (self->sink_caps)
- gst_caps_unref (self->sink_caps);
- self->sink_caps = NULL;
-
- if (self->src_caps)
- gst_caps_unref (self->src_caps);
- self->src_caps = NULL;
-
if (self->request_caps)
gst_caps_unref (self->request_caps);
self->request_caps = NULL;
GST_DEBUG_OBJECT (self, "deinterlacing top field");
/* create new buffer */
- ret = gst_pad_alloc_buffer (self->srcpad,
- GST_BUFFER_OFFSET_NONE, self->frame_size, self->src_caps, &outbuf);
+ ret =
+ gst_pad_alloc_buffer (self->srcpad, GST_BUFFER_OFFSET_NONE,
+ self->frame_size, GST_PAD_CAPS (self->srcpad), &outbuf);
if (ret != GST_FLOW_OK)
return ret;
- if (self->src_caps != GST_BUFFER_CAPS (outbuf) &&
- !gst_caps_is_equal (self->src_caps, GST_BUFFER_CAPS (outbuf))) {
+ if (GST_PAD_CAPS (self->srcpad) != GST_BUFFER_CAPS (outbuf)
+ && !gst_caps_is_equal (GST_PAD_CAPS (self->srcpad),
+ GST_BUFFER_CAPS (outbuf))) {
gst_caps_replace (&self->request_caps, GST_BUFFER_CAPS (outbuf));
GST_DEBUG_OBJECT (self, "Upstream wants new caps %" GST_PTR_FORMAT,
self->request_caps);
if (!outbuf)
return GST_FLOW_ERROR;
- gst_buffer_set_caps (outbuf, self->src_caps);
+ gst_buffer_set_caps (outbuf, GST_PAD_CAPS (self->srcpad));
}
g_return_val_if_fail (self->history_count - 1 -
GST_DEBUG_OBJECT (self, "deinterlacing bottom field");
/* create new buffer */
- ret = gst_pad_alloc_buffer (self->srcpad,
- GST_BUFFER_OFFSET_NONE, self->frame_size, self->src_caps, &outbuf);
+ ret =
+ gst_pad_alloc_buffer (self->srcpad, GST_BUFFER_OFFSET_NONE,
+ self->frame_size, GST_PAD_CAPS (self->srcpad), &outbuf);
if (ret != GST_FLOW_OK)
return ret;
- if (self->src_caps != GST_BUFFER_CAPS (outbuf) &&
- !gst_caps_is_equal (self->src_caps, GST_BUFFER_CAPS (outbuf))) {
+ if (GST_PAD_CAPS (self->srcpad) != GST_BUFFER_CAPS (outbuf)
+ && !gst_caps_is_equal (GST_PAD_CAPS (self->srcpad),
+ GST_BUFFER_CAPS (outbuf))) {
gst_caps_replace (&self->request_caps, GST_BUFFER_CAPS (outbuf));
GST_DEBUG_OBJECT (self, "Upstream wants new caps %" GST_PTR_FORMAT,
self->request_caps);
if (!outbuf)
return GST_FLOW_ERROR;
- gst_buffer_set_caps (outbuf, self->src_caps);
+ gst_buffer_set_caps (outbuf, GST_PAD_CAPS (self->srcpad));
}
g_return_val_if_fail (self->history_count - 1 -
{
gboolean res = TRUE;
GstDeinterlace *self = GST_DEINTERLACE (gst_pad_get_parent (pad));
- GstPad *otherpad;
- GstCaps *othercaps;
-
- otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad;
+ GstCaps *srccaps;
res =
gst_video_format_parse_caps (caps, &self->format, &self->width,
if (!self->passthrough && self->fields == GST_DEINTERLACE_ALL) {
gint fps_n = self->fps_n, fps_d = self->fps_d;
- if (!gst_fraction_double (&fps_n, &fps_d, otherpad != self->srcpad))
+ if (!gst_fraction_double (&fps_n, &fps_d, FALSE))
goto invalid_caps;
- othercaps = gst_caps_copy (caps);
+ srccaps = gst_caps_copy (caps);
- gst_caps_set_simple (othercaps, "framerate", GST_TYPE_FRACTION, fps_n,
+ gst_caps_set_simple (srccaps, "framerate", GST_TYPE_FRACTION, fps_n,
fps_d, NULL);
} else {
- othercaps = gst_caps_ref (caps);
+ srccaps = gst_caps_ref (caps);
}
- if (otherpad == self->srcpad && self->mode != GST_DEINTERLACE_MODE_DISABLED) {
- othercaps = gst_caps_make_writable (othercaps);
- gst_caps_set_simple (othercaps, "interlaced", G_TYPE_BOOLEAN, FALSE, NULL);
+ if (self->mode != GST_DEINTERLACE_MODE_DISABLED) {
+ srccaps = gst_caps_make_writable (srccaps);
+ gst_caps_set_simple (srccaps, "interlaced", G_TYPE_BOOLEAN, FALSE, NULL);
}
gst_deinterlace_reset_history (self, FALSE);
- if (!gst_pad_set_caps (otherpad, othercaps))
+ if (!gst_pad_set_caps (self->srcpad, srccaps))
goto caps_not_accepted;
self->frame_size =
gst_video_format_get_size (self->format, self->width, self->height);
if (G_LIKELY (self->fps_n != 0)) {
- if (self->fields == GST_DEINTERLACE_ALL && otherpad == self->srcpad)
- self->field_duration =
- gst_util_uint64_scale (GST_SECOND, self->fps_d, self->fps_n);
- else
- self->field_duration =
- gst_util_uint64_scale (GST_SECOND, self->fps_d, 2 * self->fps_n);
+ self->field_duration =
+ gst_util_uint64_scale (GST_SECOND, self->fps_d, 2 * self->fps_n);
} else {
self->field_duration = 0;
}
- if (pad == self->sinkpad) {
- gst_caps_replace (&self->sink_caps, caps);
- gst_caps_replace (&self->src_caps, othercaps);
- } else {
- gst_caps_replace (&self->src_caps, caps);
- gst_caps_replace (&self->sink_caps, othercaps);
- }
-
gst_deinterlace_set_method (self, self->method_id);
gst_deinterlace_method_setup (self->method, self->format, self->width,
self->height);
- GST_DEBUG_OBJECT (pad, "Set caps: %" GST_PTR_FORMAT, caps);
- GST_DEBUG_OBJECT (pad, "Other caps: %" GST_PTR_FORMAT, othercaps);
+ GST_DEBUG_OBJECT (pad, "Sink caps: %" GST_PTR_FORMAT, caps);
+ GST_DEBUG_OBJECT (pad, "Src caps: %" GST_PTR_FORMAT, srccaps);
- gst_caps_unref (othercaps);
+ gst_caps_unref (srccaps);
done:
caps_not_accepted:
res = FALSE;
- GST_ERROR_OBJECT (pad, "Caps not accepted: %" GST_PTR_FORMAT, othercaps);
- gst_caps_unref (othercaps);
+ GST_ERROR_OBJECT (pad, "Caps not accepted: %" GST_PTR_FORMAT, srccaps);
+ gst_caps_unref (srccaps);
goto done;
}