[v 0.10] Gst::init() is slow
Tristan Matthews
tristan at sat.qc.ca
Tue Sep 11 12:29:08 PDT 2012
>
> On Sat, 2012-09-08 at 13:19 +0300, Jiergir Ogoerg wrote:
> > Hi,
> > Gst::init() takes like 100+ ms, on rare occasions it takes even
> > longer, like over 2-4 seconds. Is it normal?
> >
> > To combat this I do Gst::init() in another pthread for my gui app to
> > show up instantly as usually.
>
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:
// compile with:
// c++ gst.cpp -o gst `pkg-config --cflags --libs gtkmm-3.0
gstreamermm-0.10`
class Example : public Gtk::Window {
public:
Example() : gst_loaded_(false) {
Glib::signal_idle().connect(sigc::mem_fun(*this,
&Example::load_gst));
}
private:
bool load_gst() {
Gst::init();
std::cout << "Finished loading gst!" << std::endl;
gst_loaded_ = true;·
return false;
}
bool gst_loaded_;
};
int main(int argc, char **argv)
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc,
argv, "org.gtkmm.example");
Example example;
app->run(example);
return 0;
}
--
Tristan Matthews
web: http://tristanswork.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120911/5f895bf3/attachment.html>
More information about the gstreamer-devel
mailing list