Implement and use configuration of video margins
This commit is contained in:
parent
fba7aaf208
commit
799ed557ec
@ -52,6 +52,8 @@ public:
|
||||
void setScreenDPI(size_t value) override;
|
||||
void setOMXLayerIndex(int32_t value) override;
|
||||
int32_t getOMXLayerIndex() const override;
|
||||
void setVideoMargins(QRect value) override;
|
||||
QRect getVideoMargins() const override;
|
||||
|
||||
bool getTouchscreenEnabled() const override;
|
||||
void setTouchscreenEnabled(bool value) override;
|
||||
@ -79,6 +81,7 @@ private:
|
||||
aasdk::proto::enums::VideoResolution::Enum videoResolution_;
|
||||
size_t screenDPI_;
|
||||
int32_t omxLayerIndex_;
|
||||
QRect videoMargins_;
|
||||
bool enableTouchscreen_;
|
||||
ButtonCodes buttonCodes_;
|
||||
BluetoothAdapterType bluetoothAdapterType_;
|
||||
@ -95,6 +98,8 @@ private:
|
||||
static const std::string cVideoResolutionKey;
|
||||
static const std::string cVideoScreenDPIKey;
|
||||
static const std::string cVideoOMXLayerIndexKey;
|
||||
static const std::string cVideoMarginWidth;
|
||||
static const std::string cVideoMarginHeight;
|
||||
|
||||
static const std::string cAudioMusicAudioChannelEnabled;
|
||||
static const std::string cAudioSpeechAudioChannelEnabled;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <QRect>
|
||||
#include <aasdk_proto/VideoFPSEnum.pb.h>
|
||||
#include <aasdk_proto/VideoResolutionEnum.pb.h>
|
||||
#include <aasdk_proto/ButtonCodeEnum.pb.h>
|
||||
@ -59,6 +60,8 @@ public:
|
||||
virtual void setScreenDPI(size_t value) = 0;
|
||||
virtual void setOMXLayerIndex(int32_t value) = 0;
|
||||
virtual int32_t getOMXLayerIndex() const = 0;
|
||||
virtual void setVideoMargins(QRect value) = 0;
|
||||
virtual QRect getVideoMargins() const = 0;
|
||||
|
||||
virtual bool getTouchscreenEnabled() const = 0;
|
||||
virtual void setTouchscreenEnabled(bool value) = 0;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QRect>
|
||||
#include <aasdk_proto/VideoFPSEnum.pb.h>
|
||||
#include <aasdk_proto/VideoResolutionEnum.pb.h>
|
||||
#include <f1x/aasdk/Common/Data.hpp>
|
||||
@ -47,6 +48,7 @@ public:
|
||||
virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0;
|
||||
virtual aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const = 0;
|
||||
virtual size_t getScreenDPI() const = 0;
|
||||
virtual QRect getVideoMargins() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override;
|
||||
aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const override;
|
||||
size_t getScreenDPI() const override;
|
||||
QRect getVideoMargins() const override;
|
||||
|
||||
protected:
|
||||
configuration::IConfiguration::Pointer configuration_;
|
||||
|
@ -37,6 +37,8 @@ const std::string Configuration::cVideoFPSKey = "Video.FPS";
|
||||
const std::string Configuration::cVideoResolutionKey = "Video.Resolution";
|
||||
const std::string Configuration::cVideoScreenDPIKey = "Video.ScreenDPI";
|
||||
const std::string Configuration::cVideoOMXLayerIndexKey = "Video.OMXLayerIndex";
|
||||
const std::string Configuration::cVideoMarginWidth = "Video.MarginWidth";
|
||||
const std::string Configuration::cVideoMarginHeight = "Video.MarginHeight";
|
||||
|
||||
const std::string Configuration::cAudioMusicAudioChannelEnabled = "Audio.MusicAudioChannelEnabled";
|
||||
const std::string Configuration::cAudioSpeechAudioChannelEnabled = "Audio.SpeechAudioChannelEnabled";
|
||||
@ -87,6 +89,7 @@ void Configuration::load()
|
||||
screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 140);
|
||||
|
||||
omxLayerIndex_ = iniConfig.get<int32_t>(cVideoOMXLayerIndexKey, 1);
|
||||
videoMargins_ = QRect(0, 0, iniConfig.get<int32_t>(cVideoMarginWidth, 0), iniConfig.get<int32_t>(cVideoMarginHeight, 0));
|
||||
|
||||
enableTouchscreen_ = iniConfig.get<bool>(cInputEnableTouchscreenKey, true);
|
||||
this->readButtonCodes(iniConfig);
|
||||
@ -116,6 +119,7 @@ void Configuration::reset()
|
||||
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
|
||||
screenDPI_ = 140;
|
||||
omxLayerIndex_ = 1;
|
||||
videoMargins_ = QRect(0, 0, 0, 0);
|
||||
enableTouchscreen_ = true;
|
||||
buttonCodes_.clear();
|
||||
bluetoothAdapterType_ = BluetoothAdapterType::NONE;
|
||||
@ -134,6 +138,8 @@ void Configuration::save()
|
||||
iniConfig.put<uint32_t>(cVideoResolutionKey, static_cast<uint32_t>(videoResolution_));
|
||||
iniConfig.put<size_t>(cVideoScreenDPIKey, screenDPI_);
|
||||
iniConfig.put<int32_t>(cVideoOMXLayerIndexKey, omxLayerIndex_);
|
||||
iniConfig.put<uint32_t>(cVideoMarginWidth, videoMargins_.width());
|
||||
iniConfig.put<uint32_t>(cVideoMarginHeight, videoMargins_.height());
|
||||
|
||||
iniConfig.put<bool>(cInputEnableTouchscreenKey, enableTouchscreen_);
|
||||
this->writeButtonCodes(iniConfig);
|
||||
@ -206,6 +212,16 @@ int32_t Configuration::getOMXLayerIndex() const
|
||||
return omxLayerIndex_;
|
||||
}
|
||||
|
||||
void Configuration::setVideoMargins(QRect value)
|
||||
{
|
||||
videoMargins_ = value;
|
||||
}
|
||||
|
||||
QRect Configuration::getVideoMargins() const
|
||||
{
|
||||
return videoMargins_;
|
||||
}
|
||||
|
||||
bool Configuration::getTouchscreenEnabled() const
|
||||
{
|
||||
return enableTouchscreen_;
|
||||
|
@ -48,6 +48,11 @@ size_t VideoOutput::getScreenDPI() const
|
||||
return configuration_->getScreenDPI();
|
||||
}
|
||||
|
||||
QRect VideoOutput::getVideoMargins() const
|
||||
{
|
||||
return configuration_->getVideoMargins();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,8 +144,10 @@ void VideoService::fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse
|
||||
auto* videoConfig1 = videoChannel->add_video_configs();
|
||||
videoConfig1->set_video_resolution(videoOutput_->getVideoResolution());
|
||||
videoConfig1->set_video_fps(videoOutput_->getVideoFPS());
|
||||
videoConfig1->set_margin_height(0);
|
||||
videoConfig1->set_margin_width(0);
|
||||
|
||||
const auto& videoMargins = videoOutput_->getVideoMargins();
|
||||
videoConfig1->set_margin_height(videoMargins.height());
|
||||
videoConfig1->set_margin_width(videoMargins.width());
|
||||
videoConfig1->set_dpi(videoOutput_->getScreenDPI());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user