<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im HOEnZb">
On Sat, 2012-09-08 at 13:19 +0300, Jiergir Ogoerg wrote:<br>
</div><div class="HOEnZb"><div class="h5">> Hi,<br>
> Gst::init() takes like 100+ ms, on rare occasions it takes even<br>
> longer, like over 2-4 seconds. Is it normal?<br>
><br>
> To combat this I do Gst::init() in another pthread for my gui app to<br>
> show up instantly as usually.<br></div></div></blockquote><br></div>Rather than going to the trouble of calling Gst::init in a new thread, why not just call it in an idle callback? This way your GUI window will still show up right away, while Gst::init() is called asynchronously. You just have to be sure that Gst::init has finished (hence the flag) before using it:<br>
<br>// compile with:<br>// c++ gst.cpp -o gst `pkg-config --cflags --libs gtkmm-3.0 gstreamermm-0.10`<br><br>class Example : public Gtk::Window {<br> public:<br> Example() : gst_loaded_(false) {<br> Glib::signal_idle().connect(sigc::mem_fun(*this, &Example::load_gst));<br>
}<br><br> private:<br> bool load_gst() {<br> Gst::init();<br> std::cout << "Finished loading gst!" << std::endl;<br> gst_loaded_ = true;·<br> return false;<br>
}<br><br> bool gst_loaded_;<br>};<br><br>int main(int argc, char **argv)<br>{<br> Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");<br> Example example;<br>
app->run(example);<br> return 0;<br>}<br><br clear="all"><br>-- <br>Tristan Matthews<br>web: <a href="http://tristanswork.blogspot.com">http://tristanswork.blogspot.com</a><br><br>