[gst-devel] Re: [gst-cvs] rbultje gstreamer: gstreamer/gst/ gstreamer/gst/elements/ gstreamer/testsuite/elements/

Thomas Vander Stichele thomas at urgent.rug.ac.be
Tue Sep 10 03:32:02 CEST 2002


> CVS Root:       /cvsroot/gstreamer
> Module:         gstreamer
> Changes by:     rbultje
> Date:           Tue Sep 10 2002  01:53:11 PDT
> 
> Log message:
> This changes an important part of the plugin API, gst_pad_try_set_caps() no longer returns a boolean, it now returns a GstPadConnectReturn, which makes much more sense than a boolean. All plugins have also been changed, so don't worry ;)

Hm, I have a few questions re: this change.  I might have some things 
wrong so feel free to explain to me if I am ;)

First of all, it seems to mix stuff from the pads with stuff from the 
caps.  Should a _caps function return a pad return value ?

Second, the fixes to the plug-ins all depend on the numerical value of the
current GstPadConnectReturn enum, which I think is a bad idea.
First of all, the tests lose real-world meaning - I think they should at 
least be done with the actual enum names.  I'd rather not even be them
inequality comparisons but actual comparisons with or.

Third, while the idea itself looks valid to change this, is there an 
actual need for it ? I don't like changing the API at all when going to 
0.4.0 to 0.4.1 unless it's been discussed and it has shown to be a 
problem.  I had hoped this to be mainly a bugfix release.
(If it does fix a valid problem, however, it should of course be 
considered).

Basically, I'm saying a change this big makes me feel uneasy about doing a 
release in three days time ;) I'd like some more explanations on the 
patch, and at least have it look better than it does now.

Thomas

 > > Modified files:
