Usage of the qtglvideosink

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Tue Mar 26 01:24:02 PDT 2013


> *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?
>
>
> This example seg faults on my machine at the
sink->setProperty("glcontext"...) call. I have a Ubuntu 12.10, 32-bit pc
with QtGstreamer compiled.
I've not used QtGstreamer this way, so can;t say anything immediately. This
will need further investigation.


> *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()?
>
>
If using QtGstreamer, you don't have to create the
qtvideosink/qtglvideosink element explicitly. The docs mention that one
will be created for you internally.

>From the video surface class docs:

"This class internally creates and uses either a "qtglvideosink" or a
"qtvideosink" element. This element is created the first time it is
requested and a reference is kept internally."

So in case using "with QtGstreamer", the previous example that worked seems
to be the right approach.

HTH,
-mandeep

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/20130326/86180d94/attachment-0001.html>


More information about the gstreamer-devel mailing list