Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 255 additions & 4 deletions AVInput/AVInput.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in AVInput/AVInput.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 'AVInput/AVInput.cpp' (Match: rdkcentral/rdkservices/1, 1795 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: HdmiInput/HdmiInput.cpp)

Check failure on line 1 in AVInput/AVInput.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 'AVInput/AVInput.cpp' (Match: rdkcentral/rdkservices/5.1.0, 1795 lines, url: https://github.com/rdkcentral/rdkservices/archive/AML_BSP_REL_VERSION_RDK5.1.0.tar.gz, file: AVInput/AVInput.cpp)

Check failure on line 1 in AVInput/AVInput.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 'AVInput/AVInput.cpp' (Match: rdkcentral/rdkservices/1, 1795 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: AVInput/AVInput.cpp)

Check failure on line 1 in AVInput/AVInput.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 'AVInput/AVInput.cpp' (Match: rdkcentral/rdkservices/1, 1795 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: HdmiInput/HdmiInput.cpp)

Check failure on line 1 in AVInput/AVInput.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 'AVInput/AVInput.cpp' (Match: rdkcentral/rdkservices/5.1.0, 1795 lines, url: https://github.com/rdkcentral/rdkservices/archive/AML_BSP_REL_VERSION_RDK5.1.0.tar.gz, file: AVInput/AVInput.cpp)

Check failure on line 1 in AVInput/AVInput.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 'AVInput/AVInput.cpp' (Match: rdkcentral/rdkservices/1, 1795 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: AVInput/AVInput.cpp)
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
Expand Down Expand Up @@ -48,6 +48,9 @@
#define AVINPUT_METHOD_GET_EDID_VERSION "getEdidVersion"
#define AVINPUT_METHOD_SET_EDID_ALLM_SUPPORT "setEdid2AllmSupport"
#define AVINPUT_METHOD_GET_EDID_ALLM_SUPPORT "getEdid2AllmSupport"
#define AVINPUT_METHOD_SET_VRR_SUPPORT "setVRRSupport"
#define AVINPUT_METHOD_GET_VRR_SUPPORT "getVRRSupport"
#define AVINPUT_METHOD_GET_VRR_FRAME_RATE "getVRRFrameRate"
#define AVINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION "getHdmiVersion"
#define AVINPUT_METHOD_SET_MIXER_LEVELS "setMixerLevels"
#define AVINPUT_METHOD_START_INPUT "startInput"
Expand All @@ -65,6 +68,12 @@
#define AVINPUT_EVENT_ON_GAME_FEATURE_STATUS_CHANGED "gameFeatureStatusUpdate"
#define AVINPUT_EVENT_ON_AVI_CONTENT_TYPE_CHANGED "aviContentTypeUpdate"

#define STR_ALLM "ALLM"
#define VRR_TYPE_HDMI "VRR-HDMI"
#define VRR_TYPE_FREESYNC "VRR-FREESYNC"
#define VRR_TYPE_FREESYNC_PREMIUM "VRR-FREESYNC-PREMIUM"
#define VRR_TYPE_FREESYNC_PREMIUM_PRO "VRR-FREESYNC-PREMIUM-PRO"

static bool isAudioBalanceSet = false;
static int planeType = 0;

Expand Down Expand Up @@ -156,7 +165,11 @@
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_HDMI_IN_ALLM_STATUS,
dsAVGameFeatureStatusEventHandler));
IARM_CHECK(IARM_Bus_RegisterEventHandler(
IARM_CHECK(IARM_Bus_RegisterEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS,
dsAVGameFeatureStatusEventHandler));
IARM_CHECK(IARM_Bus_RegisterEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_HOTPLUG,
dsAVEventHandler));
Expand Down Expand Up @@ -198,6 +211,9 @@
IARM_CHECK(IARM_Bus_RemoveEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_HDMI_IN_ALLM_STATUS, dsAVGameFeatureStatusEventHandler));
IARM_CHECK(IARM_Bus_RemoveEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS, dsAVGameFeatureStatusEventHandler));
IARM_CHECK(IARM_Bus_RemoveEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_HOTPLUG, dsAVEventHandler));
Expand Down Expand Up @@ -231,6 +247,9 @@
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_SET_MIXER_LEVELS), &AVInput::setMixerLevels, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_SET_EDID_ALLM_SUPPORT), &AVInput::setEdid2AllmSupportWrapper, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_GET_EDID_ALLM_SUPPORT), &AVInput::getEdid2AllmSupportWrapper, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_SET_VRR_SUPPORT), &AVInput::setVRRSupportWrapper, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_GET_VRR_SUPPORT), &AVInput::getVRRSupportWrapper, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_GET_VRR_FRAME_RATE), &AVInput::getVRRFrameRateWrapper, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION), &AVInput::getHdmiVersionWrapper, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_START_INPUT), &AVInput::startInput, this);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_STOP_INPUT), &AVInput::stopInput, this);
Expand All @@ -239,6 +258,7 @@
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_GAME_FEATURE_STATUS), &AVInput::getGameFeatureStatusWrapper, this);
m_primVolume = DEFAULT_PRIM_VOL_LEVEL;
m_inputVolume = DEFAULT_INPUT_VOL_LEVEL;
m_currentVrrType = dsVRR_NONE;
}

