Re: gst_pad_template_new() does more than call g_object_new()



On Sun, 2008-06-22 at 21:56 -0400, José Alburquerque wrote:
> I'm wondering: I'm reviewing the pad wrapping of gstreamermm (Pad, 
> GhostPad, and PadTemplate) and noticed that gst_pad_template_new() does 
> a few more things than just calling g_object_new().  I also noticed that 
> its parameters don't correspond to the construction properties used in 
> the call to g_object_new().  This is the code:
> 
> GstPadTemplate *
> gst_pad_template_new (const gchar * name_template,
>     GstPadDirection direction, GstPadPresence presence, GstCaps * caps)
> {
>   GstPadTemplate *new;
> 
>   g_return_val_if_fail (name_template != NULL, NULL);
>   g_return_val_if_fail (caps != NULL, NULL);
>   g_return_val_if_fail (direction == GST_PAD_SRC
>       || direction == GST_PAD_SINK, NULL);
>   g_return_val_if_fail (presence == GST_PAD_ALWAYS
>       || presence == GST_PAD_SOMETIMES || presence == GST_PAD_REQUEST, 
> NULL);
> 
>   if (!name_is_valid (name_template, presence)) {
>     gst_caps_unref (caps);
>     return NULL;
>   }
> 
>   new = g_object_new (gst_pad_template_get_type (),
>       "name", name_template, NULL);
> 
>   GST_PAD_TEMPLATE_NAME_TEMPLATE (new) = g_strdup (name_template);
>   GST_PAD_TEMPLATE_DIRECTION (new) = direction;
>   GST_PAD_TEMPLATE_PRESENCE (new) = presence;
>   GST_PAD_TEMPLATE_CAPS (new) = caps;
> 
>   return new;
> }
> 
> I guess this would be a bug.

Yes, it's a bug in the C API:
http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-wrapping-problems.html#wrapping-no-properties

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]