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
127 changes: 108 additions & 19 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: HariniElangovan890/rdkservices/d73bf6eda46ff140b2d678f5a2eaf3fca1c07bbd, 1521 lines, url: https://github.com/HariniElangovan890/rdkservices/archive/d73bf6eda46ff140b2d678f5a2eaf3fca1c07bbd.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 @@ -31,8 +31,8 @@
#include <algorithm>

#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 6
#define API_VERSION_NUMBER_PATCH 0
#define API_VERSION_NUMBER_MINOR 7
#define API_VERSION_NUMBER_PATCH 1

#define HDMI 0
#define COMPOSITE 1
Expand All @@ -48,6 +48,7 @@
#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_GET_HDMI_COMPATIBILITY_VERSION "getHdmiVersion"
#define AVINPUT_METHOD_SET_MIXER_LEVELS "setMixerLevels"
#define AVINPUT_METHOD_START_INPUT "startInput"
#define AVINPUT_METHOD_STOP_INPUT "stopInput"
Expand Down Expand Up @@ -167,6 +168,10 @@
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS,
dsAVStatusEventHandler));
IARM_CHECK(IARM_Bus_RegisterEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE,
dsAVVideoModeEventHandler));
IARM_CHECK(IARM_Bus_RegisterEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE,
Expand Down Expand Up @@ -203,6 +208,9 @@
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_STATUS, dsAVStatusEventHandler));
IARM_CHECK(IARM_Bus_RemoveEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE, dsAVVideoModeEventHandler));
IARM_CHECK(IARM_Bus_RemoveEventHandler(
IARM_BUS_DSMGR_NAME,
IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE, dsAviContentTypeEventHandler));
}
Expand All @@ -223,6 +231,7 @@
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_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);
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_SCALE_INPUT), &AVInput::setVideoRectangleWrapper, this);
Expand Down Expand Up @@ -748,17 +757,18 @@
* @param[in] port HDMI In port id.
* @param[dsVideoPortResolution_t] video resolution data
*/
void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution)
void AVInput::AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution, int type)
{
LOGWARN("AVInputVideoModeUpdate [%d]", port);

JsonObject params;
params["id"] = port;
std::stringstream locator;
locator << "hdmiin://localhost/deviceid/" << port;
params["locator"] = locator.str();
if(type == HDMI){

locator << "hdmiin://localhost/deviceid/" << port;
switch(resolution.pixelResolution) {

switch(resolution.pixelResolution) {
case dsVIDEO_PIXELRES_720x480:
params["width"] = 720;
params["height"] = 480;
Expand All @@ -773,8 +783,8 @@
params["width"] = 1280;
params["height"] = 720;
break;

case dsVIDEO_PIXELRES_1920x1080:
case dsVIDEO_PIXELRES_1920x1080:
params["width"] = 1920;
params["height"] = 1080;
break;
Expand All @@ -793,10 +803,31 @@
params["width"] = 1920;
params["height"] = 1080;
break;
}
params["progressive"] = (!resolution.interlaced);
}
else if(type == COMPOSITE)
{
locator << "cvbsin://localhost/deviceid/" << port;
switch(resolution.pixelResolution) {
case dsVIDEO_PIXELRES_720x480:
params["width"] = 720;
params["height"] = 480;
break;
case dsVIDEO_PIXELRES_720x576:
params["width"] = 720;
params["height"] = 576;
break;
default:
params["width"] = 720;
params["height"] = 576;
break;
}

params["progressive"] = (!resolution.interlaced);
params["progressive"] = false;
}

params["locator"] = locator.str();
switch(resolution.frameRate) {
case dsVIDEO_FRAMERATE_24:
params["frameRateN"] = 24000;
Expand Down Expand Up @@ -849,16 +880,17 @@

void AVInput::dsAviContentTypeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
{
if(!AVInput::_instance)
return;
if(!AVInput::_instance)
return;

if (IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE == eventId)
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdmi_in_port = eventData->data.hdmi_in_content_type.port;
int avi_content_type = eventData->data.hdmi_in_content_type.aviContentType;
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE event port: %d, Content Type : %d", hdmi_in_port,avi_content_type);
AVInput::_instance->hdmiInputAviContentTypeChange(hdmi_in_port, avi_content_type);
if (IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE == eventId)
{
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdmi_in_port = eventData->data.hdmi_in_content_type.port;
int avi_content_type = eventData->data.hdmi_in_content_type.aviContentType;
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_AVI_CONTENT_TYPE event port: %d, Content Type : %d", hdmi_in_port,avi_content_type);

AVInput::_instance->hdmiInputAviContentTypeChange(hdmi_in_port, avi_content_type);
}
}

Expand Down Expand Up @@ -941,7 +973,17 @@
resolution.interlaced = eventData->data.hdmi_in_video_mode.resolution.interlaced;
resolution.frameRate = eventData->data.hdmi_in_video_mode.resolution.frameRate;
LOGWARN("Received IARM_BUS_DSMGR_EVENT_HDMI_IN_VIDEO_MODE_UPDATE event port: %d, pixelResolution: %d, interlaced : %d, frameRate: %d \n", hdmi_in_port,resolution.pixelResolution, resolution.interlaced, resolution.frameRate);
AVInput::_instance->AVInputVideoModeUpdate(hdmi_in_port, resolution);
AVInput::_instance->AVInputVideoModeUpdate(hdmi_in_port, resolution,HDMI);
}
else if (IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE == eventId) {
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int composite_in_port = eventData->data.composite_in_video_mode.port;
dsVideoPortResolution_t resolution = {};
resolution.pixelResolution = eventData->data.composite_in_video_mode.resolution.pixelResolution;
resolution.interlaced = eventData->data.composite_in_video_mode.resolution.interlaced;
resolution.frameRate = eventData->data.composite_in_video_mode.resolution.frameRate;
LOGWARN("Received IARM_BUS_DSMGR_EVENT_COMPOSITE_IN_VIDEO_MODE_UPDATE event port: %d, pixelResolution: %d, interlaced : %d, frameRate: %d \n", composite_in_port,resolution.pixelResolution, resolution.interlaced, resolution.frameRate);
AVInput::_instance->AVInputVideoModeUpdate(composite_in_port, resolution,COMPOSITE);
}
}

Expand Down Expand Up @@ -1362,6 +1404,53 @@
}
}

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

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

