Skip to content

Commit 407c761

Browse files
author
skk451
committed
RDKEMW-5197 Sync code updated
1 parent 24e3e67 commit 407c761

File tree

2 files changed

+44
-107
lines changed

2 files changed

+44
-107
lines changed

AVOutput/AVOutputTV.cpp

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ namespace Plugin {
799799
LOGWARN("AVOutputPlugins: %s: result: %d", __FUNCTION__, result);
800800

801801
if (result != tvERROR_NONE) {
802+
response["platformSupport"] = false;
802803
returnResponse(false);
803804
}
804805

@@ -963,6 +964,7 @@ namespace Plugin {
963964

964965
if (ret != tvERROR_NONE) {
965966
LOGWARN("GetMultiPointWBCaps failed: %s", getErrorString(ret).c_str());
967+
response["platformSupport"] = false;
966968
returnResponse(false);
967969
}
968970
response["platformSupport"] = true;
@@ -1032,6 +1034,7 @@ namespace Plugin {
10321034

10331035
tvError_t err = GetColorTemperatureCaps(&color_temp, &num_color_temp, &context_caps);
10341036
if (err != tvERROR_NONE) {
1037+
response["platformSupport"] = false;
10351038
return err;
10361039
}
10371040

@@ -1059,6 +1062,7 @@ namespace Plugin {
10591062

10601063
tvError_t err = GetSdrGammaCaps(&sdr_gamma, &num_sdr_gamma, &context_caps);
10611064
if (err != tvERROR_NONE) {
1065+
response["platformSupport"] = false;
10621066
return err;
10631067
}
10641068

@@ -1093,6 +1097,7 @@ namespace Plugin {
10931097

10941098
tvError_t err = GetTVDimmingModeCaps(&dimming_mode, &num_dimming_mode, &context_caps);
10951099
if (err != tvERROR_NONE) {
1100+
response["platformSupport"] = false;
10961101
return err;
10971102
}
10981103

@@ -1114,44 +1119,44 @@ namespace Plugin {
11141119

11151120
uint32_t AVOutputTV::getZoomModeCapsV2(const JsonObject& parameters, JsonObject& response)
11161121
{
1117-
response["platformSupport"] = true;
1118-
11191122
JsonArray optionsArray;
11201123
for (size_t i = 0; i < m_numAspectRatio; ++i) {
11211124
auto it = zoomModeReverseMap.find(m_aspectRatio[i]);
11221125
if (it != zoomModeReverseMap.end()) {
11231126
optionsArray.Add(it->second);
11241127
}
11251128
}
1126-
response["options"] = optionsArray;
11271129

1130+
bool platformSupport = (optionsArray.Length() > 0);
1131+
1132+
response["platformSupport"] = platformSupport;
1133+
response["options"] = optionsArray;
11281134
response["context"] = parseContextCaps(m_aspectRatioCaps);
11291135

1130-
returnResponse(true);
1136+
returnResponse(platformSupport);
11311137
}
11321138

11331139
uint32_t AVOutputTV::getPictureModeCapsV2(const JsonObject& parameters, JsonObject& response)
11341140
{
1135-
response["platformSupport"] = true;
1136-
11371141
JsonArray optionsArray;
11381142
for (size_t i = 0; i < m_numPictureModes; ++i) {
11391143
auto it = pqModeMap.find(m_pictureModes[i]);
11401144
if (it != pqModeMap.end()) {
11411145
optionsArray.Add(it->second);
11421146
}
11431147
}
1144-
response["options"] = optionsArray;
11451148

1149+
bool platformSupport = (optionsArray.Length() > 0);
1150+
1151+
response["platformSupport"] = platformSupport;
1152+
response["options"] = optionsArray;
11461153
response["context"] = parseContextCaps(m_pictureModeCaps);
11471154

1148-
returnResponse(true);
1155+
returnResponse(platformSupport);
11491156
}
11501157

11511158
uint32_t AVOutputTV::getAutoBacklightModeCapsV2(const JsonObject& parameters, JsonObject& response)
11521159
{
1153-
response["platformSupport"] = true;
1154-
11551160
JsonArray optionsArray;
11561161
for (size_t i = 0; i < m_numBacklightModes; ++i) {
11571162
switch (m_backlightModes[i]) {
@@ -1169,45 +1174,19 @@ namespace Plugin {
11691174
break;
11701175
}
11711176
}
1172-
response["options"] = optionsArray;
11731177

1178+
bool platformSupport = (optionsArray.Length() > 0);
1179+
1180+
response["platformSupport"] = platformSupport;
1181+
response["options"] = optionsArray;
11741182
response["context"] = parseContextCaps(m_backlightModeCaps);
11751183

1176-
returnResponse(true);
1184+
returnResponse(platformSupport);
11771185
}
11781186

1187+
11791188
uint32_t AVOutputTV::getDolbyVisionCalibrationCaps(const JsonObject& parameters, JsonObject& response)
11801189
{
1181-
tvDVCalibrationSettings_t* min_values = nullptr;
1182-
tvDVCalibrationSettings_t* max_values = nullptr;
1183-
tvContextCaps_t* context_caps = nullptr;
1184-
1185-
if (GetDVCalibrationCaps(&min_values, &max_values, &context_caps) != tvERROR_NONE) {
1186-
returnResponse(false);
1187-
}
1188-
1189-
// Set platform support
1190-
response["platformSupport"] = true;
1191-
1192-
// Add all range fields (flattened as per expected JSON)
1193-
response["rangeTmax"] = JsonObject({{"from", min_values->Tmax}, {"to", max_values->Tmax}});
1194-
response["rangeTmin"] = JsonObject({{"from", min_values->Tmin}, {"to", max_values->Tmin}});
1195-
response["rangeTgamma"] = JsonObject({{"from", min_values->Tgamma}, {"to", max_values->Tgamma}});
1196-
response["rangeRx"] = JsonObject({{"from", min_values->Rx}, {"to", max_values->Rx}});
1197-
response["rangeRy"] = JsonObject({{"from", min_values->Ry}, {"to", max_values->Ry}});
1198-
response["rangeGx"] = JsonObject({{"from", min_values->Gx}, {"to", max_values->Gx}});
1199-
response["rangeGy"] = JsonObject({{"from", min_values->Gy}, {"to", max_values->Gy}});
1200-
response["rangeBx"] = JsonObject({{"from", min_values->Bx}, {"to", max_values->Bx}});
1201-
response["rangeBy"] = JsonObject({{"from", min_values->By}, {"to", max_values->By}});
1202-
response["rangeWx"] = JsonObject({{"from", min_values->Wx}, {"to", max_values->Wx}});
1203-
response["rangeWy"] = JsonObject({{"from", min_values->Wy}, {"to", max_values->Wy}});
1204-
1205-
// Add context list
1206-
response["context"] = parseContextCaps(context_caps);
1207-
1208-
// Indicate success
1209-
response["success"] = true;
1210-
12111190
returnResponse(true);
12121191
}
12131192

@@ -5205,6 +5184,7 @@ namespace Plugin {
52055184

52065185
if (ret != tvERROR_NONE) {
52075186
LOGERR("GetCMSCaps failed with error: %d", ret);
5187+
response["platformSupport"] = false;
52085188
returnResponse(false);
52095189
}
52105190
response["platformSupport"] = true;
@@ -5711,6 +5691,7 @@ namespace Plugin {
57115691

57125692
if (ret != tvERROR_NONE) {
57135693
LOGERR("GetCustom2PointWhiteBalanceCaps failed with error: %d", ret);
5694+
response["platformSupport"] = false;
57145695
returnResponse(false);
57155696
}
57165697

AVOutput/AVOutputTVHelper.cpp

Lines changed: 21 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,9 +1281,6 @@ namespace Plugin {
12811281
updateAVoutputTVParamV2("sync", "ColorTemp", paramJson, PQ_PARAM_COLOR_TEMPERATURE,level);
12821282
}
12831283

1284-
// HDRMode
1285-
updateAVoutputTVParam("sync", "HDRMode", info, PQ_PARAM_DOLBY_MODE, level);
1286-
12871284
// DimmingMode
12881285
m_dimmingModeStatus = GetTVDimmingModeCaps(&m_dimmingModes, &m_numdimmingModes, &m_dimmingModeCaps);
12891286
LOGINFO("GetTVDimmingModeCaps returned status: %d, numdimmingModes: %d", m_dimmingModeStatus, m_numdimmingModes);
@@ -1297,27 +1294,7 @@ namespace Plugin {
12971294
LOGINFO("Calling GetBacklightCaps...");
12981295
m_backlightStatus = GetBacklightCaps(&m_maxBacklight, &m_backlightCaps);
12991296
LOGINFO("GetBacklightCaps returned status: %d, maxBacklight: %d", m_backlightStatus, m_maxBacklight);
1300-
#if DEBUG
1301-
if (m_backlightCaps)
1302-
{
1303-
LOGINFO("Backlight caps pointer is valid. Num contexts: %zu", m_backlightCaps->num_contexts);
1304-
for (size_t i = 0; i < m_backlightCaps->num_contexts; ++i) {
1305-
const auto& context = m_backlightCaps->contexts[i];
1306-
std::string pqModeStr = AVOutputTV::pqModeMap.count(context.pq_mode) ?
1307-
AVOutputTV::pqModeMap.at(context.pq_mode) : "Unknown";
1308-
std::string formatStr = AVOutputTV::videoFormatMap.count(context.videoFormatType) ?
1309-
AVOutputTV::videoFormatMap.at(context.videoFormatType) : "Unknown";
1310-
std::string srcStr = AVOutputTV::videoSrcMap.count(context.videoSrcType) ?
1311-
AVOutputTV::videoSrcMap.at(context.videoSrcType) : "Unknown";
1312-
LOGINFO("Context[%zu]: PQMode = %s (%d), Format = %s (%d), Source = %s (%d)",
1313-
i, pqModeStr.c_str(), context.pq_mode,
1314-
formatStr.c_str(), context.videoFormatType,
1315-
srcStr.c_str(), context.videoSrcType);
1316-
}
1317-
} else {
1318-
LOGWARN("Backlight caps pointer is null.");
1319-
}
1320-
#endif
1297+
13211298
if (m_backlightStatus == tvERROR_OPERATION_NOT_SUPPORTED) {
13221299
updateAVoutputTVParam("sync", "Backlight", info, PQ_PARAM_BACKLIGHT, level);
13231300
} else {
@@ -1398,11 +1375,14 @@ namespace Plugin {
13981375
syncCMSParams();
13991376
}
14001377

1401-
syncWBParams();
1378+
//syncWBParams(); Enable once Get2PointWBCaps is implemented
14021379

1380+
if(m_pictureModeStatus == tvERROR_OPERATION_NOT_SUPPORTED)
1381+
{
14031382
// Dolby Vision Mode
14041383
info.format = "DV"; // Sync only for Dolby
14051384
updateAVoutputTVParam("sync", "DolbyVisionMode", info, PQ_PARAM_DOLBY_MODE, level);
1385+
}
14061386

14071387
LOGINFO("Exit %s : pqmode : %s source : %s format : %s\n", __FUNCTION__, pqmode.c_str(), source.c_str(), format.c_str());
14081388
return tvERROR_NONE;
@@ -1464,9 +1444,7 @@ namespace Plugin {
14641444
break;
14651445
}
14661446
}
1467-
#if DEBUG
1468-
LOGINFO("Got mode string from TR181: %s -> index=%d", modeStr.c_str(), modeIndex);
1469-
#endif
1447+
14701448
tvError_t tv_err = SaveSourcePictureMode(ctx.videoSrcType, ctx.videoFormatType, modeIndex);
14711449
if (tv_err != tvERROR_NONE) {
14721450
LOGWARN("Failed SaveSourcePictureMode for %s / %s\n", sourceStr.c_str(), formatStr.c_str());
@@ -2182,6 +2160,11 @@ namespace Plugin {
21822160
inputInfo.source = source;
21832161
inputInfo.format = format;
21842162

2163+
JsonObject paramJson;
2164+
paramJson["pictureMode"] = inputInfo.pqmode;
2165+
paramJson["videoSource"] = inputInfo.source;
2166+
paramJson["videoFormat"] = inputInfo.format;
2167+
21852168
memset(&param, 0, sizeof(param));
21862169
tr181ErrorCode_t err = getLocalParam(rfc_caller_id, AVOUTPUT_ASPECTRATIO_RFC_PARAM, &param);
21872170
if ( tr181Success == err ) {
@@ -2226,14 +2209,17 @@ namespace Plugin {
22262209
LOGERR("AspectRatio set failed: %s\n",getErrorString(ret).c_str());
22272210
}
22282211
else {
2229-
//Save DisplayMode to ssm_data
2230-
int retval=updateAVoutputTVParam("set","ZoomMode",inputInfo,PQ_PARAM_ASPECT_RATIO,mode);
2231-
2232-
if(retval != 0) {
2212+
if (m_aspectRatioStatus == tvERROR_OPERATION_NOT_SUPPORTED) {
2213+
int retval=updateAVoutputTVParam("set","ZoomMode",inputInfo,PQ_PARAM_ASPECT_RATIO,mode);
2214+
if(retval != 0) {
22332215
LOGERR("Failed to Save DisplayMode to ssm_data\n");
22342216
ret = tvERROR_GENERAL;
2217+
}
2218+
LOGINFO("Aspect Ratio initialized successfully, value: %s\n", param.value);
2219+
}
2220+
else {
2221+
updateAVoutputTVParamV2("set", "ZoomMode", paramJson, PQ_PARAM_ASPECT_RATIO,mode);
22352222
}
2236-
LOGINFO("Aspect Ratio initialized successfully, value: %s\n", param.value);
22372223
}
22382224

22392225
}
@@ -2760,10 +2746,7 @@ namespace Plugin {
27602746
if (caps && caps->num_contexts > 0) {
27612747
for (size_t i = 0; i < caps->num_contexts; ++i) {
27622748
const tvConfigContext_t& available = caps->contexts[i];
2763-
#if DEBUG
2764-
LOGINFO("Context[%zu]: PQMode=%d, Format=%d, Source=%d", i,
2765-
available.pq_mode, available.videoFormatType, available.videoSrcType);
2766-
#endif
2749+
27672750
if (available.videoSrcType == validContext.videoSrcType &&
27682751
available.videoFormatType == validContext.videoFormatType &&
27692752
available.pq_mode == validContext.pq_mode) {
@@ -2975,22 +2958,7 @@ namespace Plugin {
29752958
const auto resolvedPicModes = resolveParam("pictureMode", curPicMode);
29762959
const auto resolvedFormats = resolveParam("videoFormat", curFormat);
29772960
const auto resolvedSources = resolveParam("videoSource", curSource);
2978-
#if DEBUG
2979-
// Helper function to log vector content
2980-
auto logResolvedValues = [&](const std::string& label, const std::vector<std::string>& values) {
2981-
std::string joined;
2982-
for (const auto& val : values) {
2983-
if (!joined.empty()) joined += ", ";
2984-
joined += val;
2985-
}
2986-
LOGINFO("Resolved %s: [%s]", label.c_str(), joined.c_str());
2987-
};
29882961

2989-
// Debug logs
2990-
logResolvedValues("pictureMode", resolvedPicModes);
2991-
logResolvedValues("videoSource", resolvedSources);
2992-
logResolvedValues("videoFormat", resolvedFormats);
2993-
#endif
29942962

29952963
// Check if current combination exists in resolved sets
29962964
for (const auto& pm : resolvedPicModes) {
@@ -3135,25 +3103,15 @@ namespace Plugin {
31353103
const JsonObject& parameters,
31363104
tvPQParameterIndex_t pqParamIndex,int level)
31373105
{
3138-
#if DEBUG
31393106
LOGINFO("Entry %s: Action: %s, Param: %s, Level: %d", __FUNCTION__, action.c_str(), tr181ParamName.c_str(), level);
3140-
#endif
31413107
int ret = 0;
31423108
const bool isSet = (action == "set");
31433109
const bool isReset = (action == "reset");
31443110
const bool isSync = (action == "sync");
31453111

31463112
std::vector<tvConfigContext_t> validContexts = getValidContextsFromParameters(parameters, tr181ParamName);
31473113
LOGINFO("%s: Number of validContexts = %zu", __FUNCTION__, validContexts.size());
3148-
#if DEBUG
3149-
for (const auto& ctx : validContexts) {
31503114

3151-
std::string pqStr = pqModeMap.count(ctx.pq_mode) ? pqModeMap.at(ctx.pq_mode) : std::to_string(ctx.pq_mode);
3152-
std::string fmtStr = videoFormatMap.count(ctx.videoFormatType) ? videoFormatMap.at(ctx.videoFormatType) : std::to_string(ctx.videoFormatType);
3153-
std::string srcStr = videoSrcMap.count(ctx.videoSrcType) ? videoSrcMap.at(ctx.videoSrcType) : std::to_string(ctx.videoSrcType);
3154-
LOGINFO("Valid Context - PQMode: %s, Format: %s, Source: %s", pqStr.c_str(), fmtStr.c_str(), srcStr.c_str());
3155-
}
3156-
#endif
31573115
if (validContexts.empty()) {
31583116
LOGWARN("%s: No valid contexts found for parameters", __FUNCTION__);
31593117
return (int)tvERROR_GENERAL;
@@ -3182,9 +3140,7 @@ namespace Plugin {
31823140
for (const auto& ctx : validContexts) {
31833141
for (const auto& colorStr : colors) {
31843142
for (const auto& componentStr : components) {
3185-
#if DEBUG
3186-
LOGINFO("%s: Processing Color: %s, Component: %s", __FUNCTION__, colorStr.c_str(), componentStr.c_str());
3187-
#endif
3143+
31883144
tvPQParameterIndex_t pqIndex;
31893145
if (convertCMSParamToPQEnum(componentStr, colorStr, pqIndex) != 0) {
31903146
LOGERR("%s: convertCMSParamToPQEnum failed for color: %s, component: %s",

0 commit comments

Comments
 (0)