Skip to content
6 changes: 6 additions & 0 deletions ds/include/videoOutputPort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ class VideoOutputPort : public Enumerable {
void setPreferredColorDepth(const unsigned int colordepth, bool persist = true);
void getColorDepthCapabilities (unsigned int *capabilities) const;

// static IARM_Result_t _SetStandbyVideoState(void *arg)
void SetStandbyVideoState();

// static IARM_Result_t _GetStandbyVideoState(void *arg)
void GetStandbyVideoState();

private:
Display _display;

Expand Down
36 changes: 28 additions & 8 deletions ds/videoOutputPort.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in ds/videoOutputPort.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ds/videoOutputPort.cpp' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/1906, 908 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-1906.tar.gz, file: ds/videoOutputPort.cpp)

Check failure on line 3 in ds/videoOutputPort.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ds/videoOutputPort.cpp' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2009, 908 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/RDK-DEV-2009.tar.gz, file: ds/videoOutputPort.cpp)

Check failure on line 3 in ds/videoOutputPort.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ds/videoOutputPort.cpp' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/1906, 908 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-1906.tar.gz, file: ds/videoOutputPort.cpp)

Check failure on line 3 in ds/videoOutputPort.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ds/videoOutputPort.cpp' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2009, 908 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/RDK-DEV-2009.tar.gz, file: ds/videoOutputPort.cpp)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -911,18 +911,38 @@
return hdcpProtocol;
}

bool VideoOutputPort::SetStandbyVideoState(const string port , const bool enable)
{
dsError_t ret = dsSetStandbyVideoState(port, enable);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to propagate dsError_t, applicable to other APIs too..

if (ret != dsERR_NONE) {
return false;
}
return true;

}

bool VideoOutputPort::GetStandbyVideoState(const string port, bool isEnabled)
{
dsError_t ret = dsGetStandbyVideoState(port, isEnabled);
if (ret != dsERR_NONE) {
return false;
}
return true;

}

/**
* @fn void setAllmEnabled(bool enable);
* @brief Enables/Disables ALLM mode for connected HDMI display.
*/
void VideoOutputPort::Display::setAllmEnabled(bool enable) const
{
printf("VideoOutputPort::Display::setAllmEnabled \r\n");
dsError_t ret = dsSetAllmEnabled(_handle,enable);
if (ret != dsERR_NONE) {
throw Exception(ret);
}
}
void VideoOutputPort::Display::setAllmEnabled(bool enable) const
{
printf("VideoOutputPort::Display::setAllmEnabled \r\n");
dsError_t ret = dsSetAllmEnabled(_handle,enable);
if (ret != dsERR_NONE) {
throw Exception(ret);
}
}

