문제

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;
  }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top