void AVInput::UnregisterAll()
Expand All @@ -251,6 +271,9 @@
Unregister(_T(AVINPUT_METHOD_READ_EDID));
Unregister(_T(AVINPUT_METHOD_READ_RAWSPD));
Unregister(_T(AVINPUT_METHOD_READ_SPD));
Unregister(_T(AVINPUT_METHOD_SET_VRR_SUPPORT));
Unregister(_T(AVINPUT_METHOD_GET_VRR_SUPPORT));
Unregister(_T(AVINPUT_METHOD_GET_VRR_FRAME_RATE));
Unregister(_T(AVINPUT_METHOD_SET_EDID_VERSION));
Unregister(_T(AVINPUT_METHOD_GET_EDID_VERSION));
Unregister(_T(AVINPUT_METHOD_START_INPUT));
Expand Down Expand Up @@ -1024,18 +1047,71 @@

AVInput::_instance->AVInputALLMChange(hdmi_in_port, allm_mode);
}
if (IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS == eventId)
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdmi_in_port = eventData->data.hdmi_in_vrr_mode.port;
dsVRRType_t new_vrrType = eventData->data.hdmi_in_vrr_mode.vrr_type;
LOGWARN("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS event port: %d, VRR Type: %d", hdmi_in_port,new_vrrType);

if(new_vrrType == dsVRR_NONE)
{
if(AVInput::_instance->m_currentVrrType != dsVRR_NONE){
AVInput::_instance->AVInputVRRChange(hdmi_in_port, AVInput::_instance->m_currentVrrType, false);
}
}
else
{
if(AVInput::_instance->m_currentVrrType != dsVRR_NONE){
AVInput::_instance->AVInputVRRChange(hdmi_in_port, AVInput::_instance->m_currentVrrType, false);
}
AVInput::_instance->AVInputVRRChange(hdmi_in_port, new_vrrType, true);
}
AVInput::_instance->m_currentVrrType = new_vrrType;
}
}

void AVInput::AVInputALLMChange( int port , bool allm_mode)
{
JsonObject params;
params["id"] = port;
params["gameFeature"] = "ALLM";
params["gameFeature"] = STR_ALLM;
params["mode"] = allm_mode;

sendNotify(AVINPUT_EVENT_ON_GAME_FEATURE_STATUS_CHANGED, params);
}

void AVInput::AVInputVRRChange( int port , dsVRRType_t vrr_type, bool vrr_mode)
{
JsonObject params;
switch(vrr_type)
{
case dsVRR_HDMI_VRR:
params["id"] = port;
params["gameFeature"] = VRR_TYPE_HDMI;
params["mode"] = vrr_mode;
break;
case dsVRR_AMD_FREESYNC:
params["id"] = port;
params["gameFeature"] = VRR_TYPE_FREESYNC;
params["mode"] = vrr_mode;
break;
case dsVRR_AMD_FREESYNC_PREMIUM:
params["id"] = port;
params["gameFeature"] = VRR_TYPE_FREESYNC_PREMIUM;
params["mode"] = vrr_mode;
break;
case dsVRR_AMD_FREESYNC_PREMIUM_PRO:
params["id"] = port;
params["gameFeature"] = VRR_TYPE_FREESYNC_PREMIUM_PRO;
params["mode"] = vrr_mode;
break;
default:
break;
}
sendNotify(AVINPUT_EVENT_ON_GAME_FEATURE_STATUS_CHANGED, params);
}