/**
* @fn void setAVIContentType(dsAviContentType_t contentType);
Expand Down
48 changes: 48 additions & 0 deletions rpc/cli/dsVideoPort.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 2 in rpc/cli/dsVideoPort.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'rpc/cli/dsVideoPort.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2008, 963 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-2008.tar.gz, file: rpc/cli/dsVideoPort.c)

Check failure on line 2 in rpc/cli/dsVideoPort.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'rpc/cli/dsVideoPort.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/1906, 963 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-1906.tar.gz, file: rpc/cli/dsVideoPort.c)

Check failure on line 2 in rpc/cli/dsVideoPort.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'rpc/cli/dsVideoPort.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2008, 963 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-2008.tar.gz, file: rpc/cli/dsVideoPort.c)

Check failure on line 2 in rpc/cli/dsVideoPort.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'rpc/cli/dsVideoPort.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/1906, 963 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-1906.tar.gz, file: rpc/cli/dsVideoPort.c)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -965,6 +965,54 @@
return dsERR_GENERAL ;
}

dsError_t dsSetStandbyVideoState(string port , const bool enable)
{
dsError_t dsErr = dsERR_GENERAL;
_DEBUG_ENTER();

if(!port.empty())
{
dsMgrStandbyVideoStateParam_t param;
param.port = port;
param.isEnabled = enable;
param.result = 0;

IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
(char *)IARM_BUS_DSMGR_API_dsSetStandbyVideoState,
(void *)&param, sizeof(param));

if (IARM_RESULT_SUCCESS == rpcRet)
{
dsErr = dsERR_NONE;
}
}
return dsErr ;
}

dsError_t dsGetStandbyVideoState(string port , bool enable)
{
dsError_t dsErr = dsERR_GENERAL;
_DEBUG_ENTER();

if(!port.empty())
{
dsMgrStandbyVideoStateParam_t param;
param.port = port;
param.result = 0;

IARM_Result_t rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
(char *)IARM_BUS_DSMGR_API_dsGetStandbyVideoState,
(void *)&param,
sizeof(param));

if (IARM_RESULT_SUCCESS == rpcRet)
{
enable = param.isEnabled;
dsErr = dsERR_NONE;
}
}
return dsErr ;
}

/** @} */
/** @} */
3 changes: 3 additions & 0 deletions rpc/include/dsRpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ extern "C" {
#define IARM_BUS_DSMGR_API_dsSetBackgroundColor "dsSetBackgroundColor"
#define IARM_BUS_DSMGR_API_dsSetForceHDRMode "dsSetForceHDRMode"
#define IARM_BUS_DSMGR_API_dsSetAllmEnabled "dsSetAllmEnabled"
#define IARM_BUS_DSMGR_API_dsSetStandbyVideoState "dsSetStandbyVideoState"
#define IARM_BUS_DSMGR_API_dsGetStandbyVideoState "dsGetStandbyVideoState"

/*
* Declare RPC FP API names
*/
Expand Down
103 changes: 101 additions & 2 deletions rpc/srv/dsVideoPort.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in rpc/srv/dsVideoPort.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'ISC' license found in local file 'rpc/srv/dsVideoPort.c' (Match: rdk/components/generic/iarmmgrs/rdk/components/generic/iarmmgrs/7ff5a0a, 1239 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/iarmmgrs/+archive/7ff5a0ad8fb159162bf6e99581c884a2ea97cecb.tar.gz, file: power/pwrMgr.c)

Check failure on line 3 in rpc/srv/dsVideoPort.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'rpc/srv/dsVideoPort.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2102, 2367 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-2102.tar.gz, file: rpc/srv/dsVideoPort.c)

Check failure on line 3 in rpc/srv/dsVideoPort.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'rpc/srv/dsVideoPort.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2102, 2367 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-2102.tar.gz, file: rpc/srv/dsVideoPort.c)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -61,9 +61,14 @@
#define DEFAULT_RESOLUTION "720p"
#define DEFAULT_RESOLUTION_1080P "1080p"
#define DEFAULT_RESOLUTION_2160P "2160p"

#define MAX_NUM_VIDEO_PORTS 5
#define DEFAULT_SD_RESOLUTION "480i"

typedef struct{
char port[DSMGR_MAX_VIDEO_PORT_NAME_LENGTH];
bool isEnabled;
}DSMgr_Standby_Video_State_t;

static int m_isInitialized = 0;
static int m_isPlatInitialized = 0;
static pthread_mutex_t dsLock = PTHREAD_MUTEX_INITIALIZER;
Expand All @@ -75,6 +80,8 @@
static bool force_disable_4K = false;
static const dsDisplayColorDepth_t DEFAULT_COLOR_DEPTH = dsDISPLAY_COLORDEPTH_AUTO;
static dsDisplayColorDepth_t hdmiColorDept = DEFAULT_COLOR_DEPTH;
static DSMgr_Standby_Video_State_t g_standby_video_port_setting[MAX_NUM_VIDEO_PORTS];

#define NULL_HANDLE 0
#define IARM_BUS_Lock(lock) pthread_mutex_lock(&dsLock)
#define IARM_BUS_Unlock(lock) pthread_mutex_unlock(&dsLock)
Expand Down Expand Up @@ -317,7 +324,9 @@
IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsColorDepthCapabilities,_dsColorDepthCapabilities);
IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetPreferredColorDepth,_dsGetPreferredColorDepth);
IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetPreferredColorDepth,_dsSetPreferredColorDepth);

IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetStandbyVideoState,_dsSetStandbyVideoState);
IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetStandbyVideoState,_dsGetStandbyVideoState);

dsError_t eRet = _dsVideoFormatUpdateRegisterCB (_dsVideoFormatUpdateCB) ;
if (dsERR_NONE != eRet) {
INT_DEBUG("%s: _dsVideoFormatUpdateRegisterCB eRet:%04x", __FUNCTION__, eRet);
Expand Down Expand Up @@ -1195,6 +1204,96 @@

}

IARM_Result_t _dsSetStandbyVideoState(void *arg)
{
dsMgrStandbyVideoStateParam_t *param = (dsMgrStandbyVideoStateParam_t *)arg;
if(NULL == param->port)
{
param->result = -1;
INT_DEBUG("[%s] empty port name. Cannot proceed.\n", __FUNCTION__);
return IARM_RESULT_SUCCESS;
}
else
param->result = 0;

int i = 0;
for(i = 0; i < MAX_NUM_VIDEO_PORTS; i++)
{
if(0 == strncasecmp(param->port, g_standby_video_port_setting[i].port, DSMGR_MAX_VIDEO_PORT_NAME_LENGTH))
{
/*Found a match. Update it*/
g_standby_video_port_setting[i].isEnabled = ((0 == param->isEnabled) ? false : true);
break;
}
}
if(MAX_NUM_VIDEO_PORTS == i)
{
/*No matching entries are present. Add one.*/
for(i = 0; i < MAX_NUM_VIDEO_PORTS; i++)
{
if('\0' == g_standby_video_port_setting[i].port[0])
{
strncpy(g_standby_video_port_setting[i].port, param->port, (DSMGR_MAX_VIDEO_PORT_NAME_LENGTH - 1));
g_standby_video_port_setting[i].isEnabled = ((0 == param->isEnabled) ? false : true);
break;
}
}
}
if(MAX_NUM_VIDEO_PORTS == i)
{
INT_DEBUG("[%s] Error! Out of room to write new video port setting for standby mode.\n", __FUNCTION__);
}

try
{
device::VideoOutputPort &vPort = device::Host::getInstance().getVideoOutputPort(param->port);
if((POWER_STATE_ON != curState) && (POWER_STATE_OFF != curState))
{
/*We're currently in one of the standby states. This new setting needs to be applied right away.*/
INT_DEBUG("[%s] Setting standby %s port status to %s.\n", __FUNCTION__, param->port, ((1 == param->isEnabled)? "enabled" : "disabled"));
if(1 == param->isEnabled)
vPort.enable();
else
vPort.disable();
}
else
{
INT_DEBUG("[%s] video port %s will be %s when going into standby mode.\n", __FUNCTION__, param->port, ((1 == param->isEnabled)? "enabled" : "disabled"));
}
}
catch (...)
{
INT_DEBUG("Exception Caught during [%s]. Possible bad video port.\n", __FUNCTION__);
param->result = -1;
}
return IARM_RESULT_SUCCESS;
}

IARM_Result_t _dsGetStandbyVideoState(void *arg)
{
INT_INFO("Entering [%s]\r\n", __FUNCTION__);
dsMgrStandbyVideoStateParam_t *param = (dsMgrStandbyVideoStateParam_t *)arg;
if(NULL == param->port)
{
INT_DEBUG("[%s]Bad port name. Cannot get state.\n", __FUNCTION__);
return IARM_RESULT_SUCCESS;
}

try
{
device::VideoOutputPort &vPort = device::Host::getInstance().getVideoOutputPort(param->port);
}
catch (...)
{
INT_DEBUG("Exception Caught during [%s]. Possible bad video port.\n", __FUNCTION__);
param->result = -1;
return IARM_RESULT_SUCCESS;
}
param->isEnabled = ((true == get_video_port_standby_setting(param->port))? 1 : 0);
param->result = 0;
return IARM_RESULT_SUCCESS;
}

dsError_t handleDsColorDepthCapabilities(intptr_t handle, unsigned int *colorDepthCapability )
{
#ifndef RDK_DSHAL_NAME
Expand Down
Loading