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
124 changes: 122 additions & 2 deletions AVOutput/AVOutputTV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ namespace Plugin {
registerMethod("resetAutoBacklightMode", &AVOutputTV::resetAutoBacklightMode, this);
registerMethod("getAutoBacklightModeCaps", &AVOutputTV::getAutoBacklightModeCaps, this);

registerMethod("getFadeDisplayCaps", &AVOutputTV::getFadeDisplayCaps, this);
registerMethod("fadeDisplay", &AVOutputTV::fadeDisplay, this);
registerMethod("getWBMode", &AVOutputTV::getWBMode, this);
registerMethod("setWBMode", &AVOutputTV::setWBMode, this);

LOGINFO("Exit\n");
}

Expand Down Expand Up @@ -3890,7 +3895,7 @@ namespace Plugin {

tvError_t ret = tvERROR_NONE;

if (isPlatformSupport("AutoBacklightMode") != 0) {
if (isPlatformSupport("AutoBacklightMode") != 0) {
returnResponse(false);
}

Expand Down Expand Up @@ -3945,7 +3950,122 @@ namespace Plugin {
{
returnResponse(true);
}
}
}

uint32_t AVOutputTV::getFadeDisplayCaps(const JsonObject& parameters, JsonObject& response)
{
LOGINFO("Entry");
capVectors_t info;
JsonObject rangeObj;

tvError_t ret = getParamsCaps("BacklightFade",info);
if(ret != tvERROR_NONE) {
returnResponse(false);
}

response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0 ) ? true : false;
response["from"] = stoi(info.rangeVector[0]);
response["to"] = stoi(info.rangeVector[1]);
rangeObj["from"] = stoi(info.rangeVector[2]);
rangeObj["to"] = stoi(info.rangeVector[3]);
response["durationInfo"] = rangeObj;
LOGINFO("Exit\n");
returnResponse(true);
}

uint32_t AVOutputTV::fadeDisplay(const JsonObject& parameters, JsonObject& response)
{
LOGINFO("Entry\n");
std::string from,to,duration;
int fromValue = 0,toValue = 0, durationValue = 0;

if (isPlatformSupport("BacklightFade") != 0) {
LOGERR("Platform Support (%s) false", __FUNCTION__);
returnResponse(false);
}
from = parameters.HasLabel("from") ? parameters["from"].String() : "";
if (from.empty() || validateFadeDisplayInputParameter("BacklightFade", "Range", std::stoi(from)) != 0) {
LOGERR("%s: Range validation failed for BacklightFade From\n", __FUNCTION__);
LOGWARN("%s: Using default value, from = 100\n", __FUNCTION__);
fromValue = 100;
} else
fromValue = std::stoi(from);

to = parameters.HasLabel("to") ? parameters["to"].String() : "";
if(to.empty() || validateFadeDisplayInputParameter("BacklightFade", "Range", std::stoi(to)) != 0) {
LOGERR("%s: Range validation failed for BacklightFade To\n", __FUNCTION__);
LOGWARN("%s: Using default value, to = 0\n", __FUNCTION__);
toValue = 0;
} else
toValue = std::stoi(to);

duration = parameters.HasLabel("duration") ? parameters["duration"].String() : "";
if(duration.empty() || validateFadeDisplayInputParameter("BacklightFade", "Duration", std::stoi(duration)) != 0) {
LOGERR("%s: Range validation failed for BacklightFade Duration\n", __FUNCTION__);
LOGWARN("%s: Using default value, duration = 0\n", __FUNCTION__);
durationValue = 0;
} else
durationValue = std::stoi(duration);

LOGINFO("from = %d to = %d duration = %d\n" ,fromValue,toValue,durationValue);
tvError_t ret = SetBacklightFade(fromValue,toValue,durationValue);
if(ret != tvERROR_NONE) {
LOGERR("Failed to set BacklightFade \n");
returnResponse(false);
}
else {
LOGINFO("Exit : backlightFade Success \n");
returnResponse(true);
}
}

uint32_t AVOutputTV::getWBMode(const JsonObject& parameters, JsonObject& response)
{
LOGINFO("Entry\n");
bool mode = 0;
tvError_t ret = GetCurrentWBCalibrationMode(&mode);
if(ret != tvERROR_NONE) {
LOGERR("Failed to get WBCalibrationMode \n");
returnResponse(false);
}
else
{
response["wbMode"] = (mode);
LOGINFO("Exiting getWBMode\n");
returnResponse(true);
}
}

uint32_t AVOutputTV::setWBMode(const JsonObject& parameters, JsonObject& response)
{
LOGINFO("Entry\n");
std::string value;
tvError_t ret = tvERROR_NONE;
bool mode = 0;
if(parameters.HasLabel("wbMode")) {
value = parameters["wbMode"].String();
if(value == "true") {
mode = 1;
} else if(value == "false") {
mode = 0;
} else {
LOGERR("Invalid WBMode param value\n");
returnResponse(false);
}
ret = EnableWBCalibrationMode(mode);
if(ret != tvERROR_NONE) {
LOGERR("enableWBmode failed\n");
returnResponse(false);
}
else{
LOGINFO("setWBmode to %s\n", mode ? "true" : "false");
returnResponse(true);
}
} else {
LOGERR("Invalid Param\n");
returnResponse(false);
}
}