uint32_t AVInput::getSupportedGameFeatures(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
Expand Down Expand Up @@ -1084,15 +1160,55 @@
returnResponse(false);
}

if (strcmp (sGameFeature.c_str(), "ALLM") == 0)
if (strcmp (sGameFeature.c_str(), STR_ALLM) == 0)
{
bool allm = getALLMStatus(portId);
LOGWARN("AVInput::getGameFeatureStatusWrapper ALLM MODE:%d", allm);
response["mode"] = allm;
}
else if(strcmp (sGameFeature.c_str(), VRR_TYPE_HDMI) == 0)
{
bool hdmi_vrr = false;
dsHdmiInVrrStatus_t vrrStatus;
getVRRStatus(portId, &vrrStatus);
if(vrrStatus.vrrType == dsVRR_HDMI_VRR)
hdmi_vrr = true;
LOGWARN("AVInput::getGameFeatureStatusWrapper HDMI VRR MODE:%d", hdmi_vrr);
response["mode"] = hdmi_vrr;
}
else if(strcmp (sGameFeature.c_str(), VRR_TYPE_FREESYNC) == 0)
{
bool freesync = false;
dsHdmiInVrrStatus_t vrrStatus;
getVRRStatus(portId, &vrrStatus);
if(vrrStatus.vrrType == dsVRR_AMD_FREESYNC)
freesync = true;
LOGWARN("AVInput::getGameFeatureStatusWrapper FREESYNC MODE:%d", freesync);
response["mode"] = freesync;
}
else if(strcmp (sGameFeature.c_str(), VRR_TYPE_FREESYNC_PREMIUM) == 0)
{
bool freesync_premium = false;
dsHdmiInVrrStatus_t vrrStatus;
getVRRStatus(portId, &vrrStatus);
if(vrrStatus.vrrType == dsVRR_AMD_FREESYNC_PREMIUM)
freesync_premium = true;
LOGWARN("AVInput::getGameFeatureStatusWrapper FREESYNC PREMIUM MODE:%d", freesync_premium);
response["mode"] = freesync_premium;
}
else if(strcmp (sGameFeature.c_str(), VRR_TYPE_FREESYNC_PREMIUM_PRO) == 0)
{
bool freesync_premium_pro = false;
dsHdmiInVrrStatus_t vrrStatus;
getVRRStatus(portId, &vrrStatus);
if(vrrStatus.vrrType == dsVRR_AMD_FREESYNC_PREMIUM_PRO)
freesync_premium_pro = true;
LOGWARN("AVInput::getGameFeatureStatusWrapper FREESYNC PREMIUM PRO MODE:%d", freesync_premium_pro);
response["mode"] = freesync_premium_pro;
}
else
{
LOGWARN("AVInput::getGameFeatureStatusWrapper Mode is not supported. Supported mode: ALLM");
LOGWARN("AVInput::getGameFeatureStatusWrapper Mode is not supported. Supported mode: ALLM, VRR-HDMI, VRR-FREESYNC-PREMIUM");
returnResponse(false);
}
returnResponse(true);
Expand All @@ -1114,6 +1230,22 @@
return allm;
}

bool AVInput::getVRRStatus(int iPort, dsHdmiInVrrStatus_t *vrrStatus)
{
bool ret = true;
try
{
device::HdmiInput::getInstance().getVRRStatus (iPort, vrrStatus);
LOGWARN("AVInput::getVRRStatus VRR TYPE: %d, VRR FRAMERATE: %f", vrrStatus->vrrType,vrrStatus->vrrAmdfreesyncFramerate_Hz);
}
catch (const device::Exception& err)
{
LOG_DEVICE_EXCEPTION1(std::to_string(iPort));
ret = false;
}
return ret;
}

uint32_t AVInput::getRawSPDWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
Expand Down Expand Up @@ -1386,6 +1518,125 @@
}
}

bool AVInput::getVRRSupport(int portId,bool *vrrSupportValue)
{
bool ret = true;
try
{
device::HdmiInput::getInstance().getVRRSupport (portId, vrrSupportValue);
LOGINFO("AVInput - getVRRSupport:%d", *vrrSupportValue);
}
catch (const device::Exception& err)
{
LOG_DEVICE_EXCEPTION1(std::to_string(portId));
ret = false;
}
return ret;
}

