static gboolean gst_udpsrc_close (GstUDPSrc * src);
static gboolean gst_udpsrc_unlock (GstBaseSrc * bsrc);
static gboolean gst_udpsrc_unlock_stop (GstBaseSrc * bsrc);
+static gboolean gst_udpsrc_negotiate (GstBaseSrc * basesrc);
static void gst_udpsrc_finalize (GObject * object);
gstbasesrc_class->unlock = gst_udpsrc_unlock;
gstbasesrc_class->unlock_stop = gst_udpsrc_unlock_stop;
gstbasesrc_class->get_caps = gst_udpsrc_getcaps;
+ gstbasesrc_class->negotiate = gst_udpsrc_negotiate;
gstpushsrc_class->create = gst_udpsrc_create;
}
return result;
}
+static gboolean
+gst_udpsrc_negotiate (GstBaseSrc * basesrc)
+{
+ gboolean ret;
+
+ /* just chain up to the default implementation, we just want to
+ * retrieve the allocator at the end of it (if there is one) */
+ ret = GST_BASE_SRC_CLASS (parent_class)->negotiate (basesrc);
+
+ if (ret) {
+ GstUDPSrc *src;
+
+ src = GST_UDPSRC (basesrc);
+
+ if (src->allocator != NULL) {
+ gst_object_unref (src->allocator);
+ src->allocator = NULL;
+ }
+
+ gst_base_src_get_allocator (basesrc, &src->allocator, &src->params);
+ GST_INFO_OBJECT (src, "allocator: %" GST_PTR_FORMAT, src->allocator);
+ }
+
+ return ret;
+}
+
static GstFlowReturn
gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
{
goto receive_error;
}
+ /* remember maximum packet size */
+ if (res > udpsrc->max_size)
+ udpsrc->max_size = res;
+
/* patch offset and size when stripping off the headers */
if (G_UNLIKELY (udpsrc->skip_first_bytes != 0)) {
if (G_UNLIKELY (readsize < udpsrc->skip_first_bytes))
g_object_unref (addr);
}
+ src->allocator = NULL;
+ gst_allocation_params_init (&src->params);
+
+ src->max_size = 0;
+
return TRUE;
/* ERRORS */
src->addr = NULL;
}
+ if (src->allocator != NULL) {
+ gst_object_unref (src->allocator);
+ src->allocator = NULL;
+ }
+
return TRUE;
}
gboolean auto_multicast;
gboolean reuse;
+ /* stats */
+ guint max_size;
+
/* our sockets */
GSocket *used_socket;
GCancellable *cancellable;
GInetSocketAddress *addr;
gboolean external_socket;
+ /* memory management */
+ GstAllocator *allocator;
+ GstAllocationParams params;
+
gchar *uri;
};