I am looking to write a simple QT-based web-browser with a gstreamer back-end as a proof-of-concept for a much more complex program. The idea is to have the QWebView render to gstreamer buffers which would be displayed or streamed by gstreamer depending on provided parameters.
However, I'm very new to QT and its not clear to me how to get QWebView to render to a backend of my choosing. Any hints would be appreciated.
Turns out its not that difficult. Given a GstBuffer * in buf to fill out:
QApplication app;
QWebView web;
web.load(QUrl("www.google.ca"));
web.resize(1024,768);
GstMapInfo inf;
if( !gst_buffer_map(buf,&inf,GST_MAP_WRITE) )
GST_ERROR("Couldn't map output buffer for writing!");
else
{ QImage img
( inf.data
, 1024, 768
, 1024*sizeof(uint32)
, QImage::Format_xRGB
);
web.render(&img); // render our webpage to our image buffer;
app.processEvents();
gst_buffer_unmap(buf,&inf);
return buf;
}