<font size="2"><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"></font><div style="font-family: arial,helvetica,sans-serif;" class="gmail_quote"><font size="2">2010/11/18 Sebastian Dröge <span dir="ltr"><<a href="mailto:sebastian.droege@collabora.co.uk">sebastian.droege@collabora.co.uk</a>></span><br>
</font><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div class="h5"><font size="2">On Thu, 2010-11-18 at 11:51 -0200, Tiago Katcipis wrote:<br>
><br>
><br>
> 2010/11/18 Sebastian Dröge <<a href="mailto:sebastian.droege@collabora.co.uk">sebastian.droege@collabora.co.uk</a>><br>
> On Thu, 2010-11-18 at 10:07 -0200, Tiago Katcipis wrote:<br>
> ><br>
> ><br>
> > On Tue, Nov 16, 2010 at 6:28 PM, David Schleef<br>
> <<a href="mailto:ds@entropywave.com">ds@entropywave.com</a>><br>
> > wrote:<br>
> > On Tue, Nov 16, 2010 at 10:28:23AM -0200, Tiago<br>
> Katcipis<br>
> > wrote:<br>
> > > but to make use of the async API it is needed a<br>
> GMainLoop,<br>
> > and there is the<br>
> > > problem :-), gst plugins are not aware if there is<br>
> a main<br>
> > loop running, it<br>
> > > is not mandatory.<br>
> ><br>
> > Elements that require a GMainLoop create a thread<br>
> and run a<br>
> > GMainLoop<br>
> > there. One example is souphttpsrc.<br>
> ><br>
><br>
> > That approach doesn't bring the same hazards of<br>
> gst_bus_poll ?<br>
><br>
> No, if you want to use a GMainLoop inside your element you<br>
> also have to<br>
> create a new GMainContext for it (which is then driven by your<br>
> private<br>
> main loop). There's no need to run a GLib main loop on the<br>
> default<br>
> context or any other ugly things.<br>
><br>
> hmm, that's interesting, why gst_bus_poll use the default context<br>
> them?<br><br></font>
</div></div><font size="2">Because it was meant to be used by application that have a main loop on<br>
the default context and that want to continue other things in that main<br>
loop while waiting for a message on the bus.<br></font></blockquote><div><br>hmm and in that case using a
<a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-push-thread-default" class="link" title="g_main_context_push_thread_default ()"><code class="function">g_main_context_push_thread_default()</code></a> to run poll stuff on other context and them
<a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-pop-thread-default" class="link" title="g_main_context_pop_thread_default ()"><code class="function">g_main_context_pop_thread_default()</code></a> to restore the main context would prevent other things from happening on the default context, right?<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font size="2"></font>
<div class="im"><font size="2"><br>
> i never used GMainLoop with different contexts, not pretty sure of how<br>
> it works. If the main loop on the default context is running (the<br>
> application is using it), and i create my main loop with a different<br>
> context inside the plugin, to which main loop will go the async result<br>
> of the GIO call ? (I'm going to read more about multiple main loops<br>
> with different contexts)<br><br></font>
</div><font size="2">GIO uses the thread default main context of the thread that started the<br>
async operation (see the GMainContext docs) and signals are emitted to<br>
any main loop running on that main context.<br></font></blockquote><div><font size="2"><br>Thanks for the help Sebastian, i read</font><font size="2"> g_main_context_get_thread_default ()</font><font size="2"> and</font><font size="2"> g_main_context_push_thread_default ()</font><font size="2"> doc and helped a lot to understand better how could this work.<br>
</font></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><font size="2"><br>
> if GIO would work with this approach it seems to be an interesting<br>
> solution to start using the GIO async API instead of the sync API, and<br>
> it would be possible to mount the file for the user, making the use of<br>
> giosrc/sink pretty easier.<br><br></font>
</div><font size="2">That's all possible but the problem with that is, that a) the state<br>
change from NULL->READY happens synchronous in GStreamer and that b)<br>
basesrc wants to know the file size in READY already, otherwise it will<br>
never activate random access mode.<br><br></font></blockquote><div><br>Well if it must be synchronous running the main loop on another Thread does not to seem to be an option. What is done on gst_bus_poll seems to fit here:<br>
<br>1 - the caller on the set_state will get blocked on the call<br>2 - inside the call we mount the file and do all the stuff async using the main_loop_run to block the caller<br>3 - after everything is done we get out of the run call and give to the basesrc the file size<br>
<br>this way we can use the async GIO API, mount the file for the user giving a "sync" operation to the set_state caller. But this approach is pretty simple, if you guys still not implemented it... it is because it has something pretty bad on it... it is because the same problem that can happen on gst_bus_poll?<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font size="2"><br>------------------------------
</font>
<font size="2">------------------------------</font><font size="2">------------------<br>
Beautiful is writing same markup. Internet Explorer 9 supports<br>
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.<br>
Spend less time writing and rewriting code and more time creating great<br>
experiences on the web. Be a part of the beta today<br><a href="http://p.sf.net/sfu/msIE9-sfdev2dev" target="_blank">http://p.sf.net/sfu/msIE9-sfdev2dev</a><br>______________________________</font>
<font size="2">_________________<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></font>
</blockquote></div><font size="2"><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;" clear="all"><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">-- </span><br style="font-family: arial,helvetica,sans-serif;">
<span style="font-family: arial,helvetica,sans-serif;"><a href="http://www.getgnulinux.org/windows">http://www.getgnulinux.org/windows</a></span><br style="font-family: arial,helvetica,sans-serif;"></font>