Skip to content
Open
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
177 changes: 176 additions & 1 deletion 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, 1696 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/5.1.0, 1696 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, 1696 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: HdmiInput/HdmiInput.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,8 @@
#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_HDMI_COMPATIBILITY_VERSION "getHdmiVersion"
#define AVINPUT_METHOD_SET_MIXER_LEVELS "setMixerLevels"
#define AVINPUT_METHOD_START_INPUT "startInput"
Expand All @@ -64,6 +66,7 @@
#define AVINPUT_EVENT_ON_VIDEO_MODE_UPDATED "videoStreamInfoUpdate"
#define AVINPUT_EVENT_ON_GAME_FEATURE_STATUS_CHANGED "gameFeatureStatusUpdate"
#define AVINPUT_EVENT_ON_AVI_CONTENT_TYPE_CHANGED "aviContentTypeUpdate"
#define IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS 35

static bool isAudioBalanceSet = false;
static int planeType = 0;
Expand Down Expand Up @@ -156,6 +159,10 @@
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_HDMI_IN_ALLM_STATUS,
dsAVGameFeatureStatusEventHandler));
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,
Expand Down Expand Up @@ -198,6 +205,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 +241,8 @@
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_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 +251,8 @@
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_vrrMode = false;
m_vrrType = VRR_NONE;
}

void AVInput::UnregisterAll()
Expand All @@ -251,6 +265,8 @@
Unregister(_T(AVINPUT_METHOD_READ_EDID));
Unregister(_T(AVINPUT_METHOD_READ_RAWSPD));
Unregister(_T(AVINPUT_METHOD_READ_SPD));
Unregister(_T(AVINPUT_METHOD_GET_VRR_SUPPORT));
Unregister(_T(AVINPUT_METHOD_SET_VRR_SUPPORT));
Unregister(_T(AVINPUT_METHOD_SET_EDID_VERSION));
Unregister(_T(AVINPUT_METHOD_GET_EDID_VERSION));
Unregister(_T(AVINPUT_METHOD_START_INPUT));
Expand Down Expand Up @@ -1001,6 +1017,28 @@

AVInput::_instance->AVInputALLMChange(hdmi_in_port, allm_mode);
}
if (IARM_BUS_DSMGR_EVENT_HDMI_IN_VRR_STATUS == eventId)
{
bool vrr_mode = true;
// Hardcoding the values
int hdmi_in_port = 0;
VRRType_t vrrType = VRR_HDMI_VRR;
//
if(vrrType == VRR_NONE)
{
vrr_mode = false;
AVInput::_instance->AVInputHDMIVRRChange(hdmi_in_port, vrr_mode);
AVInput::_instance->AVInputAMDFreeSyncChange(hdmi_in_port, vrr_mode);
}
else if(vrrType == VRR_HDMI_VRR)
{
AVInput::_instance->AVInputHDMIVRRChange(hdmi_in_port, vrr_mode);
}
else if(vrrType == VRR_AMD_FREESYNC_PREMIUM)
{
AVInput::_instance->AVInputAMDFreeSyncChange(hdmi_in_port, vrr_mode);
}
}
}

void AVInput::AVInputALLMChange( int port , bool allm_mode)
Expand All @@ -1012,6 +1050,25 @@

sendNotify(AVINPUT_EVENT_ON_GAME_FEATURE_STATUS_CHANGED, params);
}
void AVInput::AVInputHDMIVRRChange( int port , bool vrr_mode)
{
JsonObject params;
params["id"] = port;
params["gameFeature"] = "VRR-HDMI";
params["mode"] = vrr_mode;

sendNotify(AVINPUT_EVENT_ON_GAME_FEATURE_STATUS_CHANGED, params);
}

void AVInput::AVInputAMDFreeSyncChange( int port , bool vrr_mode)
{
JsonObject params;
params["id"] = port;
params["gameFeature"] = "VRR-FREESYNC-PREMIUM";
params["mode"] = vrr_mode;

sendNotify(AVINPUT_EVENT_ON_GAME_FEATURE_STATUS_CHANGED, params);
}

