Usage of the qtglvideosink
pfarmer
flacone at gmx.de
Sun Mar 24 07:23:16 PDT 2013
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.
More information about the gstreamer-devel
mailing list