From 1c01b923f391037e51e72be58d891266a0547ba0 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Fri, 3 Jan 2025 03:41:25 +0000 Subject: [PATCH 01/20] RDK-52028: Add CMS and WB to AVOutput --- AVOutput/AVOutputTV.cpp | 2125 +++++++++++++++++++++++---------- AVOutput/AVOutputTV.h | 139 ++- AVOutput/AVOutputTVHelper.cpp | 1733 ++++++++++++++++++--------- 3 files changed, 2756 insertions(+), 1241 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 94f38fe663..deccaf07eb 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -270,73 +270,93 @@ namespace Plugin { LOGINFO("CTOR\n"); AVOutputTV::instance = this; - InitializeIARM(); - - registerMethod("getBacklight", &AVOutputTV::getBacklight, this); - registerMethod("setBacklight", &AVOutputTV::setBacklight, this); - registerMethod("resetBacklight", &AVOutputTV::resetBacklight, this); - registerMethod("getBacklightCaps", &AVOutputTV::getBacklightCaps, this); - registerMethod("getBrightnessCaps", &AVOutputTV::getBrightnessCaps, this); - registerMethod("getBrightness", &AVOutputTV::getBrightness, this); - registerMethod("setBrightness", &AVOutputTV::setBrightness, this); - registerMethod("resetBrightness", &AVOutputTV::resetBrightness, this); - registerMethod("getContrast", &AVOutputTV::getContrast, this); - registerMethod("setContrast", &AVOutputTV::setContrast, this); - registerMethod("resetContrast", &AVOutputTV::resetContrast, this); - registerMethod("getContrastCaps", &AVOutputTV::getContrastCaps, this); - registerMethod("getSharpness", &AVOutputTV::getSharpness, this); - registerMethod("setSharpness", &AVOutputTV::setSharpness, this); - registerMethod("resetSharpness", &AVOutputTV::resetSharpness, this); - registerMethod("getSharpnessCaps", &AVOutputTV::getSharpnessCaps, this); - registerMethod("getSaturation", &AVOutputTV::getSaturation, this); - registerMethod("setSaturation", &AVOutputTV::setSaturation, this); - registerMethod("resetSaturation", &AVOutputTV::resetSaturation, this); - registerMethod("getSaturationCaps", &AVOutputTV::getSaturationCaps, this); - registerMethod("getHue", &AVOutputTV::getHue, this); - registerMethod("setHue", &AVOutputTV::setHue, this); - registerMethod("resetHue", &AVOutputTV::resetHue, this); - registerMethod("getHueCaps", &AVOutputTV::getHueCaps, this); - registerMethod("getColorTemperature", &AVOutputTV::getColorTemperature, this); - registerMethod("setColorTemperature", &AVOutputTV::setColorTemperature, this); - registerMethod("resetColorTemperature", &AVOutputTV::resetColorTemperature, this); - registerMethod("getColorTemperatureCaps", &AVOutputTV::getColorTemperatureCaps, this); - - registerMethod("getBacklightDimmingMode", &AVOutputTV::getBacklightDimmingMode, this); - registerMethod("setBacklightDimmingMode", &AVOutputTV::setBacklightDimmingMode, this); - registerMethod("resetBacklightDimmingMode", &AVOutputTV::resetBacklightDimmingMode, this); - registerMethod("getBacklightDimmingModeCaps", &AVOutputTV::getBacklightDimmingModeCaps, this); - - registerMethod("getSupportedDolbyVisionModes", &AVOutputTV::getSupportedDolbyVisionModes, this); - registerMethod("getDolbyVisionMode", &AVOutputTV::getDolbyVisionMode, this); - registerMethod("setDolbyVisionMode", &AVOutputTV::setDolbyVisionMode, this); - registerMethod("resetDolbyVisionMode", &AVOutputTV::resetDolbyVisionMode, this); - registerMethod("getDolbyVisionModeCaps", &AVOutputTV::getDolbyVisionModeCaps, this); - registerMethod("getVideoFormat", &AVOutputTV::getVideoFormat, this); - registerMethod("getVideoSource", &AVOutputTV::getVideoSource, this); - registerMethod("getVideoFrameRate", &AVOutputTV::getVideoFrameRate, this); - registerMethod("getVideoResolution", &AVOutputTV::getVideoResolution, this); - registerMethod("getVideoContentType", &AVOutputTV::getVideoContentType, this); - - registerMethod("getZoomMode", &AVOutputTV::getZoomMode, this); - registerMethod("setZoomMode", &AVOutputTV::setZoomMode, this); - registerMethod("resetZoomMode", &AVOutputTV::resetZoomMode, this); - registerMethod("getZoomModeCaps", &AVOutputTV::getZoomModeCaps, this); - - registerMethod("getPictureMode", &AVOutputTV::getPictureMode, this); - registerMethod("setPictureMode", &AVOutputTV::setPictureMode, this); - registerMethod("signalFilmMakerMode", &AVOutputTV::signalFilmMakerMode, this); - registerMethod("resetPictureMode", &AVOutputTV::resetPictureMode, this); - registerMethod("getPictureModeCaps", &AVOutputTV::getPictureModeCaps, this); - registerMethod("getSupportedPictureModes", &AVOutputTV::getSupportedPictureModes, this); - registerMethod("getVideoSourceCaps", &AVOutputTV::getVideoSourceCaps, this); - registerMethod("getVideoFormatCaps", &AVOutputTV::getVideoFormatCaps, this); - registerMethod("getVideoFrameRateCaps", &AVOutputTV::getVideoFrameRateCaps, this); - registerMethod("getVideoResolutionCaps", &AVOutputTV::getVideoResolutionCaps, this); - - registerMethod("getLowLatencyState", &AVOutputTV::getLowLatencyState, this); - registerMethod("setLowLatencyState", &AVOutputTV::setLowLatencyState, this); - registerMethod("resetLowLatencyState", &AVOutputTV::resetLowLatencyState, this); - registerMethod("getLowLatencyStateCaps", &AVOutputTV::getLowLatencyStateCaps, this); + InitializeIARM(); + + registerMethod("getBacklight", &AVOutputTV::getBacklight, this); + registerMethod("setBacklight", &AVOutputTV::setBacklight, this); + registerMethod("resetBacklight", &AVOutputTV::resetBacklight, this); + registerMethod("getBacklightCaps", &AVOutputTV::getBacklightCaps, this); + registerMethod("getBrightnessCaps", &AVOutputTV::getBrightnessCaps, this); + registerMethod("getBrightness", &AVOutputTV::getBrightness, this); + registerMethod("setBrightness", &AVOutputTV::setBrightness, this); + registerMethod("resetBrightness", &AVOutputTV::resetBrightness, this); + registerMethod("getContrast", &AVOutputTV::getContrast, this); + registerMethod("setContrast", &AVOutputTV::setContrast, this); + registerMethod("resetContrast", &AVOutputTV::resetContrast, this); + registerMethod("getContrastCaps", &AVOutputTV::getContrastCaps, this); + registerMethod("getSharpness", &AVOutputTV::getSharpness, this); + registerMethod("setSharpness", &AVOutputTV::setSharpness, this); + registerMethod("resetSharpness", &AVOutputTV::resetSharpness, this); + registerMethod("getSharpnessCaps", &AVOutputTV::getSharpnessCaps, this); + registerMethod("getSaturation", &AVOutputTV::getSaturation, this); + registerMethod("setSaturation", &AVOutputTV::setSaturation, this); + registerMethod("resetSaturation", &AVOutputTV::resetSaturation, this); + registerMethod("getSaturationCaps", &AVOutputTV::getSaturationCaps, this); + registerMethod("getHue", &AVOutputTV::getHue, this); + registerMethod("setHue", &AVOutputTV::setHue, this); + registerMethod("resetHue", &AVOutputTV::resetHue, this); + registerMethod("getHueCaps", &AVOutputTV::getHueCaps, this); + registerMethod("getColorTemperature", &AVOutputTV::getColorTemperature, this); + registerMethod("setColorTemperature", &AVOutputTV::setColorTemperature, this); + registerMethod("resetColorTemperature", &AVOutputTV::resetColorTemperature, this); + registerMethod("getColorTemperatureCaps", &AVOutputTV::getColorTemperatureCaps, this); + + registerMethod("getBacklightDimmingMode", &AVOutputTV::getBacklightDimmingMode, this); + registerMethod("setBacklightDimmingMode", &AVOutputTV::setBacklightDimmingMode, this); + registerMethod("resetBacklightDimmingMode", &AVOutputTV::resetBacklightDimmingMode, this); + registerMethod("getBacklightDimmingModeCaps", &AVOutputTV::getBacklightDimmingModeCaps, this); + + registerMethod("getSupportedDolbyVisionModes", &AVOutputTV::getSupportedDolbyVisionModes, this); + registerMethod("getDolbyVisionMode", &AVOutputTV::getDolbyVisionMode, this); + registerMethod("setDolbyVisionMode", &AVOutputTV::setDolbyVisionMode, this); + registerMethod("resetDolbyVisionMode", &AVOutputTV::resetDolbyVisionMode, this); + registerMethod("getDolbyVisionModeCaps", &AVOutputTV::getDolbyVisionModeCaps, this); + registerMethod("getVideoFormat", &AVOutputTV::getVideoFormat, this); + registerMethod("getVideoSource", &AVOutputTV::getVideoSource, this); + registerMethod("getVideoFrameRate", &AVOutputTV::getVideoFrameRate, this); + registerMethod("getVideoResolution", &AVOutputTV::getVideoResolution, this); + registerMethod("getVideoContentType", &AVOutputTV::getVideoContentType, this); + + registerMethod("getZoomMode", &AVOutputTV::getZoomMode, this); + registerMethod("setZoomMode", &AVOutputTV::setZoomMode, this); + registerMethod("resetZoomMode", &AVOutputTV::resetZoomMode, this); + registerMethod("getZoomModeCaps", &AVOutputTV::getZoomModeCaps, this); + + registerMethod("getPictureMode", &AVOutputTV::getPictureMode, this); + registerMethod("setPictureMode", &AVOutputTV::setPictureMode, this); + registerMethod("signalFilmMakerMode", &AVOutputTV::signalFilmMakerMode, this); + registerMethod("resetPictureMode", &AVOutputTV::resetPictureMode, this); + registerMethod("getPictureModeCaps", &AVOutputTV::getPictureModeCaps, this); + registerMethod("getSupportedPictureModes", &AVOutputTV::getSupportedPictureModes, this); + registerMethod("getVideoSourceCaps", &AVOutputTV::getVideoSourceCaps, this); + registerMethod("getVideoFormatCaps", &AVOutputTV::getVideoFormatCaps, this); + registerMethod("getVideoFrameRateCaps", &AVOutputTV::getVideoFrameRateCaps, this); + registerMethod("getVideoResolutionCaps", &AVOutputTV::getVideoResolutionCaps, this); + + registerMethod("getLowLatencyState", &AVOutputTV::getLowLatencyState, this); + registerMethod("setLowLatencyState", &AVOutputTV::setLowLatencyState, this); + registerMethod("resetLowLatencyState", &AVOutputTV::resetLowLatencyState, this); + registerMethod("getLowLatencyStateCaps", &AVOutputTV::getLowLatencyStateCaps, this); + + registerMethod("getCMS", &AVOutputTV::getCMS, this); + registerMethod("setCMS", &AVOutputTV::setCMS, this); + registerMethod("resetCMS", &AVOutputTV::resetCMS, this); + registerMethod("getCMSCaps", &AVOutputTV::getCMSCaps, this); + + registerMethod("get2PointWB", &AVOutputTV::get2PointWB, this); + registerMethod("set2PointWB", &AVOutputTV::set2PointWB, this); + registerMethod("reset2PointWB", &AVOutputTV::reset2PointWB, this); + registerMethod("get2PointWBCaps", &AVOutputTV::get2PointWBCaps, this); + + registerMethod("getHDRMode", &AVOutputTV::getHDRMode, this); + registerMethod("setHDRMode", &AVOutputTV::setHDRMode, this); + registerMethod("resetHDRMode", &AVOutputTV::resetHDRMode, this); + registerMethod("getHDRModeCaps", &AVOutputTV::getHDRModeCaps, this); + + registerMethod("getAutoBacklightMode", &AVOutputTV::getAutoBacklightMode, this); + registerMethod("setAutoBacklightMode", &AVOutputTV::setAutoBacklightMode, this); + registerMethod("resetAutoBacklightMode", &AVOutputTV::resetAutoBacklightMode, this); + registerMethod("getAutoBacklightModeCaps", &AVOutputTV::getAutoBacklightModeCaps, this); LOGINFO("Exit\n"); } @@ -403,8 +423,8 @@ namespace Plugin { locatePQSettingsFile(); - // Get Index from PQ capabailites - if (getPqParamIndex() != 0) { + // Get Index from PQ capabailites + if (getPqParamIndex() != 0) { LOGWARN("Failed to get the supported index from capability \n"); } @@ -442,10 +462,7 @@ namespace Plugin { uint32_t AVOutputTV::getZoomModeCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -454,33 +471,33 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"AspectRatio"); + tvError_t ret = getParamsCaps("AspectRatio",info); if(ret != tvERROR_NONE) { returnResponse(false); } - else { - for (index = 0; index < range.size(); index++) { - rangeArray.Add(range[index]); - } + else { + for (index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); + } response["options"]=rangeArray; - if (pqmode.front().compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if (info.pqmodeVector.front().compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -494,9 +511,7 @@ namespace Plugin { LOGINFO("Entry\n"); std::string value; tvDisplayMode_t mode = tvDisplayMode_16x9; - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; value = parameters.HasLabel("zoomMode") ? parameters["zoomMode"].String() : ""; @@ -507,12 +522,12 @@ namespace Plugin { returnResponse(false); } - if (parsingSetInputArgument(parameters, "AspectRatio",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters,"AspectRatio",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "AspectRatio" )) { + if( !isCapablityCheckPassed( "AspectRatio",inputInfo )) { LOGERR("%s: CapablityCheck failed for AspectRatio\n", __FUNCTION__); returnResponse(false); } @@ -546,19 +561,17 @@ namespace Plugin { } else { //Save DisplayMode to localstore and ssm_data - int params[3]={0}; - params[0]=mode; - int retval=updateAVoutputTVParam("set","AspectRatio",pqmode,source,format,PQ_PARAM_ASPECT_RATIO,params); + int retval=updateAVoutputTVParam("set","AspectRatio",inputInfo,PQ_PARAM_ASPECT_RATIO,mode); if(retval != 0) { LOGERR("Failed to Save DisplayMode to ssm_data\n"); - returnResponse(false); + returnResponse(false); } tr181ErrorCode_t err = setLocalParam(rfc_caller_id, AVOUTPUT_ASPECTRATIO_RFC_PARAM, value.c_str()); if ( err != tr181Success ) { LOGERR("setLocalParam for %s Failed : %s\n", AVOUTPUT_ASPECTRATIO_RFC_PARAM, getTR181ErrorString(err)); - returnResponse(false); + returnResponse(false); } else { LOGINFO("setLocalParam for %s Successful, Value: %s\n", AVOUTPUT_ASPECTRATIO_RFC_PARAM, value.c_str()); @@ -623,17 +636,15 @@ namespace Plugin { uint32_t AVOutputTV::resetZoomMode(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry\n"); - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "AspectRatio",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "AspectRatio",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "AspectRatio" )) { + if( !isCapablityCheckPassed( "AspectRatio",inputInfo )) { LOGERR("%s: CapablityCheck failed for AspectRatio\n", __FUNCTION__); returnResponse(false); } @@ -644,9 +655,9 @@ namespace Plugin { ret = tvERROR_GENERAL; } else { - ret = setDefaultAspectRatio(pqmode,source,format); + ret = setDefaultAspectRatio(inputInfo.pqmode,inputInfo.source,inputInfo.format); } - if(ret != tvERROR_NONE) { + if(ret != tvERROR_NONE) { returnResponse(false); } else { @@ -707,29 +718,26 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; std::string key; - - int sourceIndex=0,pqIndex=0,formatIndex=0; + paramIndex_t indexInfo; int backlight = 0,err = 0; - if (parsingGetInputArgument(parameters, "Backlight",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "Backlight",inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } if (isPlatformSupport("Backlight") != 0) { - returnResponse(false); - } + returnResponse(false); + } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("Backlight", inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - err = getLocalparam("Backlight",formatIndex,pqIndex,sourceIndex,backlight, PQ_PARAM_BACKLIGHT); + err = getLocalparam("Backlight",indexInfo,backlight, PQ_PARAM_BACKLIGHT); if( err == 0 ) { response["backlight"] = backlight; LOGINFO("Exit : Backlight Value: %d \n", backlight); @@ -745,9 +753,7 @@ namespace Plugin { LOGINFO("Entry\n"); std::string value; - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; int backlight = 0; tvError_t ret = tvERROR_NONE; @@ -760,21 +766,21 @@ namespace Plugin { returnResponse(false); } - if (parsingSetInputArgument(parameters, "Backlight",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters,"Backlight",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } if (isPlatformSupport("Backlight") != 0 ) { - returnResponse(false); - } + returnResponse(false); + } - if( !isCapablityCheckPassed( pqmode, source, format, "Backlight" )) { + if( !isCapablityCheckPassed( "Backlight" , inputInfo )) { LOGERR("%s: CapablityCheck failed for Backlight\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with setBacklight\n"); ret = SetBacklight(backlight); } @@ -784,9 +790,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=backlight; - int retval= updateAVoutputTVParam("set","Backlight",pqmode,source,format,PQ_PARAM_BACKLIGHT,params); + int retval= updateAVoutputTVParam("set","Backlight",inputInfo,PQ_PARAM_BACKLIGHT,backlight); if(retval != 0 ) { LOGERR("Failed to Save Backlight to ssm_data\n"); returnResponse(false); @@ -800,39 +804,39 @@ namespace Plugin { uint32_t AVOutputTV::resetBacklight(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,backlight=0; - int params[3]={0}; + capDetails_t inputInfo; + int backlight=0; + paramIndex_t indexInfo; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "Backlight",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Backlight",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } if (isPlatformSupport("Backlight") != 0) { - returnResponse(false); - } + returnResponse(false); + } - if( !isCapablityCheckPassed( pqmode, source, format, "Backlight" )) { + if( !isCapablityCheckPassed( "Backlight",inputInfo )) { LOGERR("%s: CapablityCheck failed for Backlight\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","Backlight",pqmode,source,format,PQ_PARAM_BACKLIGHT,params); + int retval= updateAVoutputTVParam("reset","Backlight",inputInfo,PQ_PARAM_BACKLIGHT,backlight); if(retval != 0 ) { LOGERR("Failed to reset Backlight\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("Backlight",formatIndex,pqIndex,sourceIndex,backlight, PQ_PARAM_BACKLIGHT); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("Backlight", inputInfo,indexInfo); + int err = getLocalparam("Backlight",indexInfo,backlight, PQ_PARAM_BACKLIGHT); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex,backlight); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex,backlight); ret = SetBacklight(backlight); } else { @@ -854,14 +858,7 @@ namespace Plugin { uint32_t AVOutputTV::getBacklightCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; - - std::string isPlatformSupport; - std::vector indexInfo; - + capVectors_t vectorInfo; JsonObject rangeObj; JsonArray pqmodeArray; JsonArray formatArray; @@ -869,33 +866,33 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"Backlight", isPlatformSupport, indexInfo); + tvError_t ret = getParamsCaps("Backlight", vectorInfo ); if(ret != tvERROR_NONE) { returnResponse(false); } else { - response["platformSupport"] = (isPlatformSupport.compare("true") == 0) ? true : false; + response["platformSupport"] = (vectorInfo.isPlatformSupportVector[0].compare("true") == 0) ? true : false; - rangeObj["from"] = stoi(range[0]); - rangeObj["to"] = stoi(range[1]); + rangeObj["from"] = std::stoi(vectorInfo.rangeVector[0]); + rangeObj["to"] = std::stoi(vectorInfo.rangeVector[1]); response["rangeInfo"]=rangeObj; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((vectorInfo.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < vectorInfo.pqmodeVector.size(); index++) { + pqmodeArray.Add(vectorInfo.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((vectorInfo.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < vectorInfo.sourceVector.size(); index++) { + sourceArray.Add(vectorInfo.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((vectorInfo.formatVector.front()).compare("none") != 0) { + for (index = 0; index < vectorInfo.formatVector.size(); index++) { + formatArray.Add(vectorInfo.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -908,24 +905,21 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int brightness = 0; - if (parsingGetInputArgument(parameters, "Brightness",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "Brightness",inputInfo) != 0) { LOGERR("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("Brightness", inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("Brightness",formatIndex,pqIndex,sourceIndex,brightness, PQ_PARAM_BRIGHTNESS); + int err = getLocalparam("Brightness",indexInfo,brightness, PQ_PARAM_BRIGHTNESS); if( err == 0 ) { response["brightness"] = brightness; LOGINFO("Exit : Brightness Value: %d \n", brightness); @@ -941,9 +935,7 @@ namespace Plugin { LOGINFO("Entry\n"); std::string value; - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; int brightness = 0; tvError_t ret = tvERROR_NONE; @@ -956,17 +948,17 @@ namespace Plugin { returnResponse(false); } - if (parsingSetInputArgument(parameters, "Brightness",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Brightness",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Brightness" )) { + if( !isCapablityCheckPassed( "Brightness",inputInfo )) { LOGERR("%s: CapablityCheck failed for Brightness\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s \n",__FUNCTION__); ret = SetBrightness(brightness); } @@ -976,9 +968,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=brightness; - int retval= updateAVoutputTVParam("set","Brightness",pqmode,source,format,PQ_PARAM_BRIGHTNESS,params); + int retval= updateAVoutputTVParam("set","Brightness",inputInfo,PQ_PARAM_BRIGHTNESS,brightness); if(retval != 0 ) { LOGERR("Failed to Save Brightness to ssm_data\n"); returnResponse(false); @@ -996,34 +986,35 @@ namespace Plugin { LOGINFO("Entry\n"); std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,brightness=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int brightness=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "Brightness",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Brightness",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Brightness" )) { + if( !isCapablityCheckPassed( "Brightness",inputInfo )) { LOGERR("%s: CapablityCheck failed for Brightness\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","Brightness",pqmode,source,format,PQ_PARAM_BRIGHTNESS,params); + int retval= updateAVoutputTVParam("reset","Brightness",inputInfo,PQ_PARAM_BRIGHTNESS,brightness); if(retval != 0 ) { LOGWARN("Failed to reset Brightness\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("Brightness",formatIndex,pqIndex,sourceIndex,brightness, PQ_PARAM_BRIGHTNESS); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("Brightness", inputInfo,indexInfo); + int err = getLocalparam("Brightness",indexInfo,brightness, PQ_PARAM_BRIGHTNESS); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex,brightness); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex,brightness); ret = SetBrightness(brightness); } else { @@ -1046,10 +1037,7 @@ namespace Plugin { uint32_t AVOutputTV::getBrightnessCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray pqmodeArray; JsonArray formatArray; @@ -1058,31 +1046,31 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"Brightness"); + tvError_t ret = getParamsCaps("Brightness",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - rangeObj["from"] = stoi(range[0]); - rangeObj["to"] = stoi(range[1]); + rangeObj["from"] = stoi(info.rangeVector[0]); + rangeObj["to"] = stoi(info.rangeVector[1]); response["rangeInfo"]=rangeObj; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -1095,24 +1083,21 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int contrast = 0; - if (parsingGetInputArgument(parameters, "Contrast",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "Contrast",inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("Contrast",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("Contrast",formatIndex,pqIndex,sourceIndex,contrast, PQ_PARAM_CONTRAST); + int err = getLocalparam("Contrast",indexInfo,contrast, PQ_PARAM_CONTRAST); if( err == 0 ) { response["contrast"] = contrast; LOGINFO("Exit : Contrast Value: %d \n", contrast); @@ -1127,33 +1112,31 @@ namespace Plugin { { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; int contrast = 0; tvError_t ret = tvERROR_NONE; + std::string value; value = parameters.HasLabel("contrast") ? parameters["contrast"].String() : ""; returnIfParamNotFound(parameters,"contrast"); - contrast = stoi(value); + contrast = std::stoi(value); if (validateIntegerInputParameter("Contrast", contrast) != 0) { LOGERR("Failed in contrast range validation:%s", __FUNCTION__); returnResponse(false); } - if (parsingSetInputArgument(parameters, "Contrast",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Contrast",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Contrast" )) { + if( !isCapablityCheckPassed( "Contrast" , inputInfo )) { LOGERR("%s: CapablityCheck failed for Contrast\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s \n",__FUNCTION__); ret = SetContrast(contrast); } @@ -1163,9 +1146,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=contrast; - int retval= updateAVoutputTVParam("set","Contrast",pqmode,source,format,PQ_PARAM_CONTRAST,params); + int retval= updateAVoutputTVParam("set","Contrast",inputInfo,PQ_PARAM_CONTRAST,contrast); if(retval != 0 ) { LOGERR("Failed to Save Contrast to ssm_data\n"); returnResponse(false); @@ -1181,36 +1162,36 @@ namespace Plugin { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,contrast=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int contrast=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "Contrast",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Contrast",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Contrast" )) { + if( !isCapablityCheckPassed( "Contrast" , inputInfo )) { LOGERR("%s: CapablityCheck failed for Contrast\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","Contrast",pqmode,source,format,PQ_PARAM_CONTRAST,params); + int retval= updateAVoutputTVParam("reset","Contrast",inputInfo,PQ_PARAM_CONTRAST,contrast); if(retval != 0 ) { LOGWARN("Failed to reset Contrast\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("Contrast",formatIndex,pqIndex,sourceIndex,contrast, PQ_PARAM_CONTRAST); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("Contrast", inputInfo,indexInfo); + int err = getLocalparam("Contrast",indexInfo,contrast, PQ_PARAM_CONTRAST); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex,contrast); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex,contrast); ret = SetContrast(contrast); } else { @@ -1233,10 +1214,7 @@ namespace Plugin { uint32_t AVOutputTV::getContrastCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -1246,31 +1224,31 @@ namespace Plugin { JsonObject rangeObj; unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"Contrast"); + tvError_t ret = getParamsCaps("Contrast",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - rangeObj["from"] = stoi(range[0]); - rangeObj["to"] = stoi(range[1]); + rangeObj["from"] = stoi(info.rangeVector[0]); + rangeObj["to"] = stoi(info.rangeVector[1]); response["rangeInfo"]=rangeObj; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -1283,24 +1261,21 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int saturation = 0; - if (parsingGetInputArgument(parameters, "Saturation",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "Saturation",inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("Saturation", inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("Saturation",formatIndex,pqIndex,sourceIndex,saturation, PQ_PARAM_SATURATION); + int err = getLocalparam("Saturation",indexInfo,saturation, PQ_PARAM_SATURATION); if( err == 0 ) { response["saturation"] = saturation; LOGINFO("Exit : Saturation Value: %d \n", saturation); @@ -1315,33 +1290,31 @@ namespace Plugin { { LOGINFO("Entry\n"); + capDetails_t inputInfo; std::string value; - std::string pqmode; - std::string source; - std::string format; int saturation = 0; tvError_t ret = tvERROR_NONE; value = parameters.HasLabel("saturation") ? parameters["saturation"].String() : ""; returnIfParamNotFound(parameters,"saturation"); - saturation = stoi(value); + saturation = std::stoi(value); if (validateIntegerInputParameter("Saturation",saturation) != 0) { LOGERR("Failed in saturation range validation:%s", __FUNCTION__); returnResponse(false); } - if (parsingSetInputArgument(parameters, "Saturation",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Saturation",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Saturation" )) { + if( !isCapablityCheckPassed( "Saturation" , inputInfo )) { LOGERR("%s: CapablityCheck failed for Saturation\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); ret = SetSaturation(saturation); } @@ -1351,9 +1324,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=saturation; - int retval= updateAVoutputTVParam("set","Saturation",pqmode,source,format,PQ_PARAM_SATURATION,params); + int retval= updateAVoutputTVParam("set","Saturation",inputInfo,PQ_PARAM_SATURATION,saturation); if(retval != 0 ) { LOGERR("Failed to Save Saturation to ssm_data\n"); returnResponse(false); @@ -1369,36 +1340,36 @@ namespace Plugin { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,saturation=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int saturation=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "Saturation",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Saturation", inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Saturation" )) { + if( !isCapablityCheckPassed( "Saturation", inputInfo )) { LOGERR("%s: CapablityCheck failed for Saturation\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","Saturation",pqmode,source,format,PQ_PARAM_SATURATION,params); + int retval= updateAVoutputTVParam("reset","Saturation",inputInfo,PQ_PARAM_SATURATION,saturation); if(retval != 0 ) { LOGERR("Failed to reset Saturation\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("Saturation",formatIndex,pqIndex,sourceIndex, saturation, PQ_PARAM_SATURATION); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("Saturation",inputInfo,indexInfo); + int err = getLocalparam("Saturation",indexInfo, saturation, PQ_PARAM_SATURATION); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex,saturation); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex,saturation); ret = SetSaturation(saturation); } else { @@ -1421,10 +1392,7 @@ namespace Plugin { uint32_t AVOutputTV::getSaturationCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -1434,32 +1402,32 @@ namespace Plugin { unsigned int index = 0; JsonObject rangeObj; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"Saturation"); + tvError_t ret = getParamsCaps("Saturation",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - rangeObj["from"] = stoi(range[0]); - rangeObj["to"] = stoi(range[1]); + rangeObj["from"] = stoi(info.rangeVector[0]); + rangeObj["to"] = stoi(info.rangeVector[1]); response["rangeInfo"]=rangeObj; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -1472,24 +1440,21 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int sharpness = 0; - if (parsingGetInputArgument(parameters, "Sharpness",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "Sharpness",inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("Sharpness",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("Sharpness",formatIndex,pqIndex,sourceIndex,sharpness, PQ_PARAM_SHARPNESS); + int err = getLocalparam("Sharpness",indexInfo,sharpness, PQ_PARAM_SHARPNESS); if( err == 0 ) { response["sharpness"] = sharpness; LOGINFO("Exit : Sharpness Value: %d \n", sharpness); @@ -1504,33 +1469,31 @@ namespace Plugin { { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; int sharpness = 0; tvError_t ret = tvERROR_NONE; + std::string value; value = parameters.HasLabel("sharpness") ? parameters["sharpness"].String() : ""; returnIfParamNotFound(parameters,"sharpness"); - sharpness = stoi(value); + sharpness = std::stoi(value); if (validateIntegerInputParameter("Sharpness",sharpness) != 0) { LOGERR("Failed in sharpness range validation:%s", __FUNCTION__); returnResponse(false); } - if (parsingSetInputArgument(parameters, "Sharpness",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Sharpness", inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Sharpness" )) { + if( !isCapablityCheckPassed( "Sharpness", inputInfo )) { LOGERR("%s: CapablityCheck failed for Sharpness\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); ret = SetSharpness(sharpness); } @@ -1540,9 +1503,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=sharpness; - int retval= updateAVoutputTVParam("set","Sharpness",pqmode,source,format,PQ_PARAM_SHARPNESS,params); + int retval= updateAVoutputTVParam("set","Sharpness",inputInfo,PQ_PARAM_SHARPNESS,sharpness); if(retval != 0 ) { LOGERR("Failed to Save Sharpness to ssm_data\n"); returnResponse(false); @@ -1558,36 +1519,36 @@ namespace Plugin { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,sharpness=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int sharpness=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "Sharpness",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Sharpness",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Sharpness" )) { + if( !isCapablityCheckPassed( "Sharpness" , inputInfo)) { LOGERR("%s: CapablityCheck failed for Sharpness\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","Sharpness",pqmode,source,format,PQ_PARAM_SHARPNESS,params); + int retval= updateAVoutputTVParam("reset","Sharpness", inputInfo,PQ_PARAM_SHARPNESS,sharpness); if(retval != 0 ) { LOGERR("Failed to reset Sharpness\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("Sharpness",formatIndex,pqIndex,sourceIndex, sharpness, PQ_PARAM_SHARPNESS); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("Sharpness",inputInfo,indexInfo); + int err = getLocalparam("Sharpness",indexInfo, sharpness, PQ_PARAM_SHARPNESS); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex,sharpness); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex,sharpness); ret = SetSharpness(sharpness); } else { @@ -1610,10 +1571,7 @@ namespace Plugin { uint32_t AVOutputTV::getSharpnessCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -1623,31 +1581,31 @@ namespace Plugin { JsonObject rangeObj; unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"Sharpness"); + tvError_t ret = getParamsCaps("Sharpness",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - rangeObj["from"] = stoi(range[0]); - rangeObj["to"] = stoi(range[1]); + rangeObj["from"] = stoi(info.rangeVector[0]); + rangeObj["to"] = stoi(info.rangeVector[1]); response["rangeInfo"]=rangeObj; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -1660,24 +1618,21 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int hue = 0; - if (parsingGetInputArgument(parameters, "Hue",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "Hue", inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("Hue",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("Hue",formatIndex,pqIndex,sourceIndex,hue, PQ_PARAM_HUE); + int err = getLocalparam("Hue",indexInfo,hue, PQ_PARAM_HUE); if( err == 0 ) { response["hue"] = hue; LOGINFO("Exit : Hue Value: %d \n", hue); @@ -1692,33 +1647,31 @@ namespace Plugin { { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; int hue = 0; tvError_t ret = tvERROR_NONE; + std::string value; value = parameters.HasLabel("hue") ? parameters["hue"].String() : ""; returnIfParamNotFound(parameters,"hue"); - hue = stoi(value); + hue = std::stoi(value); if (validateIntegerInputParameter("Hue",hue) != 0) { LOGERR("Failed in hue range validation:%s", __FUNCTION__); returnResponse(false); } - if (parsingSetInputArgument(parameters, "Hue",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Hue",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Hue" )) { + if( !isCapablityCheckPassed( "Hue", inputInfo )) { LOGERR("%s: CapablityCheck failed for Hue\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); ret = SetHue(hue); } @@ -1728,9 +1681,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=hue; - int retval= updateAVoutputTVParam("set","Hue",pqmode,source,format,PQ_PARAM_HUE,params); + int retval= updateAVoutputTVParam("set","Hue",inputInfo,PQ_PARAM_HUE,hue); if(retval != 0 ) { LOGERR("Failed to Save Hue to ssm_data\n"); returnResponse(false); @@ -1746,36 +1697,36 @@ namespace Plugin { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,hue=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int hue=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "Hue",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "Hue",inputInfo)!= 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "Hue" )) { + if( !isCapablityCheckPassed( "Hue" , inputInfo )) { LOGERR("%s: CapablityCheck failed for Hue\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","Hue",pqmode,source,format,PQ_PARAM_HUE,params); + int retval= updateAVoutputTVParam("reset","Hue", inputInfo,PQ_PARAM_HUE,hue); if(retval != 0 ) { LOGERR("Failed to reset Hue\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("Hue",formatIndex,pqIndex,sourceIndex, hue, PQ_PARAM_HUE); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("Hue",inputInfo,indexInfo); + int err = getLocalparam("Hue",indexInfo, hue, PQ_PARAM_HUE); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex,hue); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex,hue); ret = SetHue(hue); } else { @@ -1798,10 +1749,7 @@ namespace Plugin { uint32_t AVOutputTV::getHueCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -1811,31 +1759,31 @@ namespace Plugin { JsonObject rangeObj; unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"Hue"); + tvError_t ret = getParamsCaps("Hue",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - rangeObj["from"] = stoi(range[0]); - rangeObj["to"] = stoi(range[1]); + rangeObj["from"] = stoi(info.rangeVector[0]); + rangeObj["to"] = stoi(info.rangeVector[1]); response["rangeInfo"]=rangeObj; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -1848,24 +1796,21 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int colortemp = 0; - if (parsingGetInputArgument(parameters, "ColorTemperature",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "ColorTemperature", inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("ColorTemperature",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("ColorTemp",formatIndex,pqIndex,sourceIndex,colortemp,PQ_PARAM_COLOR_TEMPERATURE); + int err = getLocalparam("ColorTemp",indexInfo,colortemp,PQ_PARAM_COLOR_TEMPERATURE); if( err == 0 ) { switch(colortemp) { case tvColorTemp_STANDARD: @@ -1885,7 +1830,7 @@ namespace Plugin { case tvColorTemp_USER: LOGINFO("Color Temp Value: User Defined\n"); - response["colorTemperature"] = "User Defined"; + response["colorTemperature"] = "UserDefined"; break; default: @@ -1905,10 +1850,8 @@ namespace Plugin { { LOGINFO("Entry\n"); + capDetails_t inputInfo; std::string value; - std::string pqmode; - std::string source; - std::string format; tvColorTemp_t colortemp = tvColorTemp_MAX; tvError_t ret = tvERROR_NONE; @@ -1923,24 +1866,24 @@ namespace Plugin { else if (!value.compare("Cold")) { colortemp = tvColorTemp_COLD; } - else if (!value.compare("User Defined")) { + else if (!value.compare("UserDefined")) { colortemp = tvColorTemp_USER; } else { returnResponse(false); } - if (parsingSetInputArgument(parameters, "ColorTemperature",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "ColorTemperature",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "ColorTemperature" )) { + if( !isCapablityCheckPassed( "ColorTemperature", inputInfo )) { LOGERR("%s: CapablityCheck failed for colorTemperature\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); ret = SetColorTemperature((tvColorTemp_t)colortemp); } @@ -1950,9 +1893,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=(int)colortemp; - int retval= updateAVoutputTVParam("set","ColorTemp",pqmode,source,format,PQ_PARAM_COLOR_TEMPERATURE,params); + int retval= updateAVoutputTVParam("set","ColorTemp", inputInfo,PQ_PARAM_COLOR_TEMPERATURE,(int)colortemp); if(retval != 0 ) { LOGERR("Failed to Save ColorTemperature to ssm_data\n"); returnResponse(false); @@ -1967,36 +1908,36 @@ namespace Plugin { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,colortemp=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int colortemp=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "ColorTemperature",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "ColorTemperature", inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "ColorTemperature" )) { + if( !isCapablityCheckPassed( "ColorTemperature", inputInfo )) { LOGERR("%s: CapablityCheck failed for colorTemperature\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","ColorTemp",pqmode,source,format,PQ_PARAM_COLOR_TEMPERATURE,params); + int retval= updateAVoutputTVParam("reset","ColorTemp", inputInfo,PQ_PARAM_COLOR_TEMPERATURE,colortemp); if(retval != 0 ) { LOGERR("Failed to reset ColorTemperature\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("ColorTemp",formatIndex,pqIndex,sourceIndex, colortemp, PQ_PARAM_COLOR_TEMPERATURE); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("ColorTemperature",inputInfo,indexInfo); + int err = getLocalparam("ColorTemp",indexInfo, colortemp, PQ_PARAM_COLOR_TEMPERATURE); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex, colortemp); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex, colortemp); ret = SetColorTemperature((tvColorTemp_t)colortemp); } else { @@ -2018,10 +1959,7 @@ namespace Plugin { uint32_t AVOutputTV::getColorTemperatureCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -2030,33 +1968,33 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"ColorTemperature"); + tvError_t ret = getParamsCaps("ColorTemperature",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - for (index = 0; index < range.size(); index++) { - rangeArray.Add(range[index]); - } + for (index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); + } response["options"]=rangeArray; - if (((pqmode.front()).compare("none") != 0)) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if (((info.pqmodeVector.front()).compare("none") != 0)) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -2069,25 +2007,22 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int dimmingMode = 0; - if (parsingGetInputArgument(parameters, "DimmingMode",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "DimmingMode", inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("DimmingMode",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("DimmingMode",formatIndex,pqIndex,sourceIndex,dimmingMode, PQ_PARAM_DIMMINGMODE); + int err = getLocalparam("DimmingMode",indexInfo,dimmingMode, PQ_PARAM_DIMMINGMODE); if( err == 0 ) { switch(dimmingMode) { case tvDimmingMode_Fixed: @@ -2118,12 +2053,10 @@ namespace Plugin { { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; int dimmingMode = 0; tvError_t ret = tvERROR_NONE; + std::string value; value = parameters.HasLabel("DimmingMode") ? parameters["DimmingMode"].String() : ""; returnIfParamNotFound(parameters,"DimmingMode"); @@ -2134,17 +2067,17 @@ namespace Plugin { } dimmingMode = getDimmingModeIndex(value); - if (parsingSetInputArgument(parameters, "DimmingMode",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "DimmingMode",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "DimmingMode" )) { + if( !isCapablityCheckPassed( "DimmingMode" , inputInfo )) { LOGERR("%s: CapablityCheck failed for DimmingMode\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired(pqmode,source,format) ) { + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); ret = SetTVDimmingMode(value.c_str()); } @@ -2154,9 +2087,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=(int)dimmingMode; - int retval= updateAVoutputTVParam("set","DimmingMode",pqmode,source,format,PQ_PARAM_DIMMINGMODE,params); + int retval= updateAVoutputTVParam("set","DimmingMode",inputInfo,PQ_PARAM_DIMMINGMODE,(int)dimmingMode); if(retval != 0 ) { LOGERR("Failed to Save DimmingMode to ssm_data\n"); returnResponse(false); @@ -2171,25 +2102,23 @@ namespace Plugin { { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format;std::string dimmingMode; - int sourceIndex=0,pqIndex=0,formatIndex=0,dMode=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + std::string dimmingMode; + int dMode=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "DimmingMode",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "DimmingMode", inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "DimmingMode" )) { + if( !isCapablityCheckPassed( "DimmingMode" , inputInfo )) { LOGERR("%s: CapablityCheck failed for DimmingMode\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","DimmingMode",pqmode,source,format,PQ_PARAM_DIMMINGMODE,params); + int retval= updateAVoutputTVParam("reset","DimmingMode", inputInfo,PQ_PARAM_DIMMINGMODE,dMode); if(retval != 0 ) { LOGERR("Failed to reset ldim\n"); @@ -2197,11 +2126,14 @@ namespace Plugin { } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("DimmingMode",formatIndex,pqIndex,sourceIndex, dMode, PQ_PARAM_DIMMINGMODE); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("DimmingMode",inputInfo,indexInfo); + int err = getLocalparam("DimmingMode",indexInfo, dMode, PQ_PARAM_DIMMINGMODE); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex, dMode); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex, dMode); getDimmingModeStringFromEnum(dMode,dimmingMode); ret = SetTVDimmingMode(dimmingMode.c_str()); } @@ -2224,10 +2156,7 @@ namespace Plugin { uint32_t AVOutputTV::getBacklightDimmingModeCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector supportedDimmingMode; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray supportedDimmingModeArray; JsonArray pqmodeArray; @@ -2236,33 +2165,33 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps(supportedDimmingMode,pqmode,source,format,"DimmingMode"); + tvError_t ret = getParamsCaps("DimmingMode",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - for (index = 0; index < supportedDimmingMode.size(); index++) { - supportedDimmingModeArray.Add(supportedDimmingMode[index]); + for (index = 0; index < info.rangeVector.size(); index++) { + supportedDimmingModeArray.Add(info.rangeVector[index]); } response["options"]=supportedDimmingModeArray; - if (((pqmode.front()).compare("none") != 0)) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if (((info.pqmodeVector.front()).compare("none") != 0)) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -2273,7 +2202,6 @@ namespace Plugin { uint32_t AVOutputTV::getSupportedDolbyVisionModes(const JsonObject& parameters, JsonObject& response) { - LOGINFO("Entry\n"); tvDolbyMode_t dvModes[tvMode_Max]; tvDolbyMode_t *dvModesPtr = dvModes; // Pointer to statically allocated tvDolbyMode_t array @@ -2297,21 +2225,18 @@ namespace Plugin { LOGINFO("Exit\n"); returnResponse(true); } - } + uint32_t AVOutputTV::getDolbyVisionMode(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; + capDetails_t inputInfo; + paramIndex_t indexInfo; int dolbyMode = 0; int err = 0; - int sourceIndex=0,pqIndex=0,formatIndex=0; - - if (parsingGetInputArgument(parameters, "DolbyVisionMode",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "DolbyVisionMode",inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } @@ -2320,15 +2245,13 @@ namespace Plugin { returnResponse(false); } - // Since it is dolby vision mode, to should get only for dolby vision format - format = "DV"; - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("DolbyVisionMode",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - err = getLocalparam("DolbyVisionMode",formatIndex,pqIndex,sourceIndex,dolbyMode, PQ_PARAM_DOLBY_MODE); + err = getLocalparam("DolbyVisionMode",indexInfo,dolbyMode, PQ_PARAM_DOLBY_MODE); if( err == 0 ) { response["dolbyVisionMode"] = getDolbyModeStringFromEnum((tvDolbyMode_t)dolbyMode); LOGINFO("Exit : DolbyVisionMode Value: %d \n", dolbyMode); @@ -2344,35 +2267,33 @@ namespace Plugin { { LOGINFO("Entry\n"); + capDetails_t inputInfo; std::string value; - std::string pqmode; - std::string source; - std::string format; tvError_t ret = tvERROR_NONE; value = parameters.HasLabel("dolbyVisionMode") ? parameters["dolbyVisionMode"].String() : ""; returnIfParamNotFound(parameters,"dolbyVisionMode"); - if (parsingSetInputArgument(parameters, "DolbyVisionMode",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "DolbyVisionMode",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } if (isPlatformSupport("DolbyVisionMode") != 0) { - returnResponse(false); - } + returnResponse(false); + } if (validateInputParameter("DolbyVisionMode",value) != 0) { LOGERR("%s: Range validation failed for DolbyVisionMode\n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "DolbyVisionMode" )) { + if( !isCapablityCheckPassed( "DolbyVisionMode" , inputInfo )) { LOGERR("%s: CapablityCheck failed for DolbyVisionMode\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired("Current",source,"DV") ) { + if( isSetRequired("Current",inputInfo.source,"DV") ) { LOGINFO("Proceed with setDolbyVisionMode\n\n"); ret = SetTVDolbyVisionMode(GetDolbyVisionEnumFromModeString(value.c_str())); } @@ -2382,10 +2303,7 @@ namespace Plugin { returnResponse(false); } else { - int params[3]={0}; - params[0]=getDolbyModeIndex(value.c_str()); - format = "DV"; - int retval= updateAVoutputTVParam("set","DolbyVisionMode",pqmode,source,format,PQ_PARAM_DOLBY_MODE,params); + int retval= updateAVoutputTVParam("set","DolbyVisionMode",inputInfo,PQ_PARAM_DOLBY_MODE,getDolbyModeIndex(value.c_str())); if(retval != 0 ) { LOGERR("Failed to Save Dolbyvision mode\n"); returnResponse(false); @@ -2400,15 +2318,12 @@ namespace Plugin { { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,dolbyMode=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int dolbyMode=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "DolbyVisionMode",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "DolbyVisionMode",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } @@ -2417,24 +2332,26 @@ namespace Plugin { returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "DolbyVisionMode" )) { + if( !isCapablityCheckPassed( "DolbyVisionMode" , inputInfo )) { LOGERR("%s: CapablityCheck failed for DolbyVisionMode\n", __FUNCTION__); returnResponse(false); } - format = "DV"; - int retval= updateAVoutputTVParam("reset","DolbyVisionMode",pqmode,source,format,PQ_PARAM_DOLBY_MODE,params); + int retval= updateAVoutputTVParam("reset","DolbyVisionMode",inputInfo,PQ_PARAM_DOLBY_MODE,dolbyMode); if(retval != 0 ) { LOGERR("Failed to reset DolbyVisionMode\n"); returnResponse(false); } else { - if (isSetRequired("Current",source,format)) { - getParamIndex("Current","Current", format,sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("DolbyVisionMode",formatIndex,pqIndex,sourceIndex, dolbyMode, PQ_PARAM_DOLBY_MODE); + if (isSetRequired("Current",inputInfo.source,inputInfo.format)) { + inputInfo.source = "Current"; + inputInfo.pqmode = "Current"; + inputInfo.format = "DV"; + getParamIndex("DolbyVisionMode",inputInfo,indexInfo); + int err = getLocalparam("DolbyVisionMode",indexInfo, dolbyMode, PQ_PARAM_DOLBY_MODE); 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()); + + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d dolbyvalue : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex, dolbyMode); ret = SetTVDolbyVisionMode((tvDolbyMode_t)dolbyMode); } else { @@ -2456,12 +2373,7 @@ namespace Plugin { uint32_t AVOutputTV::getDolbyVisionModeCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; - std::string isPlatformSupport; - std::vector indexInfo; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -2470,35 +2382,35 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"DolbyVisionMode", isPlatformSupport, indexInfo); + tvError_t ret = getParamsCaps("DolbyVisionMode", info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - response["platformSupport"] = (isPlatformSupport.compare("true") == 0 ) ? true : false; + response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0 ) ? true : false; - for (index = 0; index < range.size(); index++) { - rangeArray.Add(range[index]); + for (index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); } response["options"]=rangeArray; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -2553,20 +2465,17 @@ namespace Plugin { JsonArray rangeArray; - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"VideoFormat"); + tvError_t ret = getParamsCaps("VideoFormat",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - if ((range.front()).compare("none") != 0) { - for (unsigned int index = 0; index < range.size(); index++) { - rangeArray.Add(range[index]); + if ((info.rangeVector.front()).compare("none") != 0) { + for (unsigned int index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); } response["options"]=rangeArray; } @@ -2608,35 +2517,32 @@ namespace Plugin { JsonArray formatArray; JsonArray rangeArray; - std::vector range; - std::vector source; - std::vector pqmode; - std::vector format; + capVectors_t info; unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"PictureMode"); + tvError_t ret = getParamsCaps("PictureMode",info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - if ((range.front()).compare("none") != 0) { - for (index = 0; index < range.size(); index++) { - rangeArray.Add(range[index]); + if ((info.rangeVector.front()).compare("none") != 0) { + for (index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); } response["options"]=rangeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } @@ -2648,29 +2554,24 @@ namespace Plugin { uint32_t AVOutputTV::getPictureMode(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry\n"); - std::string picturemode; - std::string source; - std::string format; - std::string dummyPqmode; - int current_source = 0; - int current_format = 0; - int pqIndex = 0; + capDetails_t inputInfo; + paramIndex_t indexInfo; std::string tr181_param_name; TR181_ParamData_t param = {0}; tr181ErrorCode_t err = tr181Success; - if (parsingGetInputArgument(parameters, "PictureMode",source, dummyPqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "PictureMode",inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,dummyPqmode,format,current_source,pqIndex,current_format) == -1) { + if (getParamIndex("PictureMode",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } tr181_param_name += std::string(AVOUTPUT_SOURCE_PICTUREMODE_STRING_RFC_PARAM); - tr181_param_name += "." + convertSourceIndexToString(current_source) + "." + "Format."+convertVideoFormatToString(current_format)+"."+"PictureModeString"; + tr181_param_name += "." + convertSourceIndexToString(indexInfo.sourceIndex) + "." + "Format."+convertVideoFormatToString(indexInfo.formatIndex)+"."+"PictureModeString"; err = getLocalParam(rfc_caller_id, tr181_param_name.c_str(), ¶m); if ( tr181Success != err ) { @@ -2688,11 +2589,9 @@ namespace Plugin { uint32_t AVOutputTV::setPictureMode(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry\n"); - std::string value; - std::string source; - std::string format; - std::string dummyPqmode; + capDetails_t inputInfo; char prevmode[PIC_MODE_NAME_MAX]={0}; + std::string value; GetTVPictureMode(prevmode); tvError_t ret = tvERROR_NONE; @@ -2700,7 +2599,7 @@ namespace Plugin { returnIfParamNotFound(parameters,"pictureMode"); // As only source need to validate, so pqmode and formate passing as currrent - if (parsingSetInputArgument(parameters, "PictureMode",source, dummyPqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "PictureMode",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } @@ -2709,12 +2608,12 @@ namespace Plugin { LOGERR("%s: Range validation failed for PictureMode\n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( dummyPqmode, source,format, "PictureMode" )) { + if( !isCapablityCheckPassed( "PictureMode" , inputInfo )) { LOGERR("%s: CapablityCheck failed for PictureMode\n", __FUNCTION__); returnResponse(false); } - if( isSetRequired("Current",source,format) ) { + if( isSetRequired("Current",inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with SetTVPictureMode\n"); ret = SetTVPictureMode(value.c_str()); } @@ -2722,15 +2621,14 @@ namespace Plugin { returnResponse(false); } else { - std::vector pq_mode_vec; - std::vector source_vec; - std::vector format_vec; + valueVectors_t values; + inputInfo.pqmode = "Current"; - getSaveConfig("Current", source.c_str(), format.c_str(), source_vec, pq_mode_vec, format_vec); + getSaveConfig("PictureMode" ,inputInfo, values); - for (int sourceType : source_vec) { + for (int sourceType : values.sourceValues) { tvVideoSrcType_t source = (tvVideoSrcType_t)sourceType; - for (int formatType : format_vec) { + for (int formatType : values.formatValues) { tvVideoFormatType_t format = (tvVideoFormatType_t)formatType; std::string tr181_param_name = ""; tr181_param_name += std::string(AVOUTPUT_SOURCE_PICTUREMODE_STRING_RFC_PARAM); @@ -2781,29 +2679,25 @@ namespace Plugin { tr181ErrorCode_t err = tr181Success; TR181_ParamData_t param = {0}; - std::vector pq_mode_vec; - std::vector source_vec; - std::vector format_vec; - std::string source; - std::string dummyPqmode; - std::string format; + valueVectors_t values; + capDetails_t inputInfo; // As only source need to validate, so pqmode and formate passing as currrent - if (parsingSetInputArgument(parameters, "PictureMode",source, dummyPqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "PictureMode",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( dummyPqmode, source,format, "PictureMode" )) { + if( !isCapablityCheckPassed( "PictureMode",inputInfo )) { LOGERR("%s: CapablityCheck failed for PictureMode\n", __FUNCTION__); returnResponse(false); } + inputInfo.pqmode = "Current"; + getSaveConfig("PictureMode", inputInfo, values); - getSaveConfig("Current", source, format, source_vec, pq_mode_vec, format_vec); - - for (int source : source_vec) { + for (int source : values.sourceValues) { tvVideoSrcType_t sourceType = (tvVideoSrcType_t)source; - for (int format : format_vec) { + for (int format : values.formatValues) { tvVideoFormatType_t formatType = (tvVideoFormatType_t)format; std::string tr181_param_name = ""; tr181_param_name += std::string(AVOUTPUT_SOURCE_PICTUREMODE_STRING_RFC_PARAM); @@ -2878,10 +2772,7 @@ namespace Plugin { LOGINFO("Entry\n"); std::string value; - std::string pqmode; - std::string source; - std::string format; - int params[3]={0}; + capDetails_t inputInfo; int lowLatencyIndex = 0,prevLowLatencyIndex = 0; tvError_t ret = tvERROR_NONE; @@ -2893,41 +2784,37 @@ namespace Plugin { value = parameters.HasLabel("LowLatencyState") ? parameters["LowLatencyState"].String() : ""; returnIfParamNotFound(parameters,"LowLatencyState"); - lowLatencyIndex = stoi(value); + lowLatencyIndex = std::stoi(value); if (validateIntegerInputParameter("LowLatencyState",lowLatencyIndex) != 0) { LOGERR("Failed in Brightness range validation:%s", __FUNCTION__); returnResponse(false); } - if (parsingSetInputArgument(parameters, "LowLatencyState",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "LowLatencyState",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed(pqmode, source, format, "LowLatencyState" )) { + if( !isCapablityCheckPassed( "LowLatencyState" , inputInfo )) { LOGERR("%s: CapablityCheck failed for LowLatencyState\n", __FUNCTION__); returnResponse(false); } - params[0]=lowLatencyIndex; - int retval= updateAVoutputTVParam("set","LowLatencyState",pqmode,source,format,PQ_PARAM_LOWLATENCY_STATE,params); + int retval= updateAVoutputTVParam("set","LowLatencyState",inputInfo,PQ_PARAM_LOWLATENCY_STATE,lowLatencyIndex); if(retval != 0 ) { LOGERR("Failed to SaveLowLatency to ssm_data\n"); returnResponse(false); } else { - - if( isSetRequired(pqmode,source,format) ) { + + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with setLowLatencyState\n"); ret = SetLowLatencyState( lowLatencyIndex ); } if(ret != tvERROR_NONE) { - LOGERR("Failed to setLowLatency\n"); - params[0]=prevLowLatencyIndex; LOGERR("Failed to set low latency. Fallback to previous state %d\n", prevLowLatencyIndex); - - retval=updateAVoutputTVParam("set","LowLatencyState",pqmode,source,format,PQ_PARAM_LOWLATENCY_STATE,params); + retval=updateAVoutputTVParam("set","LowLatencyState",inputInfo,PQ_PARAM_LOWLATENCY_STATE,prevLowLatencyIndex); if(retval != 0 ){ LOGERR("Fallback to previous low latency state %d failed.\n", prevLowLatencyIndex); } @@ -2943,23 +2830,20 @@ namespace Plugin { { LOGINFO("Entry"); - std::string pqmode; - std::string source; - std::string format; - std::string key; - int sourceIndex=0,pqIndex=0,formatIndex=0; + capDetails_t inputInfo; + paramIndex_t indexInfo; int lowlatencystate = 0; - if (parsingGetInputArgument(parameters, "LowLatencyState",source, pqmode, format) != 0) { + if (parsingGetInputArgument(parameters, "LowLatencyState",inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); } - if (getParamIndex(source,pqmode,format,sourceIndex,pqIndex,formatIndex) == -1) { + if (getParamIndex("LowLatencyState",inputInfo,indexInfo) == -1) { LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); returnResponse(false); } - int err = getLocalparam("LowLatencyState",formatIndex,pqIndex,sourceIndex,lowlatencystate, PQ_PARAM_LOWLATENCY_STATE); + int err = getLocalparam("LowLatencyState", indexInfo ,lowlatencystate, PQ_PARAM_LOWLATENCY_STATE); if( err == 0 ) { response["lowLatencyState"] = std::to_string(lowlatencystate); LOGINFO("Exit : LowLatencyState Value: %d \n", lowlatencystate); @@ -2974,35 +2858,35 @@ namespace Plugin { { LOGINFO("Entry\n"); - std::string value; - std::string pqmode; - std::string source; - std::string format; - int sourceIndex=0,pqIndex=0,formatIndex=0,lowlatencystate=0; - int params[3]={0}; + capDetails_t inputInfo; + paramIndex_t indexInfo; + int lowlatencystate=0; tvError_t ret = tvERROR_NONE; - if (parsingSetInputArgument(parameters, "LowLatencyState",source, pqmode, format) != 0) { + if (parsingSetInputArgument(parameters, "LowLatencyState", inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); } - if( !isCapablityCheckPassed( pqmode, source, format, "LowLatencyState" )) { + if( !isCapablityCheckPassed( "LowLatencyState" , inputInfo )) { LOGERR("%s: CapablityCheck failed for LowLatencyState\n", __FUNCTION__); returnResponse(false); } - int retval= updateAVoutputTVParam("reset","LowLatencyState",pqmode,source,format,PQ_PARAM_LOWLATENCY_STATE,params); + int retval= updateAVoutputTVParam("reset","LowLatencyState", inputInfo,PQ_PARAM_LOWLATENCY_STATE,lowlatencystate); if(retval != 0 ) { LOGERR("Failed to clear Lowlatency from ssmdata and localstore\n"); returnResponse(false); } else { - if (isSetRequired(pqmode,source,format)) { - getParamIndex("Current","Current", "Current",sourceIndex,pqIndex,formatIndex); - int err = getLocalparam("LowLatencyState",formatIndex,pqIndex,sourceIndex, lowlatencystate, PQ_PARAM_LOWLATENCY_STATE); + if (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + inputInfo.pqmode = "Current"; + inputInfo.source = "Current"; + inputInfo.format = "Current"; + getParamIndex("LowLatencyState",inputInfo, indexInfo); + int err = getLocalparam("LowLatencyState",indexInfo, lowlatencystate, PQ_PARAM_LOWLATENCY_STATE); if( err == 0 ) { - LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,formatIndex, sourceIndex, pqIndex, lowlatencystate); + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d value : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex, lowlatencystate); ret = SetLowLatencyState(lowlatencystate); } else { @@ -3024,10 +2908,7 @@ namespace Plugin { uint32_t AVOutputTV::getLowLatencyStateCaps(const JsonObject& parameters, JsonObject& response) { LOGINFO("Entry"); - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; JsonArray rangeArray; JsonArray pqmodeArray; @@ -3036,40 +2917,964 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"LowLatencyState"); + tvError_t ret = getParamsCaps("LowLatencyState", info); if(ret != tvERROR_NONE) { returnResponse(false); } else { - for (index = 0; index < range.size(); index++) { - rangeArray.Add(stoi(range[index])); + for (index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(stoi(info.rangeVector[index])); } response["LowLatencyInfo"]=rangeArray; - if ((pqmode.front()).compare("none") != 0) { - for (index = 0; index < pqmode.size(); index++) { - pqmodeArray.Add(pqmode[index]); + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); + } + response["pictureModeInfo"]=pqmodeArray; + } + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); + } + response["videoSourceInfo"]=sourceArray; + } + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); + } + response["videoFormatInfo"]=formatArray; + } + LOGINFO("Exit\n"); + returnResponse(true); + } + } + + uint32_t AVOutputTV::getCMS(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry"); + + capDetails_t inputInfo; + paramIndex_t indexInfo; + int level = 0; + tvPQParameterIndex_t tvPQEnum; + + inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; + inputInfo.component = parameters.HasLabel("component") ? parameters["component"].String() : ""; + + if( inputInfo.color.empty() || inputInfo.component.empty() ) { + LOGERR("%s : Color/Component param not found!!!\n",__FUNCTION__); + returnResponse(false); + } + + + if (parsingGetInputArgument(parameters, "CMS", inputInfo) != 0) { + LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); + returnResponse(false); + } + + if (getParamIndex("CMS",inputInfo,indexInfo) == -1) { + LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); + returnResponse(false); + } + + if ( convertCMSParamToPQEnum(inputInfo.component,inputInfo.color,tvPQEnum) != 0 ) { + LOGINFO("%s: Component/Color Param Not Found \n",__FUNCTION__); + returnResponse(false); + } + + int err = getLocalparam("CMS",indexInfo,level,tvPQEnum); + if( err == 0 ) { + response["level"] = level; + LOGINFO("Exit : params Value: %d \n", level); + returnResponse(true); + } + else { + returnResponse(false); + } + } + + uint32_t AVOutputTV::setCMS(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + + capDetails_t inputInfo; + int level = 0,retVal = 0; + tvPQParameterIndex_t tvPQEnum; + tvDataComponentColor_t colorEnum=tvDataColor_NONE; + std::string color,component; + tvError_t ret = tvERROR_NONE; + std::string value; + + inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; + inputInfo.component = parameters.HasLabel("component") ? parameters["component"].String() : ""; + + if( inputInfo.color.empty() || inputInfo.component.empty() ) { + LOGERR("%s : Color/Component param not found!!!\n",__FUNCTION__); + returnResponse(false); + } + + value = parameters.HasLabel("level") ? parameters["level"].String() : ""; + returnIfParamNotFound(parameters,"level"); + level = std::stoi(value); + + if (validateCMSParameter(inputInfo.component,level) != 0) { + LOGERR("%s: CMS Failed in range validation", __FUNCTION__); + returnResponse(false); + } + + if (parsingSetInputArgument(parameters,"CMS",inputInfo) != 0) { + LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); + returnResponse(false); + } + + if( !isCapablityCheckPassed( "CMS",inputInfo )) { + LOGERR("%s: CapablityCheck failed for CMS\n", __FUNCTION__); + returnResponse(false); + } + + if ( convertCMSParamToPQEnum(inputInfo.component,inputInfo.color,tvPQEnum) != 0 ) { + LOGERR("%s: %s/%s Param Not Found \n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str()); + returnResponse(false); + } + + /* retVal = getCMSComponentEnumFromString(inputInfo.component,compEnum); + if( retVal == -1) { + LOGERR("%s: Invalid Component : %s\n",__FUNCTION__,inputInfo.component.c_str()); + returnResponse(false); + } + + retVal = getCMSColorEnumFromString(inputInfo.color,colorEnum); + if( retVal == -1) { + LOGERR("%s: Invalid Color : %s\n",__FUNCTION__,inputInfo.color.c_str()); + returnResponse(false); + }*/ + + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { + LOGINFO("Proceed with %s\n",__FUNCTION__); + tvError_t ret = SetCMSState(true); + if(ret != tvERROR_NONE) { + LOGWARN("CMS enable failed\n"); + returnResponse(false); + } + + if(inputInfo.component.compare("Saturation") == 0) + ret = SetCurrentComponentSaturation(colorEnum, level); + else if(inputInfo.component.compare("Hue") == 0 ) + ret = SetCurrentComponentHue(colorEnum,level); + else if( inputInfo.component.compare("Luma") == 0 ) + ret = SetCurrentComponentLuma(colorEnum,level); + + } + + if(ret != tvERROR_NONE) { + LOGERR("Failed to set CMS\n"); + returnResponse(false); + } + else { + std::string cmsParam; + cmsParam = inputInfo.color+"."+inputInfo.component; + + retVal= updateAVoutputTVParam("set","CMS",inputInfo,tvPQEnum,level); + if(retVal != 0 ) { + LOGERR("%s : Failed to Save CMS %s/%s(%s) to ssm_data\n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str(),cmsParam.c_str()); + returnResponse(false); + } + LOGINFO("Exit : setCMS %s/%s successful to value: %d\n", inputInfo.component.c_str(),inputInfo.color.c_str(),level); + returnResponse(true); + } + } + + uint32_t AVOutputTV::resetCMS(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + + capDetails_t inputInfo; + int retVal = 0; + std::string color,component; + tvError_t ret = tvERROR_NONE; + + inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; + inputInfo.component = parameters.HasLabel("component") ? parameters["component"].String() : ""; + + if (parsingSetInputArgument(parameters,"CMS",inputInfo) != 0) { + LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); + returnResponse(false); + } + + if( !isCapablityCheckPassed( "CMS" , inputInfo )) { + LOGERR("%s: CapablityCheck failed for CMS\n", __FUNCTION__); + returnResponse(false); + } +/* + if ( convertCMSParamToEnum(inputInfo.component,inputInfo.color,tvPQEnum) != 0 ) { + LOGERR("%s: %s/%s Param Not Found \n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str()); + returnResponse(false); + } + + retVal = getCMSComponentEnumFromString(inputInfo.component,compEnum); + if( ret == -1) { + LOGERR("%s: Invalid Component : %s\n",__FUNCTION__,inputInfo.component.c_str()); + returnResponse(false); + } + + retVal = getCMSColorEnumFromString(inputInfo.color,colorEnum); + if( ret == -1) { + LOGERR("%s: Invalid Color : %s\n",__FUNCTION__,inputInfo.color.c_str()); + returnResponse(false); + } */ + + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { + LOGINFO("Proceed with %s\n",__FUNCTION__); + tvError_t ret = SetCMSState(false); + if(ret != tvERROR_NONE) { + LOGWARN("CMS disable failed\n"); + returnResponse(false); + } + } + + if(ret != tvERROR_NONE) { + LOGERR("%s : Failed to setCMSState\n",__FUNCTION__); + returnResponse(false); + } + else { + int cms = 0; + retVal= updateAVoutputTVParam("reset","CMS",inputInfo,PQ_PARAM_CMS_SATURATION_RED,cms); + if(retVal != 0 ) { + LOGERR("%s : Failed to Save CMS %s/%s to ssm_data\n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str() ); + returnResponse(false); + } + returnResponse(true); + } + } + + uint32_t AVOutputTV::getCMSCaps(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry"); + capVectors_t info; + + JsonArray rangeArray; + JsonArray pqmodeArray; + JsonArray formatArray; + JsonArray sourceArray; + JsonArray colorArray; + JsonArray componentArray; + + JsonObject componentSaturationRangeInfo; + JsonObject componentHueRangeInfo; + JsonObject componentLumaRangeInfo; + unsigned int index = 0; + + tvError_t ret = getParamsCaps("CMS",info); + + if(ret != tvERROR_NONE) { + returnResponse(false); + } + else { + + response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0) ? true : false; + + componentSaturationRangeInfo["from"] = stoi(info.rangeVector[0]); + componentSaturationRangeInfo["to"] = stoi(info.rangeVector[1]); + response["componentSaturationRangeInfo"]=componentSaturationRangeInfo; + + componentHueRangeInfo["from"] = stoi(info.rangeVector[2]); + componentHueRangeInfo["to"] = stoi(info.rangeVector[3]); + response["componentHueRangeInfo"]=componentHueRangeInfo; + + componentLumaRangeInfo["from"] = stoi(info.rangeVector[4]); + componentLumaRangeInfo["to"] = stoi(info.rangeVector[5]); + response["componentLumaRangeInfo"]=componentLumaRangeInfo; + + + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); } response["pictureModeInfo"]=pqmodeArray; } - if ((source.front()).compare("none") != 0) { - for (index = 0; index < source.size(); index++) { - sourceArray.Add(source[index]); + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); } response["videoSourceInfo"]=sourceArray; } - if ((format.front()).compare("none") != 0) { - for (index = 0; index < format.size(); index++) { - formatArray.Add(format[index]); + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); } response["videoFormatInfo"]=formatArray; } + + if ((info.colorVector.front()).compare("none") != 0) { + for (index = 0; index < info.colorVector.size(); index++) { + colorArray.Add(info.colorVector[index]); + } + response["colorInfo"]=colorArray; + } + + if ((info.componentVector.front()).compare("none") != 0) { + for (index = 0; index < info.componentVector.size(); index++) { + componentArray.Add(info.componentVector[index]); + } + response["componentInfo"]=componentArray; + } + LOGINFO("Exit\n"); returnResponse(true); } } + uint32_t AVOutputTV::getHDRMode(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry"); + capDetails_t inputInfo; + int dolbyMode = 0; + int err = 0; + paramIndex_t indexInfo; + + if (parsingGetInputArgument(parameters, "HDRMode", inputInfo) != 0) { + LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); + returnResponse(false); + } + + if (isPlatformSupport("HDRMode") != 0) { + returnResponse(false); + } + + if (getParamIndex("HDRMode",inputInfo,indexInfo) == -1) { + LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); + returnResponse(false); + } + + err = getLocalparam("HDRMode", indexInfo,dolbyMode, PQ_PARAM_DOLBY_MODE); + if( err == 0 ) { + response["hdrMode"] = getDolbyModeStringFromEnum((tvDolbyMode_t)dolbyMode); + LOGINFO("Exit : hdrMode Value: %d \n", dolbyMode); + returnResponse(true); + } + else { + returnResponse(false); + } + + } + + uint32_t AVOutputTV::setHDRMode(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + tvDolbyMode_t index; + capDetails_t inputInfo; + tvError_t ret = tvERROR_NONE; + std::string value; + int retval = 0; + + value = parameters.HasLabel("HDRMode") ? parameters["HDRMode"].String() : ""; + returnIfParamNotFound(parameters,"HDRMode"); + + if (parsingSetInputArgument(parameters, "HDRMode", inputInfo) != 0) { + LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); + returnResponse(false); + } + + if (isPlatformSupport("HDRMode") != 0) { + returnResponse(false); + } + + if (validateInputParameter("HDRMode",value) != 0) { + LOGERR("%s: Range validation failed for hdrMode\n", __FUNCTION__); + returnResponse(false); + } + + if( !isCapablityCheckPassed( "HDRMode", inputInfo )) { + LOGERR("%s: CapablityCheck failed for hdrMode\n", __FUNCTION__); + returnResponse(false); + } + + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { + LOGINFO("Proceed with HDRMode\n\n"); + retval = getHDRModeIndex(value,inputInfo.format,index); + if( retval != 0 ) + { + LOGERR("Failed to getHDRMode index\n"); + returnResponse(false); + } + ret = SetTVDolbyVisionMode(index); + } + + if(ret != tvERROR_NONE) { + LOGERR("Failed to set HDRMode\n\n"); + returnResponse(false); + } + else { + retval= updateAVoutputTVParam("set","HDRMode",inputInfo,PQ_PARAM_DOLBY_MODE,(int)index); + if(retval != 0 ) { + LOGERR("Failed to Save hdrMode mode\n"); + returnResponse(false); + } + LOGINFO("Exit : hdrMode successful to value: %s\n", value.c_str()); + returnResponse(true); + } + + } + + uint32_t AVOutputTV::resetHDRMode(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + + capDetails_t inputInfo; + paramIndex_t indexInfo; + int dolbyMode=0; + tvError_t ret = tvERROR_NONE; + + if (parsingSetInputArgument(parameters, "HDRMode", inputInfo) != 0) { + LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); + returnResponse(false); + } + + if (isPlatformSupport("HDRMode") != 0) { + returnResponse(false); + } + + if( !isCapablityCheckPassed( "HDRMode" , inputInfo )) { + LOGERR("%s: CapablityCheck failed for HDRMode\n", __FUNCTION__); + returnResponse(false); + } + + int retval= updateAVoutputTVParam("reset","HDRMode",inputInfo,PQ_PARAM_DOLBY_MODE,dolbyMode); + if(retval != 0 ) { + LOGERR("Failed to reset HDRMode\n"); + returnResponse(false); + } + else { + if (isSetRequired( inputInfo.pqmode,inputInfo.source,inputInfo.format)) { + getParamIndex( "HDRMode", inputInfo,indexInfo); + int err = getLocalparam("HDRMode", indexInfo, dolbyMode, PQ_PARAM_DOLBY_MODE); + if( err == 0 ) { + LOGINFO("%s : getLocalparam success format :%d source : %d format : %d dolbyvalue : %d\n",__FUNCTION__,indexInfo.formatIndex, indexInfo.sourceIndex, indexInfo.pqmodeIndex, dolbyMode); + ret = SetTVDolbyVisionMode((tvDolbyMode_t)dolbyMode); + } + else { + LOGERR("%s : GetLocalParam Failed \n",__FUNCTION__); + ret = tvERROR_GENERAL; + } + } + } + + if(ret != tvERROR_NONE) { + returnResponse(false); + } + else { + LOGINFO("Exit : resetHDRMode Successful to value : %d \n",dolbyMode); + returnResponse(true); + } + } + + uint32_t AVOutputTV::getHDRModeCaps(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry"); + capVectors_t info; + + JsonArray rangeArray; + JsonArray pqmodeArray; + JsonArray formatArray; + JsonArray sourceArray; + + unsigned int index = 0; + + tvError_t ret = getParamsCaps("HDRMode", info); + + if(ret != tvERROR_NONE) { + returnResponse(false); + } + else { + + response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0 ) ? true : false; + + for (index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); + } + + response["options"]=rangeArray; + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); + } + response["pictureModeInfo"]=pqmodeArray; + } + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); + } + response["videoSourceInfo"]=sourceArray; + } + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); + } + response["videoFormatInfo"]=formatArray; + } + LOGINFO("Exit\n"); + returnResponse(true); + } + } + + uint32_t AVOutputTV::get2PointWB(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry"); + + capDetails_t inputInfo; + paramIndex_t indexInfo; + int level = 0; + tvPQParameterIndex_t tvPQEnum; + + inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; + inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; + + if( inputInfo.color.empty() || inputInfo.control.empty() ) { + LOGERR("%s : Color/Control param not found!!!\n",__FUNCTION__); + returnResponse(false); + } + + if (parsingGetInputArgument(parameters, "WhiteBalance", inputInfo) != 0) { + LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); + returnResponse(false); + } + + if (getParamIndex("WhiteBalance", inputInfo,indexInfo) == -1) { + LOGERR("%s: getParamIndex failed to get \n", __FUNCTION__); + returnResponse(false); + } + + if ( convertWBParamToPQEnum(inputInfo.control,inputInfo.color,tvPQEnum) != 0 ) { + LOGINFO("%s: Control/Color Param Not Found \n",__FUNCTION__); + returnResponse(false); + } + + int err = getLocalparam("WhiteBalance",indexInfo,level, tvPQEnum); + if( err == 0 ) { + response["level"] = level; + LOGINFO("Exit : params Value: %d \n", level); + returnResponse(true); + } + else { + returnResponse(false); + } + } + + uint32_t AVOutputTV::set2PointWB(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + + capDetails_t inputInfo; + int level = 0; + tvPQParameterIndex_t tvPQEnum; + int retVal = 0; + std::string color,control,value; + tvError_t ret = tvERROR_NONE; + tvColorTemp_t colorTemp = tvColorTemp_STANDARD; + + inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; + inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; + + //Proceed Only if current colorTemp is User + if( tvERROR_NONE != GetColorTemperature(&colorTemp) ) + { + LOGERR("%s : Failed to GetcolorTemperature!!!\n",__FUNCTION__); + returnResponse(false); + } + + if( colorTemp != tvColorTemp_USER) + { + LOGERR("%s : Dont Proceed color temp is non-tvColorTemp_USER !!!\n",__FUNCTION__); + returnResponse(false); + } + + if( inputInfo.color.empty() || inputInfo.control.empty() ) { + LOGERR("%s : Color/Control param not found!!!\n",__FUNCTION__); + returnResponse(false); + } + + value = parameters.HasLabel("level") ? parameters["level"].String() : ""; + returnIfParamNotFound(parameters,"level"); + level = std::stoi(value); + + if (validateWBParameter("WhiteBalance",inputInfo.control,level) != 0) { + LOGERR("%s: CMS Failed in range validation", __FUNCTION__); + returnResponse(false); + } + + if (parsingSetInputArgument(parameters,"WhiteBalance",inputInfo) != 0) { + LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); + returnResponse(false); + } + + if( !isCapablityCheckPassed( "WhiteBalance",inputInfo )) { + LOGERR("%s: CapablityCheck failed for WhiteBalance\n", __FUNCTION__); + returnResponse(false); + } + + if ( convertWBParamToPQEnum(inputInfo.control,inputInfo.color,tvPQEnum) != 0 ) { + LOGERR("%s: %s/%s Param Not Found \n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str()); + returnResponse(false); + } + + if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { + LOGINFO("Proceed with %s\n",__FUNCTION__); + + tvVideoSrcType_t currentSource = VIDEO_SOURCE_IP; + tvError_t ret = GetCurrentVideoSource(¤tSource); + + if(ret != tvERROR_NONE) { + LOGWARN("%s: GetCurrentVideoSource( ) Failed \n",__FUNCTION__); + return -1; + } + + tvWBColor_t colorLevel; + if ( getWBColorEnumFromString(inputInfo.color,colorLevel ) == -1 ) { + LOGERR("%s : GetColorEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + + tvWBControl_t controlLevel; + if ( getWBControlEnumFromString(inputInfo.control,controlLevel ) == -1 ) { + LOGERR("%s : GetComponentEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + + ret = SetCustom2PointWhiteBalance(colorLevel,controlLevel,level); + } + + if(ret != tvERROR_NONE) { + LOGERR("%s: Failed to set WhiteBalance\n",__FUNCTION__); + returnResponse(false); + } + else { + retVal= updateAVoutputTVParam("set","WhiteBalance",inputInfo,tvPQEnum,level); + if(retVal != 0 ) { + LOGERR("%s : Failed to Save WB %s/%s : %d to ssm_data\n",__FUNCTION__,inputInfo.control.c_str(),inputInfo.color.c_str(),level); + returnResponse(false); + } + LOGINFO("Exit : set2PointWB %s/%s successful to value: %d\n", inputInfo.control.c_str(),inputInfo.color.c_str(),level); + returnResponse(true); + } + } + + uint32_t AVOutputTV::reset2PointWB(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + + capDetails_t inputInfo; + tvPQParameterIndex_t tvPQEnum; + int retVal = 0; + int level = 0; + std::string color,control; + inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; + inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; + + if (parsingSetInputArgument(parameters,"WhiteBalance",inputInfo) != 0) { + LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); + returnResponse(false); + } + + if( !isCapablityCheckPassed( "WhiteBalance",inputInfo )) { + LOGERR("%s: CapablityCheck failed for WhiteBalance\n", __FUNCTION__); + returnResponse(false); + } + + for( int colorIndex= tvWB_COLOR_RED; colorIndex < tvWB_COLOR_MAX; colorIndex++) { + for(int controlIndex = tvWB_CONTROL_GAIN;controlIndex < tvWB_CONTROL_MAX;controlIndex++) { + inputInfo.control = getWBControlStringFromEnum((tvWBControl_t)controlIndex); + inputInfo.color = getWBColorStringFromEnum((tvWBColor_t)colorIndex); + if ( convertWBParamToPQEnum(inputInfo.control,inputInfo.color,tvPQEnum) != 0 ) { + LOGERR("%s: %s/%s Param Not Found \n",__FUNCTION__,inputInfo.control.c_str(),inputInfo.color.c_str()); + returnResponse(false); + } + + retVal |= updateAVoutputTVParam("reset","WhiteBalance",inputInfo,tvPQEnum,level); + } + } + + if( retVal != 0 ) { + LOGWARN("Failed to reset WhiteBalance\n"); + returnResponse(false); + } + else { + LOGINFO("Exit : reset2PointWB successful \n"); + returnResponse(true); + } + } + + uint32_t AVOutputTV::get2PointWBCaps(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry"); + capVectors_t info; + + JsonArray rangeArray; + JsonArray pqmodeArray; + JsonArray formatArray; + JsonArray sourceArray; + JsonArray colorArray; + JsonArray componentArray; + + JsonObject gainInfo; + JsonObject offsetInfo; + + unsigned int index = 0; + + tvError_t ret = getParamsCaps("CMS",info); + + if(ret != tvERROR_NONE) { + returnResponse(false); + } + else { + response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0) ? true : false; + + gainInfo["from"] = stoi(info.rangeVector[0]); + gainInfo["to"] = stoi(info.rangeVector[1]); + response["gainInfo"]=gainInfo; + + offsetInfo["from"] = stoi(info.rangeVector[0]); + offsetInfo["to"] = stoi(info.rangeVector[1]); + response["offsetInfo"]=offsetInfo; + + + + if ((info.pqmodeVector.front()).compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); + } + response["pictureModeInfo"]=pqmodeArray; + } + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); + } + response["videoSourceInfo"]=sourceArray; + } + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); + } + response["videoFormatInfo"]=formatArray; + } + + if ((info.colorVector.front()).compare("none") != 0) { + for (index = 0; index < info.colorVector.size(); index++) { + colorArray.Add(info.colorVector[index]); + } + response["colorInfo"]=colorArray; + } + + if ((info.componentVector.front()).compare("none") != 0) { + for (index = 0; index < info.componentVector.size(); index++) { + componentArray.Add(info.componentVector[index]); + } + response["componentInfo"]=componentArray; + } + + LOGINFO("Exit\n"); + returnResponse(true); + } + } + + uint32_t AVOutputTV::getAutoBacklightModeCaps(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry"); + capVectors_t info; + + JsonArray rangeArray; + JsonArray pqmodeArray; + JsonArray formatArray; + JsonArray sourceArray; + + unsigned int index = 0; + + tvError_t ret = getParamsCaps("AutoBacklightMode",info); + + if(ret != tvERROR_NONE) { + returnResponse(false); + } + else { + + response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0 ) ? true : false; + + for (index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); + } + + response["options"]=rangeArray; + + if (info.pqmodeVector.front().compare("none") != 0) { + for (index = 0; index < info.pqmodeVector.size(); index++) { + pqmodeArray.Add(info.pqmodeVector[index]); + } + response["pictureModeInfo"]=pqmodeArray; + } + if ((info.sourceVector.front()).compare("none") != 0) { + for (index = 0; index < info.sourceVector.size(); index++) { + sourceArray.Add(info.sourceVector[index]); + } + response["videoSourceInfo"]=sourceArray; + } + if ((info.formatVector.front()).compare("none") != 0) { + for (index = 0; index < info.formatVector.size(); index++) { + formatArray.Add(info.formatVector[index]); + } + response["videoFormatInfo"]=formatArray; + } + LOGINFO("Exit\n"); + returnResponse(true); + } + } + + uint32_t AVOutputTV::setAutoBacklightMode(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + std::string value; + tvBacklightMode_t mode = tvBacklightMode_AMBIENT; + capDetails_t inputInfo; + + + value = parameters.HasLabel("mode") ? parameters["mode"].String() : ""; + returnIfParamNotFound(parameters,"mode"); + + if (validateInputParameter("AutoBacklightMode",value) != 0) { + LOGERR("%s: Range validation failed for AutoBacklightMode\n", __FUNCTION__); + returnResponse(false); + } + + if (isPlatformSupport("AutoBacklightMode") != 0) { + returnResponse(false); + } + + if (parsingSetInputArgument(parameters,"AutoBacklightMode",inputInfo) != 0) { + LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); + returnResponse(false); + } + + if( !isCapablityCheckPassed( "AutoBacklightMode",inputInfo )) { + LOGERR("%s: CapablityCheck failed for AutoBacklightMode\n", __FUNCTION__); + returnResponse(false); + } + + if(!value.compare("Manual")) { + mode = tvBacklightMode_MANUAL; + } + else if (!value.compare("Ambient")) { + mode = tvBacklightMode_AMBIENT; + } + else { + returnResponse(false); + } + + tvError_t ret = SetCurrentBacklightMode (mode); + + if(ret != tvERROR_NONE) { + returnResponse(false); + } + else { + //Save AutoBacklightMode to localstore + + tr181ErrorCode_t err = setLocalParam(rfc_caller_id, AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM, value.c_str()); + if ( err != tr181Success ) { + LOGERR("setLocalParam for %s Failed : %s\n", AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM, getTR181ErrorString(err)); + returnResponse(false); + } + else { + LOGINFO("setLocalParam for %s Successful, Value: %s\n", AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM, value.c_str()); + } + LOGINFO("Exit : SetAutoBacklightMode() value : %s\n",value.c_str()); + returnResponse(true); + } + } + + uint32_t AVOutputTV::getAutoBacklightMode(const JsonObject& parameters, JsonObject& response) + { + + TR181_ParamData_t param; + + if (isPlatformSupport("AutoBacklightMode") != 0) { + returnResponse(false); + } + + tr181ErrorCode_t err = getLocalParam(rfc_caller_id, AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM, ¶m); + if (err!= tr181Success) { + returnResponse(false); + } + else { + std::string s; + s+=param.value; + response["mode"] = s; + LOGINFO("Exit getAutoBacklightMode(): %s\n",s.c_str()); + returnResponse(true); + } + + } + + uint32_t AVOutputTV::resetAutoBacklightMode(const JsonObject& parameters, JsonObject& response) + { + LOGINFO("Entry\n"); + + tvError_t ret = tvERROR_NONE; + + if (isPlatformSupport("AutoBacklightMode") != 0) { + returnResponse(false); + } + + tr181ErrorCode_t err = clearLocalParam(rfc_caller_id,AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM); + if ( err != tr181Success ) { + LOGWARN("clearLocalParam for %s Failed : %s\n", AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM, getTR181ErrorString(err)); + ret = tvERROR_GENERAL; + } + else { + LOGINFO("clearLocalParam for %s Successful\n", AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM); + + TR181_ParamData_t param; + memset(¶m, 0, sizeof(param)); + + tr181ErrorCode_t err = getLocalParam(rfc_caller_id, AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM,¶m); + if ( err != tr181Success ) { + LOGWARN("getLocalParam for %s Failed : %s\n", AVOUTPUT_AUTO_BACKLIGHT_MODE_RFC_PARAM, getTR181ErrorString(err)); + ret = tvERROR_GENERAL; + } + else { + tvBacklightMode_t blMode = tvBacklightMode_NONE; + + if(!std::string(param.value).compare("none")) { + blMode = tvBacklightMode_NONE; + } + else if (!std::string(param.value).compare("Manual")){ + blMode = tvBacklightMode_MANUAL; + } + else if (!std::string(param.value).compare("Ambient")){ + blMode = tvBacklightMode_AMBIENT; + } + else if (!std::string(param.value).compare("Eco")){ + blMode = tvBacklightMode_ECO; + } + else { + blMode = tvBacklightMode_NONE; + } + ret = SetCurrentBacklightMode(blMode); + if(ret != tvERROR_NONE) { + LOGWARN("Autobacklight Mode set failed: %s\n",getErrorString(ret).c_str()); + } + else { + LOGINFO("Exit : Autobacklight Mode set successfully, value: %s\n", param.value); + } + } + } + if(ret != tvERROR_NONE) + { + returnResponse(false); + } + else + { + returnResponse(true); + } + } + uint32_t AVOutputTV::getVideoSource(const JsonObject& parameters,JsonObject& response) { LOGINFO("Entry\n"); diff --git a/AVOutput/AVOutputTV.h b/AVOutput/AVOutputTV.h index feb6f9c2e9..5ffc0ccdba 100644 --- a/AVOutput/AVOutputTV.h +++ b/AVOutput/AVOutputTV.h @@ -43,6 +43,8 @@ #include "dsMgr.h" #include "hdmiIn.hpp" #include +#include +#include //Macro #define RFC_BUFF_MAX 100 @@ -68,6 +70,10 @@ #define STRING_FORMAT "Format." #define STRING_DEFAULT "Default" #define STRING_SOURCE "Source." +#define STRING_COMPONENT "Component." +#define STRING_COLOR "Color." +#define STRING_CONTROL "Control." +#define STRING_COLORTEMPERATURE "ColorTemperature." #define CREATE_DIRTY(__X__) (__X__+=STRING_DIRTY) #define CAPABLITY_FILE_NAME "pq_capabilities.ini" @@ -116,6 +122,61 @@ class CIniFile namespace WPEFramework { namespace Plugin { +typedef struct +{ + std::string range; + std::string pqmode; + std::string format; + std::string source; + std::string isPlatformSupport; + std::string index; + std::string color; + std::string component; + std::string colorTemperature; + std::string control; +}capDetails_t; + +typedef struct +{ + std::vector rangeVector; + std::vector pqmodeVector; + std::vector formatVector; + std::vector sourceVector; + std::vector isPlatformSupportVector; + std::vector indexVector; + std::vector colorVector; + std::vector componentVector; + std::vector colorTempVector; + std::vector controlVector; +}capVectors_t; + + +typedef struct +{ + std::vector rangeValues; + std::vector pqmodeValues; + std::vector formatValues; + std::vector sourceValues; + std::vector isPlatformSupportValues; + std::vector indexValues; + std::vector colorValues; + std::vector componentValues; + std::vector colorTempValues; + std::vector controlValues; + }valueVectors_t; + +typedef struct +{ + uint8_t sourceIndex; + uint8_t pqmodeIndex; + uint8_t formatIndex; + uint8_t colorIndex; + uint8_t componentIndex; + uint8_t colorTempIndex; + uint8_t controlIndex; +}paramIndex_t; + + //class AVOutputTV : public PluginHost::IPlugin, public PluginHost::JSONRPC { class AVOutputTV : public AVOutputBase { private: @@ -142,6 +203,10 @@ class AVOutputTV : public AVOutputBase { DECLARE_JSON_RPC_METHOD(getLowLatencyState) DECLARE_JSON_RPC_METHOD(getZoomMode) DECLARE_JSON_RPC_METHOD(getVideoContentType) + DECLARE_JSON_RPC_METHOD(getCMS) + DECLARE_JSON_RPC_METHOD(getHDRMode) + DECLARE_JSON_RPC_METHOD(get2PointWB) + DECLARE_JSON_RPC_METHOD(getAutoBacklightMode) /*Get Capability API's*/ @@ -161,6 +226,10 @@ class AVOutputTV : public AVOutputBase { DECLARE_JSON_RPC_METHOD(getVideoResolutionCaps) DECLARE_JSON_RPC_METHOD(getLowLatencyStateCaps) DECLARE_JSON_RPC_METHOD(getZoomModeCaps) + DECLARE_JSON_RPC_METHOD(getCMSCaps) + DECLARE_JSON_RPC_METHOD(get2PointWBCaps) + DECLARE_JSON_RPC_METHOD(getHDRModeCaps) + DECLARE_JSON_RPC_METHOD(getAutoBacklightModeCaps) /*Set API's*/ DECLARE_JSON_RPC_METHOD(setBacklight) @@ -176,7 +245,11 @@ class AVOutputTV : public AVOutputBase { DECLARE_JSON_RPC_METHOD(setLowLatencyState) DECLARE_JSON_RPC_METHOD(setZoomMode) DECLARE_JSON_RPC_METHOD(setWBCtrl ) - DECLARE_JSON_RPC_METHOD(signalFilmMakerMode) + DECLARE_JSON_RPC_METHOD(setHDRMode ) + DECLARE_JSON_RPC_METHOD(setCMS ) + DECLARE_JSON_RPC_METHOD(set2PointWB ) + DECLARE_JSON_RPC_METHOD(signalFilmMakerMode) + DECLARE_JSON_RPC_METHOD(setAutoBacklightMode) /*Reset API's*/ DECLARE_JSON_RPC_METHOD(resetBacklight) @@ -191,6 +264,10 @@ class AVOutputTV : public AVOutputBase { DECLARE_JSON_RPC_METHOD(resetPictureMode ) DECLARE_JSON_RPC_METHOD(resetLowLatencyState) DECLARE_JSON_RPC_METHOD(resetZoomMode) + DECLARE_JSON_RPC_METHOD(resetHDRMode) + DECLARE_JSON_RPC_METHOD(resetCMS) + DECLARE_JSON_RPC_METHOD(reset2PointWB) + DECLARE_JSON_RPC_METHOD(resetAutoBacklightMode) private: @@ -200,22 +277,26 @@ class AVOutputTV : public AVOutputBase { int getSourceIndex(std::string source); int getFormatIndex(std::string format); int getPqParamIndex(); - int getParamIndex(string source,string pqmode,string format,int& sourceIndex,int& pqmodeIndex,int& formatIndex); + int getParamIndex(std::string param, capDetails_t& paramInfo, paramIndex_t& indexInfo); int getDolbyModeIndex(const char * dolbyMode); + int getHDRModeIndex(const std::string HDRMode, const std::string format,tvDolbyMode_t &value); tvDimmingMode_t getDimmingModeIndex(string mode); bool isIncluded(const std::set set1,const std::set set2); bool isSetRequired(std::string pqmode,std::string source,std::string format); int isPlatformSupport(std::string pqparam); - void spliltCapablities( std::vector &range,std::vector &pqmode,std::vector &format,std::vector &source, std::vector &index,std::string rangeInfo, std::string pqmodeInfo, std::string formatInfo, std::string sourceInfo, std::string indexInfo); - bool isCapablityCheckPassed( std::string pqmodeInputInfo,std::string sourceInputInfo,std::string formatInputInfo,std::string param ); - int parsingSetInputArgument(const JsonObject& parameters, std::string pqparam,std::string & source, std::string & pqmode, std::string & format); - int parsingGetInputArgument(const JsonObject& parameters, std::string pqparam,std::string & source, std::string & pqmode, std::string & format); + + bool isCapablityCheckPassed( std::string param, capDetails_t inputInfo ); + int parsingSetInputArgument(const JsonObject& parameters, std::string pqparam,capDetails_t& paramInfo); + int parsingGetInputArgument(const JsonObject& parameters, std::string pqparam, capDetails_t& info); + void spliltCapablities( capVectors_t& vectorInfo, capDetails_t stringInfo); void spliltStringsAndConvertToSet( std::string pqmodeInfo,std::string formatInfo,std::string sourceInfo,std::set &pqmode, std::set &format, std::set &source); int validateIntegerInputParameter(std::string param, int inputValue); - int fetchCapablities(string pqparam, string & source, string & pqmode, string & format); + 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); + int validateCMSParameter(std::string component,int inputValue); /* AVoutput ini file default entries */ void locatePQSettingsFile(void); @@ -225,7 +306,7 @@ class AVOutputTV : public AVOutputBase { std::string convertToString(std::vector vec_strings); void convertParamToLowerCase(std::string &source, std::string &pqmode, std::string &format); - int convertToValidInputParameter(std::string pqparam, std::string & source, std::string & pqmode, std::string & format); + int convertToValidInputParameter(std::string pqparam, capDetails_t& info); string convertSourceIndexToString(int source); string convertVideoFormatToString(int format); string convertPictureIndexToString(int pqmode); @@ -235,36 +316,37 @@ class AVOutputTV : public AVOutputBase { void convertUserScaleBacklightToDriverScale(int format,int * params); /* Update TR181 with new values when app calls set/reset calls */ - tvError_t updateAVoutputTVParamToHAL(std::string forParam, int source, int pqmode, int format, int value,bool setNotDelete); + tvError_t updateAVoutputTVParamToHAL(std::string forParam, paramIndex_t indexInfo, int value,bool setNotDelete); /* updatePQParamsToCache will call updatePQParamToLocalCache for writing to TR181. * it will call TVSettings HAL for setting/saving the value * Will be called whenever the application invokes set/reset call */ - int updateAVoutputTVParam( std::string action, std::string tr181ParamName, std::string pqmode, std::string source, std::string format, tvPQParameterIndex_t pqParamIndex, int params[] ); + int updateAVoutputTVParam( std::string action, std::string tr181ParamName, capDetails_t info, tvPQParameterIndex_t pqParamIndex, int level ); /* Every bootup this function is called to sync TR181 to TVSettings HAL for saving the value */ tvError_t syncAvoutputTVParamsToHAL(std::string pqmode, std::string source, std::string format); /* Every Bootup this function is called to sync TR181 to TVSettings HAL for saving the picture mode assiocation to source */ int syncAvoutputTVPQModeParamsToHAL(std::string pqmode, std::string source, std::string format); + void syncCMSParams( ); + void syncWBParams( ); - uint32_t generateStorageIdentifier(std::string &key, std::string forParam,int contentFormat, int pqmode, int source); + uint32_t generateStorageIdentifier(std::string &key, std::string forParam,paramIndex_t info); + uint32_t generateStorageIdentifierCMS(std::string &key, std::string forParam, paramIndex_t info); + uint32_t generateStorageIdentifierWB(std::string &key, std::string forParam, paramIndex_t info); uint32_t generateStorageIdentifierDirty(std::string &key, std::string forParam,uint32_t contentFormat, int pqmode); std::string getErrorString (tvError_t eReturn); /* Get function to query TR181 entries or pq capability.ini file*/ - int getSaveConfig(std::string pqmode, std::string source, std::string format,std::vector &sources,std::vector &picturemodes, std::vector &formats); - int getLocalparam(std::string forParam,int formatIndex,int pqIndex,int sourceIndex,int &value, - tvPQParameterIndex_t pqParamIndex ,bool cms=false,int tunnel_type=0); + int getSaveConfig(std::string param, capDetails_t capInfo, valueVectors_t &values); + int getLocalparam( std::string forParam,paramIndex_t indexInfo,int & value,tvPQParameterIndex_t pqParamIndex,bool sync=false); + tvDataComponentColor_t getComponentColorEnum(std::string colorName); int getDolbyParams(tvContentFormatType_t format, std::string &s, std::string source = ""); - tvError_t getParamsCaps(std::vector &range, std::vector &pqmode, std::vector &source, std::vector &format,std::string param ); - tvError_t getParamsCaps(std::vector &range, std::vector &pqmode, std::vector &source, - std::vector &format,std::string param , std::string & isPlatformSupport, - std::vector & index); + tvError_t getParamsCaps(std::string param, capVectors_t &vecInfo); int GetPanelID(char *panelid); int ConvertHDRFormatToContentFormat(tvhdr_type_t hdrFormat); - int ReadCapablitiesFromConf(std::string &rangeInfo,std::string &pqmodeInfo,std::string &formatInfo,std::string &sourceInfo,std::string param, std::string & isPlatformSupport, std::string & indexInfo); + int ReadCapablitiesFromConf(std::string param, capDetails_t& info); void getDimmingModeStringFromEnum(int value, std::string &toStore); void getColorTempStringFromEnum(int value, std::string &toStore); int getCurrentPictureMode(char *picMode); @@ -273,15 +355,31 @@ class AVOutputTV : public AVOutputBase { std::string getDolbyModeStringFromEnum( tvDolbyMode_t mode); JsonArray getSupportedVideoSource(void); int getAvailableCapabilityModesWrapper(std::string param, std::string & outparam); - int getAvailableCapabilityModes(std::string & source, std::string & pqmode, std::string & format); + int getAvailableCapabilityModes( capDetails_t& info ); int getCapabilitySource(JsonArray &rangeArray); int getRangeCapability(std::string param, std::vector & rangeInfo); void getDynamicAutoLatencyConfig(); tvError_t getUserSelectedAspectRatio (tvDisplayMode_t* mode); + std::string getColorTemperatureStringFromEnum(tvColorTemp_t value); + std::string getCMSColorStringFromEnum(tvDataComponentColor_t value); + std::string getCMSComponentStringFromEnum(tvComponentType_t value); + std::string getWBControlStringFromEnum(tvWBControl_t value); + int getCMSColorEnumFromString(std::string color,tvDataComponentColor_t &value); + int getCMSComponentEnumFromString(std::string component, tvComponentType_t& value); + std::string getWBColorStringFromEnum(tvWBColor_t value); + int getWBColorEnumFromString(std::string color,tvWBColor_t& value); + int getWBControlEnumFromString(std::string color,tvWBControl_t& value); + int getColorTempEnumFromString(std::string color, tvColorTemp_t& value); + + int convertToSourceOffsetEnum(std::string source, tvColorTempSourceOffset_t& value); + int convertCMSParamToPQEnum(const std::string component, const std::string color,tvPQParameterIndex_t& value); + int convertWBParamToPQEnum(const std::string control, const std::string color,tvPQParameterIndex_t& value); + int convertWBParamToRGBEnum(const std::string color,const std::string control,tvRGBType_t &value); void broadcastLowLatencyModeChangeEvent(bool lowLatencyMode); tvError_t setAspectRatioZoomSettings(tvDisplayMode_t mode); tvError_t setDefaultAspectRatio(std::string pqmode="none",std::string format="none",std::string source="none"); + int ReadCapablitiesFromConfODM(std::string param, capDetails_t& info); public: int m_currentHdmiInResoluton; @@ -313,6 +411,7 @@ class AVOutputTV : public AVOutputBase { void DeinitializeIARM(); }; + }//namespace Plugin }//namespace WPEFramework #endif diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index 3c112b877b..a5491c24bf 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -22,6 +22,8 @@ #include "UtilsIarm.h" #include "rfcapi.h" +#define CAPABLITY_FILE_NAME "pq_capabilities.ini" + static std::map supportedSourcemap; static std::map supportedPictureModemap; static std::map supportedFormatmap; @@ -104,19 +106,14 @@ namespace Plugin { int AVOutputTV::getPqParamIndex() { - std::vector localpq; - std::vector localformat; - std::vector localsource; - std::vector localrange; - std::string platformsupport; - std::vector index; + + capVectors_t info; - tvError_t ret = getParamsCaps(localrange, localpq, localformat, localsource, - "VideoSource", platformsupport, index); + tvError_t ret = getParamsCaps("VideoSource", info); if (ret == tvERROR_NONE) { - if (localrange.size() == index.size()) { - for (unsigned int i = 0; i< localrange.size(); i++) { - supportedSourcemap[localrange[i]] = stoi(index[i]); + if (info.rangeVector.size() == info.indexVector.size()) { + for (unsigned int i = 0; i< info.rangeVector.size(); i++) { + supportedSourcemap[info.rangeVector[i]] = stoi(info.indexVector[i]); } } } @@ -124,28 +121,18 @@ namespace Plugin { LOGERR("%s: Failed to fetch the source index \n", __FUNCTION__); return -1; } - if (!localpq.empty()) { - localpq.clear(); - } - if (!localformat.empty()) { - localformat.clear(); - } - if (!localsource.empty()) { - localsource.clear(); - } - if (!localrange.empty()) { - localrange.clear(); - } - if(!index.empty()) { - index.clear(); - } + + info.pqmodeVector.clear(); + info.sourceVector.clear(); + info.formatVector.clear(); + info.indexVector.clear(); + info.rangeVector.clear(); - ret = getParamsCaps(localrange, localpq, localformat, localsource, - "PictureMode", platformsupport, index); + ret = getParamsCaps("PictureMode", info); if (ret == tvERROR_NONE) { - if (localrange.size() == index.size()) { - for (unsigned int i = 0; i< localrange.size(); i++) { - supportedPictureModemap[localrange[i]] = stoi(index[i]); + if (info.rangeVector.size() == info.indexVector.size()) { + for (unsigned int i = 0; i< info.rangeVector.size(); i++) { + supportedPictureModemap[info.rangeVector[i]] = stoi(info.indexVector[i]); } } } @@ -153,28 +140,18 @@ namespace Plugin { LOGERR("%s: Failed to fetch the picture index \n", __FUNCTION__); return -1; } - if (!localpq.empty()) { - localpq.clear(); - } - if (!localformat.empty()) { - localformat.clear(); - } - if (!localsource.empty()) { - localsource.clear(); - } - if (!localrange.empty()) { - localrange.clear(); - } - if(!index.empty()) { - index.clear(); - } + + info.pqmodeVector.clear(); + info.sourceVector.clear(); + info.formatVector.clear(); + info.indexVector.clear(); + info.rangeVector.clear(); - ret = getParamsCaps(localrange, localpq, localformat, localsource, - "VideoFormat", platformsupport, index); + ret = getParamsCaps( "VideoFormat", info); if (ret == tvERROR_NONE) { - if (localrange.size() == index.size()) { - for (unsigned int i = 0; i< localrange.size(); i++) { - supportedFormatmap[localrange[i]] = stoi(index[i]); + if ( info.rangeVector.size() == info.indexVector.size()) { + for (unsigned int i = 0; i< info.rangeVector.size(); i++) { + supportedFormatmap[info.rangeVector[i]] = stoi(info.indexVector[i]); } } } @@ -186,50 +163,101 @@ namespace Plugin { return 0; } - int AVOutputTV::getParamIndex(string source,string pqmode,string format,int& sourceIndex,int& pqmodeIndex,int& formatIndex) + int AVOutputTV::getParamIndex(std::string param, capDetails_t& paramInfo, paramIndex_t& indexInfo) { - LOGINFO("Entry : %s pqmode : %s source :%s format :%s\n",__FUNCTION__,pqmode.c_str(),source.c_str(),format.c_str()); + LOGINFO("Entry : %s param : %s pqmode : %s source :%s format :%s\n",__FUNCTION__,param.c_str(),paramInfo.pqmode.c_str(),paramInfo.source.c_str(),paramInfo.format.c_str()); - if( source.compare("none") == 0 || source.compare("Current") == 0 ) { + if( paramInfo.source.compare("none") == 0 || paramInfo.source.compare("Current") == 0 ) { tvVideoSrcType_t currentSource = VIDEO_SOURCE_IP; GetCurrentVideoSource(¤tSource); - sourceIndex = (int)currentSource; + indexInfo.sourceIndex = (int)currentSource; } else { - sourceIndex = getSourceIndex(source); + indexInfo.sourceIndex = getSourceIndex(paramInfo.source); } - if( pqmode.compare("none") == 0 || pqmode.compare("Current") == 0) { + if( paramInfo.pqmode.compare("none") == 0 || paramInfo.pqmode.compare("Current") == 0) { char picMode[PIC_MODE_NAME_MAX]={0}; if(!getCurrentPictureMode(picMode)) { LOGERR("Failed to get the Current picture mode\n"); } else { std::string local = picMode; - pqmodeIndex = getPictureModeIndex(local); + indexInfo.pqmodeIndex = getPictureModeIndex(local); } } else { - pqmodeIndex = getPictureModeIndex(pqmode); + indexInfo.pqmodeIndex = getPictureModeIndex(paramInfo.pqmode); } - if( format.compare("none") == 0 || format.compare("Current") == 0) { + if( paramInfo.format.compare("none") == 0 || paramInfo.format.compare("Current") == 0) { tvVideoFormatType_t currentFormat = VIDEO_FORMAT_NONE; GetCurrentVideoFormat(¤tFormat); if( VIDEO_FORMAT_NONE == currentFormat ) { - formatIndex = VIDEO_FORMAT_SDR; + indexInfo.formatIndex = VIDEO_FORMAT_SDR; } else { - formatIndex = (int)currentFormat; + indexInfo.formatIndex = (int)currentFormat; } } else { - formatIndex = getFormatIndex(format); + indexInfo.formatIndex = getFormatIndex(paramInfo.format); } - if (sourceIndex == -1 || pqmodeIndex == -1 || formatIndex == -1) { - return -1; - } - LOGINFO("%s: Exit sourceIndex = %d pqmodeIndex = %d formatIndex = %d\n",__FUNCTION__,sourceIndex,pqmodeIndex,formatIndex); + if(param == "CMS") + { + tvDataComponentColor_t level = tvDataColor_NONE; + if ( getCMSColorEnumFromString(paramInfo.color,level ) == -1 ) { + LOGERR("%s : GetColorEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + + indexInfo.colorIndex = level; + + tvComponentType_t componentLevel; + if ( getCMSComponentEnumFromString(paramInfo.component,componentLevel ) == -1 ) { + LOGERR("%s : GetComponentEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + + indexInfo.componentIndex = componentLevel; + + LOGINFO("%s colorIndex : %d , componentIndex : %d\n",__FUNCTION__,indexInfo.colorIndex, indexInfo.componentIndex); + } + + if(param == "WhiteBalance") + { + tvWBColor_t level; + if ( getWBColorEnumFromString(paramInfo.color,level ) == -1 ) { + LOGERR("%s : GetColorEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + + indexInfo.colorIndex = level; + + tvWBControl_t controlLevel; + if ( getWBControlEnumFromString(paramInfo.control,controlLevel ) == -1 ) { + LOGERR("%s : GetComponentEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + + indexInfo.controlIndex = controlLevel; + + /*tvColorTemp_t colorTemp; + if ( getColorTempEnumFromString(paramInfo.colorTemperature,colorTemp ) == -1 ) { + LOGERR("%s : GetComponentEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + + indexInfo.colorTempIndex = colorTemp; */ + + LOGINFO("%s colorIndex : %d , controlIndex : %d \n",__FUNCTION__,indexInfo.colorIndex, indexInfo.controlIndex); + + } + + if (indexInfo.sourceIndex == -1 || indexInfo.pqmodeIndex == -1 || indexInfo.formatIndex == -1) { + return -1; + } + LOGINFO("%s: Exit sourceIndex = %d pqmodeIndex = %d formatIndex = %d\n",__FUNCTION__,indexInfo.sourceIndex,indexInfo.pqmodeIndex,indexInfo.formatIndex); return 0; } @@ -251,16 +279,44 @@ namespace Plugin { mode = dolbyModes[count]; break; } - } } else { mode = -1; printf("(%s):get supported mode is failed\n", __func__); } - return mode; } + int AVOutputTV::getHDRModeIndex(const std::string HDRMode, const std::string format,tvDolbyMode_t &value) { + // Create a map to associate format-mode pairs with enum values + int ret = 0; + static const std::unordered_map hdrModeIndexMap = { + {"DVDark", tvDolbyMode_Dark}, + {"DVBright", tvDolbyMode_Bright}, + {"DVGame", tvDolbyMode_Game}, + {"HDR10Dark", tvHDR10Mode_Dark}, + {"HDR10Bright", tvHDR10Mode_Bright}, + {"HDR10Game", tvHDR10Mode_Game}, + {"HLGDark", tvHLGMode_Dark}, + {"HLGBright", tvHLGMode_Bright}, + {"HLGGame", tvHLGMode_Game} + }; + + // Create the key by concatenating the format and HDRMode + std::string key = format+HDRMode; + + // Look up the key in the map + auto it = hdrModeIndexMap.find(key); + if (it != hdrModeIndexMap.end()) { + value = it->second; + ret = 0; + } else { + LOGERR("%s : Invalid format/mode\n",__FUNCTION__); + ret = -1; + } + return ret; + } + tvDimmingMode_t AVOutputTV::getDimmingModeIndex(std::string mode) { tvDimmingMode_t index = tvDimmingMode_MAX; @@ -337,21 +393,16 @@ namespace Plugin { int AVOutputTV::isPlatformSupport(std::string pqparam) { - std::vector range; - std::vector sourceVec; - std::vector pqmodeVec; - std::vector formatVec; - std::string isPlatformSupport; - std::vector index; + capVectors_t vectorInfo; - tvError_t ret = getParamsCaps(range, pqmodeVec, sourceVec, formatVec, pqparam, isPlatformSupport, index); + tvError_t ret = getParamsCaps(pqparam,vectorInfo); if (ret != tvERROR_NONE) { LOGINFO("%s: failed to get the capability \n", __FUNCTION__); return -1; } else { - if(isPlatformSupport.compare("true") != 0) { + if(vectorInfo.isPlatformSupportVector[0].compare("true") != 0) { LOGERR("%s: platform support not available\n", __FUNCTION__); return -1; } @@ -359,51 +410,36 @@ namespace Plugin { return 0; } - void AVOutputTV::spliltCapablities( std::vector &range,std::vector &pqmode,std::vector &format, - std::vector &source, std::vector &index, std::string rangeInfo, - std::string pqmodeInfo, std::string formatInfo, std::string sourceInfo, std::string indexInfo) + void AVOutputTV::spliltCapablities( capVectors_t& vectorInfo, capDetails_t stringInfo) { - std::string token; - std::stringstream rangeStream(rangeInfo); - std::stringstream pqmodeStream(pqmodeInfo); - std::stringstream formatStream(formatInfo); - std::stringstream sourceStream(sourceInfo); - std::stringstream indexStream(indexInfo); - - while( getline(rangeStream,token,',')) { - range.push_back(token ); - token.clear(); - } - - while( getline(pqmodeStream,token,',') ) { - pqmode.push_back(token ); - token.clear(); - } - - while( getline(formatStream,token,',')) { - format.push_back( token ); - token.clear(); - } - while( getline(sourceStream,token,',') ) { - source.push_back( token ); - token.clear(); - } - - while( getline(indexStream,token,',') ) { - index.push_back( token ); - token.clear(); + std::vector&>> streamVector; + + // Initializing the streamVector with stringstreams and corresponding vectors + streamVector.push_back({std::stringstream(stringInfo.range), vectorInfo.rangeVector}); + streamVector.push_back({std::stringstream(stringInfo.pqmode), vectorInfo.pqmodeVector}); + streamVector.push_back({std::stringstream(stringInfo.format), vectorInfo.formatVector}); + streamVector.push_back({std::stringstream(stringInfo.source), vectorInfo.sourceVector}); + streamVector.push_back({std::stringstream(stringInfo.isPlatformSupport), vectorInfo.isPlatformSupportVector}); + streamVector.push_back({std::stringstream(stringInfo.index), vectorInfo.indexVector}); + streamVector.push_back({std::stringstream(stringInfo.color), vectorInfo.colorVector}); + streamVector.push_back({std::stringstream(stringInfo.component), vectorInfo.componentVector}); + streamVector.push_back({std::stringstream(stringInfo.colorTemperature), vectorInfo.colorTempVector}); + + for (auto& pair : streamVector) { + std::stringstream& ss = pair.first; + std::vector& vec = pair.second; + + std::string token; + while (getline(ss, token, ',')) { + vec.push_back(token); + } } } - - bool AVOutputTV::isCapablityCheckPassed( std::string pqmodeInputInfo,std::string sourceInputInfo,std::string formatInputInfo,std::string param ) + + bool AVOutputTV::isCapablityCheckPassed( std::string param, capDetails_t inputInfo ) { - std::string rangeCapInfo; - std::string sourceCapInfo; - std::string formatCapInfo; - std::string pqmodeCapInfo; - std::string isPlatformSupport; - std::string indexInfo; + capDetails_t paramInfo; std::set pqmodeCapSet; std::set formatCapSet; @@ -412,17 +448,29 @@ namespace Plugin { std::set formatInputSet; std::set sourceInputSet; - if( ReadCapablitiesFromConf( rangeCapInfo, pqmodeCapInfo, formatCapInfo, sourceCapInfo,param, isPlatformSupport, indexInfo) ) { + + if( ReadCapablitiesFromConf( param, paramInfo ) != 0 ) { LOGINFO( "%s: readCapablitiesFromConf Failed !!!\n",__FUNCTION__); return false; } + + if( param == "CMS") + { + if ( ( paramInfo.color.find(inputInfo.color) == std::string::npos ) || ( paramInfo.component.find(inputInfo.component) == std::string::npos) ) + return false; + } + else if( param == "WhiteBalance") + { + if ( ( paramInfo.color.find(inputInfo.color) == std::string::npos ) || ( paramInfo.control.find(inputInfo.control) == std::string::npos) ) + return false; + } //Compare capablityInfo with Input params //1.convertCapablity Info to set for comparison - spliltStringsAndConvertToSet( pqmodeCapInfo, formatCapInfo, sourceCapInfo, pqmodeCapSet, formatCapSet, sourceCapset); + spliltStringsAndConvertToSet( paramInfo.pqmode, paramInfo.format, paramInfo.source, pqmodeCapSet, formatCapSet, sourceCapset); //2.convert Application Input Info to set for comparison - spliltStringsAndConvertToSet( pqmodeInputInfo, formatInputInfo, sourceInputInfo, pqmodeInputSet, formatInputSet, sourceInputSet ); + spliltStringsAndConvertToSet( inputInfo.pqmode, inputInfo.format, inputInfo.source, pqmodeInputSet, formatInputSet, sourceInputSet ); //3.Compare Each pqmode/format/source InputInfo against CapablityInfo if ( isIncluded(pqmodeCapSet,pqmodeInputSet) && isIncluded(formatCapSet,formatInputSet) && isIncluded(sourceCapset,sourceInputSet) ) { @@ -435,8 +483,7 @@ namespace Plugin { } } - int AVOutputTV::parsingSetInputArgument(const JsonObject& parameters, std::string pqparam, std::string & source, - std::string & pqmode, std::string & format) { + int AVOutputTV::parsingSetInputArgument(const JsonObject& parameters, std::string pqparam,capDetails_t& paramInfo) { JsonArray sourceArray; JsonArray pqmodeArray; @@ -445,39 +492,60 @@ namespace Plugin { pqmodeArray = parameters.HasLabel("pictureMode") ? parameters["pictureMode"].Array() : JsonArray(); for (int i = 0; i < pqmodeArray.Length(); ++i) { - pqmode += pqmodeArray[i].String(); + paramInfo.pqmode += pqmodeArray[i].String(); if (i != (pqmodeArray.Length() - 1) ) { - pqmode += ","; + paramInfo.pqmode += ","; } } sourceArray = parameters.HasLabel("videoSource") ? parameters["videoSource"].Array() : JsonArray(); for (int i = 0; i < sourceArray.Length(); ++i) { - source += sourceArray[i].String(); + paramInfo.source += sourceArray[i].String(); if (i != (sourceArray.Length() - 1) ) { - source += ","; - } + paramInfo.source += ","; + } } formatArray = parameters.HasLabel("videoFormat") ? parameters["videoFormat"].Array() : JsonArray(); for (int i = 0; i < formatArray.Length(); ++i) { - format += formatArray[i].String(); + paramInfo.format += formatArray[i].String(); if (i != (formatArray.Length() - 1) ) { - format += ","; + paramInfo.format += ","; } } - if (source.empty()) { - source = "Global"; - } - if (pqmode.empty()) { - pqmode = "Global"; - } - if (format.empty()) { - format = "Global"; - } + if (paramInfo.source.empty()) { + paramInfo.source = "Global"; + } + if (paramInfo.pqmode.empty()) { + paramInfo.pqmode = "Global"; + } + if (paramInfo.format.empty()) { + paramInfo.format = "Global"; + } - if (convertToValidInputParameter(pqparam, source, pqmode, format) != 0) { + if( pqparam.compare("WhiteBalance") == 0 ) + { + if ( paramInfo.color.empty() ) + paramInfo.color = "Global"; + + if ( paramInfo.control.empty() ) + paramInfo.control = "Global"; + + if ( paramInfo.colorTemperature.empty() ) + paramInfo.colorTemperature = "Global"; + } + + if( pqparam.compare("CMS") == 0 ) + { + if ( paramInfo.color.empty() ) + paramInfo.color = "Global"; + + if ( paramInfo.component.empty() ) + paramInfo.component = "Global"; + } + + if (convertToValidInputParameter(pqparam, paramInfo) != 0) { LOGERR("%s: Failed to convert the input paramters. \n", __FUNCTION__); return -1; } @@ -485,30 +553,30 @@ namespace Plugin { return 0; } - int AVOutputTV::parsingGetInputArgument(const JsonObject& parameters, std::string pqparam, - std::string & source, std::string & pqmode, std::string & format) { - pqmode = parameters.HasLabel("pictureMode") ? parameters["pictureMode"].String() : ""; + int AVOutputTV::parsingGetInputArgument(const JsonObject& parameters, std::string pqparam, capDetails_t& info) + { + info.pqmode = parameters.HasLabel("pictureMode") ? parameters["pictureMode"].String() : ""; - source = parameters.HasLabel("videoSource") ? parameters["videoSource"].String() : ""; + info.source = parameters.HasLabel("videoSource") ? parameters["videoSource"].String() : ""; - format = parameters.HasLabel("videoFormat") ? parameters["videoFormat"].String() : ""; + info.format = parameters.HasLabel("videoFormat") ? parameters["videoFormat"].String() : ""; - if ( (source.compare("Global") == 0) || (pqmode.compare("Global") == 0) || (format.compare("Global") == 0) ) { + if ( (info.source.compare("Global") == 0) || (info.pqmode.compare("Global") == 0) || (info.format.compare("Global") == 0) ) { LOGERR("%s: get cannot fetch the Global inputs \n", __FUNCTION__); return -1; } - if (source.empty()) { - source = "Current"; - } - if (pqmode.empty()) { - pqmode = "Current"; - } - if (format.empty()) { - format = "Current"; - } + if (info.source.empty()) { + info.source = "Current"; + } + if (info.pqmode.empty()) { + info.pqmode = "Current"; + } + if (info.format.empty()) { + info.format = "Current"; + } - if (convertToValidInputParameter(pqparam,source, pqmode, format) != 0) { + if (convertToValidInputParameter(pqparam,info) != 0) { LOGERR("%s: Failed to convert the input paramters. \n", __FUNCTION__); return -1; } @@ -541,13 +609,8 @@ namespace Plugin { int AVOutputTV::validateIntegerInputParameter(std::string param, int inputValue) { - - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; - - tvError_t ret = getParamsCaps(range, pqmode, source, format, param); + 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()); @@ -557,9 +620,9 @@ namespace Plugin { if ( (param == "Brightness") || (param == "Contrast") || (param == "Sharpness") || (param == "Saturation") || (param == "Hue") || (param == "WhiteBalance") || - (param == "ComponentSaturation") || (param == "Backlight") || - (param == "ComponentHue") || (param == "ComponentLuma") || (param == "LowLatencyState") ) { - if (inputValue < stoi(range[0]) || inputValue > stoi(range[1])) { + (param == "CMS") || (param == "Backlight") || + (param == "WhiteBalance") || (param == "LowLatencyState") ) { + if (inputValue < stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])) { LOGERR("wrong Input value[%d]", inputValue); return -1; } @@ -567,32 +630,45 @@ namespace Plugin { return 0; } - int AVOutputTV::fetchCapablities(string pqparam, string & source, string & pqmode, string & format) { + int AVOutputTV::fetchCapablities(string pqparam, capDetails_t& info) { - std::vector range; - std::vector sourceVec; - std::vector pqmodeVec; - std::vector formatVec; + capVectors_t vectorInfo; tvError_t ret = tvERROR_NONE; - ret = getParamsCaps(range, pqmodeVec, sourceVec, formatVec, pqparam); + ret = getParamsCaps(pqparam, vectorInfo); if (ret != tvERROR_NONE) { LOGINFO("%s: failed to get the capability \n", __FUNCTION__); return -1; } - if (sourceVec.size() != 0) { - source = convertToString(sourceVec); + if (vectorInfo.sourceVector.size() != 0) { + info.source = convertToString(vectorInfo.sourceVector); + } + + if (vectorInfo.pqmodeVector.size() != 0) { + info.pqmode = convertToString(vectorInfo.pqmodeVector); + } + + if (vectorInfo.formatVector.size() != 0) { + info.format = convertToString(vectorInfo.formatVector); + } + + if (vectorInfo.colorVector.size() != 0) { + info.color = convertToString(vectorInfo.colorVector); } - if (pqmodeVec.size() != 0) { - pqmode = convertToString(pqmodeVec); + if (vectorInfo.componentVector.size() != 0) { + info.component = convertToString(vectorInfo.componentVector); } - if (formatVec.size() != 0) { - format = convertToString(formatVec); + if (vectorInfo.controlVector.size() != 0) { + info.control = convertToString(vectorInfo.controlVector); + } + + if (vectorInfo.colorTempVector.size() != 0) { + info.colorTemperature = convertToString(vectorInfo.colorTempVector); } return 0; @@ -601,12 +677,9 @@ namespace Plugin { int AVOutputTV::validateInputParameter(std::string param, std::string inputValue) { - std::vector range; - std::vector pqmode; - std::vector source; - std::vector format; + capVectors_t info; - tvError_t ret = getParamsCaps(range, pqmode, source, format, param); + tvError_t ret = getParamsCaps( param, info); if (ret != tvERROR_NONE) { LOGERR("Failed to fetch the range capability[%s] \n", param.c_str()); @@ -614,12 +687,12 @@ namespace Plugin { } if ( (param == "ColorTemperature") || - (param == "DimmingMode") || (param == "AutoBacklightControl") || + (param == "DimmingMode") || (param == "AutoBacklightMode") || (param == "DolbyVisionMode") || (param == "HDR10Mode") || - (param == "HLGMode") || (param == "AspectRatio") || (param == "PictureMode") ) { - auto iter = find(range.begin(), range.end(), inputValue); + (param == "HLGMode") || (param == "AspectRatio") || (param == "PictureMode") ) { + auto iter = find(info.rangeVector.begin(), info.rangeVector.end(), inputValue); - if (iter == range.end()) { + if (iter == info.rangeVector.end()) { LOGERR("Not a valid input value[%s].\n", inputValue.c_str()); return -1; } @@ -708,49 +781,36 @@ namespace Plugin { return result; } - int AVOutputTV::convertToValidInputParameter(std::string pqparam, std::string & source, std::string & pqmode, std::string & format) + int AVOutputTV::convertToValidInputParameter(std::string pqparam, capDetails_t& info) { - LOGINFO("Entry %s source %s pqmode %s format %s \n", __FUNCTION__, source.c_str(), pqmode.c_str(), format.c_str()); + LOGINFO("Entry %s source %s pqmode %s format %s \n", __FUNCTION__, info.source.c_str(), info.pqmode.c_str(), info.format.c_str()); + capDetails_t localInfo; + if (fetchCapablities(pqparam, localInfo) != 0) { + LOGINFO("%s, Failed to get capability fo %s\n", __FUNCTION__,pqparam.c_str()); + return -1; + } + // converting pq to valid paramter format - if (pqmode == "Global") { - std::string localSource; - std::string localPqmode; - std::string localFormat; - if (fetchCapablities(pqparam, localSource, localPqmode, localFormat) == 0) { - pqmode = localPqmode; - //if pqmode none from capabilty then lets keep pqmode as global to fail the capabilty - } - else { - LOGINFO("%s, Failed to get picturemode capability\n", __FUNCTION__); - return -1; - } + if (info.pqmode == "Global") { + info.pqmode = localInfo.pqmode; } - else if (pqmode == "Current") { + else if (info.pqmode == "Current") { char picMode[PIC_MODE_NAME_MAX]={0}; if(!getCurrentPictureMode(picMode)) { LOGINFO("Failed to get the Current picture mode\n"); return -1; } else { - pqmode = picMode; + info.pqmode = picMode; } } - if (source == "Global") { - std::string localSource; - std::string localPqmode; - std::string localFormat; - if (fetchCapablities(pqparam, localSource, localPqmode, localFormat) == 0) { - source = localSource; - } - else { - LOGINFO("%s, Failed to get source capability\n", __FUNCTION__); - return -1; - } + if (info.source == "Global") { + info.source = localInfo.source; } - else if (source == "Current") { + else if (info.source == "Current") { tvVideoSrcType_t currentSource = VIDEO_SOURCE_IP; tvError_t ret = GetCurrentVideoSource(¤tSource); @@ -758,32 +818,60 @@ namespace Plugin { LOGWARN("%s: GetCurrentVideoSource( ) Failed \n",__FUNCTION__); return -1; } - source = convertSourceIndexToString(currentSource); + info.source = convertSourceIndexToString(currentSource); } //convert format into valid parameter - if (format == "Global") { - std::string localSource; - std::string localPqmode; - std::string localFormat; - if (fetchCapablities(pqparam, localSource, localPqmode, localFormat) == 0) { - format = localFormat; - } - else { - LOGINFO("%s, Failed to get format capability\n", __FUNCTION__); - return -1; - } + if (info.format == "Global") { + info.format = localInfo.format; } - else if (format == "Current") { + else if (info.format == "Current") { tvVideoFormatType_t formatIndex = VIDEO_FORMAT_NONE; GetCurrentVideoFormat(&formatIndex); if ( formatIndex == VIDEO_FORMAT_NONE) { formatIndex = VIDEO_FORMAT_SDR; - } - format = convertVideoFormatToString(formatIndex); + } + info.format = convertVideoFormatToString(formatIndex); + } + + //convert WB and CMS params + if( pqparam.compare("WhiteBalance") == 0 ) + { + if( info.control.compare("Global") == 0 ) + { + info.control = localInfo.control; + } + + if( info.color.compare("Global") == 0 ) + { + info.color = localInfo.color; + } + + if( info.colorTemperature.compare("Global") == 0 ) + { + info.colorTemperature= localInfo.colorTemperature; + } + + LOGINFO("%s : control : %s color : %s colorTemp : %s \n",__FUNCTION__,info.control.c_str(),info.color.c_str(),info.colorTemperature.c_str()); + } - LOGINFO("Exit %s source %s pqmode %s format %s \n", __FUNCTION__, source.c_str(), pqmode.c_str(), format.c_str()); + if( pqparam.compare("CMS") == 0 ) + { + if( info.component.compare("Global") == 0 ) + { + info.component = localInfo.component; + } + + if( info.color.compare("Global") == 0 ) + { + info.color = localInfo.color; + } + + LOGINFO("%s : component : %s color : %s \n",__FUNCTION__,info.component.c_str(),info.color.c_str()); + } + + LOGINFO("Exit %s source %s pqmode %s format %s \n", __FUNCTION__, info.source.c_str(), info.pqmode.c_str(), info.format.c_str()); return 0; } @@ -846,12 +934,18 @@ namespace Plugin { return ret; } - tvError_t AVOutputTV::updateAVoutputTVParamToHAL(std::string forParam, int source, int pqmode, int format, int value,bool setNotDelete) + tvError_t AVOutputTV::updateAVoutputTVParamToHAL(std::string forParam, paramIndex_t indexInfo, int value,bool setNotDelete) { tvError_t ret = tvERROR_NONE; std::string key; - generateStorageIdentifier(key,forParam,format,pqmode,source); + if( forParam.compare("CMS") == 0 ) + generateStorageIdentifierCMS(key,forParam,indexInfo); + else if( forParam.compare("WhiteBalance") == 0 ) + generateStorageIdentifierWB(key,forParam,indexInfo); + else + generateStorageIdentifier(key,forParam,indexInfo); + if(key.empty()) { LOGERR("generateStorageIdentifierDirty failed\n"); ret = tvERROR_GENERAL; @@ -866,7 +960,7 @@ namespace Plugin { else if(forParam.compare("DimmingMode") == 0 ) { getDimmingModeStringFromEnum(value, toStore); } - else if (forParam.compare("DolbyVisionMode") == 0 ) { + else if (forParam.compare("DolbyVisionMode") == 0 || forParam.compare("HDRMode") == 0 ) { toStore = getDolbyModeStringFromEnum((tvDolbyMode_t)value); } err = setLocalParam(rfc_caller_id, key.c_str(),toStore.c_str()); @@ -884,9 +978,11 @@ namespace Plugin { return ret; } - int AVOutputTV::updateAVoutputTVParam( std::string action, std::string tr181ParamName, std::string pqmode, std::string source, std::string format, tvPQParameterIndex_t pqParamIndex, int params[] ) + int AVOutputTV::updateAVoutputTVParam( std::string action, std::string tr181ParamName, capDetails_t info, tvPQParameterIndex_t pqParamIndex, int level ) { LOGINFO("Entry : %s\n",__FUNCTION__); + valueVectors_t values; + paramIndex_t paramIndex; std::vector sources; std::vector pictureModes; std::vector formats; @@ -895,14 +991,15 @@ namespace Plugin { bool reset = !(action.compare("reset")); bool set = !(action.compare("set")); - LOGINFO("%s: Entry param : %s Action : %s pqmode : %s source :%s format :%s\n",__FUNCTION__,tr181ParamName.c_str(),action.c_str(),pqmode.c_str(),source.c_str(),format.c_str() ); - ret = getSaveConfig(pqmode, source, format, sources, pictureModes, formats); + LOGINFO("%s: Entry param : %s Action : %s pqmode : %s source :%s format :%s color:%s component:%s control:%s\n",__FUNCTION__,tr181ParamName.c_str(),action.c_str(),info.pqmode.c_str(),info.source.c_str(),info.format.c_str(),info.color.c_str(),info.component.c_str(),info.control.c_str() ); + ret = getSaveConfig(tr181ParamName,info, values); if( 0 == ret ) { - for(int sourceType: sources) { - tvVideoSrcType_t source = (tvVideoSrcType_t)sourceType; - for(int mode : pictureModes) { - for(int formatType : formats) { - tvVideoFormatType_t format = (tvVideoFormatType_t)formatType; + for( int sourceType: values.sourceValues ) { + paramIndex.sourceIndex = sourceType; + for( int modeType : values.pqmodeValues ) { + paramIndex.pqmodeIndex = modeType; + for( int formatType : values.formatValues ) { + paramIndex.formatIndex = formatType; switch(pqParamIndex) { case PQ_PARAM_BRIGHTNESS: case PQ_PARAM_CONTRAST: @@ -915,17 +1012,17 @@ namespace Plugin { case PQ_PARAM_LOWLATENCY_STATE: case PQ_PARAM_DOLBY_MODE: if(reset) { - ret |= updateAVoutputTVParamToHAL(tr181ParamName,source, mode, format,0,false); - } + ret |= updateAVoutputTVParamToHAL(tr181ParamName,paramIndex,0,false); + } if(sync || reset) { int value=0; - if(getLocalparam(tr181ParamName,format,mode,source,value,pqParamIndex,sync)) { - continue; - } - params[0]=value; + if(getLocalparam(tr181ParamName,paramIndex,value,pqParamIndex,sync)) { + continue; + } + level=value; } if(set) { - ret |= updateAVoutputTVParamToHAL(tr181ParamName,source, mode, format, params[0],true); + ret |= updateAVoutputTVParamToHAL(tr181ParamName,paramIndex,level,true); } break; default: @@ -933,53 +1030,144 @@ namespace Plugin { } switch(pqParamIndex) { case PQ_PARAM_BRIGHTNESS: - ret |= SaveBrightness(source, mode,format,params[0]); + ret |= SaveBrightness((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,level); break; case PQ_PARAM_CONTRAST: - ret |= SaveContrast(source, mode,format,params[0]); + ret |= SaveContrast((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,level); break; case PQ_PARAM_SHARPNESS: - ret |= SaveSharpness(source, mode,format,params[0]); + ret |= SaveSharpness((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,level); break; case PQ_PARAM_HUE: - ret |= SaveHue(source, mode,format,params[0]); + ret |= SaveHue((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,level); break; case PQ_PARAM_SATURATION: - ret |= SaveSaturation(source, mode,format,params[0]); + ret |= SaveSaturation((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,level); break; case PQ_PARAM_COLOR_TEMPERATURE: - ret |= SaveColorTemperature(source, mode,format,(tvColorTemp_t)params[0]); + ret |= SaveColorTemperature((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvColorTemp_t)level); break; case PQ_PARAM_BACKLIGHT: - ret |= SaveBacklight(source, mode,format,params[0]); + ret |= SaveBacklight((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,level); break; case PQ_PARAM_DIMMINGMODE: - ret |= SaveTVDimmingMode(source,mode,format,(tvDimmingMode_t)params[0]); + ret |= SaveTVDimmingMode((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvDimmingMode_t)level); break; case PQ_PARAM_LOWLATENCY_STATE: - ret |= SaveLowLatencyState(source, mode,format,params[0]); + ret |= SaveLowLatencyState((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,level); break; case PQ_PARAM_DOLBY_MODE: - ret |= SaveTVDolbyVisionMode(source, mode,format,(tvDolbyMode_t)params[0]); + ret |= SaveTVDolbyVisionMode((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvDolbyMode_t)level); break; - case PQ_PARAM_ASPECT_RATIO: - ret |= SaveAspectRatio(source,mode,format,(tvDisplayMode_t)params[0]); + case PQ_PARAM_ASPECT_RATIO: + ret |= SaveAspectRatio((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvDisplayMode_t)level); break; - case PQ_PARAM_LOCALDIMMING_LEVEL: + + case PQ_PARAM_CMS_SATURATION_RED: + case PQ_PARAM_CMS_SATURATION_BLUE: + case PQ_PARAM_CMS_SATURATION_GREEN: + case PQ_PARAM_CMS_SATURATION_YELLOW: + case PQ_PARAM_CMS_SATURATION_CYAN: + case PQ_PARAM_CMS_SATURATION_MAGENTA: + case PQ_PARAM_CMS_HUE_RED: + case PQ_PARAM_CMS_HUE_BLUE: + case PQ_PARAM_CMS_HUE_GREEN: + case PQ_PARAM_CMS_HUE_YELLOW: + case PQ_PARAM_CMS_HUE_CYAN: + case PQ_PARAM_CMS_HUE_MAGENTA: + case PQ_PARAM_CMS_LUMA_RED: + case PQ_PARAM_CMS_LUMA_BLUE: + case PQ_PARAM_CMS_LUMA_GREEN: + case PQ_PARAM_CMS_LUMA_YELLOW: + case PQ_PARAM_CMS_LUMA_CYAN: + case PQ_PARAM_CMS_LUMA_MAGENTA: + { + for( int componentType : values.componentValues ) { + paramIndex.componentIndex = componentType; + for( int colorType : values.colorValues ) { + paramIndex.colorIndex = colorType; + if(reset) { + ret |= updateAVoutputTVParamToHAL(tr181ParamName,paramIndex,0,false); + } + if(sync || reset) { + int value=0; + tvPQParameterIndex_t pqIndex; + if ( convertCMSParamToPQEnum(getCMSComponentStringFromEnum((tvComponentType_t)paramIndex.componentIndex),getCMSColorStringFromEnum((tvDataComponentColor_t)paramIndex.colorIndex),pqIndex) != 0 ) + { + LOGERR("%s:convertCMSParamToPQEnum failed color : %d component : %d \n",__FUNCTION__,paramIndex.colorIndex,paramIndex.componentIndex); + return -1; + } + if(getLocalparam(tr181ParamName,paramIndex,value,pqIndex,sync)) { + continue; + } + else { + if(sync) + ret |= SaveCMS((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,COMP_NONE,tvDataColor_NONE,COMPONENT_ENABLE); + else + ret |= SaveCMS((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,COMP_NONE,tvDataColor_NONE,COMPONENT_DISABLE); + } + level=value; + } + ret |= SaveCMS((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvComponentType_t)paramIndex.componentIndex,(tvDataComponentColor_t)paramIndex.colorIndex,level); + + if(set) { + ret |= updateAVoutputTVParamToHAL(tr181ParamName,paramIndex,level,true); + } + } + } + break; + } + case PQ_PARAM_WB_GAIN_RED: + case PQ_PARAM_WB_GAIN_GREEN: + case PQ_PARAM_WB_GAIN_BLUE: + case PQ_PARAM_WB_OFFSET_RED: + case PQ_PARAM_WB_OFFSET_GREEN: + case PQ_PARAM_WB_OFFSET_BLUE: + { + for( int colorType : values.colorValues ) { + paramIndex.colorIndex = colorType; + for( int controlType : values.controlValues ) { + paramIndex.controlIndex = controlType; + if(reset) { + ret |= updateAVoutputTVParamToHAL(tr181ParamName,paramIndex,0,false); + } + if(sync || reset) { + int value=0; + if(getLocalparam(tr181ParamName,paramIndex,value,pqParamIndex,sync)) { + continue; + } + level=value; + } + /* tvRGBType_t rgbIndex; + if ( convertWBParamToRGBEnum(getWBColorStringFromEnum((tvWBColor_t)(paramIndex.colorIndex)),getWBControlStringFromEnum((tvWBControl_t)(paramIndex.controlIndex)),rgbIndex) != 0 ) + { + LOGERR("%s:convertWBParamToRGBEnum failed Color : %d Control : %d \n",__FUNCTION__,paramIndex.colorIndex,paramIndex.controlIndex); + return -1; + }*/ + ret |= SaveCustom2PointWhiteBalance((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvWBColor_t)paramIndex.colorIndex,(tvWBControl_t)paramIndex.controlIndex,level); + + if(set) { + ret |= updateAVoutputTVParamToHAL(tr181ParamName,paramIndex,level,true); + } + } + } + break; + } + case PQ_PARAM_LOCALDIMMING_LEVEL: { - if(sync) { - int value=0; - getLocalparam(tr181ParamName,format,mode,source,value,pqParamIndex,sync); - params[0]=value; - } - ret |= SaveTVDimmingMode(source, mode,format,(tvDimmingMode_t)params[0]); - break; - } - case PQ_PARAM_CMS: - case PQ_PARAM_LDIM: - default: - break; + if(sync) { + int value=0; + getLocalparam(tr181ParamName,paramIndex,value,pqParamIndex,sync); + level=value; + } + ret |= SaveTVDimmingMode((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvDimmingMode_t)level); + break; + } + case PQ_PARAM_CMS: + case PQ_PARAM_LDIM: + default: + break; } } } @@ -991,72 +1179,88 @@ namespace Plugin { tvError_t AVOutputTV::syncAvoutputTVParamsToHAL(std::string pqmode,std::string source,std::string format) { - int params[3]={0}; + int level={0}; + capDetails_t info; + info.pqmode = pqmode; + info.source = source; + info.format = format; LOGINFO("Entry %s : pqmode : %s source : %s format : %s\n",__FUNCTION__,pqmode.c_str(),source.c_str(),format.c_str()); - if( !updateAVoutputTVParam("sync","Brightness",pqmode,source,format,PQ_PARAM_BRIGHTNESS,params)) { + if( !updateAVoutputTVParam("sync","Brightness",info,PQ_PARAM_BRIGHTNESS,level)) { LOGINFO("Brightness Successfully sync to Drive Cache\n"); - } + } else { LOGERR("Brightness Sync to cache Failed !!!\n"); - } + } - if( !updateAVoutputTVParam("sync","Contrast",pqmode,source,format,PQ_PARAM_CONTRAST,params)) { + if( !updateAVoutputTVParam("sync","Contrast",info,PQ_PARAM_CONTRAST,level)) { LOGINFO("Contrast Successfully Synced to Drive Cache\n"); - } + } else { LOGERR("Contrast Sync to cache Failed !!!\n"); - } + } - if( !updateAVoutputTVParam("sync","Sharpness",pqmode,source,format,PQ_PARAM_SHARPNESS,params)) { + if( !updateAVoutputTVParam("sync","Sharpness",info,PQ_PARAM_SHARPNESS,level)) { LOGINFO("Sharpness Successfully Synced to Drive Cache\n"); - } + } else { LOGERR("Sharpness Sync to cache Failed !!!\n"); - } + } - if( !updateAVoutputTVParam("sync","Saturation",pqmode,source,format,PQ_PARAM_SATURATION,params)) { + if( !updateAVoutputTVParam("sync","Saturation",info,PQ_PARAM_SATURATION,level)) { LOGINFO("Saturation Successfully Synced to Drive Cache\n"); - } + } else { LOGERR("Saturation Sync to cache Failed !!!\n"); - } + } - if( !updateAVoutputTVParam("sync","Hue",pqmode,source,format,PQ_PARAM_HUE,params)) { + if( !updateAVoutputTVParam("sync","Hue",info,PQ_PARAM_HUE,level)) { LOGINFO("Hue Successfully Synced to Drive Cache\n"); - } + } else { LOGERR("Hue Sync to cache Failed !!!\n"); - } + } - if( !updateAVoutputTVParam("sync","ColorTemp",pqmode,source,format,PQ_PARAM_COLOR_TEMPERATURE,params)) { + if( !updateAVoutputTVParam("sync","ColorTemp",info,PQ_PARAM_COLOR_TEMPERATURE,level)) { LOGINFO("ColorTemp Successfully Synced to Drive Cache\n"); - } + } else { LOGERR("ColorTemp Sync to cache Failed !!!\n"); } - - if( !updateAVoutputTVParam("sync","DolbyVisionMode",pqmode,source,"DV",PQ_PARAM_DOLBY_MODE,params)) { - LOGINFO("dvmode Successfully Synced to Drive Cache\n"); - } + if( !updateAVoutputTVParam("sync","HDRMode",info,PQ_PARAM_DOLBY_MODE,level)) { + LOGINFO("HDRmode Successfully Synced to Drive Cache\n"); + } else { - LOGERR("dvmode Sync to cache Failed !!!\n"); - } + LOGERR("HDRmode Sync to cache Failed !!!\n"); + } - if( !updateAVoutputTVParam("sync","DimmingMode",pqmode,source,format,PQ_PARAM_DIMMINGMODE,params)) { + if( !updateAVoutputTVParam("sync","DimmingMode",info,PQ_PARAM_DIMMINGMODE,level)) { LOGINFO("dimmingmode Successfully Synced to Drive Cache\n"); - } + } else { LOGERR("dimmingmode Sync to cache Failed !!!\n"); - } + } - if( !updateAVoutputTVParam("sync","Backlight",pqmode,source,format,PQ_PARAM_BACKLIGHT,params) ) { + if( !updateAVoutputTVParam("sync","Backlight",info,PQ_PARAM_BACKLIGHT,level) ) { LOGINFO("Backlight Successfully Synced to Drive Cache\n"); - } + } else { LOGERR("Backlight Sync to cache Failed !!!\n"); - } + } + + syncCMSParams(); //sync CMS + + syncWBParams(); + + info.format = "DV";//Sync only for Dolby + + if( !updateAVoutputTVParam("sync","DolbyVisionMode",info,PQ_PARAM_DOLBY_MODE,level)) { + LOGINFO("dvmode Successfully Synced to Drive Cache\n"); + } + else { + LOGERR("dvmode Sync to cache Failed !!!\n"); + } LOGINFO("Exit %s : pqmode : %s source : %s format : %s\n",__FUNCTION__,pqmode.c_str(),source.c_str(),format.c_str()); return tvERROR_NONE; @@ -1064,19 +1268,22 @@ namespace Plugin { int AVOutputTV::syncAvoutputTVPQModeParamsToHAL(std::string pqmode, std::string source, std::string format) { - std::vector sources; - std::vector pictureModes; - std::vector formats; + capDetails_t inputInfo; + valueVectors_t valueVectors; tr181ErrorCode_t err = tr181Success; TR181_ParamData_t param = {0}; int ret = 0; - ret = getSaveConfig(pqmode, source, format, sources, pictureModes, formats); + inputInfo.pqmode = pqmode; + inputInfo.source = source; + inputInfo.format = format; + + ret = getSaveConfig("PictureMode", inputInfo, valueVectors); if (ret == 0 ) { - for (int source : sources) { + for (int source : valueVectors.sourceValues ) { tvVideoSrcType_t sourceType = (tvVideoSrcType_t)source; - for (int format : formats) { + for (int format : valueVectors.formatValues ) { tvVideoFormatType_t formatType = (tvVideoFormatType_t)format; std::string tr181_param_name = ""; tr181_param_name += std::string(AVOUTPUT_SOURCE_PICTUREMODE_STRING_RFC_PARAM); @@ -1104,13 +1311,29 @@ namespace Plugin { return ret; } - uint32_t AVOutputTV::generateStorageIdentifier(std::string &key, std::string forParam,int contentFormat, int pqmode, int source) + uint32_t AVOutputTV::generateStorageIdentifier(std::string &key, std::string forParam, paramIndex_t info) + { + key+=std::string(AVOUTPUT_GENERIC_STRING_RFC_PARAM); + key+=STRING_SOURCE+convertSourceIndexToString(info.sourceIndex)+std::string(".")+STRING_PICMODE+convertPictureIndexToString(info.pqmodeIndex)+std::string(".")+std::string(STRING_FORMAT)+convertVideoFormatToString(info.formatIndex)+std::string(".")+forParam; + return tvERROR_NONE; + } + + uint32_t AVOutputTV::generateStorageIdentifierCMS(std::string &key, std::string forParam, paramIndex_t info) { key+=std::string(AVOUTPUT_GENERIC_STRING_RFC_PARAM); - key+=STRING_SOURCE+convertSourceIndexToString(source)+std::string(".")+STRING_PICMODE+convertPictureIndexToString(pqmode)+std::string(".")+std::string(STRING_FORMAT)+convertVideoFormatToString(contentFormat)+std::string(".")+forParam; + key+=STRING_SOURCE+convertSourceIndexToString(info.sourceIndex)+std::string(".")+STRING_PICMODE+convertPictureIndexToString(info.pqmodeIndex)+std::string(".")+std::string(STRING_FORMAT)+convertVideoFormatToString(info.formatIndex)+std::string(".")+STRING_COLOR+getCMSColorStringFromEnum((tvDataComponentColor_t)info.colorIndex)+std::string(".")+STRING_COMPONENT+getCMSComponentStringFromEnum((tvComponentType_t)info.componentIndex)+std::string(".")+forParam; return tvERROR_NONE; } + uint32_t AVOutputTV::generateStorageIdentifierWB(std::string &key, std::string forParam, paramIndex_t info) + { + key+=std::string(AVOUTPUT_GENERIC_STRING_RFC_PARAM); + key+=STRING_SOURCE+convertSourceIndexToString(info.sourceIndex)+std::string(".")+STRING_PICMODE+convertPictureIndexToString(info.pqmodeIndex)+std::string(".")+std::string(STRING_FORMAT)+convertVideoFormatToString(info.formatIndex)+std::string(".")+STRING_COLOR+getWBColorStringFromEnum((tvWBColor_t)info.colorIndex)+std::string(".")+STRING_CONTROL+getWBControlStringFromEnum((tvWBControl_t)info.controlIndex)+std::string(".")+forParam; + return tvERROR_NONE; + } + + + uint32_t AVOutputTV::generateStorageIdentifierDirty(std::string &key, std::string forParam,uint32_t contentFormat, int pqmode) { key+=std::string(AVOUTPUT_GENERIC_STRING_RFC_PARAM); @@ -1137,48 +1360,128 @@ namespace Plugin { return "UNKNOWN ERROR"; } - int AVOutputTV::getSaveConfig(std::string pqmode, std::string source, std::string format,std::vector &sources,std::vector &picturemodes, std::vector &formats) + int AVOutputTV::getSaveConfig(std::string param, capDetails_t capInfo, valueVectors_t &values) { - LOGINFO("Entry : %s pqmode : %s source :%s format :%s\n",__FUNCTION__,pqmode.c_str(),source.c_str(),format.c_str()); + LOGINFO("Entry : %s pqmode : %s source :%s format :%s component : %s color : %s control:%s\n",__FUNCTION__,capInfo.pqmode.c_str(),capInfo.source.c_str(),capInfo.format.c_str(),capInfo.component.c_str(),capInfo.color.c_str(),capInfo.control.c_str()); int ret = 0; - if (getAvailableCapabilityModes(source, pqmode, format) != 0) { + if (getAvailableCapabilityModes(capInfo) != 0) { LOGERR("%s: failed to get picture/source/format mode capability \n", __FUNCTION__); return -1; } //pqmode - char *modeString = strdup(pqmode.c_str()); + char *modeString = strdup(capInfo.pqmode.c_str()); char *token = NULL; while ((token = strtok_r(modeString,",",&modeString))) { std::string local = token; - picturemodes.push_back(getPictureModeIndex(local)); + values.pqmodeValues.push_back(getPictureModeIndex(local)); } //source - char *sourceString = strdup(source.c_str()); + char *sourceString = strdup(capInfo.source.c_str()); char *sourceToken = NULL; while ((sourceToken = strtok_r(sourceString,",",&sourceString))) { std::string local = sourceToken; - sources.push_back(getSourceIndex(local)); + if( local == "All") continue; + values.sourceValues.push_back(getSourceIndex(local)); } //3)check format - char *formatString = strdup(format.c_str()); + char *formatString = strdup(capInfo.format.c_str()); char *formatToken = NULL; while ((formatToken = strtok_r(formatString,",",&formatString))) { std::string local = formatToken; - formats.push_back(getFormatIndex(local)); + values.formatValues.push_back(getFormatIndex(local)); } - LOGINFO("Exit : %s pqmode : %s source :%s format :%s ret:%d\n",__FUNCTION__,pqmode.c_str(),source.c_str(),format.c_str(), ret); + if( param.compare("CMS") == 0 ) + { + //Check Color + char *colorString = strdup(capInfo.color.c_str()); + char *colorToken = NULL; + while ((colorToken = strtok_r(colorString,",",&colorString))) { + std::string local = colorToken; + tvDataComponentColor_t level = tvDataColor_NONE; + if ( getCMSColorEnumFromString(local,level ) == -1 ) { + LOGERR("%s : GetColorEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + values.colorValues.push_back(level); + } + + //Check Component + char *componentString = strdup(capInfo.component.c_str()); + char *componentToken = NULL; + while ((componentToken = strtok_r(componentString,",",&componentString))) { + std::string local = componentToken; + tvComponentType_t level; + if ( getCMSComponentEnumFromString(local,level ) == -1 ) { + LOGERR("%s : GetComponentEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + values.componentValues.push_back(level); + } + } + + if( param.compare("WhiteBalance") == 0 ) + { + //Check Color + char *colorString = strdup(capInfo.color.c_str()); + char *colorToken = NULL; + while ((colorToken = strtok_r(colorString,",",&colorString))) { + std::string local = colorToken; + tvWBColor_t level=tvWB_COLOR_RED; + if ( getWBColorEnumFromString(local,level ) == -1 ) { + LOGERR("%s : GetWBColorEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + values.colorValues.push_back(level); + } + + //Check Control + char *controlString = strdup(capInfo.control.c_str()); + char *controlToken = NULL; + while ((controlToken = strtok_r(controlString,",",&controlString))) { + std::string local = controlToken; + tvWBControl_t level=tvWB_CONTROL_GAIN;; + if ( getWBControlEnumFromString(local,level ) == -1 ) { + LOGERR("%s : GetWBControlEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + values.controlValues.push_back(level); + } + + /* + //Check Color Temp + char *colorTempString = strdup(capInfo.colorTemperature.c_str()); + char *colorTempToken = NULL; + while ((colorTempToken = strtok_r(colorTempString,",",&colorTempString))) { + std::string local = colorTempToken; + tvColorTemp_t level; + if ( getColorTempEnumFromString(local,level ) == -1 ) { + LOGERR("%s : GetColorTempEnumFromString Failed!!! ",__FUNCTION__); + return -1; + } + values.colorTempValues.push_back(level); + }*/ + } + + LOGINFO("Exit : %s pqmode : %s source :%s format :%s ret:%d\n",__FUNCTION__,capInfo.pqmode.c_str(),capInfo.source.c_str(),capInfo.format.c_str(), ret); return ret; } - int AVOutputTV::getLocalparam( std::string forParam,int formatIndex,int pqIndex,int sourceIndex,int & value, - tvPQParameterIndex_t pqParamIndex,bool sync,int color ) + int AVOutputTV::getLocalparam( std::string forParam,paramIndex_t indexInfo,int & value,tvPQParameterIndex_t pqParamIndex,bool sync) { string key; TR181_ParamData_t param={0}; - generateStorageIdentifier(key,forParam,formatIndex,pqIndex,sourceIndex); + + if( forParam.compare("CMS") == 0 ) { + generateStorageIdentifierCMS(key,forParam,indexInfo); + } else if( forParam.compare("WhiteBalance") == 0 ) { + generateStorageIdentifierWB(key,forParam,indexInfo); + } else { + generateStorageIdentifier(key,forParam,indexInfo); + } + if(key.empty()) { LOGERR("generateStorageIdentifier failed\n"); return -1; @@ -1190,31 +1493,31 @@ namespace Plugin { if( forParam.compare("ColorTemp") == 0 ) { if (strncmp(param.value, "Standard", strlen(param.value))==0) { value=tvColorTemp_STANDARD; - } + } else if (strncmp(param.value, "Warm", strlen(param.value))==0) { value=tvColorTemp_WARM; - } + } else if (strncmp(param.value, "Cold", strlen(param.value))==0) { value=tvColorTemp_COLD; - } - else if (strncmp(param.value, "User Defined", strlen(param.value))==0) { + } + else if (strncmp(param.value, "UserDefined", strlen(param.value))==0) { value=tvColorTemp_USER; - } + } else { value=tvColorTemp_STANDARD; - } + } return 0; - } + } else if( forParam.compare("DimmingMode") == 0 ) { if (strncmp(param.value, "fixed", strlen(param.value))==0) { value=tvDimmingMode_Fixed; - } + } else if (strncmp(param.value, "local", strlen(param.value))==0) { value=tvDimmingMode_Local; - } + } else if (strncmp(param.value, "global", strlen(param.value))==0) { value=tvDimmingMode_Global; - } + } return 0; } else if ( forParam.compare("DolbyVisionMode") == 0) { @@ -1228,17 +1531,41 @@ namespace Plugin { value = tvDolbyMode_Bright; } return 0; + } + else if ( forParam.compare("HDRMode") == 0) { + if (strncmp(param.value, "Dark", strlen(param.value)) == 0 && key.find("DV") != std::string::npos ) { + value = tvDolbyMode_Dark; + } + else if(strncmp(param.value, "Bright", strlen(param.value)) == 0 && key.find("DV") != std::string::npos ) { + value = tvDolbyMode_Game; + } + else if(strncmp(param.value, "Dark", strlen(param.value)) == 0 && key.find("HDR10") != std::string::npos ) { + value = tvHDR10Mode_Dark; + } + else if(strncmp(param.value, "Bright", strlen(param.value)) == 0 && key.find("HDR10") != std::string::npos ) { + value = tvHDR10Mode_Bright; + } + else if(strncmp(param.value, "Dark", strlen(param.value)) == 0 && key.find("HLG") != std::string::npos ) { + value = tvHLGMode_Dark; + } + else if(strncmp(param.value, "Bright", strlen(param.value)) == 0 && key.find("HLG") != std::string::npos ) { + value = tvHLGMode_Bright; + } + else { + value = tvDolbyMode_Game; + } + return 0; } else { value=std::stoi(param.value); - return 0; + return 0; } } else {// default value from DB if( sync ) { return 1; } - GetDefaultPQParams(pqIndex,(tvVideoSrcType_t)sourceIndex,(tvVideoFormatType_t)formatIndex,pqParamIndex,&value); + GetDefaultPQParams(indexInfo.pqmodeIndex,(tvVideoSrcType_t)indexInfo.sourceIndex,(tvVideoFormatType_t)indexInfo.formatIndex,pqParamIndex,&value); LOGINFO("Default value from DB : %s : %d \n",key.c_str(),value); return 0; } @@ -1272,102 +1599,20 @@ namespace Plugin { return CompColorEnum; } - int AVOutputTV::getDolbyParams(tvContentFormatType_t format, std::string &s, std::string source) - { - int ret = -1; - TR181_ParamData_t param; - std::string rfc_param = AVOUTPUT_HDR10MODE_RFC_PARAM; - int dolby_mode_value = 0; - tvVideoSrcType_t sourceIndex = VIDEO_SOURCE_IP; - /*Since dolby vision is source specific, we should for check for specific source*/ - if (!source.empty()) { - sourceIndex = (tvVideoSrcType_t)getSourceIndex(source); - } - else { - GetCurrentVideoSource(&sourceIndex); - } - - char picMode[PIC_MODE_NAME_MAX]={0}; - int pqmodeIndex = 0; - if(!getCurrentPictureMode(picMode)) { - LOGERR("Failed to get the Current picture mode\n"); - } - else { - std::string local = picMode; - pqmodeIndex = getPictureModeIndex(local); - } - memset(¶m, 0, sizeof(param)); - if (format == tvContentFormatType_HLG ) { - rfc_param = AVOUTPUT_HLGMODE_RFC_PARAM; - } - else if (format == tvContentFormatType_DOVI) { - rfc_param = AVOUTPUT_SOURCE_PICTUREMODE_STRING_RFC_PARAM + std::to_string(sourceIndex) + "."+"DolbyVisionMode"; - } - - tr181ErrorCode_t err = getLocalParam(rfc_caller_id, rfc_param.c_str(), ¶m); - if ( tr181Success != err) { - tvError_t retVal = GetDefaultPQParams(pqmodeIndex,(tvVideoSrcType_t)sourceIndex, - (tvVideoFormatType_t)ConvertHDRFormatToContentFormat((tvhdr_type_t)format), - PQ_PARAM_DOLBY_MODE,&dolby_mode_value); - if( retVal != tvERROR_NONE ) { - LOGERR("%s : failed\n",__FUNCTION__); - return ret; - } - s = getDolbyModeStringFromEnum((tvDolbyMode_t)dolby_mode_value); - ret = 0; - } - else { - s += param.value; - ret = 0; - } - return ret; - } - - tvError_t AVOutputTV::getParamsCaps(std::vector &range - , std::vector &pqmode, std::vector &source, std::vector &format,std::string param ) - { - tvError_t ret = tvERROR_NONE; - - std::string rangeInfo; - std::string sourceInfo; - std::string formatInfo; - std::string pqmodeInfo; - - std::string platformsupport; - std::string indexInfo; - std::vector localIndex; - - if( ReadCapablitiesFromConf( rangeInfo, pqmodeInfo, formatInfo ,sourceInfo,param, platformsupport, indexInfo)) { - LOGERR( "%s: ReadCapablitiesFromConf Failed !!!\n",__FUNCTION__); - return tvERROR_GENERAL; - } - else { - spliltCapablities( range, pqmode, format, source, localIndex,rangeInfo, pqmodeInfo, formatInfo, sourceInfo , indexInfo); - } - - return ret; - } - - tvError_t AVOutputTV::getParamsCaps(std::vector &range - , std::vector &pqmode, std::vector &source, std::vector &format,std::string param, - std::string & isPlatformSupport, std::vector & index) + tvError_t AVOutputTV::getParamsCaps(std::string param, capVectors_t &vecInfo) { tvError_t ret = tvERROR_NONE; - - std::string rangeInfo; - std::string sourceInfo; - std::string formatInfo; - std::string pqmodeInfo; - std::string indexInfo; - - if( ReadCapablitiesFromConf( rangeInfo, pqmodeInfo, formatInfo ,sourceInfo,param, isPlatformSupport, indexInfo)) { + capDetails_t stringInfo; + + if( ReadCapablitiesFromConf( param, stringInfo) != 0 ) + { LOGERR( "%s: ReadCapablitiesFromConf Failed !!!\n",__FUNCTION__); return tvERROR_GENERAL; } - else { - spliltCapablities( range, pqmode, format, source, index,rangeInfo, pqmodeInfo, formatInfo, sourceInfo, indexInfo); + else + { + spliltCapablities( vecInfo, stringInfo); } - return ret; } @@ -1430,60 +1675,6 @@ namespace Plugin { return ret; } - - int AVOutputTV::ReadCapablitiesFromConf(std::string &rangeInfo,std::string &pqmodeInfo,std::string &formatInfo,std::string &sourceInfo, - std::string param, std::string & isPlatformSupport, std::string & indexInfo) - { - int ret = 0; - - try { - CIniFile inFile(CAPABLITY_FILE_NAME); - std::string configString; - if ((param == "DolbyVisionMode") || (param == "Backlight") ) { - configString = param + ".platformsupport"; - isPlatformSupport = inFile.Get(configString); - printf(" platfromsupport : %s\n",isPlatformSupport.c_str() ); - } - - if ( (param == "ColorTemperature") || (param == "DimmingMode") || - ( param == "AutoBacklightControl") || (param == "DolbyVisionMode") || - (param == "HDR10Mode") || (param == "HLGMode") || (param == "AspectRatio") || - (param == "PictureMode") || (param == "VideoSource") || (param == "VideoFormat") || - (param == "VideoFrameRate") ) { - configString = param + ".range"; - rangeInfo = inFile.Get(configString); - printf(" String Range info : %s\n",rangeInfo.c_str() ); - } else { - configString = param + ".range_from"; - rangeInfo = inFile.Get(configString); - configString = param + ".range_to"; - rangeInfo += ","+inFile.Get(configString); - printf(" Integer Range Info : %s\n",rangeInfo.c_str() ); - } - - if ((param == "VideoSource") || (param == "PictureMode") || (param == "VideoFormat") ) { - configString.clear(); - configString = param + ".index"; - indexInfo = inFile.Get(configString); - printf("Index value %s\n", indexInfo.c_str()); - } - - configString.clear(); - configString = param + ".pqmode"; - pqmodeInfo = inFile.Get(configString); - configString = param + ".format"; - formatInfo = inFile.Get(configString); - configString = param + ".source"; - sourceInfo = inFile.Get(configString); - ret = 0; - } - catch(const boost::property_tree::ptree_error &e) { - printf("%s: error %s::config table entry not found in ini file\n",__FUNCTION__,e.what()); - ret = -1; - } - return ret; - } - void AVOutputTV::getDimmingModeStringFromEnum(int value, std::string &toStore) { const char *color_temp_string[] = { @@ -1501,7 +1692,7 @@ namespace Plugin { [tvColorTemp_STANDARD] = "Standard", [tvColorTemp_WARM] = "Warm", [tvColorTemp_COLD] = "Cold", - [tvColorTemp_USER] = "User Defined" + [tvColorTemp_USER] = "UserDefined" }; toStore.clear(); toStore+=color_temp_string[value]; @@ -1538,44 +1729,11 @@ namespace Plugin { return 1; } else { - LOGERR("getLocalParam failed"); + LOGERR("getLocalParam failed %s\n",tr181_param_name.c_str()); return 0; } } - - int AVOutputTV::getDolbyParamToSync(int sourceIndex, int formatIndex, int& value) - { - int ret=0; - TR181_ParamData_t param; - int pqmodeIndex = 0; - char picMode[PIC_MODE_NAME_MAX]={0}; - if(!getCurrentPictureMode(picMode)) { - LOGERR("Failed to get the Current picture mode\n"); - } - else { - std::string local = picMode; - pqmodeIndex = getPictureModeIndex(local); - } - std ::string rfc_param = AVOUTPUT_SOURCE_PICTUREMODE_STRING_RFC_PARAM + std::to_string(sourceIndex) + "."+"DolbyVisionMode"; - memset(¶m, 0, sizeof(param)); - tr181ErrorCode_t err = getLocalParam(rfc_caller_id, rfc_param.c_str(), ¶m); - - if ( tr181Success != err) { - tvError_t retVal = GetDefaultPQParams(pqmodeIndex,(tvVideoSrcType_t)sourceIndex, (tvVideoFormatType_t)formatIndex, - PQ_PARAM_DOLBY_MODE, &value); - if( retVal != tvERROR_NONE ) { - LOGERR("%s : failed\n",__FUNCTION__); - return -1; - } - ret = 0; - } - else { - value=getDolbyModeIndex(param.value); - ret = 0; - } - - return ret; - } + tvDolbyMode_t AVOutputTV::GetDolbyVisionEnumFromModeString(const char* modeString) { if (strcmp(modeString, "Invalid") == 0) { @@ -1586,45 +1744,31 @@ namespace Plugin { return tvDolbyMode_Bright; } else if (strcmp(modeString, "Game") == 0) { return tvDolbyMode_Game; - } else if (strcmp(modeString, "HDR10 Dark") == 0) { - return tvHDR10Mode_Dark; - } else if (strcmp(modeString, "HDR10 Bright") == 0) { - return tvHDR10Mode_Bright; - } else if (strcmp(modeString, "HDR10 Game") == 0) { - return tvHDR10Mode_Game; - } else if (strcmp(modeString, "HLG Dark") == 0) { - return tvHLGMode_Dark; - } else if (strcmp(modeString, "HLG Bright") == 0) { - return tvHLGMode_Bright; - } else if (strcmp(modeString, "HLG Game") == 0) { - return tvHLGMode_Game; } - return tvDolbyMode_Invalid; // Default case for invalid input } std::string AVOutputTV::getDolbyModeStringFromEnum( tvDolbyMode_t mode) - { std::string value; switch(mode) { case tvDolbyMode_Dark: case tvHDR10Mode_Dark: case tvHLGMode_Dark: - value = "Dark"; - break; + value = "Dark"; + break; case tvDolbyMode_Bright: case tvHDR10Mode_Bright: case tvHLGMode_Bright: - value = "Bright"; - break; - case tvDolbyMode_Game: + value = "Bright"; + break; + case tvDolbyMode_Game: case tvHDR10Mode_Game: case tvHLGMode_Game: value = "Game"; break; default: - break; + break; } return value; @@ -1633,39 +1777,36 @@ namespace Plugin { int AVOutputTV::getAvailableCapabilityModesWrapper(std::string param, std::string & outparam) { tvError_t err = tvERROR_NONE; - std::vector range; - std::vector picmodeVec; - std::vector sourceVec; - std::vector formatVec; + capVectors_t info; - err = getParamsCaps(range,picmodeVec,sourceVec,formatVec, param); + err = getParamsCaps(param,info); if (err != tvERROR_NONE) { LOGERR("%s: failed to get [%s] capability \n", __FUNCTION__, param.c_str()); return -1; } - outparam = convertToString(range); + outparam = convertToString(info.rangeVector); return 0; } - int AVOutputTV::getAvailableCapabilityModes(std::string & source, std::string & pqmode, std::string & format) + int AVOutputTV::getAvailableCapabilityModes( capDetails_t &info) { - if ((pqmode.compare("none") == 0 )) { - if (getAvailableCapabilityModesWrapper("PictureMode", pqmode) != 0) { + if ((info.pqmode.compare("none") == 0 )) { + if (getAvailableCapabilityModesWrapper("PictureMode", info.pqmode) != 0) { LOGERR("%s: failed to get picture mode capability \n", __FUNCTION__); return -1; } } - if( (source.compare("none") == 0)) { - if (getAvailableCapabilityModesWrapper("VideoSource",source) != 0) { + if( (info.source.compare("none") == 0)) { + if (getAvailableCapabilityModesWrapper("VideoSource",info.source) != 0) { LOGERR("%s: failed to get source capability \n", __FUNCTION__); return -1; } } - if( (format.compare("none") == 0) ) { - if (getAvailableCapabilityModesWrapper("VideoFormat",format) != 0) { + if( (info.format.compare("none") == 0) ) { + if (getAvailableCapabilityModesWrapper("VideoFormat",info.format) != 0) { LOGERR("%s: failed to get format capability \n", __FUNCTION__); return -1; } @@ -1675,17 +1816,17 @@ namespace Plugin { int AVOutputTV::getCapabilitySource(JsonArray & rangeArray) { - std::vector range,pqmode,source,format; + capVectors_t info; - tvError_t ret = getParamsCaps(range,pqmode,source,format,"VideoSource"); + tvError_t ret = getParamsCaps("VideoSource",info); if(ret != tvERROR_NONE) { return -1; } else { - if ((range.front()).compare("none") != 0) { - for (unsigned int index = 0; index < range.size(); index++) { - rangeArray.Add(range[index]); + if ((info.rangeVector.front()).compare("none") != 0) { + for (unsigned int index = 0; index < info.rangeVector.size(); index++) { + rangeArray.Add(info.rangeVector[index]); } } } @@ -1694,16 +1835,16 @@ namespace Plugin { int AVOutputTV::getRangeCapability(std::string param, std::vector & rangeInfo) { - std::vector range,pqmode,source,format; + capVectors_t info; - tvError_t ret = getParamsCaps(range,pqmode,source,format, param); + tvError_t ret = getParamsCaps(param,info); if(ret != tvERROR_NONE) { return -1; } else { - if ((range.front()).compare("none") != 0) { - rangeInfo = range; + if ((info.rangeVector.front()).compare("none") != 0) { + rangeInfo = info.rangeVector; } } return 0; @@ -1781,6 +1922,11 @@ namespace Plugin { tvDisplayMode_t mode = tvDisplayMode_MAX; TR181_ParamData_t param; tvError_t ret = tvERROR_NONE; + capDetails_t inputInfo; + + inputInfo.pqmode = pqmode; + inputInfo.source = source; + inputInfo.format = format; memset(¶m, 0, sizeof(param)); tr181ErrorCode_t err = getLocalParam(rfc_caller_id, AVOUTPUT_ASPECTRATIO_RFC_PARAM, ¶m); @@ -1827,9 +1973,7 @@ namespace Plugin { } else { //Save DisplayMode to ssm_data - int params[3]={0}; - params[0]=mode; - int retval=updateAVoutputTVParam("set","AspectRatio",pqmode,source,format,PQ_PARAM_ASPECT_RATIO,params); + int retval=updateAVoutputTVParam("set","ZoomMode",inputInfo,PQ_PARAM_ASPECT_RATIO,mode); if(retval != 0) { LOGERR("Failed to Save DisplayMode to ssm_data\n"); @@ -1846,5 +1990,472 @@ namespace Plugin { return ret; } + int AVOutputTV::getCMSComponentEnumFromString(std::string component, tvComponentType_t& value) + { + int ret = 0; + + if( component.compare("Luma") == 0 ) + value = COMP_LUMA; + else if( component.compare("Saturation") == 0 ) + value = COMP_SATURATION; + else if( component.compare("Hue") == 0 ) + value = COMP_HUE; + else + ret = -1; + + return ret; + } + + int AVOutputTV::getCMSColorEnumFromString(std::string color,tvDataComponentColor_t& value) + { + int ret = 0; + + if( color.compare("Red") == 0 ) + value = tvDataColor_RED; + else if( color.compare("Green") == 0 ) + value = tvDataColor_GREEN; + else if( color.compare("Blue") == 0 ) + value = tvDataColor_BLUE; + else if( color.compare("Yellow") == 0) + value = tvDataColor_YELLOW; + else if( color.compare("Cyan") == 0) + value = tvDataColor_CYAN; + else if( color.compare("Magenta") == 0) + value = tvDataColor_MAGENTA; + else + ret = -1; + + return ret; + } + + int AVOutputTV::getColorTempEnumFromString(std::string color, tvColorTemp_t& value) + { + int ret = 0; + + if( color.compare("Standard") == 0 ) + value = tvColorTemp_STANDARD; + else if( color.compare("Warm") == 0 ) + value = tvColorTemp_WARM; + else if( color.compare("Cold") == 0 ) + value = tvColorTemp_COLD; + else if( color.compare("UserDefined") == 0 ) + value =tvColorTemp_USER; + else + ret = -1; + + return ret; + } + + int AVOutputTV::convertToSourceOffsetEnum(std::string source, tvColorTempSourceOffset_t& value) + { + int ret = 0; + + if( source.compare("Composite1") == 0 ) + value = AV_OFFSET; + else if( source.compare("IP") == 0 ) + value = TV_OFFSET; + else if( source.compare("HDMI1") == 0 || source.compare("HDMI2") == 0 || source.compare("HDMI3") == 0 || source.compare("Tuner") == 0) + value = HDMI_OFFSET; + else + ret = -1; + + return ret; + } + + void AVOutputTV::syncCMSParams( ) + { + int level = 0; + std::string cmsParam; + tvPQParameterIndex_t tvPQEnum; + capDetails_t inputInfo; + tvDataComponentColor_t colors[] = {tvDataColor_RED,tvDataColor_GREEN,tvDataColor_BLUE,tvDataColor_YELLOW,tvDataColor_CYAN,tvDataColor_MAGENTA}; + + inputInfo.pqmode = "none"; + inputInfo.source = "none"; + inputInfo.format = "none"; + + for ( int component = COMP_HUE; component < COMP_MAX;component++) { + for(int count = 0;count < (int)(sizeof(colors)/sizeof(colors[0])); ++count) { + + tvDataComponentColor_t color = colors[count]; + + std::string componentString = getCMSComponentStringFromEnum((tvComponentType_t)component); + std::string colorString = getCMSColorStringFromEnum((tvDataComponentColor_t)color); + cmsParam = componentString+"."+colorString; + + if ( convertCMSParamToPQEnum(componentString,colorString,tvPQEnum) != 0 ) { + LOGINFO("%s: %s/%s Param Not Found \n",__FUNCTION__,componentString.c_str(),componentString.c_str()); + continue; + } + + inputInfo.color = colorString; + inputInfo.component = componentString; + if( !updateAVoutputTVParam("sync","CMS", inputInfo,tvPQEnum,level)) + LOGINFO("CMS Successfully Synced to Drive Cache\n"); + else + LOGERR("CMS Sync to cache Failed !!!\n"); + } + } + } + + void AVOutputTV::syncWBParams( ) + { + int level = 0; + tvPQParameterIndex_t tvPQEnum; + capDetails_t inputInfo; + + inputInfo.pqmode = "none"; + inputInfo.source = "none"; + inputInfo.format = "none"; + + for( int colorIndex= tvWB_COLOR_RED; colorIndex < tvWB_COLOR_MAX; colorIndex++) { + for(int controlIndex = tvWB_CONTROL_GAIN;controlIndex < tvWB_CONTROL_MAX;controlIndex++) { + inputInfo.control = getWBControlStringFromEnum((tvWBControl_t)controlIndex); + inputInfo.color = getWBColorStringFromEnum((tvWBColor_t)colorIndex); + + if ( convertWBParamToPQEnum(inputInfo.control,inputInfo.color,tvPQEnum) != 0 ) { + LOGERR("%s: %s/%s Param Not Found \n",__FUNCTION__,inputInfo.control.c_str(),inputInfo.color.c_str()); + } + updateAVoutputTVParam("sync","WhiteBalance",inputInfo,tvPQEnum,level); + } + } + } + + + int AVOutputTV:: convertCMSParamToPQEnum(const std::string component, const std::string color,tvPQParameterIndex_t& value) { + // Create a map to associate color-component pairs with enum values + int ret = 0; + static const std::unordered_map colorComponentMap = { + {"SaturationRed", PQ_PARAM_CMS_SATURATION_RED}, + {"SaturationGreen", PQ_PARAM_CMS_SATURATION_GREEN}, + {"SaturationBlue", PQ_PARAM_CMS_SATURATION_BLUE}, + {"SaturationCyan", PQ_PARAM_CMS_SATURATION_CYAN}, + {"SaturationMagenta", PQ_PARAM_CMS_SATURATION_MAGENTA}, + {"SaturationYellow", PQ_PARAM_CMS_SATURATION_YELLOW}, + {"HueRed", PQ_PARAM_CMS_HUE_RED}, + {"HueGreen", PQ_PARAM_CMS_HUE_GREEN}, + {"HueBlue", PQ_PARAM_CMS_HUE_BLUE}, + {"HueCyan", PQ_PARAM_CMS_HUE_CYAN}, + {"HueMagenta", PQ_PARAM_CMS_HUE_MAGENTA}, + {"HueYellow", PQ_PARAM_CMS_HUE_YELLOW}, + {"LumaRed", PQ_PARAM_CMS_LUMA_RED}, + {"LumaGreen", PQ_PARAM_CMS_LUMA_GREEN}, + {"LumaBlue", PQ_PARAM_CMS_LUMA_BLUE}, + {"LumaCyan", PQ_PARAM_CMS_LUMA_CYAN}, + {"LumaMagenta", PQ_PARAM_CMS_LUMA_MAGENTA}, + {"LumaYellow", PQ_PARAM_CMS_LUMA_YELLOW} + }; + + // Create the key by concatenating the component and color + std::string key = component + color; + + // Look up the key in the map + auto it = colorComponentMap.find(key); + if (it != colorComponentMap.end()) { + value = it->second; + ret = 0; + } else { + LOGERR("%s : Invalid color/component\n",__FUNCTION__); + ret = -1; + } + return ret; + } + + int AVOutputTV:: convertWBParamToRGBEnum(const std::string color,std::string control,tvRGBType_t &value) + { + // Create a map to associate color-ntrol pairs with enum values + int ret = 0; + static const std::unordered_map colorControlMap = { + {"RedGain", R_GAIN}, + {"GreenGain", G_GAIN}, + {"BlueGain", B_GAIN}, + {"RedOffset", R_POST_OFFSET}, + {"GreenOffset", G_POST_OFFSET}, + {"BlueOffset", B_POST_OFFSET} + }; + + // Create the key by concatenating the color and control + std::string key = color + control; + + // Look up the key in the map + auto it = colorControlMap.find(key); + if (it != colorControlMap.end()) { + value = it->second; + ret = 0; + } else { + LOGERR("%s : Invalid color/control\n",__FUNCTION__); + ret = -1; + } + return ret; + } + + int AVOutputTV:: convertWBParamToPQEnum(const std::string control, const std::string color,tvPQParameterIndex_t& value) { + // Create a map to associate color-component pairs with enum values + int ret = 0; + static const std::unordered_map colorControlMap = { + {"RedGain", PQ_PARAM_WB_GAIN_RED}, + {"RedOffset", PQ_PARAM_WB_OFFSET_RED}, + {"GreenGain", PQ_PARAM_WB_GAIN_GREEN}, + {"GreenOffset", PQ_PARAM_WB_OFFSET_GREEN}, + {"BlueGain", PQ_PARAM_WB_GAIN_BLUE}, + {"BlueOffset", PQ_PARAM_WB_OFFSET_BLUE}, + }; + + // Create the key by concatenating the component and color + std::string key = color+control; + + // Look up the key in the map + auto it = colorControlMap.find(key); + if (it != colorControlMap.end()) { + value = it->second; + ret = 0; + } else { + LOGERR("%s : Invalid color/control\n",__FUNCTION__); + ret = -1; + } + return ret; + } + + std::string AVOutputTV::getCMSColorStringFromEnum(tvDataComponentColor_t value) + { + switch(value) + { + case tvDataColor_RED: return "Red"; + case tvDataColor_GREEN: return "Green"; + case tvDataColor_BLUE: return "Blue"; + case tvDataColor_YELLOW: return "Yellow"; + case tvDataColor_CYAN: return "Cyan"; + case tvDataColor_MAGENTA: return "Magenta"; + default : return "Max"; + } + } + + std::string AVOutputTV::getCMSComponentStringFromEnum(tvComponentType_t value) { + switch(value) { + case COMP_HUE: return "Hue"; + case COMP_SATURATION: return "Saturation"; + case COMP_LUMA: return "Luma"; + default : return "Max"; + } + } + + std::string AVOutputTV::getWBColorStringFromEnum(tvWBColor_t value) { + switch(value) { + case tvWB_COLOR_RED: return "Red"; + case tvWB_COLOR_GREEN: return "Green"; + case tvWB_COLOR_BLUE: return "Blue"; + default : return "Max"; + } + } + + std::string AVOutputTV::getWBControlStringFromEnum(tvWBControl_t value) { + switch(value) + { + case tvWB_CONTROL_GAIN: return "Gain"; + case tvWB_CONTROL_OFFSET: return "Offset"; + default: return "Max"; + } + } + + int AVOutputTV::getWBColorEnumFromString(std::string color,tvWBColor_t& value) { + int ret = 0; + + if( color.compare("Red") == 0 ) + value = tvWB_COLOR_RED; + else if( color.compare("Green") == 0 ) + value = tvWB_COLOR_GREEN; + else if( color.compare("Blue") == 0 ) + value = tvWB_COLOR_BLUE; + else + ret = -1; + + return ret; + } + + int AVOutputTV::getWBControlEnumFromString(std::string color,tvWBControl_t& value) { + int ret = 0; + + if( color.compare("Gain") == 0 ) + value = tvWB_CONTROL_GAIN; + else if( color.compare("Offset") == 0 ) + value = tvWB_CONTROL_OFFSET; + else + ret = -1; + + return ret; + } + + std::string AVOutputTV::getColorTemperatureStringFromEnum(tvColorTemp_t value) { + switch(value) { + case tvColorTemp_STANDARD: return "Standard"; + case tvColorTemp_WARM: return "Warm"; + case tvColorTemp_COLD: return "Cold"; + case tvColorTemp_USER : return "UserDefined"; + default : return "Max"; + } + } + + int AVOutputTV:: validateCMSParameter(std::string component,int inputValue) + { + capVectors_t info; + tvError_t ret = getParamsCaps("CMS", info); + + LOGINFO("%s : component : %s inputValue : %d\n",__FUNCTION__,component.c_str(),inputValue); + + if (ret != tvERROR_NONE) { + LOGERR("Failed to fetch the range capability \n"); + return -1; + } + + if( component == "Saturation" ) { + if (inputValue < stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])) { + LOGERR("wrong Input value[%d] for %s\n", inputValue,component.c_str()); + return -1; + } + } else if ( component == "Hue" ) { + if (inputValue < stoi(info.rangeVector[2]) || inputValue > std::stoi(info.rangeVector[3])) { + LOGERR("wrong Input value[%d] for %s\n", inputValue,component.c_str()); + return -1; + } + } else if ( component == "Luma" ) { + if (inputValue < stoi(info.rangeVector[4]) || inputValue > std::stoi(info.rangeVector[5])) { + LOGERR("wrong Input value[%d] for %s\n", inputValue,component.c_str()); + return -1; + } + } + return 0; + } + + int AVOutputTV:: validateWBParameter(std::string param,std::string control,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( control == "Gain" ) { + if (inputValue < stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])) { + LOGERR("wrong Input value[%d] for %s\n", inputValue,control.c_str()); + return -1; + } + } else if ( control == "Offset" ) { + if (inputValue < stoi(info.rangeVector[2]) || inputValue > std::stoi(info.rangeVector[3])) { + LOGERR("wrong Input value[%d] for %s\n", inputValue,control.c_str()); + return -1; + } + } + return 0; + } + + int AVOutputTV::ReadCapablitiesFromConf(std::string param, capDetails_t& info) + { + int ret = 0; + + /*Consider User WhiteBalance as CustomWhiteBalance + To avoid clash with Factory WhiteBalance Calibration capablities*/ + + if ( param == "WhiteBalance") + param = "CustomWhiteBalance"; + + if ( param == "WhiteBalance") + param = "BacklightControl"; + + try { + CIniFile inFile(CAPABLITY_FILE_NAME); + std::string configString; + + if(param == "CMS") + { + configString = param + ".color"; + info.color = inFile.Get(configString); + + configString = param + ".component"; + info.component = inFile.Get(configString); + } + + if(param == "CustomWhiteBalance") + { + configString = param + ".color"; + info.color = inFile.Get(configString); + + configString = param + ".control"; + info.control = inFile.Get(configString); + + } + + if ((param == "DolbyVisionMode") || (param == "Backlight") || (param == "CMS") || (param == "CustomWhiteBalance") || (param == "HDRMode") || (param == "BacklightControl")) { + configString = param + ".platformsupport"; + info.isPlatformSupport = inFile.Get(configString); + printf(" platformsupport : %s\n",info.isPlatformSupport.c_str() ); + } + + if ( (param == "ColorTemperature") || (param == "DimmingMode") || + ( param == "BacklightControl") || (param == "DolbyVisionMode") || + (param == "HDR10Mode") || (param == "HLGMode") || (param == "AspectRatio") || + (param == "PictureMode") || (param == "VideoSource") || (param == "VideoFormat") || + (param == "VideoFrameRate") || (param == "HDRMode") ) { + configString = param + ".range"; + info.range = inFile.Get(configString); + printf(" String Range info : %s\n",info.range.c_str() ); + } else if ( (param == "CMS" )) { + configString.clear(); + configString = param + ".range_Saturation_from"; + info.range = inFile.Get(configString); + configString = param + ".range_Saturation_to"; + info.range += ","+inFile.Get(configString); + + configString = param + ".range_Hue_from"; + info.range += ","+inFile.Get(configString); + configString = param + ".range_Hue_to"; + info.range += ","+inFile.Get(configString); + + configString = param + ".range_Luma_from"; + info.range += ","+inFile.Get(configString); + configString = param + ".range_Luma_to"; + info.range += ","+inFile.Get(configString); + } else if ( (param == "CustomWhiteBalance")) { + configString = param + ".range_Gain_from"; + info.range = inFile.Get(configString); + configString = param + ".range_Gain_to"; + info.range += ","+inFile.Get(configString); + + configString = param + ".range_Offset_from"; + info.range += ","+inFile.Get(configString); + configString = param + ".range_Offset_to"; + info.range += ","+inFile.Get(configString); + } else { + configString = param + ".range_from"; + info.range = inFile.Get(configString); + configString = param + ".range_to"; + info.range += ","+inFile.Get(configString); + printf(" Integer Range Info : %s\n",info.range.c_str() ); + } + + if ((param == "VideoSource") || (param == "PictureMode") || (param == "VideoFormat") ) { + configString.clear(); + configString = param + ".index"; + info.index = inFile.Get(configString); + printf("Index value %s\n", info.index.c_str()); + } + + configString.clear(); + configString = param + ".pqmode"; + info.pqmode = inFile.Get(configString); + configString = param + ".format"; + info.format = inFile.Get(configString); + configString = param + ".source"; + info.source = inFile.Get(configString); + ret = 0; + } + catch(const boost::property_tree::ptree_error &e) { + printf("%s: error %s::config table entry not found in ini file\n",__FUNCTION__,e.what()); + ret = -1; + } + return ret; + } + } //namespace Plugin } //namespace WPEFramework From 22b8480f26864b4354f36ae7e76a7aa141f73753 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Fri, 3 Jan 2025 12:08:18 +0000 Subject: [PATCH 02/20] RDK-52028: corrected resetCMS --- AVOutput/AVOutputTV.cpp | 78 ++++++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 20 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index deccaf07eb..3cda2441ae 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3094,36 +3094,74 @@ namespace Plugin { int retVal = 0; std::string color,component; tvError_t ret = tvERROR_NONE; + JsonArray sourceArray; + JsonArray pqmodeArray; + JsonArray formatArray; + JsonArray colorArray; + JsonArray componentArray; - inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; - inputInfo.component = parameters.HasLabel("component") ? parameters["component"].String() : ""; + pqmodeArray = parameters.HasLabel("pictureMode") ? parameters["pictureMode"].Array() : JsonArray(); + for (int i = 0; i < pqmodeArray.Length(); ++i) { + inputInfo.pqmode += pqmodeArray[i].String(); + if (i != (pqmodeArray.Length() - 1) ) { + inputInfo.pqmode += ","; + } + } - if (parsingSetInputArgument(parameters,"CMS",inputInfo) != 0) { - LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); - returnResponse(false); + sourceArray = parameters.HasLabel("videoSource") ? parameters["videoSource"].Array() : JsonArray(); + for (int i = 0; i < sourceArray.Length(); ++i) { + inputInfo.source += sourceArray[i].String(); + if (i != (sourceArray.Length() - 1) ) { + inputInfo.source += ","; + } } - if( !isCapablityCheckPassed( "CMS" , inputInfo )) { - LOGERR("%s: CapablityCheck failed for CMS\n", __FUNCTION__); - returnResponse(false); + formatArray = parameters.HasLabel("videoFormat") ? parameters["videoFormat"].Array() : JsonArray(); + for (int i = 0; i < formatArray.Length(); ++i) { + inputInfo.format += formatArray[i].String(); + if (i != (formatArray.Length() - 1) ) { + inputInfo.format += ","; + } } -/* - if ( convertCMSParamToEnum(inputInfo.component,inputInfo.color,tvPQEnum) != 0 ) { - LOGERR("%s: %s/%s Param Not Found \n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str()); - returnResponse(false); - } + colorArray = parameters.HasLabel("color") ? parameters["color"].Array() : JsonArray(); + for (int i = 0; i < color.Length(); ++i) { + inputInfo.format += colorArray[i].String(); + if (i != (colorArray.Length() - 1) ) { + inputInfo.color += ","; + } + } + componentArray = parameters.HasLabel("component") ? parameters["component"].Array() : JsonArray(); + for (int i = 0; i < componentArray.Length(); ++i) { + inputInfo.format += componentArray[i].String(); + if (i != (componentArray.Length() - 1) ) { + inputInfo.component += ","; + } + } + if (inputInfo.source.empty()) { + inputInfo.source = "Global"; + } + if (inputInfo.pqmode.empty()) { + inputInfo.pqmode = "Global"; + } + if (inputInfo.format.empty()) { + inputInfo.format = "Global"; + } + if (inputInfo.color.empty()) { + inputInfo.color = "Global"; + } + if (inputInfo.component.empty()) { + inputInfo.component = "Global"; + } - retVal = getCMSComponentEnumFromString(inputInfo.component,compEnum); - if( ret == -1) { - LOGERR("%s: Invalid Component : %s\n",__FUNCTION__,inputInfo.component.c_str()); + if (convertToValidInputParameter("CMS", inputInfo) != 0) { + LOGERR("%s: Failed to convert the input paramters. \n", __FUNCTION__); returnResponse(false); } - retVal = getCMSColorEnumFromString(inputInfo.color,colorEnum); - if( ret == -1) { - LOGERR("%s: Invalid Color : %s\n",__FUNCTION__,inputInfo.color.c_str()); + if( !isCapablityCheckPassed( "CMS" , inputInfo )) { + LOGERR("%s: CapablityCheck failed for CMS\n", __FUNCTION__); returnResponse(false); - } */ + } if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); From 923154f01a3fe5d0f8b002d2c994a3e21d365bd5 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Fri, 3 Jan 2025 12:48:27 +0000 Subject: [PATCH 03/20] RDK-52028: ResetCMS build issues --- AVOutput/AVOutputTV.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 3cda2441ae..8d6e9cd324 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3124,7 +3124,7 @@ namespace Plugin { } } colorArray = parameters.HasLabel("color") ? parameters["color"].Array() : JsonArray(); - for (int i = 0; i < color.Length(); ++i) { + for (int i = 0; i < colorArray.Length(); ++i) { inputInfo.format += colorArray[i].String(); if (i != (colorArray.Length() - 1) ) { inputInfo.color += ","; From 89f08a76bcb4b0fcc002a8e4db73c96d7dba9a6e Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Fri, 3 Jan 2025 14:16:33 +0000 Subject: [PATCH 04/20] RDK-52028: AutoBacklightMode issues --- AVOutput/AVOutputTVHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index a5491c24bf..9734349939 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -2360,7 +2360,7 @@ namespace Plugin { if ( param == "WhiteBalance") param = "CustomWhiteBalance"; - if ( param == "WhiteBalance") + if ( param == "AutoBacklightMode") param = "BacklightControl"; try { From 458f3240f3d691f346d90fd50aef5dc4465c0068 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Fri, 3 Jan 2025 14:55:17 +0000 Subject: [PATCH 05/20] RDK-52028: ReadCapabilitiesConf issues --- AVOutput/AVOutputTVHelper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index 9734349939..3ae3062d2c 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -2357,11 +2357,11 @@ namespace Plugin { /*Consider User WhiteBalance as CustomWhiteBalance To avoid clash with Factory WhiteBalance Calibration capablities*/ - if ( param == "WhiteBalance") + if ( param == "WhiteBalance") { param = "CustomWhiteBalance"; - - if ( param == "AutoBacklightMode") + } else if ( param == "AutoBacklightMode") { param = "BacklightControl"; + } try { CIniFile inFile(CAPABLITY_FILE_NAME); From a970a5ad856ef95040e99d52feafd40ff23125d5 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 6 Jan 2025 05:29:04 +0000 Subject: [PATCH 06/20] RDK-52028 : allow save only for custom WB --- AVOutput/AVOutputTV.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 8d6e9cd324..9326d19ccf 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3522,12 +3522,6 @@ namespace Plugin { returnResponse(false); } - if( colorTemp != tvColorTemp_USER) - { - LOGERR("%s : Dont Proceed color temp is non-tvColorTemp_USER !!!\n",__FUNCTION__); - returnResponse(false); - } - if( inputInfo.color.empty() || inputInfo.control.empty() ) { LOGERR("%s : Color/Control param not found!!!\n",__FUNCTION__); returnResponse(false); @@ -3557,7 +3551,7 @@ namespace Plugin { returnResponse(false); } - if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { + if( (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) && (colorTemp == tvColorTemp_USER) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); tvVideoSrcType_t currentSource = VIDEO_SOURCE_IP; @@ -3832,7 +3826,7 @@ namespace Plugin { TR181_ParamData_t param; - if (isPlatformSupport("AutoBacklightMode") != 0) { + if (isPlatformSupport("AutoBacklightMode") != 0) { returnResponse(false); } From 581aaf896d457d7018720c27dc16f171ff83c4c6 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 6 Jan 2025 11:59:35 +0000 Subject: [PATCH 07/20] RDK-52028 : CMS capabilty changes --- AVOutput/AVOutputTV.cpp | 4 ++-- AVOutput/AVOutputTV.h | 1 + AVOutput/AVOutputTVHelper.cpp | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 9326d19ccf..a462c4a538 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3125,14 +3125,14 @@ namespace Plugin { } colorArray = parameters.HasLabel("color") ? parameters["color"].Array() : JsonArray(); for (int i = 0; i < colorArray.Length(); ++i) { - inputInfo.format += colorArray[i].String(); + inputInfo.color += colorArray[i].String(); if (i != (colorArray.Length() - 1) ) { inputInfo.color += ","; } } componentArray = parameters.HasLabel("component") ? parameters["component"].Array() : JsonArray(); for (int i = 0; i < componentArray.Length(); ++i) { - inputInfo.format += componentArray[i].String(); + inputInfo.component += componentArray[i].String(); if (i != (componentArray.Length() - 1) ) { inputInfo.component += ","; } diff --git a/AVOutput/AVOutputTV.h b/AVOutput/AVOutputTV.h index 5ffc0ccdba..876e1cb4a4 100644 --- a/AVOutput/AVOutputTV.h +++ b/AVOutput/AVOutputTV.h @@ -372,6 +372,7 @@ class AVOutputTV : public AVOutputBase { int getColorTempEnumFromString(std::string color, tvColorTemp_t& value); int convertToSourceOffsetEnum(std::string source, tvColorTempSourceOffset_t& value); + bool checkCMSColorAndComponentCapability(const std::string capValue, const std::string inputValue); int convertCMSParamToPQEnum(const std::string component, const std::string color,tvPQParameterIndex_t& value); int convertWBParamToPQEnum(const std::string control, const std::string color,tvPQParameterIndex_t& value); int convertWBParamToRGBEnum(const std::string color,const std::string control,tvRGBType_t &value); diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index 3ae3062d2c..7abcbb039f 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -456,8 +456,19 @@ namespace Plugin { if( param == "CMS") { - if ( ( paramInfo.color.find(inputInfo.color) == std::string::npos ) || ( paramInfo.component.find(inputInfo.component) == std::string::npos) ) + // Check color + if (! checkCMSColorAndComponentCapability(paramInfo.color, inputInfo.color)) { + { + LOGINFO( "%s:CMS color Capablity Failed CapColor : %s inputColor : %s!!!\n",__FUNCTION__,paramInfo.color, inputInfo.color); + return false; + } + + // Check component + if (! checkCMSColorAndComponentCapability(paramInfo.component, inputInfo.component)) { + { + LOGINFO( "%s:CMS component Capablity capComponent : %s inputComponent : %s Failed!!!.\n",__FUNCTION__,paramInfo.color, inputInfo.color); return false; + } } else if( param == "WhiteBalance") { @@ -2457,5 +2468,25 @@ namespace Plugin { return ret; } + bool AVOutputTV::checkCMSColorAndComponentCapability(const std::string capValue, const std::string inputValue) { + // Parse capValue into a set + std::set capSet; + std::istringstream capStream(capValue); + std::string token; + + while (std::getline(capStream, token, ',')) { + capSet.insert(token); + } + + // Parse inputValue and check if each item exists in the set + std::istringstream inputStream(inputValue); + while (std::getline(inputStream, token, ',')) { + if (capSet.find(token) == capSet.end()) { + return false; + } + } + return true; + } + } //namespace Plugin } //namespace WPEFramework From 538233c9fe3a750bd74ecbb5b2136794404cf980 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 6 Jan 2025 12:29:00 +0000 Subject: [PATCH 08/20] RDK-52028: Fix CMS build issues --- AVOutput/AVOutputTVHelper.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index 7abcbb039f..74e7e25031 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -458,15 +458,13 @@ namespace Plugin { { // Check color if (! checkCMSColorAndComponentCapability(paramInfo.color, inputInfo.color)) { - { - LOGINFO( "%s:CMS color Capablity Failed CapColor : %s inputColor : %s!!!\n",__FUNCTION__,paramInfo.color, inputInfo.color); + LOGINFO( "%s:CMS color Capablity Failed CapColor : %s inputColor : %s!!!\n",__FUNCTION__,paramInfo.color.c_str(), inputInfo.color.c_str()); return false; } // Check component if (! checkCMSColorAndComponentCapability(paramInfo.component, inputInfo.component)) { - { - LOGINFO( "%s:CMS component Capablity capComponent : %s inputComponent : %s Failed!!!.\n",__FUNCTION__,paramInfo.color, inputInfo.color); + LOGINFO( "%s:CMS component Capablity capComponent : %s inputComponent : %s Failed!!!.\n",__FUNCTION__,paramInfo.component.c_str(), inputInfo.component.c_str()); return false; } } From 6dabf880cd320adb61422714569af827d72d01bb Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Tue, 7 Jan 2025 12:13:40 +0000 Subject: [PATCH 09/20] RDK-52028 : RRemove ODM enum --- AVOutput/AVOutputTVHelper.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index 74e7e25031..5c48a6f1d9 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -1110,12 +1110,6 @@ namespace Plugin { if(getLocalparam(tr181ParamName,paramIndex,value,pqIndex,sync)) { continue; } - else { - if(sync) - ret |= SaveCMS((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,COMP_NONE,tvDataColor_NONE,COMPONENT_ENABLE); - else - ret |= SaveCMS((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,COMP_NONE,tvDataColor_NONE,COMPONENT_DISABLE); - } level=value; } ret |= SaveCMS((tvVideoSrcType_t)paramIndex.sourceIndex, paramIndex.pqmodeIndex,(tvVideoFormatType_t)paramIndex.formatIndex,(tvComponentType_t)paramIndex.componentIndex,(tvDataComponentColor_t)paramIndex.colorIndex,level); From 8e742f5eab8799a358e9a27165d789be29863ac8 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Tue, 7 Jan 2025 12:16:56 +0000 Subject: [PATCH 10/20] RDK-52028 : Corrected get2PointWBCaps issue --- AVOutput/AVOutputTV.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index a462c4a538..1f128e3080 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3654,7 +3654,7 @@ namespace Plugin { unsigned int index = 0; - tvError_t ret = getParamsCaps("CMS",info); + tvError_t ret = getParamsCaps("WhiteBalance",info); if(ret != tvERROR_NONE) { returnResponse(false); From 46ce46f63501095c38bf8493c4fc6e79fb3daf23 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Tue, 7 Jan 2025 13:54:49 +0000 Subject: [PATCH 11/20] RDK-52028 : WB Cap API failures --- AVOutput/AVOutputTV.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 1f128e3080..01d2c21fb5 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3639,7 +3639,7 @@ namespace Plugin { uint32_t AVOutputTV::get2PointWBCaps(const JsonObject& parameters, JsonObject& response) { - LOGINFO("Entry"); + LOGINFO("Entry\n"); capVectors_t info; JsonArray rangeArray; @@ -3647,7 +3647,7 @@ namespace Plugin { JsonArray formatArray; JsonArray sourceArray; JsonArray colorArray; - JsonArray componentArray; + JsonArray controlArray; JsonObject gainInfo; JsonObject offsetInfo; @@ -3698,11 +3698,11 @@ namespace Plugin { response["colorInfo"]=colorArray; } - if ((info.componentVector.front()).compare("none") != 0) { - for (index = 0; index < info.componentVector.size(); index++) { - componentArray.Add(info.componentVector[index]); + if ((info.controlVector.front()).compare("none") != 0) { + for (index = 0; index < info.controlVector.size(); index++) { + controlArray.Add(info.controlVector[index]); } - response["componentInfo"]=componentArray; + response["controlInfo"]=controlArray; } LOGINFO("Exit\n"); From 88aeffd06bf883f4d974d7e4f3c34fda6bbc64ed Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Fri, 10 Jan 2025 05:17:03 +0000 Subject: [PATCH 12/20] RDK-52028 : Fix WB Capability issues --- AVOutput/AVOutputTVHelper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index 5c48a6f1d9..b58a731bfb 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -424,6 +424,7 @@ namespace Plugin { streamVector.push_back({std::stringstream(stringInfo.color), vectorInfo.colorVector}); streamVector.push_back({std::stringstream(stringInfo.component), vectorInfo.componentVector}); streamVector.push_back({std::stringstream(stringInfo.colorTemperature), vectorInfo.colorTempVector}); + streamVector.push_back({std::stringstream(stringInfo.control), vectorInfo.controlVector}); for (auto& pair : streamVector) { std::stringstream& ss = pair.first; From 917f7c310ea6f57b945759a8a274f2012efeb177 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Fri, 17 Jan 2025 09:51:02 +0000 Subject: [PATCH 13/20] RDK-52028 : Fix set and reset DV mode issue --- AVOutput/AVOutputTV.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 01d2c21fb5..3ec5e47086 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -2303,6 +2303,7 @@ namespace Plugin { returnResponse(false); } else { + inputInfo.format = "DV"; //Update only for DV format int retval= updateAVoutputTVParam("set","DolbyVisionMode",inputInfo,PQ_PARAM_DOLBY_MODE,getDolbyModeIndex(value.c_str())); if(retval != 0 ) { LOGERR("Failed to Save Dolbyvision mode\n"); @@ -2336,7 +2337,7 @@ namespace Plugin { LOGERR("%s: CapablityCheck failed for DolbyVisionMode\n", __FUNCTION__); returnResponse(false); } - + inputInfo.format = "DV"; //Update only for DV format int retval= updateAVoutputTVParam("reset","DolbyVisionMode",inputInfo,PQ_PARAM_DOLBY_MODE,dolbyMode); if(retval != 0 ) { LOGERR("Failed to reset DolbyVisionMode\n"); From 9747241b687954d25aaaf6a89ccc79ee4c834edd Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 27 Jan 2025 02:21:17 +0000 Subject: [PATCH 14/20] RDK-52028: Removed ununsed functions --- AVOutput/AVOutputTV.h | 7 ++----- AVOutput/AVOutputTVHelper.cpp | 16 ---------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/AVOutput/AVOutputTV.h b/AVOutput/AVOutputTV.h index 876e1cb4a4..b0af573d3c 100644 --- a/AVOutput/AVOutputTV.h +++ b/AVOutput/AVOutputTV.h @@ -43,8 +43,6 @@ #include "dsMgr.h" #include "hdmiIn.hpp" #include -#include -#include //Macro #define RFC_BUFF_MAX 100 @@ -163,7 +161,7 @@ typedef struct std::vector componentValues; std::vector colorTempValues; std::vector controlValues; - }valueVectors_t; +}valueVectors_t; typedef struct { @@ -371,11 +369,10 @@ class AVOutputTV : public AVOutputBase { int getWBControlEnumFromString(std::string color,tvWBControl_t& value); int getColorTempEnumFromString(std::string color, tvColorTemp_t& value); - int convertToSourceOffsetEnum(std::string source, tvColorTempSourceOffset_t& value); bool checkCMSColorAndComponentCapability(const std::string capValue, const std::string inputValue); int convertCMSParamToPQEnum(const std::string component, const std::string color,tvPQParameterIndex_t& value); int convertWBParamToPQEnum(const std::string control, const std::string color,tvPQParameterIndex_t& value); - int convertWBParamToRGBEnum(const std::string color,const std::string control,tvRGBType_t &value); + int convertWBParamToRGBEnum(const std::string color,const std::string control,tvRGBType_t &value); void broadcastLowLatencyModeChangeEvent(bool lowLatencyMode); tvError_t setAspectRatioZoomSettings(tvDisplayMode_t mode); diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index b58a731bfb..d03aa7121c 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -2050,22 +2050,6 @@ namespace Plugin { return ret; } - int AVOutputTV::convertToSourceOffsetEnum(std::string source, tvColorTempSourceOffset_t& value) - { - int ret = 0; - - if( source.compare("Composite1") == 0 ) - value = AV_OFFSET; - else if( source.compare("IP") == 0 ) - value = TV_OFFSET; - else if( source.compare("HDMI1") == 0 || source.compare("HDMI2") == 0 || source.compare("HDMI3") == 0 || source.compare("Tuner") == 0) - value = HDMI_OFFSET; - else - ret = -1; - - return ret; - } - void AVOutputTV::syncCMSParams( ) { int level = 0; From 910036da578f32622d0ebedfc9ebf34a9727fa0c Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 27 Jan 2025 02:24:58 +0000 Subject: [PATCH 15/20] RDK-52028: Corrected allignment --- AVOutput/AVOutputTV.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/AVOutput/AVOutputTV.h b/AVOutput/AVOutputTV.h index b0af573d3c..a2f099f587 100644 --- a/AVOutput/AVOutputTV.h +++ b/AVOutput/AVOutputTV.h @@ -145,7 +145,7 @@ typedef struct std::vector colorVector; std::vector componentVector; std::vector colorTempVector; - std::vector controlVector; + std::vector controlVector; }capVectors_t; @@ -159,19 +159,19 @@ typedef struct std::vector indexValues; std::vector colorValues; std::vector componentValues; - std::vector colorTempValues; - std::vector controlValues; + std::vector colorTempValues; + std::vector controlValues; }valueVectors_t; typedef struct { - uint8_t sourceIndex; - uint8_t pqmodeIndex; - uint8_t formatIndex; - uint8_t colorIndex; - uint8_t componentIndex; - uint8_t colorTempIndex; - uint8_t controlIndex; + uint8_t sourceIndex; + uint8_t pqmodeIndex; + uint8_t formatIndex; + uint8_t colorIndex; + uint8_t componentIndex; + uint8_t colorTempIndex; + uint8_t controlIndex; }paramIndex_t; From f97ac62ecee4e729188cba50800944f219cd3392 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 27 Jan 2025 05:48:45 +0000 Subject: [PATCH 16/20] RDK-52028: added platform check for CMS and WB --- AVOutput/AVOutputTV.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 3ec5e47086..7733874c96 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -2969,6 +2969,10 @@ namespace Plugin { returnResponse(false); } + if (isPlatformSupport("CMS") != 0) { + returnResponse(false); + } + if (parsingGetInputArgument(parameters, "CMS", inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); @@ -3016,6 +3020,10 @@ namespace Plugin { returnResponse(false); } + if (isPlatformSupport("CMS") != 0) { + returnResponse(false); + } + value = parameters.HasLabel("level") ? parameters["level"].String() : ""; returnIfParamNotFound(parameters,"level"); level = std::stoi(value); @@ -3101,6 +3109,10 @@ namespace Plugin { JsonArray colorArray; JsonArray componentArray; + if (isPlatformSupport("CMS") != 0) { + returnResponse(false); + } + pqmodeArray = parameters.HasLabel("pictureMode") ? parameters["pictureMode"].Array() : JsonArray(); for (int i = 0; i < pqmodeArray.Length(); ++i) { inputInfo.pqmode += pqmodeArray[i].String(); @@ -3475,6 +3487,10 @@ namespace Plugin { returnResponse(false); } + if (isPlatformSupport("WhiteBalance") != 0) { + returnResponse(false); + } + if (parsingGetInputArgument(parameters, "WhiteBalance", inputInfo) != 0) { LOGINFO("%s: Failed to parse argument\n", __FUNCTION__); returnResponse(false); @@ -3516,11 +3532,8 @@ namespace Plugin { inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; - //Proceed Only if current colorTemp is User - if( tvERROR_NONE != GetColorTemperature(&colorTemp) ) - { - LOGERR("%s : Failed to GetcolorTemperature!!!\n",__FUNCTION__); - returnResponse(false); + if (isPlatformSupport("WhiteBalance") != 0) { + returnResponse(false); } if( inputInfo.color.empty() || inputInfo.control.empty() ) { @@ -3605,6 +3618,10 @@ namespace Plugin { inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; + if (isPlatformSupport("WhiteBalance") != 0) { + returnResponse(false); + } + if (parsingSetInputArgument(parameters,"WhiteBalance",inputInfo) != 0) { LOGERR("%s: Failed to parse the input arguments \n", __FUNCTION__); returnResponse(false); From 5990038227827ef6eba0c6e8bc98498ad3ab2dbc Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 27 Jan 2025 08:30:53 +0000 Subject: [PATCH 17/20] RDK-52028 : Fix SetCMS and alignment --- AVOutput/AVOutputTV.cpp | 46 +++++------ AVOutput/AVOutputTVHelper.cpp | 147 +++++++++++++++++----------------- 2 files changed, 92 insertions(+), 101 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index 7733874c96..c80b52e01e 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3016,7 +3016,7 @@ namespace Plugin { inputInfo.component = parameters.HasLabel("component") ? parameters["component"].String() : ""; if( inputInfo.color.empty() || inputInfo.component.empty() ) { - LOGERR("%s : Color/Component param not found!!!\n",__FUNCTION__); + LOGERR("%s : Color/Component param not found!!!\n",__FUNCTION__); returnResponse(false); } @@ -3048,17 +3048,11 @@ namespace Plugin { returnResponse(false); } - /* retVal = getCMSComponentEnumFromString(inputInfo.component,compEnum); - if( retVal == -1) { - LOGERR("%s: Invalid Component : %s\n",__FUNCTION__,inputInfo.component.c_str()); - returnResponse(false); - } - retVal = getCMSColorEnumFromString(inputInfo.color,colorEnum); if( retVal == -1) { LOGERR("%s: Invalid Color : %s\n",__FUNCTION__,inputInfo.color.c_str()); returnResponse(false); - }*/ + } if( isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format) ) { LOGINFO("Proceed with %s\n",__FUNCTION__); @@ -3088,7 +3082,7 @@ namespace Plugin { retVal= updateAVoutputTVParam("set","CMS",inputInfo,tvPQEnum,level); if(retVal != 0 ) { LOGERR("%s : Failed to Save CMS %s/%s(%s) to ssm_data\n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str(),cmsParam.c_str()); - returnResponse(false); + returnResponse(false); } LOGINFO("Exit : setCMS %s/%s successful to value: %d\n", inputInfo.component.c_str(),inputInfo.color.c_str(),level); returnResponse(true); @@ -3194,7 +3188,7 @@ namespace Plugin { retVal= updateAVoutputTVParam("reset","CMS",inputInfo,PQ_PARAM_CMS_SATURATION_RED,cms); if(retVal != 0 ) { LOGERR("%s : Failed to Save CMS %s/%s to ssm_data\n",__FUNCTION__,inputInfo.component.c_str(),inputInfo.color.c_str() ); - returnResponse(false); + returnResponse(false); } returnResponse(true); } @@ -3291,7 +3285,7 @@ namespace Plugin { } if (isPlatformSupport("HDRMode") != 0) { - returnResponse(false); + returnResponse(false); } if (getParamIndex("HDRMode",inputInfo,indexInfo) == -1) { @@ -3329,7 +3323,7 @@ namespace Plugin { } if (isPlatformSupport("HDRMode") != 0) { - returnResponse(false); + returnResponse(false); } if (validateInputParameter("HDRMode",value) != 0) { @@ -3384,8 +3378,8 @@ namespace Plugin { } if (isPlatformSupport("HDRMode") != 0) { - returnResponse(false); - } + returnResponse(false); + } if( !isCapablityCheckPassed( "HDRMode" , inputInfo )) { LOGERR("%s: CapablityCheck failed for HDRMode\n", __FUNCTION__); @@ -3480,15 +3474,15 @@ namespace Plugin { tvPQParameterIndex_t tvPQEnum; inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; - inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; + inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; if( inputInfo.color.empty() || inputInfo.control.empty() ) { - LOGERR("%s : Color/Control param not found!!!\n",__FUNCTION__); + LOGERR("%s : Color/Control param not found!!!\n",__FUNCTION__); returnResponse(false); } if (isPlatformSupport("WhiteBalance") != 0) { - returnResponse(false); + returnResponse(false); } if (parsingGetInputArgument(parameters, "WhiteBalance", inputInfo) != 0) { @@ -3530,14 +3524,14 @@ namespace Plugin { tvColorTemp_t colorTemp = tvColorTemp_STANDARD; inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; - inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; + inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; if (isPlatformSupport("WhiteBalance") != 0) { - returnResponse(false); + returnResponse(false); } if( inputInfo.color.empty() || inputInfo.control.empty() ) { - LOGERR("%s : Color/Control param not found!!!\n",__FUNCTION__); + LOGERR("%s : Color/Control param not found!!!\n",__FUNCTION__); returnResponse(false); } @@ -3582,7 +3576,7 @@ namespace Plugin { return -1; } - tvWBControl_t controlLevel; + tvWBControl_t controlLevel; if ( getWBControlEnumFromString(inputInfo.control,controlLevel ) == -1 ) { LOGERR("%s : GetComponentEnumFromString Failed!!! ",__FUNCTION__); return -1; @@ -3599,7 +3593,7 @@ namespace Plugin { retVal= updateAVoutputTVParam("set","WhiteBalance",inputInfo,tvPQEnum,level); if(retVal != 0 ) { LOGERR("%s : Failed to Save WB %s/%s : %d to ssm_data\n",__FUNCTION__,inputInfo.control.c_str(),inputInfo.color.c_str(),level); - returnResponse(false); + returnResponse(false); } LOGINFO("Exit : set2PointWB %s/%s successful to value: %d\n", inputInfo.control.c_str(),inputInfo.color.c_str(),level); returnResponse(true); @@ -3616,10 +3610,10 @@ namespace Plugin { int level = 0; std::string color,control; inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; - inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; + inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; if (isPlatformSupport("WhiteBalance") != 0) { - returnResponse(false); + returnResponse(false); } if (parsingSetInputArgument(parameters,"WhiteBalance",inputInfo) != 0) { @@ -3745,13 +3739,13 @@ namespace Plugin { if(ret != tvERROR_NONE) { returnResponse(false); } - else { + else { response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0 ) ? true : false; for (index = 0; index < info.rangeVector.size(); index++) { rangeArray.Add(info.rangeVector[index]); - } + } response["options"]=rangeArray; diff --git a/AVOutput/AVOutputTVHelper.cpp b/AVOutput/AVOutputTVHelper.cpp index d03aa7121c..a50462f2b5 100644 --- a/AVOutput/AVOutputTVHelper.cpp +++ b/AVOutput/AVOutputTVHelper.cpp @@ -2000,14 +2000,14 @@ namespace Plugin { if( component.compare("Luma") == 0 ) value = COMP_LUMA; - else if( component.compare("Saturation") == 0 ) - value = COMP_SATURATION; + else if( component.compare("Saturation") == 0 ) + value = COMP_SATURATION; else if( component.compare("Hue") == 0 ) - value = COMP_HUE; + value = COMP_HUE; else - ret = -1; + ret = -1; - return ret; + return ret; } int AVOutputTV::getCMSColorEnumFromString(std::string color,tvDataComponentColor_t& value) @@ -2015,21 +2015,21 @@ namespace Plugin { int ret = 0; if( color.compare("Red") == 0 ) - value = tvDataColor_RED; - else if( color.compare("Green") == 0 ) - value = tvDataColor_GREEN; + value = tvDataColor_RED; + else if( color.compare("Green") == 0 ) + value = tvDataColor_GREEN; else if( color.compare("Blue") == 0 ) - value = tvDataColor_BLUE; + value = tvDataColor_BLUE; else if( color.compare("Yellow") == 0) - value = tvDataColor_YELLOW; + value = tvDataColor_YELLOW; else if( color.compare("Cyan") == 0) - value = tvDataColor_CYAN; + value = tvDataColor_CYAN; else if( color.compare("Magenta") == 0) - value = tvDataColor_MAGENTA; + value = tvDataColor_MAGENTA; else - ret = -1; + ret = -1; - return ret; + return ret; } int AVOutputTV::getColorTempEnumFromString(std::string color, tvColorTemp_t& value) @@ -2038,23 +2038,22 @@ namespace Plugin { if( color.compare("Standard") == 0 ) value = tvColorTemp_STANDARD; - else if( color.compare("Warm") == 0 ) - value = tvColorTemp_WARM; + else if( color.compare("Warm") == 0 ) + value = tvColorTemp_WARM; else if( color.compare("Cold") == 0 ) - value = tvColorTemp_COLD; + value = tvColorTemp_COLD; else if( color.compare("UserDefined") == 0 ) value =tvColorTemp_USER; else - ret = -1; - - return ret; + ret = -1; + return ret; } void AVOutputTV::syncCMSParams( ) { int level = 0; std::string cmsParam; - tvPQParameterIndex_t tvPQEnum; + tvPQParameterIndex_t tvPQEnum; capDetails_t inputInfo; tvDataComponentColor_t colors[] = {tvDataColor_RED,tvDataColor_GREEN,tvDataColor_BLUE,tvDataColor_YELLOW,tvDataColor_CYAN,tvDataColor_MAGENTA}; @@ -2064,26 +2063,24 @@ namespace Plugin { for ( int component = COMP_HUE; component < COMP_MAX;component++) { for(int count = 0;count < (int)(sizeof(colors)/sizeof(colors[0])); ++count) { - - tvDataComponentColor_t color = colors[count]; - - std::string componentString = getCMSComponentStringFromEnum((tvComponentType_t)component); - std::string colorString = getCMSColorStringFromEnum((tvDataComponentColor_t)color); - cmsParam = componentString+"."+colorString; + tvDataComponentColor_t color = colors[count]; + std::string componentString = getCMSComponentStringFromEnum((tvComponentType_t)component); + std::string colorString = getCMSColorStringFromEnum((tvDataComponentColor_t)color); + cmsParam = componentString+"."+colorString; - if ( convertCMSParamToPQEnum(componentString,colorString,tvPQEnum) != 0 ) { + if ( convertCMSParamToPQEnum(componentString,colorString,tvPQEnum) != 0 ) { LOGINFO("%s: %s/%s Param Not Found \n",__FUNCTION__,componentString.c_str(),componentString.c_str()); continue; } inputInfo.color = colorString; inputInfo.component = componentString; - if( !updateAVoutputTVParam("sync","CMS", inputInfo,tvPQEnum,level)) - LOGINFO("CMS Successfully Synced to Drive Cache\n"); + if( !updateAVoutputTVParam("sync","CMS", inputInfo,tvPQEnum,level)) + LOGINFO("CMS Successfully Synced to Drive Cache\n"); else - LOGERR("CMS Sync to cache Failed !!!\n"); - } - } + LOGERR("CMS Sync to cache Failed !!!\n"); + } + } } void AVOutputTV::syncWBParams( ) @@ -2107,12 +2104,12 @@ namespace Plugin { updateAVoutputTVParam("sync","WhiteBalance",inputInfo,tvPQEnum,level); } } - } + } int AVOutputTV:: convertCMSParamToPQEnum(const std::string component, const std::string color,tvPQParameterIndex_t& value) { // Create a map to associate color-component pairs with enum values - int ret = 0; + int ret = 0; static const std::unordered_map colorComponentMap = { {"SaturationRed", PQ_PARAM_CMS_SATURATION_RED}, {"SaturationGreen", PQ_PARAM_CMS_SATURATION_GREEN}, @@ -2141,18 +2138,18 @@ namespace Plugin { auto it = colorComponentMap.find(key); if (it != colorComponentMap.end()) { value = it->second; - ret = 0; + ret = 0; } else { - LOGERR("%s : Invalid color/component\n",__FUNCTION__); + LOGERR("%s : Invalid color/component\n",__FUNCTION__); ret = -1; } - return ret; + return ret; } int AVOutputTV:: convertWBParamToRGBEnum(const std::string color,std::string control,tvRGBType_t &value) { // Create a map to associate color-ntrol pairs with enum values - int ret = 0; + int ret = 0; static const std::unordered_map colorControlMap = { {"RedGain", R_GAIN}, {"GreenGain", G_GAIN}, @@ -2169,12 +2166,12 @@ namespace Plugin { auto it = colorControlMap.find(key); if (it != colorControlMap.end()) { value = it->second; - ret = 0; + ret = 0; } else { - LOGERR("%s : Invalid color/control\n",__FUNCTION__); + LOGERR("%s : Invalid color/control\n",__FUNCTION__); ret = -1; } - return ret; + return ret; } int AVOutputTV:: convertWBParamToPQEnum(const std::string control, const std::string color,tvPQParameterIndex_t& value) { @@ -2196,12 +2193,12 @@ namespace Plugin { auto it = colorControlMap.find(key); if (it != colorControlMap.end()) { value = it->second; - ret = 0; + ret = 0; } else { - LOGERR("%s : Invalid color/control\n",__FUNCTION__); + LOGERR("%s : Invalid color/control\n",__FUNCTION__); ret = -1; } - return ret; + return ret; } std::string AVOutputTV::getCMSColorStringFromEnum(tvDataComponentColor_t value) @@ -2211,9 +2208,9 @@ namespace Plugin { case tvDataColor_RED: return "Red"; case tvDataColor_GREEN: return "Green"; case tvDataColor_BLUE: return "Blue"; - case tvDataColor_YELLOW: return "Yellow"; - case tvDataColor_CYAN: return "Cyan"; - case tvDataColor_MAGENTA: return "Magenta"; + case tvDataColor_YELLOW: return "Yellow"; + case tvDataColor_CYAN: return "Cyan"; + case tvDataColor_MAGENTA: return "Magenta"; default : return "Max"; } } @@ -2249,28 +2246,28 @@ namespace Plugin { int ret = 0; if( color.compare("Red") == 0 ) - value = tvWB_COLOR_RED; - else if( color.compare("Green") == 0 ) - value = tvWB_COLOR_GREEN; + value = tvWB_COLOR_RED; + else if( color.compare("Green") == 0 ) + value = tvWB_COLOR_GREEN; else if( color.compare("Blue") == 0 ) - value = tvWB_COLOR_BLUE; + value = tvWB_COLOR_BLUE; else - ret = -1; + ret = -1; - return ret; + return ret; } int AVOutputTV::getWBControlEnumFromString(std::string color,tvWBControl_t& value) { int ret = 0; if( color.compare("Gain") == 0 ) - value = tvWB_CONTROL_GAIN; - else if( color.compare("Offset") == 0 ) - value = tvWB_CONTROL_OFFSET; + value = tvWB_CONTROL_GAIN; + else if( color.compare("Offset") == 0 ) + value = tvWB_CONTROL_OFFSET; else - ret = -1; + ret = -1; - return ret; + return ret; } std::string AVOutputTV::getColorTemperatureStringFromEnum(tvColorTemp_t value) { @@ -2278,7 +2275,7 @@ namespace Plugin { case tvColorTemp_STANDARD: return "Standard"; case tvColorTemp_WARM: return "Warm"; case tvColorTemp_COLD: return "Cold"; - case tvColorTemp_USER : return "UserDefined"; + case tvColorTemp_USER : return "UserDefined"; default : return "Max"; } } @@ -2295,22 +2292,22 @@ namespace Plugin { return -1; } - if( component == "Saturation" ) { - if (inputValue < stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])) { + if( component == "Saturation" ) { + if (inputValue < stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])) { LOGERR("wrong Input value[%d] for %s\n", inputValue,component.c_str()); return -1; - } - } else if ( component == "Hue" ) { - if (inputValue < stoi(info.rangeVector[2]) || inputValue > std::stoi(info.rangeVector[3])) { + } + } else if ( component == "Hue" ) { + if (inputValue < stoi(info.rangeVector[2]) || inputValue > std::stoi(info.rangeVector[3])) { LOGERR("wrong Input value[%d] for %s\n", inputValue,component.c_str()); return -1; - } + } } else if ( component == "Luma" ) { - if (inputValue < stoi(info.rangeVector[4]) || inputValue > std::stoi(info.rangeVector[5])) { + if (inputValue < stoi(info.rangeVector[4]) || inputValue > std::stoi(info.rangeVector[5])) { LOGERR("wrong Input value[%d] for %s\n", inputValue,component.c_str()); return -1; - } - } + } + } return 0; } @@ -2324,16 +2321,16 @@ namespace Plugin { return -1; } - if( control == "Gain" ) { - if (inputValue < stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])) { + if( control == "Gain" ) { + if (inputValue < stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])) { LOGERR("wrong Input value[%d] for %s\n", inputValue,control.c_str()); return -1; - } - } else if ( control == "Offset" ) { - if (inputValue < stoi(info.rangeVector[2]) || inputValue > std::stoi(info.rangeVector[3])) { + } + } else if ( control == "Offset" ) { + if (inputValue < stoi(info.rangeVector[2]) || inputValue > std::stoi(info.rangeVector[3])) { LOGERR("wrong Input value[%d] for %s\n", inputValue,control.c_str()); return -1; - } + } } return 0; } From 88bd499e51377ea5cdbc9d90fb86a28ee24fb8ca Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 27 Jan 2025 11:24:28 +0000 Subject: [PATCH 18/20] RDK-52028 : remove custom CT check in setWB --- AVOutput/AVOutputTV.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AVOutput/AVOutputTV.cpp b/AVOutput/AVOutputTV.cpp index c80b52e01e..704e3ffba4 100644 --- a/AVOutput/AVOutputTV.cpp +++ b/AVOutput/AVOutputTV.cpp @@ -3521,7 +3521,6 @@ namespace Plugin { int retVal = 0; std::string color,control,value; tvError_t ret = tvERROR_NONE; - tvColorTemp_t colorTemp = tvColorTemp_STANDARD; inputInfo.color = parameters.HasLabel("color") ? parameters["color"].String() : ""; inputInfo.control = parameters.HasLabel("control") ? parameters["control"].String() : ""; @@ -3559,7 +3558,7 @@ namespace Plugin { returnResponse(false); } - if( (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format)) && (colorTemp == tvColorTemp_USER) ) { + if( (isSetRequired(inputInfo.pqmode,inputInfo.source,inputInfo.format))) { LOGINFO("Proceed with %s\n",__FUNCTION__); tvVideoSrcType_t currentSource = VIDEO_SOURCE_IP; From 065c67dd4700cc317de582e80e6113bcaec62264 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 27 Jan 2025 12:36:53 +0000 Subject: [PATCH 19/20] RDK-52028 : remove ODM API --- AVOutput/AVOutputTV.h | 1 - 1 file changed, 1 deletion(-) diff --git a/AVOutput/AVOutputTV.h b/AVOutput/AVOutputTV.h index a2f099f587..c79eb6718c 100644 --- a/AVOutput/AVOutputTV.h +++ b/AVOutput/AVOutputTV.h @@ -377,7 +377,6 @@ class AVOutputTV : public AVOutputBase { void broadcastLowLatencyModeChangeEvent(bool lowLatencyMode); tvError_t setAspectRatioZoomSettings(tvDisplayMode_t mode); tvError_t setDefaultAspectRatio(std::string pqmode="none",std::string format="none",std::string source="none"); - int ReadCapablitiesFromConfODM(std::string param, capDetails_t& info); public: int m_currentHdmiInResoluton; From 94e65dfe13ffe925ed384b032ebb06aad63c4f59 Mon Sep 17 00:00:00 2001 From: Tamilselvan arumugam Kesavan Date: Mon, 27 Jan 2025 16:03:51 +0000 Subject: [PATCH 20/20] RDK-52028 : updated CHANGELOG --- AVOutput/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AVOutput/CHANGELOG.md b/AVOutput/CHANGELOG.md index d5a5f898c3..17c60496e6 100644 --- a/AVOutput/CHANGELOG.md +++ b/AVOutput/CHANGELOG.md @@ -15,6 +15,10 @@ 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. * For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README. +## [1.0.11] - 2025-01-27 +### Added +- Add additional features on AVOutput + ## [1.0.10] - 2024-12-23 ### Added - ODM API removal changes phase 1