Re: GTKmm Streaming web image



UNOmar wrote:
First off I apologize if this has been brought up before but I'm new to the
list and a quick search didn't turn anything up.
I have a webcam that I need to display a live image from.  The problem is
the camera only has an ethernet interface and internal web server.  Is there
an easy way to grab the stream and insert it into a GTK::Image?  I have
looked into Gdk::Pixbuf but I don't see anything that would work. My other thought is that I will have to do the socket dance and save the
stream to a file, but since the stream never ends won't that lock up the
application (without threads of course)?
Any thoughts or ideas would be greatly appreciated.
Thanks,
UNOmar
Gnome-vfsmm lets you do asynchronous networking (won't lag the GUI), consider that for doing the HTTP with. Or go from scratch with socket() and Glib::IOChannel::create_from_fd() (IOChannels can call back when e.g. the HTTP response is arriving).

For the view, yes you can use a Gdk::Pixbuf: create a blank pixbuf and set it as the Gtk::Image's source, then render frames into the pixbuf (manipulating the guint8* RGB data returned by get_pixels() is fairly quick), calling image.queue_draw() after each frame. You may have to call image.set(pixbuf) after each frame as well, not sure if that's necessary.

Good luck.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]