Re: gstmm add element to pipeline test



On Tue, 2007-12-04 at 13:07 -0500, José Alburquerque wrote:
> Murray Cumming wrote:
> > On Tue, 2007-12-04 at 12:38 -0500, José Alburquerque wrote:
> > [snip]
> > The gst_bus_add_signal_watch() call sort of 
> >   
> >> "enables" the "message" signal of  Gst::Bus 
> >> (see gst_bus_add_signal_watch 
> >> <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-add-signal-watch>) 
> >> (I'll add a comment as you say).  Without the call, the "message" signal 
> >> of the bus is never emitted so this call is necessary (I guess).
> >>     
> > [snip]
> >
> > Why is this not the default for GstPipeline in C? Why would we make it the default in C++?
> >
> > [snip]
> >   
> 
> I see what you're saying.  By default, it looks like the message signal 
> is not emitted in C.  The reason I thought we would needed in C++ is the 
> following:  The C code for getting messages from a GstBus appears below 
> (taken from GADM 10 
> <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-helloworld.html>):
> 
>   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>   gst_bus_add_watch (bus, bus_call, loop);
>   gst_object_unref (bus);
> 
> As you can see gst_add_watch 
> <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-add-watch>() 
> takes a GstBus*, a GstBusFunc 
> <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#GstBusFunc> 
> (a function pointer) and additional data.  As the main loop executes, 
> when a message is received on the bus, the GstBusFunc (in this case 
> bus_call) is called in this way.  My question would be:  How would we do 
> this in C++?  I'm pretty new to gstreamer and wrapping so I'm sure 
> missing something, but this is why I thought that it might be necessary 
> to enable the "message" signal for C++.  This way, the parallel C++ code 
> for the above would like like:
> 
>   RefPtr<Bus> bus = pipeline->get_bus();
>   bus->signal_message().connect(sigc::bind< RefPtr<MainLoop> >(
>     sigc::ptr_fun(&bus_message_received), mainLoop) );
> 
> 
> At any rate, I'm sure you might have better suggestions. :-)  Thanks.

I think we should do this in C++ much as it is done in C:
- We should have an add_watch(priority) that just causes the signal to
be emitted.
and
- We should have an add_watch(slot) that provides a sigc::slot that is
called. We have lots of these set_func(slot)-like functions in gtkmm.

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



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