[gst-cvs] CVS: gst-plugins/gst/volenv gstvolenv.c,1.2,1.3

Wim Taymans wtay at users.sourceforge.net
Sun Jan 13 14:28:32 PST 2002


Update of /cvsroot/gstreamer/gst-plugins/gst/volenv
In directory usw-pr-cvs1:/tmp/cvs-serv5981/gst/volenv

Modified Files:
	gstvolenv.c 
Log Message:
Bring the plugins in sync with the new core capsnego system.
Added some features, enhancements...


Index: gstvolenv.c
===================================================================
RCS file: /cvsroot/gstreamer/gst-plugins/gst/volenv/gstvolenv.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gstvolenv.c	2001/12/26 06:49:47	1.2
+++ gstvolenv.c	2002/01/13 22:27:25	1.3
@@ -91,10 +91,13 @@
 static void		gst_volenv_class_init		(GstVolEnvClass *klass);
 static void		gst_volenv_init			(GstVolEnv *filter);
 
-static void		gst_volenv_set_property		(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void		gst_volenv_get_property		(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void		gst_volenv_set_property		(GObject *object, guint prop_id, 
+							 const GValue *value, GParamSpec *pspec);
+static void		gst_volenv_get_property		(GObject *object, guint prop_id, 
+							 GValue *value, GParamSpec *pspec);
 
-static void		volenv_newcaps 			(GstPad *pad, GstCaps *caps);
+static GstPadConnectReturn
+			volenv_sinkconnect 		(GstPad *pad, GstCaps *caps);
 
 static void		gst_volenv_chain		(GstPad *pad, GstBuffer *buf);
 static void inline 	gst_volenv_fast_16bit_chain 	(gint16* data, gint16** out_data, 
@@ -107,27 +110,19 @@
 static GstElementClass *parent_class = NULL;
 //static guint gst_filter_signals[LAST_SIGNAL] = { 0 };
 
-static GstPadNegotiateReturn
-volenv_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
+static GstPadConnectReturn
+volenv_proxy_connection (GstPad *pad, GstCaps *caps)
 {
   GstVolEnv* filter = GST_VOLENV (gst_pad_get_parent (pad));
-  
-  if (*caps==NULL) 
-    return GST_PAD_NEGOTIATE_FAIL;
-  
-  return gst_pad_negotiate_proxy(pad,filter->sinkpad,caps);
-}
+  GstPad *otherpad;
+      
+  if (pad == filter->srcpad) 
+    otherpad = filter->sinkpad;
+  else
+    otherpad = filter->srcpad;
 
-static GstPadNegotiateReturn
-volenv_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
-{
-  GstVolEnv* filter = GST_VOLENV (gst_pad_get_parent (pad));
-  
-  if (*caps==NULL) 
-    return GST_PAD_NEGOTIATE_FAIL;
-  
-  return gst_pad_negotiate_proxy(pad,filter->srcpad,caps);
-}		
+  return gst_pad_proxy_connect (otherpad, caps);
+}
 
 GType
 gst_volenv_get_type(void) {
@@ -188,9 +183,9 @@
   filter->next_cp = filter->envelope;
   filter->envelope_active = FALSE;
 
-  gst_pad_set_negotiate_function(filter->sinkpad,volenv_negotiate_sink);
-  gst_pad_set_negotiate_function(filter->srcpad,volenv_negotiate_src);
-  gst_pad_set_newcaps_function (filter->sinkpad, volenv_newcaps);
+  //gst_pad_set_negotiate_function(filter->sinkpad,volenv_negotiate_sink);
+  //gst_pad_set_negotiate_function(filter->srcpad,volenv_negotiate_src);
+  gst_pad_set_connect_function (filter->sinkpad, volenv_sinkconnect);
 
   gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
   gst_pad_set_chain_function(filter->sinkpad,gst_volenv_chain);
@@ -413,8 +408,8 @@
   plugin_init
 };
 
-static void
-volenv_newcaps (GstPad *pad, GstCaps *caps)
+static GstPadConnectReturn
+volenv_sinkconnect (GstPad *pad, GstCaps *caps)
 {
   GstVolEnv *filter;
 //  guint rate;
@@ -425,8 +420,10 @@
   filter->rate = rate;
 */
   /* the first calculated rise (between pt1 and pt2) can be set now */
-  GST_DEBUG (MSG_E_IDX, "newcaps : setting rise to %e\n", filter->rise);
+  GST_DEBUG (MSG_E_IDX, "sinkconnect : setting rise to %e\n", filter->rise);
   g_object_set(G_OBJECT(filter), "rise", filter->rise, NULL);
+
+  return GST_PAD_CONNECT_OK;
 
 }
 





More information about the Gstreamer-commits mailing list