Hi all,<br><br>I spent a lot of time to pinpoint this problem and I wonder if it's a bug of QtGstreamer or not. <br>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.<br>
<br>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. <br>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.<br>
<br>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();". <br>
It was my understanding that after a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/namespaceQGst.html#af854931adda54e40b759bf4f736f1cbb">cleanup()</a> operation, a call to init() would restore things back to it's operational state, but so it happens that cleanup() makes it impossible.<br>
<br>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 useless.<br>
<br>I wrote a small demo to reproduce this behavior:<br><br>#include <QObject><br>#include <QGst/Init><br>#include <QGst/Pipeline><br>#include <QGst/Element><br><br>int main()<br>{<br><br> qDebug() << "#1 call QGst::init()";<br>
QGst::init();<br><br> QGst::PipelinePtr _pipeline = QGst::Pipeline::create();<br> if (!_pipeline)<br> {<br> qDebug() << "#1 Failed creating pipeline !!!";<br> return -1;<br> }<br>
<br> qDebug() << "#1 Setting pipeline to Playing";<br> _pipeline->setState(QGst::StatePlaying);<br><br> qDebug() << "#1 Setting pipeline to Null";<br> _pipeline->setState(QGst::StateNull);<br>
<br> qDebug() << "#1 call pipeline.clear()";<br> _pipeline.clear();<br><br> qDebug() << "#1 call QGst::cleanup()";<br> QGst::cleanup();<br><br> qDebug() << "\n* Press <enter> to restart the pipeline setup";<br>
getchar();<br><br> qDebug() << "#2 call QGst::init()";<br> QGst::init();<br> _pipeline = QGst::Pipeline::create();<br> if (!_pipeline)<br> {<br> qDebug() << "#2 Failed creating pipeline !!!";<br>
return -1;<br> }<br><br> return 0;<br>}<br><br><br>Thanks!<br>--<br>Karl Phillip<br><br><br>