fix fragile qtvideooutput (#3)
This commit is contained in:
parent
6cda29433a
commit
254382acf6
@ -57,6 +57,8 @@ ServiceFactory::ServiceFactory(boost::asio::io_service& ioService, configuration
|
||||
, activeCallback_(activeCallback)
|
||||
#ifdef USE_OMX
|
||||
, omxVideoOutput_(std::make_shared<projection::OMXVideoOutput>(configuration_, this->QRectToDestRect(screenGeometry_), activeCallback_))
|
||||
#else
|
||||
, qtVideoOutput_(nullptr)
|
||||
#endif
|
||||
, nightMode_(nightMode)
|
||||
{
|
||||
@ -90,7 +92,11 @@ IService::Pointer ServiceFactory::createVideoService(aasdk::messenger::IMessenge
|
||||
qtVideoOutput_ = new projection::QtVideoOutput(configuration_, activeArea_);
|
||||
if (activeCallback_ != nullptr) {
|
||||
QObject::connect(qtVideoOutput_, &projection::QtVideoOutput::startPlayback, [callback = activeCallback_]() { callback(true); });
|
||||
QObject::connect(qtVideoOutput_, &projection::QtVideoOutput::stopPlayback, [callback = activeCallback_]() { callback(false); });
|
||||
QObject::connect(qtVideoOutput_, &projection::QtVideoOutput::stopPlayback, [this]() {
|
||||
activeCallback_(false);
|
||||
qtVideoOutput_->disconnect();
|
||||
qtVideoOutput_ = nullptr;
|
||||
});
|
||||
}
|
||||
projection::IVideoOutput::Pointer videoOutput(qtVideoOutput_, std::bind(&QObject::deleteLater, std::placeholders::_1));
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user