@@ -984,13 +984,12 @@ namespace Plugin {
984984 std::string key;
985985
986986 // Generate storage key based on parameter type
987- if (forParam == " CMS" )
988- generateStorageIdentifierCMS (key, forParam, indexInfo);
989- else if (forParam.compare (" WhiteBalance" ) == 0 ) {
990- generateStorageIdentifierWB (key, forParam, indexInfo);
987+ if (forParam.compare (" WhiteBalance" ) == 0 ) {
988+ generateStorageIdentifierWB (key, forParam, indexInfo);
991989 }
992- else
990+ else {
993991 generateStorageIdentifierV2 (key, forParam, indexInfo);
992+ }
994993
995994 if (key.empty ()) {
996995 LOGERR (" %s generateStorageIdentifier failed\n " , __FUNCTION__);
@@ -1441,8 +1440,7 @@ namespace Plugin {
14411440 updateAVoutputTVParamV2 (" sync" , " SDRGamma" , paramJson, PQ_PARAM_SDR_GAMMA, level);
14421441 }
14431442
1444- // Commented due to missing HAL implementation
1445- /* m_cmsStatus = GetCMSCaps(&m_maxCmsHue, &m_maxCmsSaturation, &m_maxCmsLuma,
1443+ m_cmsStatus = GetCMSCaps (&m_maxCmsHue, &m_maxCmsSaturation, &m_maxCmsLuma,
14461444 &m_cmsColorArr, &m_cmsComponentArr,
14471445 &m_numColor, &m_numComponent, &m_cmsCaps);
14481446 if (m_cmsStatus == tvERROR_NONE) {
@@ -1455,7 +1453,7 @@ namespace Plugin {
14551453 m_cmsComponentList.push_back (componentStr);
14561454 }
14571455 syncCMSParamsV2 ();
1458- }*/
1456+ }
14591457 if (m_cmsStatus == tvERROR_OPERATION_NOT_SUPPORTED)
14601458 {
14611459 syncCMSParams ();
@@ -1764,11 +1762,11 @@ namespace Plugin {
17641762 string key;
17651763 TR181_ParamData_t param={0 };
17661764
1767- if (forParam.compare (" CMS" ) == 0 ) {
1765+ if (forParam.compare (" CMS" ) == 0 && m_cmsStatus == tvERROR_OPERATION_NOT_SUPPORTED ) {
17681766 generateStorageIdentifierCMS (key, forParam, indexInfo);
17691767 }
17701768 else if (forParam.compare (" WhiteBalance" ) == 0 ) {
1771- generateStorageIdentifierWB (key, forParam, indexInfo);
1769+ generateStorageIdentifierWB (key, forParam, indexInfo);
17721770 }
17731771 else {
17741772 generateStorageIdentifierV2 (key, forParam, indexInfo);
@@ -2876,8 +2874,12 @@ namespace Plugin {
28762874 key += AVOUTPUT_GENERIC_STRING_RFC_PARAM;
28772875 key += STRING_SOURCE + convertSourceIndexToStringV2 (info.sourceIndex ) + " ." +
28782876 STRING_PICMODE + convertPictureIndexToStringV2 (info.pqmodeIndex ) + " ." +
2879- STRING_FORMAT + convertVideoFormatToStringV2 (info.formatIndex ) + " ." +
2880- forParam;
2877+ STRING_FORMAT + convertVideoFormatToStringV2 (info.formatIndex ) + " ." ;
2878+ if ( forParam == " CMS" )
2879+ key += STRING_COLOR+getCMSColorStringFromEnum ((tvDataComponentColor_t)info.colorIndex )+std::string (" ." )+STRING_COMPONENT+getCMSComponentStringFromEnum ((tvComponentType_t)info.componentIndex )+std::string (" ." );
2880+
2881+ key += forParam;
2882+
28812883 return tvERROR_NONE;
28822884 }
28832885
@@ -3352,23 +3354,17 @@ namespace Plugin {
33523354 const JsonObject& parameters,
33533355 tvPQParameterIndex_t pqParamIndex, int level)
33543356 {
3355- #if DEBUG
3356- LOGINFO (" Entry %s: Action: %s, Param: %s, Level: %d" , __FUNCTION__, action.c_str (), tr181ParamName.c_str (), level);
3357- #endif
3357+
33583358 std::vector<tvConfigContext_t> validContexts = getValidContextsFromParameters (parameters, tr181ParamName);
33593359 if (validContexts.empty ()) {
33603360 LOGWARN (" %s: No valid contexts found for parameters" , __FUNCTION__);
33613361 return (int )tvERROR_GENERAL;
33623362 }
33633363 if (validContexts.size () == 1 ){
3364- #if DEBUG
3365- LOGINFO (" Processing immediately" );
3366- #endif
3364+
33673365 return updateAVoutputTVParamV2Implementation (action, tr181ParamName, parameters, pqParamIndex, level);
33683366 } else {
3369- #if DEBUG
3370- LOGINFO (" Queuing for background processing - no current values involved" );
3371- #endif
3367+
33723368 // Capture parameters by value for thread safety
33733369 std::lock_guard<std::mutex> lock (queueMutex);
33743370 paramUpdateQueue.push ([this , action, tr181ParamName, parameters, pqParamIndex, level]() {
@@ -3385,36 +3381,54 @@ namespace Plugin {
33853381 const JsonObject& parameters,
33863382 tvPQParameterIndex_t pqParamIndex,int level)
33873383 {
3388- # if DEBUG
3384+
33893385 LOGINFO (" Entry %s: Action: %s, Param: %s, Level: %d" , __FUNCTION__, action.c_str (), tr181ParamName.c_str (), level);
3390- # endif
3386+
33913387 int ret = 0 ;
33923388 const bool isSet = (action == " set" );
33933389 const bool isReset = (action == " reset" );
33943390 const bool isSync = (action == " sync" );
33953391
33963392 std::vector<tvConfigContext_t> validContexts = getValidContextsFromParameters (parameters, tr181ParamName);
3397- #if DEBUG
3393+ std::vector<std::string> colors, components;
3394+
33983395 LOGINFO (" %s: Number of validContexts = %zu" , __FUNCTION__, validContexts.size ());
3399- # endif
3396+
34003397 if (validContexts.empty ()) {
34013398 LOGWARN (" %s: No valid contexts found for parameters" , __FUNCTION__);
34023399 return (int )tvERROR_GENERAL;
34033400 }
34043401 if (tr181ParamName == " CMS" ) {
3405- JsonArray colorArray = getJsonArrayIfArray (parameters, " color " );
3406- JsonArray componentArray = getJsonArrayIfArray (parameters, " component " );
3407-
3408- std::vector<std::string> colors, components ;
3402+ if ( isReset )
3403+ {
3404+ JsonArray colorArray = getJsonArrayIfArray (parameters, " color " );
3405+ JsonArray componentArray = getJsonArrayIfArray (parameters, " component " ) ;
34093406
3410- for (size_t i = 0 ; i < colorArray.Length (); ++i)
3411- colors.emplace_back (colorArray[i].String ());
3407+ for (size_t i = 0 ; i < colorArray.Length (); ++i)
3408+ colors.emplace_back (colorArray[i].String ());
34123409
3413- for (size_t i = 0 ; i < componentArray.Length (); ++i)
3414- components.emplace_back (componentArray[i].String ());
3410+ for (size_t i = 0 ; i < componentArray.Length (); ++i)
3411+ components.emplace_back (componentArray[i].String ());
3412+ }
3413+ else if ( isSet)
3414+ {
3415+ colors.emplace_back (parameters.HasLabel (" color" ) ? parameters[" color" ].String () : " " );
3416+ components.emplace_back (parameters.HasLabel (" component" ) ? parameters[" component" ].String () : " " );
3417+ }
3418+ else if (isSync)
3419+ {
3420+ colors = m_cmsColorList;
3421+ components = m_cmsComponentList;
3422+ }
34153423
3416- if (colors.empty ()) colors.push_back (" Global" );
3417- if (components.empty ()) components.push_back (" Global" );
3424+ if (colors.empty ())
3425+ {
3426+ colors.push_back (" Global" );
3427+ }
3428+ if (components.empty ())
3429+ {
3430+ components.push_back (" Global" );
3431+ }
34183432
34193433 if (colors.size () == 1 && colors[0 ] == " Global" )
34203434 colors = m_cmsColorList;
@@ -3463,10 +3477,9 @@ namespace Plugin {
34633477 paramIndex.colorIndex = static_cast <uint8_t >(colorValue);
34643478 paramIndex.colorTempIndex = 0 ;
34653479 paramIndex.controlIndex = 0 ;
3466-
34673480 int value = 0 ;
34683481 if (isReset) {
3469- ret |= updateAVoutputTVParamToHAL (tr181ParamName, paramIndex, 0 , false );
3482+ ret |= updateAVoutputTVParamToHALV2 (tr181ParamName, paramIndex, 0 , false );
34703483 level = 0 ;
34713484 }
34723485
@@ -3487,7 +3500,7 @@ namespace Plugin {
34873500 level);
34883501
34893502 if (isSet) {
3490- ret |= updateAVoutputTVParamToHAL (tr181ParamName, paramIndex, level, true );
3503+ ret |= updateAVoutputTVParamToHALV2 (tr181ParamName, paramIndex, level, true );
34913504 }
34923505 }
34933506 }
0 commit comments