From 4440801ace8533d7e6a092c10ff974b2abf1065c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 15 Jul 2011 16:55:50 +0200 Subject: [PATCH] v4l2: implement setup_allocation Implement the setup_allocation vmethod, we'll hopefully do something clever in there later. --- sys/v4l2/gstv4l2src.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index dac2d6a711..d4e159bafc 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -121,6 +121,8 @@ static gboolean gst_v4l2src_stop (GstBaseSrc * src); static gboolean gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps); static GstCaps *gst_v4l2src_get_caps (GstBaseSrc * src, GstCaps * filter); static gboolean gst_v4l2src_query (GstBaseSrc * bsrc, GstQuery * query); +static gboolean gst_v4l2src_setup_allocation (GstBaseSrc * src, + GstQuery * query); static GstFlowReturn gst_v4l2src_create (GstPushSrc * src, GstBuffer ** out); static void gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps); static gboolean gst_v4l2src_negotiate (GstBaseSrc * basesrc); @@ -193,6 +195,8 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass) basesrc_class->query = GST_DEBUG_FUNCPTR (gst_v4l2src_query); basesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_v4l2src_fixate); basesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_v4l2src_negotiate); + basesrc_class->setup_allocation = + GST_DEBUG_FUNCPTR (gst_v4l2src_setup_allocation); pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_v4l2src_create); @@ -530,11 +534,30 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps) return TRUE; } +static gboolean +gst_v4l2src_setup_allocation (GstBaseSrc * bsrc, GstQuery * query) +{ + GstV4l2Src *src; + GstBufferPool *pool; + guint size, min, max, prefix, alignment; + + src = GST_V4L2SRC (bsrc); + + gst_query_parse_allocation_params (query, &size, &min, &max, &prefix, + &alignment, &pool); + + /* do something clever here */ + + gst_query_set_allocation_params (query, size, min, max, prefix, + alignment, pool); + + return TRUE; +} + static gboolean gst_v4l2src_query (GstBaseSrc * bsrc, GstQuery * query) { GstV4l2Src *src; - gboolean res = FALSE; src = GST_V4L2SRC (bsrc);