gst_bus_add_watch not calling buscall function (Qt integrated)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

gst_bus_add_watch not calling buscall function (Qt integrated)

deeps8us
This post was updated on .
Hi all,

I have implemented a code on which gst_bus_add_watch should call busCall function. I dont get any error; but prints from my  busCall is not coming. Any help.?

bus_Call calling code:
void CGStreamerBus::watch(Item *item)
{
    GstBus *bin_bus = gst_pipeline_get_bus(GST_PIPELINE(item->getPipeline()));

    gst_bus_add_watch(bin_bus, bus_Call, item);

    gst_object_unref(bin_bus);

}

bus_Call implementation:

gboolean
bus_Call(GstBus      *bus,
        GstMessage  *msg,
        gpointer    data)
{
printf("\n * In buscall * \n");
.....

}

I am not getting print "* In buscall *" . I get prints both above and below gst_bus_add_watch. What could be wrong?  This is QT integrated Gstreamer code. The watch function  is actually a slot which gets called when an 'emit watch' is done.
Reply | Threaded
Open this post in threaded view
|

Re: gst_bus_add_watch not calling buscall function

Tim-Philipp Müller-2
On Wed, 2012-11-14 at 01:25 -0800, deepthips wrote:

Hi,

> I have implemented a code on which gst_bus_add_watch should call busCall
> function. I dont get any error; but prints from my  busCall is not coming.
> Any help.?
>  (snip code)
> I am not getting print "* /In buscall /*" . I get prints both above and
> below /gst_bus_add_watch/. What could be wrong?  

Are you running a GLib/Gtk+ main loop ?

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst_bus_add_watch not calling buscall function

deeps8us
I am not sure.. Using 'gst_bus_set_sync_handler' instead of  'gst_bus_add_watch' solved the problem. Some kind of sync issue I guess.
Reply | Threaded
Open this post in threaded view
|

Re: gst_bus_add_watch not calling buscall function

Tim-Philipp Müller-2
On Wed, 2012-11-14 at 03:30 -0800, deepthips wrote:

> I am not sure

If you're not sure, you're probably not running a main loop.

The GstBus watch functionality requires a running GLib main loop.

> Using 'gst_bus_set_sync_handler' instead of 'gst_bus_add_watch'
> solved the problem. Some kind of sync issue I guess.

This means the handler will be called from the thread that posts the
message, which is not what you want for a normal bus handler, and
there's a lot of things you can't do from those threads.

If you don't run a main loop, you can periodically check for messages on
the bus using gst_bus_pop() and friends. The important thing is to do
this from the application thread.

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst_bus_add_watch not calling buscall function

deeps8us
Thanks Tim..