Implement configuration for OMX Layer index

pull/31/head
michal.szwaj 2018-03-03 01:37:07 +01:00
parent 88aeb591b4
commit 5984108d20
7 changed files with 117 additions and 33 deletions

View File

@ -50,6 +50,8 @@ public:
void setVideoResolution(aasdk::proto::enums::VideoResolution::Enum value) override;
size_t getScreenDPI() const override;
void setScreenDPI(size_t value) override;
void setOMXLayerIndex(int32_t value) override;
int32_t getOMXLayerIndex() const override;
bool getTouchscreenEnabled() const override;
void setTouchscreenEnabled(bool value) override;
@ -71,6 +73,7 @@ private:
aasdk::proto::enums::VideoFPS::Enum videoFPS_;
aasdk::proto::enums::VideoResolution::Enum videoResolution_;
size_t screenDPI_;
int32_t omxLayerIndex_;
bool enableTouchscreen_;
ButtonCodes buttonCodes_;
BluetoothAdapterType bluetoothAdapterType_;
@ -84,6 +87,7 @@ private:
static const std::string cVideoFPSKey;
static const std::string cVideoResolutionKey;
static const std::string cVideoScreenDPIKey;
static const std::string cVideoOMXLayerIndexKey;
static const std::string cBluetoothAdapterTypeKey;
static const std::string cBluetoothRemoteAdapterAddressKey;

View File

@ -57,6 +57,8 @@ public:
virtual void setVideoResolution(aasdk::proto::enums::VideoResolution::Enum value) = 0;
virtual size_t getScreenDPI() const = 0;
virtual void setScreenDPI(size_t value) = 0;
virtual void setOMXLayerIndex(int32_t value) = 0;
virtual int32_t getOMXLayerIndex() const = 0;
virtual bool getTouchscreenEnabled() const = 0;
virtual void setTouchscreenEnabled(bool value) = 0;

View File

@ -54,7 +54,7 @@ private:
bool initClock();
bool setupTunnels();
bool enablePortBuffers();
bool setFullscreen();
bool setupDisplayRegion();
std::mutex mutex_;
bool isActive_;

View File

@ -36,6 +36,7 @@ const std::string Configuration::cGeneralHandednessOfTrafficTypeKey = "General.H
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::cBluetoothAdapterTypeKey = "Bluetooth.AdapterType";
const std::string Configuration::cBluetoothRemoteAdapterAddressKey = "Bluetooth.RemoteAdapterAddress";
@ -82,6 +83,8 @@ void Configuration::load()
aasdk::proto::enums::VideoResolution::_480p));
screenDPI_ = iniConfig.get<size_t>(cVideoScreenDPIKey, 140);
omxLayerIndex_ = iniConfig.get<int32_t>(cVideoOMXLayerIndexKey, 1);
enableTouchscreen_ = iniConfig.get<bool>(cInputEnableTouchscreenKey, true);
this->readButtonCodes(iniConfig);
@ -105,6 +108,7 @@ void Configuration::reset()
videoFPS_ = aasdk::proto::enums::VideoFPS::_60;
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
screenDPI_ = 140;
omxLayerIndex_ = 1;
enableTouchscreen_ = true;
buttonCodes_.clear();
bluetoothAdapterType_ = BluetoothAdapterType::NONE;
@ -120,6 +124,7 @@ void Configuration::save()
iniConfig.put<uint32_t>(cVideoFPSKey, static_cast<uint32_t>(videoFPS_));
iniConfig.put<uint32_t>(cVideoResolutionKey, static_cast<uint32_t>(videoResolution_));
iniConfig.put<size_t>(cVideoScreenDPIKey, screenDPI_);
iniConfig.put<int32_t>(cVideoOMXLayerIndexKey, omxLayerIndex_);
iniConfig.put<bool>(cInputEnableTouchscreenKey, enableTouchscreen_);
this->writeButtonCodes(iniConfig);
@ -179,6 +184,16 @@ void Configuration::setScreenDPI(size_t value)
screenDPI_ = value;
}
void Configuration::setOMXLayerIndex(int32_t value)
{
omxLayerIndex_ = value;
}
int32_t Configuration::getOMXLayerIndex() const
{
return omxLayerIndex_;
}
bool Configuration::getTouchscreenEnabled() const
{
return enableTouchscreen_;

View File

@ -105,24 +105,20 @@ bool OMXVideoOutput::init()
OPENAUTO_LOG(info) << "[OMXVideoOutput] init, state: " << isActive_;
ilclient_change_component_state(components_[VideoComponent::DECODER], OMX_StateExecuting);
return this->setFullscreen();
return this->setupDisplayRegion();
}
bool OMXVideoOutput::setFullscreen()
bool OMXVideoOutput::setupDisplayRegion()
{
OMX_CONFIG_DISPLAYREGIONTYPE displayRegion;
displayRegion.nSize = sizeof(OMX_CONFIG_DISPLAYREGIONTYPE);
displayRegion.nVersion.nVersion = OMX_VERSION;
displayRegion.nPortIndex = 90;
//EGL surface needs the OMX layer to be 2
//Otherwise the Qt UI will draw on top of it
displayRegion.layer = 2;
displayRegion.set = static_cast<OMX_DISPLAYSETTYPE >(OMX_DISPLAY_SET_FULLSCREEN | OMX_DISPLAY_SET_NOASPECT | OMX_DISPLAY_SET_LAYER);
displayRegion.layer = static_cast<OMX_S32>(configuration_->getOMXLayerIndex());
displayRegion.fullscreen = OMX_TRUE;
displayRegion.noaspect = OMX_TRUE;
displayRegion.set = static_cast<OMX_DISPLAYSETTYPE >(OMX_DISPLAY_SET_FULLSCREEN | OMX_DISPLAY_SET_NOASPECT | OMX_DISPLAY_SET_LAYER);
return OMX_SetConfig(ilclient_get_handle(components_[VideoComponent::RENDERER]), OMX_IndexConfigDisplayRegion, &displayRegion) == OMX_ErrorNone;
}

