QtGstreamer fails creating pipeline after QGst::cleanup()

Karl Phillip maxphil at gmail.com
Tue Nov 29 03:36:09 PST 2011

Hi all,

I spent a lot of time to pinpoint this problem and I wonder if it's a bug
of QtGstreamer or not.
If it's not, we seriously need to make this thing more clear on the
documentation and prevent others from making the same mistake as I did.

I wrote a VideoPlayer class to deal with video files using QtGstreamer
under the hood. I was able to instantiate a VideoPlayer object and display
the video with no problems.
Then, I tried to destroy the current player and instantiate a new one
(within the same thread) to watch another video. That's when it happend:
the second object failed to create it's pipeline.

Hours of investigation went by until I found the source of the problem: the
constructor of VideoPlayer initialized the library through "QGst::init();"
and the destructor did the opposite with "QGst::cleanup();".
It was my understanding that after a
a call to init() would restore things back to it's operational
state, but so it happens that cleanup() makes it impossible.

What is also strange is that calling QGst::init() after a cleanup() doesn't
return any errors nor throw exceptions, which I think it should, since you
can't use the library to create a new pipeline rendering it pretty much

I wrote a small demo to reproduce this behavior:

#include <QObject>
#include <QGst/Init>
#include <QGst/Pipeline>
#include <QGst/Element>

int main()

    qDebug() << "#1 call QGst::init()";

    QGst::PipelinePtr _pipeline = QGst::Pipeline::create();
    if (!_pipeline)
        qDebug() << "#1 Failed creating pipeline !!!";
        return -1;

    qDebug() << "#1 Setting pipeline to Playing";

    qDebug() << "#1 Setting pipeline to Null";

    qDebug() << "#1 call pipeline.clear()";

    qDebug() << "#1 call QGst::cleanup()";

    qDebug() << "\n* Press <enter> to restart the pipeline setup";

    qDebug() << "#2 call QGst::init()";
    _pipeline = QGst::Pipeline::create();
    if (!_pipeline)
        qDebug() << "#2 Failed creating pipeline !!!";
        return -1;

    return 0;

Karl Phillip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111129/b0804a43/attachment.htm>

More information about the gstreamer-devel mailing list