|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
34 #include "videoOutputPortConfig.hpp"
35 #include "audioOutputPortConfig.hpp"
40 #include "edid-parser.hpp"
42 #include "safec_lib.h"
44 #include "illegalArgumentException.hpp"
66 const char * VideoOutputPort::kPropertyResolution =
".resolution";
69 READ_EDID_RETRY_MS = 500,
70 READ_EDID_RETRY_TOTAL_MS = 2000
87 return VideoOutputPortConfig::getInstance().getPort(
id);
101 return VideoOutputPortConfig::getInstance().getPort(name);
122 VideoOutputPort::VideoOutputPort(
const int type,
const int index,
const int id,
int audioPortId,
const std::string &resolution) :
123 _type(type), _index(index), _id(id),
124 _handle(-1), _enabled(true), _contentProtected(false),
125 _displayConnected(false), _aPortId(audioPortId),
126 _defaultResolution(resolution),
127 _resolution(resolution),
133 std::stringstream out;
135 _name = std::string(out.str());
139 bool enabled =
false;
145 bool connected =
false;
162 bool VideoOutputPort::setScartParameter(
const std::string parameter,
const std::string value)
167 int VideoOutputPort::getVideoEOTF()
const
176 return (
int)videoEotf;
179 int VideoOutputPort::getMatrixCoefficients()
const
181 dsDisplayMatrixCoefficients_t matrixCoefficients = dsDISPLAY_MATRIXCOEFFICIENT_UNKNOWN;
188 return (
int)matrixCoefficients;
191 int VideoOutputPort::getColorDepth()
const
193 unsigned int colorDepth = 0;
200 return (
int)colorDepth;
203 int VideoOutputPort::getColorSpace()
const
205 dsDisplayColorSpace_t colorSpace = dsDISPLAY_COLORSPACE_UNKNOWN;
212 return (
int)colorSpace;
215 int VideoOutputPort::getQuantizationRange()
const
217 dsDisplayQuantizationRange_t quantizationRange = dsDISPLAY_QUANTIZATIONRANGE_UNKNOWN;
224 return (
int)quantizationRange;
227 void VideoOutputPort::getCurrentOutputSettings(
int &videoEOTF,
int &matrixCoefficients,
int &colorSpace,
int &colorDepth,
int &quantizationRange)
const
230 dsDisplayMatrixCoefficients_t _matrixCoefficients = dsDISPLAY_MATRIXCOEFFICIENT_UNKNOWN;
231 dsDisplayColorSpace_t _colorSpace = dsDISPLAY_COLORSPACE_UNKNOWN;
232 unsigned int _colorDepth = 0;
233 dsDisplayQuantizationRange_t _quantizationRange = dsDISPLAY_QUANTIZATIONRANGE_UNKNOWN;
240 videoEOTF = _videoEOTF;
241 matrixCoefficients = _matrixCoefficients;
242 colorSpace = _colorSpace;
243 colorDepth = _colorDepth;
244 quantizationRange = _quantizationRange;
267 return VideoOutputPortConfig::getInstance().getPortType(
_type);
282 return AudioOutputPortConfig::getInstance().getPort(_aPortId);
296 memset(&resolution, 0,
sizeof(resolution));
301 std::string temp( resolution.
name,strlen(resolution.
name));
302 _resolution = string(temp);
333 memset(&edid, 0,
sizeof(edid));
335 if (_display._handle != 0) {
337 _display._aspectRatio = aspect;
338 dsError =
dsGetEDID(_display._handle, &edid);
357 printf(
"VideoOutputPort::Display::dsGetEDID has dsError: %d\r\n", dsError);
383 bool connected =
false;
400 bool enabled =
false;
459 printf(
"ResOverride VideoOutputPort::setResolution resolutionName:%s persist:%d isIgnoreEdid:%d line:%d\r\n", resolutionName.c_str(), persist, isIgnoreEdid, __LINE__);
460 if (0 && resolutionName.compare(_resolution) == 0) {
467 memset(&resolution, 0,
sizeof(resolution));
474 rc = strcpy_s(resolution.
name,
sizeof(resolution.
name),resolutionName.c_str());
485 _resolution = newResolution.
getName();
488 void VideoOutputPort::setPreferredColorDepth(
const unsigned int colordepth,
bool persist)
497 const unsigned int VideoOutputPort::getPreferredColorDepth(
bool persist)
499 dsDisplayColorDepth_t colordepth = dsDISPLAY_COLORDEPTH_AUTO;
505 return (
unsigned int)colordepth;
508 void VideoOutputPort::getColorDepthCapabilities (
unsigned int *capabilities)
const
540 bool isProtected =
false;
584 _productCode(0), _serialNumber(0),
585 _manufacturerYear(0), _manufacturerWeek(0),
586 _hdmiDeviceType(true), _isSurroundCapable(false),
587 _isDeviceRepeater(false), _aspectRatio(0),
588 _physicalAddressA(1), _physicalAddressB(0),
589 _physicalAddressC(0), _physicalAddressD(0)
607 printf(
"VideoOutputPort::Display::hasSurround\r\n");
610 bool surround =
false;
611 intptr_t vopHandle = 0;
615 printf(
"VideoOutputPort::Display::hasSurround ret %d\r\n", ret);
620 printf(
"VideoOutputPort::Display::hasSurround return default value false");
635 printf(
"VideoOutputPort::Display::getSurroundMode\r\n");
638 int surroundMode = dsSURROUNDMODE_NONE;
639 intptr_t vopHandle = 0;
643 printf(
"VideoOutputPort::Display::getSurroundMode ret %d\r\n", ret);
647 surroundMode = dsSURROUNDMODE_NONE;
648 printf(
"VideoOutputPort::Display::getSurroundMode return default value dsSURROUNDMODE_NONE");
675 using namespace std::chrono;
677 printf(
"VideoOutputPort::Display::getEDIDBytes \r\n");
683 MemGuard() : edidBytes(NULL) {}
690 unsigned char *edidBytes;
693 const auto reading_edid_start = system_clock::now();
694 const char* exceptionstr =
"";
697 retry_get_edid =
false;
698 const auto get_edid_bytes_start = system_clock::now();
701 printf(
"VideoOutputPort::Display::getEDIDBytes has ret %d\r\n", ret);
703 if (length <= 1024) {
704 printf(
"VideoOutputPort::Display::getEDIDBytes has %d bytes\r\n", length);
705 if (edid_parser::EDID_STATUS_OK == edid_parser::EDID_Verify(memguard.edidBytes, length)) {
707 edid.insert(edid.begin(), memguard.edidBytes, memguard.edidBytes + length);
710 exceptionstr =
"EDID verification failed";
711 auto now = system_clock::now();
712 if (now + milliseconds(READ_EDID_RETRY_MS) < reading_edid_start + milliseconds(READ_EDID_RETRY_TOTAL_MS)) {
713 std::this_thread::sleep_for(milliseconds(READ_EDID_RETRY_MS) - (now - get_edid_bytes_start));
714 retry_get_edid =
true;
719 exceptionstr =
"EDID length > 1024";
722 exceptionstr =
"dsGetEDIDBytes failed";
724 }
while (retry_get_edid);
743 int VideoOutputPort::getHDCPStatus()
745 dsHdcpStatus_t hdcpStatus;
754 _hdcpStatus = hdcpStatus;
758 int VideoOutputPort::getHDCPProtocol()
760 dsHdcpProtocolVersion_t hdcpProtocol;
770 int VideoOutputPort::getHDCPReceiverProtocol()
772 dsHdcpProtocolVersion_t hdcpProtocol;
783 int VideoOutputPort::getHDCPCurrentProtocol()
785 dsHdcpProtocolVersion_t hdcpProtocol;
821 int VideoOutputPort::forceDisable4KSupport(
bool disable)
823 dsSetForceDisable4KSupport(_handle,
disable);
867 printf(
"ds: %s: Allready SDR\n",__FUNCTION__);
906 dsHdcpProtocolVersion_t hdcpProtocol;
bool isActive() const
This API is used to check if Port is connected to active port of Sink device.
int getIndex() const
This function returns the index of the video output port.
static VideoOutputPortType & getInstance(const int id)
This function is used to get the instance of the video output port type based on the port id....
bool isContentProtected() const
This API is used to Check if the port or the content output on the port has DTCP or HDCP in use.
dsError_t dsGetEDIDBytes(intptr_t handle, unsigned char **edid, int *length)
This function is used to get the EDID buffer and length of the connected display.
dsError_t dsGetHDCPProtocol(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion)
Get STB HDCP protocol version.
dsError_t dsGetTVHDRCapabilities(intptr_t handle, int *capabilities)
To find the HDR capabilities of TV.
dsError_t dsGetColorSpace(intptr_t handle, dsDisplayColorSpace_t *color_space)
Get current color space setting.
virtual ~VideoOutputPort()
This is a default destructor of class VideoOutputPort.
bool hasSurround() const
This function returns true if connected display supports surround audio.
int _serialNumber
Serial number of the EDID video display device.
const FrameRate & getFrameRate() const
This API is used to get the frame rate of the given video output port.
dsError_t dsGetMatrixCoefficients(intptr_t handle, dsDisplayMatrixCoefficients_t *matrix_coefficients)
Get current matrix coefficients value.
uint8_t _physicalAddressB
Physical Address for HDMI node B.
enum _dsVideoAspectRatio_t dsVideoAspectRatio_t
bool isEnabled() const
This API is used to check whether this Video output port is enabled or not.
dsError_t dsSetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol)
This API is used to set the Preferred HDMI Protocol.
Class extending DSConstant to implement the videoResolution interface.
uint8_t _physicalAddressD
Physical Address for HDMI node D.
bool isDisplayConnected() const
This API is used to Check if the port is currently connected to any display device.
dsVideoStereoScopicMode_t stereoScopicMode
Class extending enumerable to implement the videoooutputport interface.
int _type
VideooOtputPortType.
enum _dsVideoFrameRate_t dsVideoFrameRate_t
dsError_t dsGetEDID(intptr_t handle, dsDisplayEDID_t *edid)
Get the EDID information from the specified display device.
enum _dsVideoPortType_t dsVideoPortType_t
bool _enabled
Method variable to check whether VideoPort is enabled or not.
bool IsOutputHDR()
This API is used to check if Video output is HDR or not.
dsError_t dsEnableVideoPort(intptr_t handle, bool enabled)
Enable/disable a video port.
dsError_t dsGetDisplayAspectRatio(intptr_t handle, dsVideoAspectRatio_t *aspectRatio)
This function gets the aspect ratio for the dsiaply device. This function returns the aspect ratio of...
int _index
Index of the video.
dsVideoResolution_t pixelResolution
bool _contentProtected
Method variable tO check whether videoport is content protected or not.
void setDisplayConnected(const bool connected)
This API is used to set the video output port display to be connected.
const StereoScopicMode & getStereoscopicMode() const
This API is used to get the stereoscopic mode of the given video output port.
dsError_t dsGetDisplay(dsVideoPortType_t vType, int index, intptr_t *handle)
Get the handle of a display device.
bool isInterlaced() const
This API is used to check the video is interlaced or not.
dsError_t dsGetHDCPStatus(intptr_t handle, dsHdcpStatus_t *status)
Get current HDCP status.
Class extending Enumerable to implement the audiooutputport interface.
const VideoOutputPortType & getType() const
This API is used to get the type of the video output port. A type of the video output port represent ...
const VideoResolution & getDefaultResolution() const
This API is used to get the default resolution supported by the video output port.
dsError_t dsGetColorDepth(intptr_t handle, unsigned int *color_depth)
Get current color depth value.
dsError_t dsGetCurrentOutputSettings(intptr_t handle, dsHDRStandard_t *video_eotf, dsDisplayMatrixCoefficients_t *matrix_coefficients, dsDisplayColorSpace_t *color_space, unsigned int *color_depth, dsDisplayQuantizationRange_t *quantization_range)
Get current color space setting, color depth, matrix coefficients, video Electro-Optical Transfer Fun...
const VideoResolution & getResolution()
This API is used to get the current video resolution output from the video output port....
dsError_t dsIsHDCPEnabled(intptr_t handle, bool *pContentProtected)
Indicate whether a video port is HDCP protected.
void getSupportedTvResolutions(int *resolutions) const
This API is used to get TV supported Video Resolutions.
It contains structures and class referenced by the videoOutputportTypes.cpp file.
const VideoOutputPort::Display & getDisplay()
This API is used to get the display device information currently connected to the output port....
bool isDynamicResolutionsSupported() const
This function is used to query if dynamic resolutions are supported by the port type.
enum _dsVideoResolution_t dsVideoResolution_t
dsError_t dsIsDisplaySurround(intptr_t handle, bool *surround)
This function is used to indicate if the display connected supports surround audio.
dsError_t dsSetForceHDRMode(intptr_t handle, dsHDRStandard_t mode)
This API is used to set/reset force HDR mode.
dsError_t dsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist)
To get the preffered color depth mode.
It contains class and structure refrenced by the videoResolution.cpp file.
dsError_t dsColorDepthCapabilities(intptr_t handle, unsigned int *colorDepthCapability)
To find the color depth capabilities.
static const VideoResolution & getInstance(int id)
This API is used to get the instance of the video resolution port based on the port id returned by th...
int _productCode
Product code of the EDID video display device.
uint8_t _physicalAddressC
Physical Address for HDMI node C.
dsError_t dsIsOutputHDR(intptr_t handle, bool *hdr)
Check Video Output is HDR or not.
dsError_t dsIsVideoPortEnabled(intptr_t handle, bool *enabled)
Indicate whether a video port is enabled.
void getTVHDRCapabilities(int *capabilities) const
This API is used to get HDR format supported by TV.
dsError_t dsGetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol)
This API is used to get the Preferred HDMI Protocol.
bool setForceHDRMode(dsHDRStandard_t status)
This API is used to set/reset force HDR mode.
const PixelResolution & getPixelResolution() const
This API is used to get the pixel format of the given video output port.
dsVideoAspectRatio_t aspectRatio
Defines the structure that is used to get the EDID information of the video display.
dsError_t dsSupportedTvResolutions(intptr_t handle, int *resolutions)
To find the TV supported resolutions.
virtual const std::string & getName() const
This function is used to the get the data member name.
dsError_t dsSetResolution(intptr_t handle, dsVideoPortResolution_t *resolution, bool persist)
Set video port's display resolution.
Display()
This function is default constructor and it is used to initialize the display handle and EDID informa...
void ResetOutputToSDR()
This API is used to reset the video output to SDR if it is HDR.
dsError_t dsGetHDCPReceiverProtocol(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion)
Get Receiver/TV HDCP protocol version.
It contains class and structure refrenced by the videooutputport.cpp file.
enum _dsHDRStandard_t dsHDRStandard_t
Structure that defines video port resolution settings of output video device.
This class extends Exception class to manage unsupported operations in devicesettings.
This class handles exceptions occurring in DS module.
dsError_t dsIsVideoPortActive(intptr_t handle, bool *active)
This function is used to indicate whether a video port is connected to a display.
AudioOutputPort & getAudioOutputPort()
This API is used to get the audio output port connected to the video output port. This connection is ...
int getSurroundMode() const
This function returns surround mode supported by connected display.
int _manufacturerYear
Year of manufacture of the EDID video display device.
bool SetHdmiPreference(dsHdcpProtocolVersion_t hdcpProtocol)
This API is used to set the Preferred HDMI Protocol.
int _manufacturerWeek
Week of manufacture of the EDID video display device.
void setResolution(const std::string &resolution, bool persist=true, bool isIgnoreEdid=false)
This API is used to set the output resolution of the port by ID or its Name. The specified resolution...
virtual ~Display()
This function is a default destructor of class Display.
void getEDIDBytes(std::vector< uint8_t > &edid) const
This function is used to get the EDID information of the connected video display. After it gets the E...
dsError_t dsGetResolution(intptr_t handle, dsVideoPortResolution_t *resolution)
Get the video display resolution.
void enable()
This API is used to enable the video output port.
dsError_t dsSetScartParameter(intptr_t handle, const char *parameter_str, const char *value_str)
Sets various SCART parameters.
dsError_t dsGetQuantizationRange(intptr_t handle, dsDisplayQuantizationRange_t *quantization_range)
Get quatization range.
dsError_t dsIsDisplayConnected(intptr_t handle, bool *connected)
Indicate whether a video port is connected to a display.
bool _displayConnected
Method variable to check whether the video display is connected or not.
dsError_t dsGetHDCPCurrentProtocol(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion)
Get current used HDCP protocol version.
@ dsERR_OPERATION_NOT_SUPPORTED
It contain variables,stuctures,class and functions referenced by audiooutputportType code.
uint8_t _physicalAddressA
Physical Address for HDMI node A.
Class extending DSConstant to implement the VideoOutputporttype interface.
This class extends Exception class to manage the expections caused due to illegal arguments.
dsVideoFrameRate_t frameRate
enum _dsVideoStereoScopicMode_t dsVideoStereoScopicMode_t
dsError_t dsGetSurroundMode(intptr_t handle, int *surround)
This function is used to get supported surround mode.
bool isDynamicResolutionSupported() const
This API is used to check whether the video output port supports the dynamic super resolution or not.
const AspectRatio & getAspectRatio() const
This API is used to get the current Aspect Ratio setting of the Display Device (i....
This file defines UnsupportedOperationException class.
int GetHdmiPreference()
This API is used to get the HDMI Preference.
dsError_t dsGetVideoEOTF(intptr_t handle, dsHDRStandard_t *video_eotf)
Get current video Electro-Optical Transfer Function (EOT) value;.
dsError_t
Device Settings API Error return codes.
dsError_t dsSetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t colorDepth, bool persist)
To set the preffered color depth mode.
virtual int getId() const
This function is used to get the id.
dsError_t dsResetOutputToSDR()
Reset Video Output to SDR.
void disable()
This API is used to disable the Audio output port.
dsError_t dsGetVideoPort(dsVideoPortType_t type, int index, intptr_t *handle)
Get the video port handle.