Thanks for giving one more way to get sync messages using only one gmainloop.<br><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 8:29 PM, Nicholas Panayis <span dir="ltr"><<a href="mailto:dime@dimebar.f2s.com">dime@dimebar.f2s.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
Why not use:<br>
gst_bus_enable_sync_message_emission(bus);<br>
gst_bus_set_sync_handler(bus, (GstBusSyncHandler) my_sync_handler,<br>
&my_var);<br>
gst_object_unref(bus);<br>
<br>
?<br>
<br>
Dime<br>
<div><div></div><div class="h5"><br>
<br>
Edward Hervey wrote:<br>
> On Wed, 2010-03-24 at 06:29 -0800, wanting2learn wrote:<br>
><br>
>> I have the following code:<br>
>><br>
> [...]<br>
><br>
>> int main()<br>
>> {<br>
>><br>
>> start_pipeline();<br>
>><br>
>> while(1)<br>
>> {<br>
>> //do stuff here<br>
>> }<br>
>><br>
>> //blah blah<br>
>> }<br>
>><br>
>> Now my pipeline runs fine but I have kicked off a new thread to handle the<br>
>> bus messages:<br>
>> boost::thread thread_gstreamer2(task_gstreamer);<br>
>><br>
>> void task_gstreamer()<br>
>> {<br>
>> g_main_loop_run (g_Loop);<br>
>> }<br>
>><br>
>><br>
>> The reason I have added this in a new thread is because of the while(1) loop<br>
>> in my main() function. If I put the g_main_loop_run in my main() before my<br>
>> while(1) loop then it would block.<br>
>> But the problem is that I do not receive any bus messages at all when I<br>
>> implement it like this.<br>
>> Can I do it this way??<br>
>><br>
>><br>
>><br>
><br>
> I don't get it... why are you asking again and again about the same<br>
> question ? Tim replied to you a week ago how to handle bus messages when<br>
> you already have a main loop yet your persist in wanting to add a<br>
> GMainLoop.<br>
><br>
> So, to summarize:<br>
> 1) DO NOT USE GMAINLOOP IF YOU ALREADY HAVE A MAIN LOOP<br>
> 2) Read 1) again at least 50 times times<br>
> 3) Do as follow in your main()<br>
><br>
> int main()<br>
> {<br>
><br>
> start_pipeline();<br>
><br>
> while(1)<br>
> {<br>
> // Do stuff here<br>
> // See if we have pending messages on the bus and handle them<br>
> while ((msg = gst_bus_pop (g_bus))) {<br>
> // Call your bus message handler<br>
> bus_call (g_bus, msg, nada);<br>
> gst_message_unref (msg);<br>
> }<br>
> }<br>
><br>
> // Stuff before we exit the application<br>
> }<br>
><br>
> 4) DO NOT USE GMAINLOOP IF YOU ALREADY HAVE A MAIN LOOP<br>
><br>
> Also : <a href="http://en.wikipedia.org/wiki/Event_loop" target="_blank">http://en.wikipedia.org/wiki/Event_loop</a> will be an interesting<br>
> read if you still see a difference between GMainLoop and "Main Loop"<br>
><br>
> Now, start2digest<br>
><br>
> Edward<br>
><br>
><br>
> ------------------------------------------------------------------------------<br>
> Download Intel&#174; Parallel Studio Eval<br>
> Try the new software tools for yourself. Speed compiling, find bugs<br>
> proactively, and fine-tune applications for parallel performance.<br>
> See why Intel Parallel Studio got high marks during beta.<br>
> <a href="http://p.sf.net/sfu/intel-sw-dev" target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
><br>
><br>
<br>
<br>
------------------------------------------------------------------------------<br>
Download Intel&#174; Parallel Studio Eval<br>
Try the new software tools for yourself. Speed compiling, find bugs<br>
proactively, and fine-tune applications for parallel performance.<br>
See why Intel Parallel Studio got high marks during beta.<br>
<a href="http://p.sf.net/sfu/intel-sw-dev" target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br>