dsHdmiMaxCapabilityVersion_t hdmiCapVersion = HDMI_COMPATIBILITY_VERSION_14;

try {
device::HdmiInput::getInstance().getHdmiVersion(portId, &(hdmiCapVersion));
LOGWARN("AVInput::getHdmiVersion Hdmi Version:%d", hdmiCapVersion);
}
catch (const device::Exception& err) {
LOG_DEVICE_EXCEPTION1(std::to_string(portId));
returnResponse(false);
}


switch ((int)hdmiCapVersion){
case HDMI_COMPATIBILITY_VERSION_14:
response["HdmiCapabilityVersion"] = "1.4";
break;
case HDMI_COMPATIBILITY_VERSION_20:
response["HdmiCapabilityVersion"] = "2.0";
break;
case HDMI_COMPATIBILITY_VERSION_21:
response["HdmiCapabilityVersion"] = "2.1";
break;
}


if(hdmiCapVersion == HDMI_COMPATIBILITY_VERSION_MAX)
{
returnResponse(false);
}else{
returnResponse(true);
}
}

int AVInput::setEdidVersion(int iPort, int iEdidVer)
{
bool ret = true;
Expand Down
3 changes: 2 additions & 1 deletion 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, 122 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 @@ -85,6 +85,7 @@
uint32_t getSupportedGameFeatures(const JsonObject& parameters, JsonObject& response);
uint32_t getGameFeatureStatusWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t setMixerLevels(const JsonObject& parameters, JsonObject& response);
uint32_t getHdmiVersionWrapper(const JsonObject& parameters, JsonObject& response);
//End methods

JsonArray getInputDevices(int iType);
Expand All @@ -106,7 +107,7 @@
void AVInputStatusChange( int port , bool isPresented, int type);
static void dsAVStatusEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution);
void AVInputVideoModeUpdate( int port , dsVideoPortResolution_t resolution,int type);
static void dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

void AVInputALLMChange( int port , bool allmMode);
Expand Down
15 changes: 15 additions & 0 deletions AVInput/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,18 @@ All notable changes to this RDK Service will be documented in this file.

* Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development.

## [1.7.1] - 2025-02-17
### Changed
- Added support for handling the videoStreamInfoUpdate for composite Input.

## [1.7.0] - 2025-02-17
### Added
- Added support for Getting the Maximum HDMI Compatibility version for the given port.

## [1.0.0] - 2025-02-17
### Added
- Add CHANGELOG

### Change
- Reset API version to 1.0.0
- Change README to inform how to update changelog and API version
36 changes: 14 additions & 22 deletions AVOutput/AVOutputTV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,6 @@ namespace Plugin {
}
else {
LOGINFO("Platform Init successful...\n");
ret = TvSyncCalibrationInfoODM();
if(ret != tvERROR_NONE) {
LOGERR(" SD3 <->cri_data sync failed, ret: %s \n", getErrorString(ret).c_str());
}
else {
LOGERR(" SD3 <->cri_data sync success, ret: %s \n", getErrorString(ret).c_str());
}
}

