Video isn't showing on surface created in thread. [Quick 2.3,QtGstreamer-1.2.0]
dfussia
daniell at inatel.br
Wed Oct 21 09:47:21 PDT 2015
Hi,
I’m having problem on render video on surface created by thread.
I’m using Quick 2.3, QtGstreamer-1.2.0.
Please see code below:
-----------------------------------------------------
void Player::stop(){
wCond.wakeAll();
while( !isFinished() )
msleep(100);
}
void Player::play()
{
qDebug("playing");
if( isRunning() ){
this->stop();
delete _surface;
}
#ifndef THREAD_SCOPE
_surface = new QGst::Quick::VideoSurface();
ctx->setContextProperty(QLatin1String("videoSurface1"), _surface);
videoSink = _surface->videoSink();
#endif
this->start();
}
void Player::run()
{
qDebug() << "Running" << this->currentThreadId();
/* Create video pipeline */
QGst::PipelinePtr _pipeline;
_pipeline =
QGst::ElementFactory::make("playbin").dynamicCast<QGst::Pipeline>();
#ifdef THREAD_SCOPE
QGst::Quick::VideoSurface* _surface = new QGst::Quick::VideoSurface();
ctx->setContextProperty(QLatin1String("videoSurface1"), _surface);
QGst::ElementPtr videoSink = _surface->videoSink();
#endif
if (_pipeline) {
QString uri =
"rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
videoSink->setProperty("async",false);
videoSink->setProperty("sync",false);
_pipeline->setProperty("uri", uri);
_pipeline->setProperty("video-sink",videoSink);
_pipeline->setProperty("force-aspect-ratio",false);
_pipeline->setState(QGst::StatePlaying);
} else {
qCritical() << "Failed to create the pipeline";
}
qDebug() << "Waiting..." << this->currentThreadId();
/* Create wait condition */
wCond.wait(&mutex);
_pipeline->setState(QGst::StateNull);
qDebug() << "Finished: " << this->currentThreadId();
}
-----------------------------------------------------
When I don't define the THREAD_SCOPE the player show video normally, because
surface is created without the thread scope. Otherwise
don’t show any error, but video doesn’t showed.
I don’t know if it happen because thread scope, but It’s possible to create
surface and show video in thread scope?
For full code see:
https://github.com/Danfx/qtteste/blob/master/QuickTest/player.cpp
Thanks!
Best Regards,
Daniel Fussia
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Video-isn-t-showing-on-surface-created-in-thread-Quick-2-3-QtGstreamer-1-2-0-tp4674200.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list