Usage of the qtglvideosink
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Mon Mar 25 01:19:00 PDT 2013
Hi Robert,
I think you should read-up a little about Qt graphics-view a little before
attempting to use the QtGstreamer OpenGL widget. As I mentioned in previous
mail you will need to create a graphics scene, add a view to to it and then
add the video widget to the scene to make it work.
I thought it worked for you after you made those changes (according to your
last mail thread - "QtGStreamer: How to get run a
QGst::Ui::GraphicsVideoWidget")?
Here's your example with the required modifications done:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGst::init(&argc, &argv);
QGraphicsScene* scene = new QGraphicsScene;
QGraphicsView* view = new QGraphicsView(scene);
view->setViewport(new QGLWidget);
QGst::Ui::GraphicsVideoSurface* surface = new
QGst::Ui::GraphicsVideoSurface(view);
QGst::Ui::GraphicsVideoWidget* widget = new
QGst::Ui::GraphicsVideoWidget();
widget->setSurface(surface);
scene->addItem(widget);
QGst::ElementPtr source = QGst::ElementFactory::make("videotestsrc");
QGst::ElementPtr sink = surface->videoSink();
QGst::PipelinePtr pipeline = QGst::Pipeline::create();
pipeline->add(source);
pipeline->add(sink);
if(source->link(sink) == false)
qDebug("Link failed");
view->show();
pipeline->setState(QGst::StatePlaying);
return app.exec();
}
HTH,
-mandeep
On Sun, Mar 24, 2013 at 7:53 PM, pfarmer <flacone at gmx.de> wrote:
> Sorry for bothering you again about an Qt related topic. But I am not able
> to
> get the qtglvideosink running.
> I tried the two ways mentioned in
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/qtvideosink_overview.html
> <
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/qtvideosink_overview.html
> > :
> 1) Usage without QtGStreamer
> 2) Usage with QtGStreamer
>
>
> *For 1 i tried this:*
>
> #include <QGst/Init>
> #include <QGst/Pipeline>
> #include <QGst/ElementFactory>
> #include <QGst/Ui/VideoWidget>
> #include <QGlib/Connect>
>
> #include <QApplication>
> #include <QGLWidget>
> #include <QDebug>
>
> int main(int argc, char *argv[])
> {
> QApplication app(argc, argv);
> QGst::init(&argc, &argv);
>
> QGst::ElementPtr source =
> QGst::ElementFactory::make("videotestsrc");
> QGst::ElementPtr sink =
> QGst::ElementFactory::make("qtglvideosink");
>
> QGLWidget* glWidget = new QGLWidget();
>
> glWidget->makeCurrent();
> sink->setProperty("glcontext",
> (void*)QGLContext::currentContext());
> glWidget->doneCurrent();
>
> if(sink->setState(QGst::StateReady) != QGst::StateChangeSuccess)
> {
> qWarning("Gl not available. Closing app.");
> app.exit();
> }
>
> QGst::PipelinePtr pipeline = QGst::Pipeline::create();
> pipeline->add(source);
> pipeline->add(sink);
> if(source->link(sink) == false)
> qDebug("Link failed");
>
> // QGlib::connect(sink, "update", glWidget, &QGLWidget::update());
>
> glWidget->show();
> pipeline->setState(QGst::StatePlaying);
>
> return app.exec();
> }
>
> I am not able to connect the update signal to the slot QGLWidget::update().
> How can i do this? Or: do I have to do it? It also seems not enough to
> solely set the QLContext to the qtglvideosink; what esle I have to do?
>
>
>
> *And for 2 I tried this:*
>
> int main(int argc, char *argv[])
> {
> QApplication app(argc, argv);
> QGst::init(&argc, &argv);
>
> QGst::ElementPtr source =
> QGst::ElementFactory::make("videotestsrc");
> QGst::ElementPtr sink =
> QGst::ElementFactory::make("qtglvideosink");
>
> QGst::Ui::VideoWidget* widget = new QGst::Ui::VideoWidget();
> // QGLWidget* glWidget = new QGLWidget(widget);
>
> // glWidget->makeCurrent();
> // sink->setProperty("glcontext",
> (void*)QGLContext::currentContext());
> // glWidget->doneCurrent();
> // if(sink->setState(QGst::StateReady) != QGst::StateChangeSuccess)
> // {
> // qWarning("Closing app. Probably Gl not available.");
> // app.exit();
> // }
>
> QGst::PipelinePtr pipeline = QGst::Pipeline::create();
> pipeline->add(source);
> pipeline->add(sink);
> if(source->link(sink) == false)
> qDebug("Link failed");
>
> widget->setVideoSink(sink);
>
> pipeline->setState(QGst::StatePlaying);
> widget->show();
>
> return app.exec();
> }
>
> Here I don't know how to make the QGst::Ui::VideoWidget() openGL aware. I
> also can't inherit both the QGLWidget and the QGst::Ui::VideoWidget in one
> class since this is forbidden by Qt. How can I GL acceleration with a
> QGst::Ui::VideoWidget()?
>
> In the two cases above nothing happens, except that an empty widget pop's
> up.
>
> Thanks for any help,
> Robert.
>
>
>
> --
> View this message in context:
> http://gstreamer-devel.966125.n4.nabble.com/Usage-of-the-qtglvideosink-tp4659243.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130325/5c569f5b/attachment-0001.html>
More information about the gstreamer-devel
mailing list