tvVideoFormatCallbackData callbackData = {this,tvVideoFormatChangeHandler};
Expand Down Expand Up @@ -2282,17 +2275,22 @@ namespace Plugin {
{

LOGINFO("Entry\n");
pic_modes_t *dvModes;
tvDolbyMode_t dvModes[tvMode_Max];
tvDolbyMode_t *dvModesPtr = dvModes; // Pointer to statically allocated tvDolbyMode_t array
unsigned short totalAvailable = 0;
tvError_t ret = GetTVSupportedDolbyVisionModesODM(&dvModes,&totalAvailable);

// Set an initial value to indicate the mode type
dvModes[0] = tvDolbyMode_Dark;

tvError_t ret = GetTVSupportedDolbyVisionModes(&dvModesPtr, &totalAvailable);
if(ret != tvERROR_NONE) {
returnResponse(false);
}
else {
JsonArray SupportedDVModes;

for(int count = 0;count <totalAvailable;count++ ) {
SupportedDVModes.Add(dvModes[count].name);
SupportedDVModes.Add(getDolbyModeStringFromEnum(dvModes[count]));
}

response["supportedDVModes"] = SupportedDVModes;
Expand Down Expand Up @@ -2376,7 +2374,7 @@ namespace Plugin {

if( isSetRequired("Current",source,"DV") ) {
LOGINFO("Proceed with setDolbyVisionMode\n\n");
ret = SetTVDolbyVisionModeODM(value.c_str());
ret = SetTVDolbyVisionMode(GetDolbyVisionEnumFromModeString(value.c_str()));
}

if(ret != tvERROR_NONE) {
Expand Down Expand Up @@ -2437,7 +2435,7 @@ namespace Plugin {
if( err == 0 ) {
std::string dolbyModeValue = getDolbyModeStringFromEnum((tvDolbyMode_t)dolbyMode);
LOGINFO("%s : getLocalparam success format :%d source : %d format : %d dolbyvalue : %s\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex, dolbyModeValue.c_str());
ret = SetTVDolbyVisionModeODM(dolbyModeValue.c_str());
ret = SetTVDolbyVisionMode((tvDolbyMode_t)dolbyMode);
}
else {
LOGERR("%s : GetLocalParam Failed \n",__FUNCTION__);
Expand Down Expand Up @@ -2716,11 +2714,9 @@ namespace Plugin {
returnResponse(false);
}

std::string local = value;
transform(local.begin(), local.end(), local.begin(), ::tolower);
if( isSetRequired("Current",source,format) ) {
LOGINFO("Proceed with SetTVPictureMode\n");
ret = SetTVPictureMode(local.c_str());
ret = SetTVPictureMode(value.c_str());
}
if(ret != tvERROR_NONE) {
returnResponse(false);
Expand Down Expand Up @@ -2824,21 +2820,17 @@ namespace Plugin {
if ( tr181Success == err ) {
//get curren source and if matches save for that alone
tvVideoSrcType_t current_source = VIDEO_SOURCE_IP;
GetCurrentSource(&current_source);
GetCurrentVideoSource(&current_source);

tvVideoFormatType_t current_format = VIDEO_FORMAT_NONE;
GetCurrentVideoFormat(&current_format);
if( current_format == VIDEO_FORMAT_NONE) {
current_format = VIDEO_FORMAT_SDR;
}

//as hal using lower across converting to lower
std::string setparam = param.value;
transform(setparam.begin(), setparam.end(), setparam.begin(), ::tolower);

if (current_source == sourceType && current_format == formatType) {

tvError_t ret = SetTVPictureMode(setparam.c_str());
tvError_t ret = SetTVPictureMode(param.value);
if(ret != tvERROR_NONE) {
LOGWARN("Picture Mode set failed: %s\n",getErrorString(ret).c_str());
returnResponse(false);
Expand Down Expand Up @@ -3083,7 +3075,7 @@ namespace Plugin {
LOGINFO("Entry\n");
tvVideoSrcType_t currentSource = VIDEO_SOURCE_IP;

tvError_t ret = GetCurrentSource(&currentSource);
tvError_t ret = GetCurrentVideoSource(&currentSource);
if(ret != tvERROR_NONE) {
response["currentVideoSource"] = "NONE";
returnResponse(false);
Expand Down
Loading
Loading