gst_pad_template_new() does more than call g_object_new()



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.

--
José Alburquerque

"Love is patient; it is kind; love does not envy; it does not parade itself (it is not puffed up); it does not behave unseemly; it does not seek its own things..." -- The Apostle Paul (1 Cor. 13:4, 5)

"He who is not loving has not known God, because God is love." -- The Apostle John (1 John 4:8)



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