diff --git a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp index 8a65d85..c1ada0d 100644 --- a/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp @@ -44,7 +44,6 @@ public: virtual bool init() = 0; virtual void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) = 0; virtual void stop() = 0; - virtual bool isActive() const = 0; virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0; virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0; virtual size_t getScreenDPI() const = 0; diff --git a/include/f1x/openauto/autoapp/Projection/OMXVideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/OMXVideoOutput.hpp index ca01373..a6b7d6c 100644 --- a/include/f1x/openauto/autoapp/Projection/OMXVideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/OMXVideoOutput.hpp @@ -48,7 +48,6 @@ public: bool init() override; void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) override; void stop() override; - bool isActive() const override; private: bool createComponents(); @@ -57,7 +56,7 @@ private: bool enablePortBuffers(); bool setFullscreen(); - mutable std::mutex mutex_; + std::mutex mutex_; bool isActive_; bool portSettingsChanged_; ILCLIENT_T* client_; diff --git a/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp index 1333a5a..2e182f7 100644 --- a/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp @@ -43,7 +43,6 @@ public: bool init() override; void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) override; void stop() override; - bool isActive() const override; signals: void startPlayback(); @@ -58,7 +57,7 @@ private: SequentialBuffer videoBuffer_; std::unique_ptr videoWidget_; std::unique_ptr mediaPlayer_; - mutable std::mutex mutex_; + std::mutex mutex_; }; } diff --git a/src/autoapp/Projection/OMXVideoOutput.cpp b/src/autoapp/Projection/OMXVideoOutput.cpp index 57d4965..4097f8f 100644 --- a/src/autoapp/Projection/OMXVideoOutput.cpp +++ b/src/autoapp/Projection/OMXVideoOutput.cpp @@ -202,13 +202,6 @@ void OMXVideoOutput::stop() } } -bool OMXVideoOutput::isActive() const -{ - std::lock_guard lock(mutex_); - - return isActive_; -} - bool OMXVideoOutput::createComponents() { if(ilclient_create_component(client_, &components_[VideoComponent::DECODER], "video_decode", static_cast(ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_INPUT_BUFFERS)) != 0) diff --git a/src/autoapp/Projection/QtVideoOutput.cpp b/src/autoapp/Projection/QtVideoOutput.cpp index 672aba3..0cbffde 100644 --- a/src/autoapp/Projection/QtVideoOutput.cpp +++ b/src/autoapp/Projection/QtVideoOutput.cpp @@ -50,6 +50,7 @@ void QtVideoOutput::createVideoOutput() bool QtVideoOutput::open() { std::lock_guard lock(mutex_); + return videoBuffer_.open(QIODevice::ReadWrite); } @@ -59,12 +60,6 @@ bool QtVideoOutput::init() return true; } -bool QtVideoOutput::isActive() const -{ - std::lock_guard lock(mutex_); - return videoWidget_ != nullptr && videoWidget_->isVisible(); -} - void QtVideoOutput::stop() { emit stopPlayback(); @@ -73,11 +68,14 @@ void QtVideoOutput::stop() void QtVideoOutput::write(uint64_t, const aasdk::common::DataConstBuffer& buffer) { std::lock_guard lock(mutex_); + videoBuffer_.write(reinterpret_cast(buffer.cdata), buffer.size); } void QtVideoOutput::onStartPlayback() { + std::lock_guard lock(mutex_); + videoWidget_->setAspectRatioMode(Qt::IgnoreAspectRatio); videoWidget_->setFocus(); videoWidget_->setWindowFlags(Qt::WindowStaysOnTopHint); @@ -91,6 +89,8 @@ void QtVideoOutput::onStartPlayback() void QtVideoOutput::onStopPlayback() { + std::lock_guard lock(mutex_); + videoWidget_->hide(); mediaPlayer_->stop(); }