Re: Fixing the Gst::Message classes



On Sun, 2007-12-09 at 00:58 -0500, José Alburquerque wrote:
> Hi.  I'm thinking of working on the Gst::Message class in such a way so 
> that when messages are sent out to the Gst::Bus they are the right type 
> (e.g. Gst::MessageError when an error occurs instead of just a 
> Gst::Message).  I'm looking at things and see that Gst::Message should 
> inherit from Gst::MiniObject (see 
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#GstMessage).  
> I made a small change to message.hg and miniobject.h which makes 
> Gst::Message inherit from Gst::MiniObject just fine (which I'm 
> attaching), I'm just not sure if it's the best change.  I'm noticing 
> that both Gst::MiniObject and Gst::Message both now have 
> reference()/unreference() methods, but Gst::Message can use the 
> Gst::MiniObject methods without having to implement its own (in fact, 
> the gst_message_{ref,unref} are actually macros calling 
> gst_mini_object_{ref,unref} respectively).

Yes, I don't see any great need to have referenc() and unreference() in
Gst::Message, as long as the C implemenatation is like this:

static inline GstMessage *
gst_message_ref (GstMessage * msg)
{
  /* not using a macro here because gcc-4.1 will complain
   * if the return value isn't used (because of the cast) */
  return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT (msg));
}

> I was thinking of changing the "_CLASS_OPAQUE_REFCOUNTED(Message, 
> GstMessage, NONE, gst_message_ref, gst_message_unref)" line in 
> message.hg to something like "_CLASS_GOBJECT(Message, GstMessage, 
> GST_MESSAGE, Gst::MiniObject, GstMiniObject)".  Is this a good 
> approach?

GstMiniObject doesn't derived from GObject, right? So I don't think it
would be a good idea to use _CLASS_GOBJECT().

I'm afraid that we might need a new macro, but you might try using
_CLASS_GENERIC() to see how far that gets us.

I will take care of this if it does turn out to be difficult.

>   I suspect that miniobject.{h,cc} will probably have to change 
> some also, but I just want to get a sense as to where to begin or if I'm 
> not going about things the right way.  BTW, is this the right place/way 
> to ask these questions?  Thanks.

Yes, I don't know of any better place.

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



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