return res;
}
-/* FIXME: buffer alloc */
-#if 0
-static GstFlowReturn
-gst_deinterlace_alloc_buffer (GstPad * pad, guint64 offset, guint size,
- GstCaps * caps, GstBuffer ** buf)
-{
- GstDeinterlace *self = GST_DEINTERLACE (gst_pad_get_parent (pad));
- GstFlowReturn ret = GST_FLOW_OK;
-
- *buf = NULL;
-
- GST_DEBUG_OBJECT (pad, "alloc with caps %" GST_PTR_FORMAT ", size %u", caps,
- size);
-
- if (self->still_frame_mode || self->passthrough) {
- ret = gst_pad_alloc_buffer (self->srcpad, offset, size, caps, buf);
- } else if (G_LIKELY (!self->request_caps)) {
- *buf = gst_buffer_try_new_and_alloc (size);
- if (G_UNLIKELY (!*buf)) {
- ret = GST_FLOW_ERROR;
- } else {
- gst_buffer_set_caps (*buf, caps);
- GST_BUFFER_OFFSET (*buf) = offset;
- }
- } else {
- gint width, height;
- GstVideoFormat fmt;
- guint new_frame_size;
- GstCaps *new_caps = gst_caps_copy (self->request_caps);
-
- if (self->fields == GST_DEINTERLACE_ALL) {
- gint n, d;
- GstStructure *s = gst_caps_get_structure (new_caps, 0);
-
- gst_structure_get_fraction (s, "framerate", &n, &d);
-
- if (!gst_fraction_double (&n, &d, TRUE)) {
- gst_object_unref (self);
- gst_caps_unref (new_caps);
- return GST_FLOW_OK;
- }
-
- gst_structure_set (s, "framerate", GST_TYPE_FRACTION, n, d, NULL);
- }
-
- if (G_UNLIKELY (!gst_video_format_parse_caps (new_caps, &fmt, &width,
- &height))) {
- gst_object_unref (self);
- gst_caps_unref (new_caps);
- return GST_FLOW_OK;
- }
-
- new_frame_size = gst_video_format_get_size (fmt, width, height);
-
- *buf = gst_buffer_try_new_and_alloc (new_frame_size);
- if (G_UNLIKELY (!*buf)) {
- ret = GST_FLOW_ERROR;
- } else {
- gst_buffer_set_caps (*buf, new_caps);
- gst_caps_unref (self->request_caps);
- self->request_caps = NULL;
- gst_caps_unref (new_caps);
- }
- }
-
- gst_object_unref (self);
-
- return ret;
-}
-#endif
-
static gboolean
plugin_init (GstPlugin * plugin)
{