uint32_t AVInput::getSupportedGameFeatures(const JsonObject& parameters, JsonObject& response)
{
Expand Down Expand Up @@ -1067,9 +1124,33 @@
LOGWARN("AVInput::getGameFeatureStatusWrapper ALLM MODE:%d", allm);
response["mode"] = allm;
}
else if(strcmp (sGameFeature.c_str(), "VRR-HDMI") == 0)
{
bool hdmi_vrr = false;
VRRType_t vrrType;
getVRRStatus(portId, &vrrType);
if(vrrType == VRR_HDMI_VRR)
hdmi_vrr = true;
else
hdmi_vrr = false;
LOGWARN("AVInput::getGameFeatureStatusWrapper HDMI VRR MODE:%d", hdmi_vrr);
response["mode"] = hdmi_vrr;
}
else if(strcmp (sGameFeature.c_str(), "VRR-FREESYNC-PREMIUM") == 0)
{
bool amd_freesync_premium = false;
VRRType_t vrrType;
getVRRStatus(portId, &vrrType);
if(vrrType == VRR_AMD_FREESYNC_PREMIUM)
amd_freesync_premium = true;
else
amd_freesync_premium = false;
LOGWARN("AVInput::getGameFeatureStatusWrapper AMD FreeSync Premium MODE:%d", amd_freesync_premium);
response["mode"] = amd_freesync_premium;
}
else
{
LOGWARN("AVInput::getGameFeatureStatusWrapper Mode is not supported. Supported mode: ALLM");
LOGWARN("AVInput::getGameFeatureStatusWrapper Mode is not supported. Supported mode: ALLM, HDMI VRR, AMD FreeSync Premium");
returnResponse(false);
}
returnResponse(true);
Expand All @@ -1091,6 +1172,17 @@
return allm;
}

void AVInput::getVRRStatus(int iPort, VRRType_t *vrrType)
{
/* to be implemented

//device::HdmiInput::getInstance().getVRRStatus (iPort, vrrType);

*/

*vrrType = m_vrrType;
}

uint32_t AVInput::getRawSPDWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
Expand Down Expand Up @@ -1363,6 +1455,89 @@
}
}

bool AVInput::getVRRSupport(int portId,bool *vrrSupportValue)
{
bool ret = true;
/*
to be implemented
device::HdmiInput::getInstance().getVRRSupport (portId, vrrSupportValue);
*/
*vrrSupportValue = m_vrrMode;
return ret;
}

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

int portId = 0;
bool vrrSupport = true;
returnIfParamNotFound(parameters, "portId");

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;
/*
device::HdmiInput::getInstance().setVRRSupport (portId, vrrSupport);
*/
m_vrrMode = vrrSupport;
if(m_vrrMode)
m_vrrType = VRR_HDMI_VRR;
else
m_vrrType = VRR_NONE;

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::setEdidVersionWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
Expand Down
20 changes: 20 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, 129 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,18 @@

int m_primVolume;
int m_inputVolume; //Player Volume

typedef enum {
VRR_NONE, // No VRR support
VRR_HDMI_VRR, // VRR (HDMI v2.1 flavour)
VRR_AMD_FREESYNC, // AMD FreeSync
VRR_AMD_FREESYNC_PREMIUM, // AMD FreeSync Premium
VRR_AMD_FREESYNC_PREMIUM_PRO // AMD FreeSync Premium Pro
}VRRType_t;

bool m_vrrMode;
VRRType_t m_vrrType;

public:
// IPlugin methods
// -------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -79,6 +91,8 @@
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 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,8 +109,11 @@
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);
void getVRRStatus(int iPort, VRRType_t *vrrType);

void AVInputHotplug(int input , int connect, int type);
static void dsAVEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
Expand All @@ -111,6 +128,9 @@
static void dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void AVInputALLMChange( int port , bool allmMode);
void AVInputHDMIVRRChange( int port , bool vrr_mode);
void AVInputAMDFreeSyncChange( int port , bool vrr_mode);

static void dsAVGameFeatureStatusEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void hdmiInputAviContentTypeChange(int port, int content_type);
Expand Down
Loading