uint32_t AVInput::getVRRSupportWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
returnIfParamNotFound(parameters, "portId");
string sPortId = parameters["portId"].String();

int portId = 0;
bool vrrSupport = true;

try {
portId = stoi(sPortId);
}catch (const std::exception& err) {
LOGWARN("sPortId invalid paramater: %s ", sPortId.c_str());
returnResponse(false);
}

bool result = getVRRSupport(portId, &vrrSupport);
if(result == true)
{
response["vrrSupport"] = vrrSupport;
returnResponse(true);
}
else
{
returnResponse(false);
}
}

bool AVInput::setVRRSupport(int portId, bool vrrSupport)
{
bool ret = true;
try
{
device::HdmiInput::getInstance().setVRRSupport (portId, vrrSupport);
LOGWARN("AVInput - vrrSupport:%d", vrrSupport);
}
catch (const device::Exception& err)
{
LOG_DEVICE_EXCEPTION1(std::to_string(portId));
ret = false;
}
return ret;

}

uint32_t AVInput::setVRRSupportWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();

returnIfParamNotFound(parameters, "portId");
returnIfParamNotFound(parameters, "vrrSupport");

int portId = 0;
string sPortId = parameters["portId"].String();
bool vrrSupport = parameters["vrrSupport"].Boolean();

try {
portId = stoi(sPortId);
}catch (const std::exception& err) {
LOGWARN("sPortId invalid paramater: %s ", sPortId.c_str());
returnResponse(false);
}

bool result = setVRRSupport(portId, vrrSupport);
if(result == true)
{
returnResponse(true);
}
else
{
returnResponse(false);
}
}

uint32_t AVInput::getVRRFrameRateWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
returnIfParamNotFound(parameters, "portId");
string sPortId = parameters["portId"].String();

int portId = 0;
dsHdmiInVrrStatus_t vrrStatus;
vrrStatus.vrrAmdfreesyncFramerate_Hz = 0;

try {
portId = stoi(sPortId);
}catch (const std::exception& err) {
LOGWARN("sPortId invalid paramater: %s ", sPortId.c_str());
returnResponse(false);
}

bool result = getVRRStatus(portId, &vrrStatus);
if(result == true)
{
response["currentVRRVideoFrameRate"] = vrrStatus.vrrAmdfreesyncFramerate_Hz;
returnResponse(true);
}
else
{
returnResponse(false);
}
}

uint32_t AVInput::setEdidVersionWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
Expand Down
9 changes: 9 additions & 0 deletions AVInput/AVInput.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in AVInput/AVInput.h

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 'AVInput/AVInput.h' (Match: rdkcentral/rdkservices/1, 131 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: AVInput/AVInput.h)

Check failure on line 1 in AVInput/AVInput.h

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 'AVInput/AVInput.h' (Match: rdkcentral/rdkservices/1, 131 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: AVInput/AVInput.h)
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
Expand Down Expand Up @@ -47,6 +47,8 @@

int m_primVolume;
int m_inputVolume; //Player Volume

dsVRRType_t m_currentVrrType;
public:
// IPlugin methods
// -------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -79,6 +81,9 @@
uint32_t getEdidVersionWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t setEdid2AllmSupportWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t getEdid2AllmSupportWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t setVRRSupportWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t getVRRSupportWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t getVRRFrameRateWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t startInput(const JsonObject& parameters, JsonObject& response);
uint32_t stopInput(const JsonObject& parameters, JsonObject& response);
uint32_t setVideoRectangleWrapper(const JsonObject& parameters, JsonObject& response);
Expand All @@ -95,10 +100,14 @@
std::string getSPD(int iPort);
int setEdidVersion(int iPort, int iEdidVer);
int getEdidVersion(int iPort);
bool setVRRSupport(int portId, bool vrrSupport);
bool getVRRSupport(int portId, bool *vrrSupportValue);
bool setVideoRectangle(int x, int y, int width, int height, int type);
bool getALLMStatus(int iPort);
bool getVRRStatus(int iPort, dsHdmiInVrrStatus_t *vrrStatus);

void AVInputHotplug(int input , int connect, int type);
void AVInputVRRChange( int port , dsVRRType_t vrr_type, bool vrr_mode);
static void dsAVEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void AVInputSignalChange( int port , int signalStatus, int type);
Expand Down
Loading
Loading