uint32_t AVOutputTV::getVideoSource(const JsonObject& parameters,JsonObject& response)
{
Expand Down
5 changes: 5 additions & 0 deletions AVOutput/AVOutputTV.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class AVOutputTV : public AVOutputBase {
DECLARE_JSON_RPC_METHOD(getHDRMode)
DECLARE_JSON_RPC_METHOD(get2PointWB)
DECLARE_JSON_RPC_METHOD(getAutoBacklightMode)
DECLARE_JSON_RPC_METHOD(getWBMode)


/*Get Capability API's*/
Expand All @@ -227,6 +228,7 @@ class AVOutputTV : public AVOutputBase {
DECLARE_JSON_RPC_METHOD(get2PointWBCaps)
DECLARE_JSON_RPC_METHOD(getHDRModeCaps)
DECLARE_JSON_RPC_METHOD(getAutoBacklightModeCaps)
DECLARE_JSON_RPC_METHOD(getFadeDisplayCaps)

/*Set API's*/
DECLARE_JSON_RPC_METHOD(setBacklight)
Expand All @@ -247,6 +249,8 @@ class AVOutputTV : public AVOutputBase {
DECLARE_JSON_RPC_METHOD(set2PointWB )
DECLARE_JSON_RPC_METHOD(signalFilmMakerMode)
DECLARE_JSON_RPC_METHOD(setAutoBacklightMode)
DECLARE_JSON_RPC_METHOD(fadeDisplay)
DECLARE_JSON_RPC_METHOD(setWBMode)

/*Reset API's*/
DECLARE_JSON_RPC_METHOD(resetBacklight)
Expand Down Expand Up @@ -289,6 +293,7 @@ class AVOutputTV : public AVOutputBase {
void spliltCapablities( capVectors_t& vectorInfo, capDetails_t stringInfo);
void spliltStringsAndConvertToSet( std::string pqmodeInfo,std::string formatInfo,std::string sourceInfo,std::set<string> &pqmode, std::set<string> &format, std::set<string> &source);
int validateIntegerInputParameter(std::string param, int inputValue);
int validateFadeDisplayInputParameter(std::string param, std::string name, int inputValue);
int fetchCapablities(string pqparam, capDetails_t& info);
int validateInputParameter(std::string param, std::string inputValue);
int validateWBParameter(std::string param,std::string control,int inputValue);
Expand Down
36 changes: 35 additions & 1 deletion AVOutput/AVOutputTVHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,30 @@ namespace Plugin {
return 0;
}

int AVOutputTV::validateFadeDisplayInputParameter(std::string param, std::string name, int inputValue)
{
capVectors_t info;
tvError_t ret = getParamsCaps(param, info);

if (ret != tvERROR_NONE) {
LOGERR("Failed to fetch the range capability[%s] \n", param.c_str());
return -1;
}
if ( (name == "Range")){
if (inputValue < std::stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])){
LOGERR("wrong Input Value[%d]", inputValue);
return -1;
}
}
if ( (name == "Duration")){
if (inputValue > std::stoi(info.rangeVector[2]) || inputValue < std::stoi(info.rangeVector[3])){
LOGERR("wrong Input Value[%d]", inputValue);
return -1;
}
}
return 0;
}

int AVOutputTV::fetchCapablities(string pqparam, capDetails_t& info) {

capVectors_t vectorInfo;
Expand Down Expand Up @@ -2309,7 +2333,7 @@ namespace Plugin {

}

if ((param == "DolbyVisionMode") || (param == "Backlight") || (param == "CMS") || (param == "CustomWhiteBalance") || (param == "HDRMode") || (param == "BacklightControl") || (param == "DimmingMode")) {
if ((param == "DolbyVisionMode") || (param == "Backlight") || (param == "CMS") || (param == "CustomWhiteBalance") || (param == "HDRMode") || (param == "BacklightControl") || (param == "DimmingMode") || (param == "BacklightFade")) {
configString = param + ".platformsupport";
info.isPlatformSupport = inFile.Get<std::string>(configString);
printf(" platformsupport : %s\n",info.isPlatformSupport.c_str() );
Expand Down Expand Up @@ -2349,6 +2373,16 @@ namespace Plugin {
info.range += ","+inFile.Get<std::string>(configString);
configString = param + ".range_Offset_to";
info.range += ","+inFile.Get<std::string>(configString);
} else if ( (param == "BacklightFade")) {
configString = param + ".range_from";
info.range = inFile.Get<std::string>(configString);
configString = param + ".range_to";
info.range += ","+inFile.Get<std::string>(configString);
configString = param + ".duration_from";
info.range += ","+inFile.Get<std::string>(configString);
configString = param + ".duration_to";
info.range += ","+inFile.Get<std::string>(configString);
printf("%s: Full integer range info: %s\n", __PRETTY_FUNCTION__, info.range.c_str());
} else {
configString = param + ".range_from";
info.range = inFile.Get<std::string>(configString);
Expand Down
4 changes: 4 additions & 0 deletions AVOutput/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ All notable changes to this RDK Service will be documented in this file.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.

## [1.1.6] - 2026-01-12
### Added
- Add FadeDisplay and WBMode AVOutput functionality

## [1.1.5] - 2025-09-22
### Fixed
- Sync low latency for AVOutput initialization
Expand Down
Loading