QtGStreamer: How to get run a QGst::Ui::GraphicsVideoWidget ?
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Wed Mar 20 23:51:59 PDT 2013
On Thu, Mar 21, 2013 at 2:47 AM, pfarmer <flacone at gmx.de> wrote:
> I am trying to run a simple test video with QtGtreamer. The examples
> provided
> with the QtGStreamer API documentation run successfully. The Voip example (
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/examples_2voip_2main_8cpp-example.html
> <
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/examples_2voip_2main_8cpp-example.html
> >
> ) also includes a videotestsrc which is properly displayed.
> Nevertheless a QGst::Ui::VideoWidget in conjunction with watchPipeline() is
> used there. I rather wanted to get it work with the help of a
> QGst::Ui::GraphicsVideoWidget. Therefore I tried following code:
>
> #include <QGst/Init>
> #include <QGst/Pipeline>
> #include <QGst/Element>
> #include <QGst/ElementFactory>
> #include <QGst/Ui/GraphicsVideoSurface>
> #include <QGst/Ui/GraphicsVideoWidget>
>
> #include <QApplication>
> #include <QGLWidget>
> #include <QGraphicsView>
> #include <QDebug>
>
> int main(int argc, char *argv[])
> {
> QApplication app(argc, argv);
> QGst::init(&argc, &argv);
>
> QGraphicsView* view = new QGraphicsView;
> view->setViewport(new QGLWidget);
> QGst::Ui::GraphicsVideoSurface* surface = new
> QGst::Ui::GraphicsVideoSurface(view);
> QGst::Ui::GraphicsVideoWidget* widget = new
> QGst::Ui::GraphicsVideoWidget();
> widget->setSurface(surface);
>
> 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();
> }
>
>
> This code is running, but the widget stays empty. What is the mistake I
> made?
> Hopefully this is the right place to ask questions about QtGStreamer.
>
I don't think there's any 'gstreamer' issue in your code. I haven't done
much of Qt graphicsview programming, but a cusrory glance on the docs
showed that you seemed to have missed creating a scene.
Something like:
QGraphicsScene* scene = new QGraphicsScene;
QGraphicsView* view = new QGraphicsView(scene);
Later you will have to add your GL widget to the scene:
scene->addItem(widget);
The gstreamer part of your code looks ok.
HTH,
-mandeep
>
>
>
>
> --
> View this message in context:
> http://gstreamer-devel.966125.n4.nabble.com/QtGStreamer-How-to-get-run-a-QGst-Ui-GraphicsVideoWidget-tp4659202.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/20130321/1b9f14f8/attachment.html>
More information about the gstreamer-devel
mailing list