>     gst             : gstpad.c gstpad.h gsttypefind.c
>     gst/elements    : gstidentity.c gsttee.c
>     testsuite/elements: tee.c
> 
> Links:
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstpad.c.diff?r1=1.178&r2=1.179
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstpad.h.diff?r1=1.97&r2=1.98
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gsttypefind.c.diff?r1=1.25&r2=1.26
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/elements/gstidentity.c.diff?r1=1.33&r2=1.34
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/elements/gsttee.c.diff?r1=1.23&r2=1.24
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/testsuite/elements/tee.c.diff?r1=1.11&r2=1.12
> 
> ====Begin Diffs====
> Index: gstpad.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gstpad.c,v
> retrieving revision 1.178
> retrieving revision 1.179
> diff -u -d -r1.178 -r1.179
> --- gstpad.c	8 Sep 2002 18:27:35 -0000	1.178
> +++ gstpad.c	10 Sep 2002 08:52:57 -0000	1.179
> @@ -1337,12 +1337,14 @@
>   *
>   * Tries to set the caps on the given pad.
>   *
> - * Returns: TRUE if the caps could be set, FALSE otherwise.
> + * Returns: A GstPadConnectReturn value indicating whether the caps
> + * 		could be set.
>   */
> -gboolean
> +GstPadConnectReturn
>  gst_pad_try_set_caps (GstPad *pad, GstCaps *caps)
>  {
>    GstRealPad *peer, *realpad;
> +  GstPadConnectReturn set_retval;
>  
>    realpad = GST_PAD_REALIZE (pad);
>    peer = GST_RPAD_PEER (realpad);
> @@ -1360,30 +1362,30 @@
>      g_warning ("trying to set non fixed caps on pad %s:%s, not allowed",
>                 GST_DEBUG_PAD_NAME (realpad));
>      gst_caps_debug (caps, "unfixed caps");
> -    return FALSE;
> +    return GST_PAD_CONNECT_DELAYED;
>    }
>  
>    /* if we have a peer try to set the caps, notifying the peerpad
>     * if it has a connect function */
> -  if (peer && (gst_pad_try_set_caps_func (peer, caps, TRUE) != GST_PAD_CONNECT_OK))
> +  if (peer && ((set_retval = gst_pad_try_set_caps_func (peer, caps, TRUE)) <= 0))
>    {
> -    GST_INFO (GST_CAT_CAPS, "tried to set caps on peerpad %s:%s but couldn't",
> -	      GST_DEBUG_PAD_NAME (peer));
> -    return FALSE;
> +    GST_INFO (GST_CAT_CAPS, "tried to set caps on peerpad %s:%s but couldn't, return value %d",
> +	      GST_DEBUG_PAD_NAME (peer), set_retval);
> +    return set_retval;
>    }
>  
>    /* then try to set our own caps, we don't need to be notified */
> -  if (gst_pad_try_set_caps_func (realpad, caps, FALSE) != GST_PAD_CONNECT_OK)
> +  if ((set_retval = gst_pad_try_set_caps_func (realpad, caps, FALSE)) <= 0)
>    {
> -    GST_INFO (GST_CAT_CAPS, "tried to set own caps on pad %s:%s but couldn't",
> -	      GST_DEBUG_PAD_NAME (realpad));
> -    return FALSE;
> +    GST_INFO (GST_CAT_CAPS, "tried to set own caps on pad %s:%s but couldn't, return value %d",
> +	      GST_DEBUG_PAD_NAME (realpad), set_retval);
> +    return set_retval;
>    }
> -  GST_INFO (GST_CAT_CAPS, "succeeded setting caps %p on pad %s:%s",
> -	    caps, GST_DEBUG_PAD_NAME (realpad));
> +  GST_INFO (GST_CAT_CAPS, "succeeded setting caps %p on pad %s:%s, return value %d",
> +	    caps, GST_DEBUG_PAD_NAME (realpad), set_retval);
>    g_assert (GST_PAD_CAPS (pad));
>  			  
> -  return TRUE;
> +  return set_retval;
>  }
>  
>  /* this is a caps negotiation convenience routine, it:
> Index: gstpad.h
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gstpad.h,v
> retrieving revision 1.97
> retrieving revision 1.98
> diff -u -d -r1.97 -r1.98
> --- gstpad.h	1 Sep 2002 21:11:18 -0000	1.97
> +++ gstpad.h	10 Sep 2002 08:52:57 -0000	1.98
> @@ -430,7 +430,7 @@
>  /* capsnego functions */
>  GstCaps*		gst_pad_get_caps			(GstPad *pad);
>  GstCaps*		gst_pad_get_pad_template_caps		(GstPad *pad);
> -gboolean		gst_pad_try_set_caps			(GstPad *pad, GstCaps *caps);
> +GstPadConnectReturn	gst_pad_try_set_caps			(GstPad *pad, GstCaps *caps);
>  gboolean		gst_pad_check_compatibility		(GstPad *srcpad, GstPad *sinkpad);
>  
>  void			gst_pad_set_getcaps_function		(GstPad *pad, GstPadGetCapsFunction getcaps);
> Index: gsttypefind.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gsttypefind.c,v
> retrieving revision 1.25
> retrieving revision 1.26
> diff -u -d -r1.25 -r1.26
> --- gsttypefind.c	8 Jul 2002 19:07:29 -0000	1.25
> +++ gsttypefind.c	10 Sep 2002 08:52:57 -0000	1.26
> @@ -188,7 +188,7 @@
>  			gst_caps_get_name (caps));
>  	typefind->caps = caps;
>  
> -	if (!gst_pad_try_set_caps (pad, caps)) {
> +	if (gst_pad_try_set_caps (pad, caps) <= 0) {
>            g_warning ("typefind: found type but peer didn't accept it");
>  	}
>  
> Index: gstidentity.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/elements/gstidentity.c,v
> retrieving revision 1.33
> retrieving revision 1.34
> diff -u -d -r1.33 -r1.34
> --- gstidentity.c	8 Sep 2002 18:27:36 -0000	1.33
> +++ gstidentity.c	10 Sep 2002 08:52:58 -0000	1.34
> @@ -163,10 +163,7 @@
>    otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
>  
>    if (GST_CAPS_IS_FIXED (caps))
> -    if (gst_pad_try_set_caps (otherpad, caps))
> -      return GST_PAD_CONNECT_OK;
> -    else
> -      return GST_PAD_CONNECT_REFUSED;
> +    return gst_pad_try_set_caps (otherpad, caps);
>    else
>      return GST_PAD_CONNECT_DELAYED;
>  }
> Index: gsttee.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/elements/gsttee.c,v
> retrieving revision 1.23
> retrieving revision 1.24
> diff -u -d -r1.23 -r1.24
> --- gsttee.c	24 Jul 2002 21:08:43 -0000	1.23
> +++ gsttee.c	10 Sep 2002 08:52:58 -0000	1.24
> @@ -123,6 +123,7 @@
>  {
>    GstTee *tee;
>    GList *pads;
> +  GstPadConnectReturn set_retval;
>    
>    tee = GST_TEE (gst_pad_get_parent (pad));
>  
> @@ -140,8 +141,8 @@
>      if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC || !GST_PAD_IS_USABLE (outpad))
>        continue;
>  
> -    if (!(gst_pad_try_set_caps (outpad, caps))) {
> -      return GST_PAD_CONNECT_REFUSED;
> +    if ((set_retval = gst_pad_try_set_caps (outpad, caps)) <= 0) {
> +      return set_retval;
>      }
>    }
>    return GST_PAD_CONNECT_OK;
> Index: tee.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/testsuite/elements/tee.c,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -d -r1.11 -r1.12
> --- tee.c	9 May 2002 16:44:22 -0000	1.11
> +++ tee.c	10 Sep 2002 08:52:58 -0000	1.12
> @@ -109,7 +109,7 @@
>    g_assert (src_caps != NULL);
>    g_print ("Setting caps on fakesrc's src pad\n");
>    pad = gst_element_get_pad (src, "src");
> -  if (! (gst_pad_try_set_caps (pad, src_caps)))
> +  if ((gst_pad_try_set_caps (pad, src_caps)) <= 0)
>    {
>      g_print ("Could not set caps !\n");
>    }
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone?  Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> _______________________________________________
> gstreamer-cvs-verbose mailing list
> gstreamer-cvs-verbose at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose
> 

-- 

The Dave/Dina Project : future TV today ! - http://davedina.apestaart.org/
<-*-                      -*->
If I'd rain for you
It would just be water
<-*- thomas at apestaart.org -*->
URGent, the best radio on the Internet - 24/7 ! - http://urgent.rug.ac.be/





More information about the gstreamer-devel mailing list