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">&lt;<a href="mailto:dime@dimebar.f2s.com">dime@dimebar.f2s.com</a>&gt;</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>
&amp;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>
&gt; On Wed, 2010-03-24 at 06:29 -0800, wanting2learn wrote:<br>
&gt;<br>
&gt;&gt; I have the following code:<br>
&gt;&gt;<br>
&gt; [...]<br>
&gt;<br>
&gt;&gt; int main()<br>
&gt;&gt; {<br>
&gt;&gt;<br>
&gt;&gt;      start_pipeline();<br>
&gt;&gt;<br>
&gt;&gt;      while(1)<br>
&gt;&gt;      {<br>
&gt;&gt;         //do stuff here<br>
&gt;&gt;      }<br>
&gt;&gt;<br>
&gt;&gt;      //blah blah<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt; Now my pipeline runs fine but I have kicked off a new thread to handle the<br>
&gt;&gt; bus messages:<br>
&gt;&gt; boost::thread thread_gstreamer2(task_gstreamer);<br>
&gt;&gt;<br>
&gt;&gt; void task_gstreamer()<br>
&gt;&gt; {<br>
&gt;&gt;    g_main_loop_run (g_Loop);<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; The reason I have added this in a new thread is because of the while(1) loop<br>
&gt;&gt; in my main() function.  If I put the g_main_loop_run in my main() before my<br>
&gt;&gt; while(1) loop then it would block.<br>
&gt;&gt; But the problem is that I do not receive any bus messages at all when I<br>
&gt;&gt; implement it like this.<br>
&gt;&gt; Can I do it this way??<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;  I don&#39;t get it... why are you asking again and again about the same<br>
&gt; question ? Tim replied to you a week ago how to handle bus messages when<br>
&gt; you already have a main loop yet your persist in wanting to add a<br>
&gt; GMainLoop.<br>
&gt;<br>
&gt;   So, to summarize:<br>
&gt;   1) DO NOT USE GMAINLOOP IF YOU ALREADY HAVE A MAIN LOOP<br>
&gt;   2) Read 1) again at least 50 times times<br>
&gt;   3) Do as follow in your main()<br>
&gt;<br>
&gt; int main()<br>
&gt; {<br>
&gt;<br>
&gt;      start_pipeline();<br>
&gt;<br>
&gt;      while(1)<br>
&gt;      {<br>
&gt;         // Do stuff here<br>
&gt;         // See if we have pending messages on the bus and handle them<br>
&gt;         while ((msg = gst_bus_pop (g_bus))) {<br>
&gt;           // Call your bus message handler<br>
&gt;           bus_call (g_bus, msg, nada);<br>
&gt;           gst_message_unref (msg);<br>
&gt;         }<br>
&gt;      }<br>
&gt;<br>
&gt;      // Stuff before we exit the application<br>
&gt; }<br>
&gt;<br>
&gt;   4) DO NOT USE GMAINLOOP IF YOU ALREADY HAVE A MAIN LOOP<br>
&gt;<br>
&gt; 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>
&gt; read if you still see a difference between GMainLoop and &quot;Main Loop&quot;<br>
&gt;<br>
&gt;    Now, start2digest<br>
&gt;<br>
&gt;     Edward<br>
&gt;<br>
&gt;<br>
&gt; ------------------------------------------------------------------------------<br>
&gt; Download Intel&amp;#174; Parallel Studio Eval<br>
&gt; Try the new software tools for yourself. Speed compiling, find bugs<br>
&gt; proactively, and fine-tune applications for parallel performance.<br>
&gt; See why Intel Parallel Studio got high marks during beta.<br>
&gt; <a href="http://p.sf.net/sfu/intel-sw-dev" target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>
&gt; _______________________________________________<br>
&gt; gstreamer-devel mailing list<br>
&gt; <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
&gt; <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
------------------------------------------------------------------------------<br>
Download Intel&amp;#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>