View File

@ -72,6 +72,7 @@ void SettingsWindow::onSave()
}
configuration_->setScreenDPI(static_cast<size_t>(ui_->horizontalSliderScreenDPI->value()));
configuration_->setOMXLayerIndex(ui_->spinBoxOmxLayerIndex->value());
configuration_->setTouchscreenEnabled(ui_->checkBoxEnableTouchscreen->isChecked());
this->saveButtonCheckBoxes();
@ -124,6 +125,7 @@ void SettingsWindow::load()
ui_->radioButton720p->setChecked(configuration_->getVideoResolution() == aasdk::proto::enums::VideoResolution::_720p);
ui_->radioButton1080p->setChecked(configuration_->getVideoResolution() == aasdk::proto::enums::VideoResolution::_1080p);
ui_->horizontalSliderScreenDPI->setValue(static_cast<int>(configuration_->getScreenDPI()));
ui_->spinBoxOmxLayerIndex->setValue(configuration_->getOMXLayerIndex());
ui_->checkBoxEnableTouchscreen->setChecked(configuration_->getTouchscreenEnabled());
this->loadButtonCheckBoxes();

View File

@ -141,9 +141,9 @@ color: rgb(238, 238, 236);</string>
<property name="geometry">
<rect>
<x>0</x>
<y>130</y>
<y>80</y>
<width>621</width>
<height>211</height>
<height>141</height>
</rect>
</property>
<property name="title">
@ -154,7 +154,7 @@ color: rgb(238, 238, 236);</string>
<rect>
<x>10</x>
<y>30</y>
<width>112</width>
<width>71</width>
<height>23</height>
</rect>
</property>
@ -165,9 +165,9 @@ color: rgb(238, 238, 236);</string>
<widget class="QRadioButton" name="radioButton720p">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>112</width>
<x>120</x>
<y>30</y>
<width>71</width>
<height>23</height>
</rect>
</property>
@ -178,9 +178,9 @@ color: rgb(238, 238, 236);</string>
<widget class="QRadioButton" name="radioButton1080p">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>112</width>
<x>230</x>
<y>30</y>
<width>81</width>
<height>23</height>
</rect>
</property>
@ -192,9 +192,9 @@ color: rgb(238, 238, 236);</string>
<property name="geometry">
<rect>
<x>50</x>
<y>150</y>
<width>551</width>
<height>51</height>
<y>60</y>
<width>561</width>
<height>71</height>
</rect>
</property>
<property name="text">
@ -203,14 +203,17 @@ color: rgb(238, 238, 236);</string>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>10</number>
</property>
</widget>
<widget class="QLabel" name="labelResolutionWarningIcon">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>41</width>
<height>51</height>
<x>20</x>
<y>60</y>
<width>31</width>
<height>71</height>
</rect>
</property>
<property name="text">
@ -224,7 +227,7 @@ color: rgb(238, 238, 236);</string>
<x>0</x>
<y>10</y>
<width>621</width>
<height>101</height>
<height>61</height>
</rect>
</property>
<property name="title">
@ -233,9 +236,9 @@ color: rgb(238, 238, 236);</string>
<widget class="QRadioButton" name="radioButton60FPS">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>112</width>
<x>120</x>
<y>30</y>
<width>81</width>
<height>23</height>
</rect>
</property>
@ -248,7 +251,7 @@ color: rgb(238, 238, 236);</string>
<rect>
<x>10</x>
<y>30</y>
<width>112</width>
<width>81</width>
<height>23</height>
</rect>
</property>
@ -267,7 +270,7 @@ color: rgb(238, 238, 236);</string>
</rect>
</property>
<property name="maximum">
<number>999</number>
<number>400</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -296,9 +299,71 @@ color: rgb(238, 238, 236);</string>
</rect>
</property>
<property name="text">
<string>999</string>
<string>400</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>0</x>
<y>230</y>
<width>621</width>
<height>121</height>
</rect>
</property>
<property name="title">
<string>OMX Layer index</string>
</property>
<widget class="QLabel" name="labelOmxLayerIndex">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Layer index:</string>
</property>
</widget>
<widget class="QLabel" name="labelBluetoothAddressFormatInfo_2">
<property name="geometry">
<rect>
<x>60</x>
<y>80</y>
<width>311</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-style:italic;&quot;&gt;OMX Layer is used only in case of OMX video output.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="labelBluetoothAddressFormatInfoIcon_2">
<property name="geometry">
<rect>
<x>30</x>
<y>80</y>
<width>21</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QSpinBox" name="spinBoxOmxLayerIndex">
<property name="geometry">
<rect>
<x>100</x>
<y>30</y>
<width>71</width>
<height>41</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tabInput">
<attribute name="title">