Video isn't showing on surface created in thread. [Quick 2.3,QtGstreamer-1.2.0]

Daniel Lopes Fússia daniell at inatel.br
Wed Oct 21 09:54:25 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151021/8bb786c3/attachment-0001.html>


More information about the gstreamer-devel mailing list