RDK Documentation (Open Sourced RDK Components)
videoOutputPort.hpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 
22 
23 /**
24 * @defgroup devicesettings
25 * @{
26 * @defgroup ds
27 * @{
28 **/
29 
30 
31 #ifndef _DS_VIDEOOUTPUTPORT_H_
32 #define _DS_VIDEOOUTPUTPORT_H_
33 
34 #include "enumerable.hpp"
35 #include "aspectRatio.hpp"
36 #include <string>
37 #include <vector>
38 #include <stdint.h>
39 
40 #include "dsTypes.h"
41 
42 /**
43  * @file videoOutputPort.hpp
44  * @brief It contains class and structure refrenced by the videooutputport.cpp file.
45  */
46 using namespace std;
47 
48 namespace device {
49 class VideoOutputPortType;
50 class AudioOutputPort;
51 class VideoResolution;
52 
53 
54 /**
55  * @class VideoOutputPort
56  * @brief Class extending enumerable to implement the videoooutputport interface.
57  * @ingroup devicesettingsclass
58  */
59 class VideoOutputPort : public Enumerable {
60  int _type; //!< VideooOtputPortType
61  int _index; //!< Index of the video
62  int _id; //!< Port id.
63 
64  intptr_t _handle;
65  std::string _name;
66 
67  bool _enabled; //!< Method variable to check whether VideoPort is enabled or not.
68  bool _contentProtected; //!< Method variable tO check whether videoport is content protected or not.
69  bool _displayConnected; //!< Method variable to check whether the video display is connected or not.
70  int _aPortId;
71 
72  std::string _defaultResolution;
73  std::string _resolution;
74 
75  static const char * kPropertyResolution;
76 
77 
78 public:
79 
80  class Display {
81  friend class VideoOutputPort;
82  intptr_t _handle;
83  int _productCode; //!< Product code of the EDID video display device.
84  int _serialNumber; //!< Serial number of the EDID video display device.
85  int _manufacturerYear; //!< Year of manufacture of the EDID video display device.
86  int _manufacturerWeek; //!< Week of manufacture of the EDID video display device.
87  int _aspectRatio;
88  bool _hdmiDeviceType;
89  bool _isSurroundCapable;
90  bool _isDeviceRepeater;
91  uint8_t _physicalAddressA; //!< Physical Address for HDMI node A
92  uint8_t _physicalAddressB; //!< Physical Address for HDMI node B
93  uint8_t _physicalAddressC; //!< Physical Address for HDMI node C
94  uint8_t _physicalAddressD; //!< Physical Address for HDMI node D
95  public:
96 
97 
98 /**
99  * @fn Display()
100  * @brief This function is default constructor and it is used to initialize the display handle
101  * and EDID information of the video display with the default values.
102  *
103  * @return None.
104  */
105  Display() :_handle(0), _productCode(0), _serialNumber(0), _manufacturerYear(0), _manufacturerWeek(0),_aspectRatio(0),_hdmiDeviceType(true), _isSurroundCapable(false), _isDeviceRepeater(false),
106  _physicalAddressA(1),_physicalAddressB(0),_physicalAddressC(0),_physicalAddressD(0){};
107  Display(VideoOutputPort &vPort);
108  virtual ~Display();
109 
110 
111 /**
112  * @fn int getProductCode() const
113  * @brief This function returns the product code of the EDID video display device.
114  *
115  * @retval _productCode Product code of the display device.
116  */
117  int getProductCode() const {return _productCode;};
118 
119 
120 /**
121  * @fn int getSerialNumber() const
122  * @brief This function returns the serial number of the EDID video display device.
123  *
124  * @retval _serialNumber Serial number of the display device.
125  */
126  int getSerialNumber() const {return _serialNumber;};
127 
128 
129 /**
130  * @fn int getManufacturerYear() const
131  * @brief This function returns the year of manufacture of the EDID video display device.
132  *
133  * @retval _manufacturerYear Year of manufacture of the display device.
134  */
135  int getManufacturerYear() const {return _manufacturerYear;};
136 
137 
138 /**
139  * @fn int getManufacturerWeek() const
140  * @brief This function returns the week of manufacture of the EDID video display device.
141  *
142  * @retval _manufacturerWeek Week of manufacture of the display device.
143  */
144  int getManufacturerWeek() const {return _manufacturerWeek;};
145 
146 
147 /**
148  * @fn int getConnectedDeviceType() const
149  * @brief This function returns the device type of the EDID video display device.
150  *
151  * @return _hdmiDeviceType
152  * @retval True If device type is HDMI.
153  * @retval False If device type is DVI.
154  */
155  int getConnectedDeviceType() const {return _hdmiDeviceType;};
156  bool isConnectedDeviceRepeater() const {return _isDeviceRepeater;};
157  void getEDIDBytes(std::vector<uint8_t> &edid) const;
158 
159 /**
160  * @fn int hasSurround() const
161  * @brief This function returns true if connected display supports surround audio
162  *
163  * @retval true/false
164  */
165  bool hasSurround() const;
166 
167 /**
168  * @fn int getSurroundMode() const
169  * @brief This function returns surround mode supported by connected display
170  *
171  * @retval int
172  */
173  int getSurroundMode() const;
174 
175 
176 /**
177  * @fn const AspectRatio& getAspectRatio()
178  * @brief This function returns the instance of the aspect ratio that is used currently in connected display device.
179  *
180  * @return _aspectRatio Indicates the aspect ration of the videooutputport.
181  */
182  const AspectRatio& getAspectRatio() const {return AspectRatio::getInstance(_aspectRatio);};
183 
184 
185 /**
186  * @fn void getPhysicallAddress(uint8_t &physicalAddressA,uint8_t &physicalAddressB,uint8_t &physicalAddressC,uint8_t &physicalAddressD) const
187  * @brief This function gets the physical address of the HDMI node of the video display device.
188  *
189  * @param[out] physicalAddressA Physical Address for HDMI node A
190  * @param[out] physicalAddressB Physical Address for HDMI node B
191  * @param[out] physicalAddressC Physical Address for HDMI node C
192  * @param[out] physicalAddressD Physical Address for HDMI node D
193  *
194  * @return None.
195  */
196  void getPhysicallAddress(uint8_t &physicalAddressA,uint8_t &physicalAddressB,uint8_t &physicalAddressC,uint8_t &physicalAddressD) const
197  {physicalAddressA = _physicalAddressA;physicalAddressB = _physicalAddressB;
198  physicalAddressC = _physicalAddressC;physicalAddressD = _physicalAddressD;};
199  };
200 
201  static VideoOutputPort & getInstance(int id);
202  static VideoOutputPort & getInstance(const std::string &name);
203  VideoOutputPort(const int type, const int index, const int id, int audioPortId, const std::string &resolution);
204  virtual ~VideoOutputPort();
205 
206  const VideoOutputPortType &getType() const;
207 
208 
209 /**
210  * @fn int getId()
211  * @brief This function returns the video output port id.
212  *
213  * @return id Video Output port id.
214  */
215  int getId() const {return _id; };
216 
217 
218 /**
219  * @fn VideoOutputPort::getName() const
220  * @brief This API gets the name of the VideoOutputPort. The VideoOutputPort names can be HDMI, RF, Component etc...
221  * which are created and used by the implementation to uniquely identify them
222  *
223  * @return _name Indicates the name of the VideoOutputPort
224  */
225  const std::string &getName() const {return _name;};
226 
227 
228 /**
229  * @fn int getIndex()
230  * @brief This function returns the index of the video output port.
231  *
232  * @return index Index of the video output port.
233  */
234  int getIndex() const {return _index; };
235 
236  AudioOutputPort &getAudioOutputPort();
237  const VideoResolution &getResolution() ;
238  const VideoResolution &getDefaultResolution() const;
239 
240  const VideoOutputPort::Display &getDisplay();
241  bool isDisplayConnected() const;
242  bool isContentProtected() const;
243  bool isEnabled() const;
244  bool isActive() const;
245  bool isDynamicResolutionSupported() const;
246 
247 
248 /**
249  * @fn void setAudioPort(int id)
250  * @brief This function set the audio output port id.
251  *
252  * @param[in] id Audio Output port id.
253  * @return None.
254  */
255  void setAudioPort(int id) { _aPortId = id; };
256  void setResolution(const std::string &resolution, bool persist = true, bool isIgnoreEdid=false);
257  void setDisplayConnected(const bool connected);
258  void enable();
259  void disable();
260  int getHDCPStatus();
261  int getHDCPProtocol();
262  int getHDCPReceiverProtocol();
263  int getHDCPCurrentProtocol();
264  void getTVHDRCapabilities(int *capabilities) const;
265  void getSupportedTvResolutions(int *resolutions) const;
266  int forceDisable4KSupport(bool disable);
267  bool setForceHDRMode(dsHDRStandard_t status);
268  bool IsOutputHDR();
269  void ResetOutputToSDR();
270  bool SetHdmiPreference(dsHdcpProtocolVersion_t hdcpProtocol);
271  int GetHdmiPreference();
272 
273  bool setScartParameter(const std::string parameter, const std::string value);
274  int getVideoEOTF() const;
275  int getMatrixCoefficients() const;
276  int getColorSpace() const;
277  int getColorDepth() const;
278  int getQuantizationRange() const;
279  void getCurrentOutputSettings(int &videoEOTF, int &matrixCoefficients, int &colorSpace, int &colorDepth, int &quantizationRange) const;
280  const unsigned int getPreferredColorDepth(bool persist = true) ;
281  void setPreferredColorDepth(const unsigned int colordepth, bool persist = true);
282  void getColorDepthCapabilities (unsigned int *capabilities) const;
283 
284 private:
285  Display _display;
286 
287 
288 };
289 
290 }
291 
292 #endif /* _DS_VIDEOOUTPUTPORT_H_ */
293 
294 
295 /** @} */
296 /** @} */
device::VideoOutputPort::Display::getManufacturerYear
int getManufacturerYear() const
This function returns the year of manufacture of the EDID video display device.
Definition: videoOutputPort.hpp:135
device::VideoOutputPort::getIndex
int getIndex() const
This function returns the index of the video output port.
Definition: videoOutputPort.hpp:234
device::VideoOutputPort::Display::getConnectedDeviceType
int getConnectedDeviceType() const
This function returns the device type of the EDID video display device.
Definition: videoOutputPort.hpp:155
device::VideoOutputPort::getName
const std::string & getName() const
This API gets the name of the VideoOutputPort. The VideoOutputPort names can be HDMI,...
Definition: videoOutputPort.hpp:225
device::VideoOutputPort::Display::getPhysicallAddress
void getPhysicallAddress(uint8_t &physicalAddressA, uint8_t &physicalAddressB, uint8_t &physicalAddressC, uint8_t &physicalAddressD) const
This function gets the physical address of the HDMI node of the video display device.
Definition: videoOutputPort.hpp:196
device::VideoOutputPort::Display::_serialNumber
int _serialNumber
Serial number of the EDID video display device.
Definition: videoOutputPort.hpp:84
device::VideoOutputPort::Display::_physicalAddressB
uint8_t _physicalAddressB
Physical Address for HDMI node B.
Definition: videoOutputPort.hpp:92
device::VideoResolution
Class extending DSConstant to implement the videoResolution interface.
Definition: videoResolution.hpp:57
device::VideoOutputPort::Display::getAspectRatio
const AspectRatio & getAspectRatio() const
This function returns the instance of the aspect ratio that is used currently in connected display de...
Definition: videoOutputPort.hpp:182
device::VideoOutputPort::Display::_physicalAddressD
uint8_t _physicalAddressD
Physical Address for HDMI node D.
Definition: videoOutputPort.hpp:94
aspectRatio.hpp
This file defines AspectRatio class for managing aspect ratio types.
device::VideoOutputPort
Class extending enumerable to implement the videoooutputport interface.
Definition: videoOutputPort.hpp:59
dsTypes.h
Device Settings HAL types.
device::VideoOutputPort::_type
int _type
VideooOtputPortType.
Definition: videoOutputPort.hpp:60
device::VideoOutputPort::_enabled
bool _enabled
Method variable to check whether VideoPort is enabled or not.
Definition: videoOutputPort.hpp:67
device::VideoOutputPort::_index
int _index
Index of the video.
Definition: videoOutputPort.hpp:61
device::VideoOutputPort::_contentProtected
bool _contentProtected
Method variable tO check whether videoport is content protected or not.
Definition: videoOutputPort.hpp:68
device::AudioOutputPort
Class extending Enumerable to implement the audiooutputport interface.
Definition: audioOutputPort.hpp:60
device::VideoOutputPort::Display::_productCode
int _productCode
Product code of the EDID video display device.
Definition: videoOutputPort.hpp:83
device::VideoOutputPort::Display::_physicalAddressC
uint8_t _physicalAddressC
Physical Address for HDMI node C.
Definition: videoOutputPort.hpp:93
device::Enumerable
This class is inherited by many classes in DS for getting the ID.
Definition: enumerable.hpp:46
device::VideoOutputPort::Display::Display
Display()
This function is default constructor and it is used to initialize the display handle and EDID informa...
Definition: videoOutputPort.hpp:105
dsHDRStandard_t
enum _dsHDRStandard_t dsHDRStandard_t
device::AspectRatio
This class extends DSConstant to implement AspectRatio. It manages the aspect ratios of the videos.
Definition: aspectRatio.hpp:50
device::VideoOutputPort::Display::_manufacturerYear
int _manufacturerYear
Year of manufacture of the EDID video display device.
Definition: videoOutputPort.hpp:85
device::VideoOutputPort::Display::_manufacturerWeek
int _manufacturerWeek
Week of manufacture of the EDID video display device.
Definition: videoOutputPort.hpp:86
enumerable.hpp
This file defines Enumerable class.
device::VideoOutputPort::_displayConnected
bool _displayConnected
Method variable to check whether the video display is connected or not.
Definition: videoOutputPort.hpp:69
device::VideoOutputPort::Display
Definition: videoOutputPort.hpp:80
device::VideoOutputPort::_id
int _id
Port id.
Definition: videoOutputPort.hpp:62
device::VideoOutputPort::getId
int getId() const
This function returns the video output port id.
Definition: videoOutputPort.hpp:215
device::VideoOutputPort::setAudioPort
void setAudioPort(int id)
This function set the audio output port id.
Definition: videoOutputPort.hpp:255
device::VideoOutputPort::Display::_physicalAddressA
uint8_t _physicalAddressA
Physical Address for HDMI node A.
Definition: videoOutputPort.hpp:91
device::VideoOutputPort::Display::getProductCode
int getProductCode() const
This function returns the product code of the EDID video display device.
Definition: videoOutputPort.hpp:117
device::VideoOutputPortType
Class extending DSConstant to implement the VideoOutputporttype interface.
Definition: videoOutputPortType.hpp:59
device::VideoOutputPort::Display::getSerialNumber
int getSerialNumber() const
This function returns the serial number of the EDID video display device.
Definition: videoOutputPort.hpp:126
device::VideoOutputPort::Display::getManufacturerWeek
int getManufacturerWeek() const
This function returns the week of manufacture of the EDID video display device.
Definition: videoOutputPort.hpp:144