@@ -523,7 +523,7 @@ namespace Plugin {
523
523
}
524
524
525
525
// Shared zoom mode mappings
526
- static const std::unordered_map<tvDisplayMode_t , std::string> zoomModeReverseMap = {
526
+ static const std::unordered_map<int , std::string> zoomModeReverseMap = {
527
527
{tvDisplayMode_16x9, " TV 16X9 STRETCH" },
528
528
{tvDisplayMode_4x3, " TV 4X3 PILLARBOX" },
529
529
{tvDisplayMode_NORMAL, " TV NORMAL" },
@@ -532,7 +532,7 @@ namespace Plugin {
532
532
{tvDisplayMode_ZOOM, " TV ZOOM" },
533
533
{tvDisplayMode_FULL, " TV FULL" }
534
534
};
535
- static const std::unordered_map<std::string, tvDisplayMode_t > zoomModeMap = {
535
+ static const std::unordered_map<std::string, int > zoomModeMap = {
536
536
{" TV 16X9 STRETCH" , tvDisplayMode_16x9},
537
537
{" TV 4X3 PILLARBOX" , tvDisplayMode_4x3},
538
538
{" TV NORMAL" , tvDisplayMode_NORMAL},
@@ -1355,37 +1355,15 @@ namespace Plugin {
1355
1355
}
1356
1356
else
1357
1357
{
1358
- std::string value = parameters.HasLabel (" zoomMode" ) ? parameters[" zoomMode" ].String () : " " ;
1359
- returnIfParamNotFound (parameters, " zoomMode" );
1360
-
1361
- auto it = zoomModeMap.find (value);
1362
- if (it == zoomModeMap.end ()) {
1363
- LOGERR (" Invalid zoom mode: %s. Not in supported options." , value.c_str ());
1364
- returnResponse (false );
1365
- }
1366
- tvDisplayMode_t mode = it->second ;
1367
- tvError_t ret = setAspectRatioZoomSettings (mode);
1368
- if (ret != tvERROR_NONE) {
1369
- returnResponse (false );
1370
- }
1371
- else
1372
- {
1373
- // Save DisplayMode to local store and ssm_data
1374
- int retval = updateAVoutputTVParamV2 (" set" , " AspectRatio" , parameters, PQ_PARAM_ASPECT_RATIO, mode);
1375
- if (retval != 0 ) {
1376
- LOGERR (" Failed to Save DisplayMode to ssm_data\n " );
1377
- returnResponse (false );
1378
- }
1379
- tr181ErrorCode_t err = setLocalParam (rfc_caller_id, AVOUTPUT_ASPECTRATIO_RFC_PARAM, value.c_str ());
1380
- if (err != tr181Success) {
1381
- LOGERR (" setLocalParam for %s Failed : %s\n " , AVOUTPUT_ASPECTRATIO_RFC_PARAM, getTR181ErrorString (err));
1382
- returnResponse (false );
1383
- } else {
1384
- LOGINFO (" setLocalParam for %s Successful, Value: %s\n " , AVOUTPUT_ASPECTRATIO_RFC_PARAM, value.c_str ());
1385
- }
1386
- LOGINFO (" Exit : SetAspectRatio() value : %s\n " , value.c_str ());
1387
- returnResponse (true );
1388
- }
1358
+ return setContextPQParam (
1359
+ parameters, response,
1360
+ " zoomMode" ,
1361
+ " ZoomMode" ,
1362
+ tvDisplayMode_MAX - 1 ,
1363
+ PQ_PARAM_ASPECT_RATIO,
1364
+ [this ](tvVideoSrcType_t /* src*/ , tvPQModeIndex_t /* mode*/ , tvVideoFormatType_t /* fmt*/ , int val) {
1365
+ return setAspectRatioZoomSettings (static_cast <tvDisplayMode_t>(val));}
1366
+ );
1389
1367
}
1390
1368
}
1391
1369
@@ -1443,33 +1421,48 @@ namespace Plugin {
1443
1421
uint32_t AVOutputTV::resetZoomMode (const JsonObject& parameters, JsonObject& response)
1444
1422
{
1445
1423
LOGINFO (" Entry\n " );
1446
- capDetails_t inputInfo;
1447
- tvError_t ret = tvERROR_NONE;
1424
+ if (m_aspectRatioStatus == tvERROR_OPERATION_NOT_SUPPORTED)
1425
+ {
1426
+ capDetails_t inputInfo;
1427
+ tvError_t ret = tvERROR_NONE;
1448
1428
1449
- if (parsingSetInputArgument (parameters, " AspectRatio" ,inputInfo) != 0 ) {
1450
- LOGERR (" %s: Failed to parse the input arguments \n " , __FUNCTION__);
1451
- returnResponse (false );
1452
- }
1429
+ if (parsingSetInputArgument (parameters, " AspectRatio" ,inputInfo) != 0 ) {
1430
+ LOGERR (" %s: Failed to parse the input arguments \n " , __FUNCTION__);
1431
+ returnResponse (false );
1432
+ }
1453
1433
1454
- if ( !isCapablityCheckPassed ( " AspectRatio" ,inputInfo )) {
1455
- LOGERR (" %s: CapablityCheck failed for AspectRatio\n " , __FUNCTION__);
1456
- returnResponse (false );
1457
- }
1434
+ if ( !isCapablityCheckPassed ( " AspectRatio" ,inputInfo )) {
1435
+ LOGERR (" %s: CapablityCheck failed for AspectRatio\n " , __FUNCTION__);
1436
+ returnResponse (false );
1437
+ }
1458
1438
1459
- tr181ErrorCode_t err = clearLocalParam (rfc_caller_id,AVOUTPUT_ASPECTRATIO_RFC_PARAM);
1460
- if ( err != tr181Success ) {
1461
- LOGERR (" clearLocalParam for %s Failed : %s\n " , AVOUTPUT_ASPECTRATIO_RFC_PARAM, getTR181ErrorString (err));
1462
- ret = tvERROR_GENERAL;
1463
- }
1464
- else {
1465
- ret = setDefaultAspectRatio (inputInfo.pqmode ,inputInfo.source ,inputInfo.format );
1466
- }
1467
- if (ret != tvERROR_NONE) {
1468
- returnResponse (false );
1439
+ tr181ErrorCode_t err = clearLocalParam (rfc_caller_id,AVOUTPUT_ASPECTRATIO_RFC_PARAM);
1440
+ if ( err != tr181Success ) {
1441
+ LOGERR (" clearLocalParam for %s Failed : %s\n " , AVOUTPUT_ASPECTRATIO_RFC_PARAM, getTR181ErrorString (err));
1442
+ ret = tvERROR_GENERAL;
1443
+ }
1444
+ else {
1445
+ ret = setDefaultAspectRatio (inputInfo.pqmode ,inputInfo.source ,inputInfo.format );
1446
+ }
1447
+ if (ret != tvERROR_NONE) {
1448
+ returnResponse (false );
1449
+ }
1450
+ else {
1451
+ LOGINFO (" Exit : resetDefaultAspectRatio()\n " );
1452
+ returnResponse (true );
1453
+ }
1469
1454
}
1470
- else {
1471
- LOGINFO (" Exit : resetDefaultAspectRatio()\n " );
1472
- returnResponse (true );
1455
+ else
1456
+ {
1457
+ bool success = resetEnumPQParamToDefault (
1458
+ parameters,
1459
+ " ZoomMode" ,
1460
+ PQ_PARAM_ASPECT_RATIO,
1461
+ zoomModeReverseMap,
1462
+ [this ](int intVal, const std::unordered_map<int , std::string>& valueMap) -> tvError_t {
1463
+ return setAspectRatioZoomSettings (static_cast <tvDisplayMode_t>(intVal));
1464
+ });
1465
+ returnResponse (success);
1473
1466
}
1474
1467
}
1475
1468
@@ -1673,6 +1666,14 @@ namespace Plugin {
1673
1666
}
1674
1667
enumValue = it->second ;
1675
1668
}
1669
+ else if (pqParamType == PQ_PARAM_ASPECT_RATIO) {
1670
+ auto it = zoomModeMap.find (valueStr);
1671
+ if (it == zoomModeMap.end ()) {
1672
+ LOGERR (" Invalid ZoomMode value: %s" , valueStr.c_str ());
1673
+ returnResponse (false );
1674
+ }
1675
+ enumValue = it->second ;
1676
+ }
1676
1677
else {
1677
1678
// default: numeric parsing
1678
1679
try {
@@ -1947,7 +1948,7 @@ namespace Plugin {
1947
1948
inputInfo.source = " Current" ;
1948
1949
inputInfo.format = " Current" ;
1949
1950
1950
- if (getParamIndex (paramName, inputInfo, indexInfo) == 0 &&
1951
+ if (getParamIndexV2 (paramName, inputInfo, indexInfo) == 0 &&
1951
1952
getLocalparam (paramName, indexInfo, intVal, pqIndex) == 0 )
1952
1953
{
1953
1954
LOGINFO (" %s: getLocalparam success for %s [format=%d, source=%d, mode=%d] → value=%d\n " ,
@@ -2003,7 +2004,7 @@ namespace Plugin {
2003
2004
inputInfo.source = " Current" ;
2004
2005
inputInfo.format = " Current" ;
2005
2006
2006
- if (getParamIndex (paramName, inputInfo, indexInfo) == 0 &&
2007
+ if (getParamIndexV2 (paramName, inputInfo, indexInfo) == 0 &&
2007
2008
getLocalparam (paramName, indexInfo, level, pqIndex) == 0 )
2008
2009
{
2009
2010
LOGINFO (" %s: getLocalparam success for %s: format=%d, source=%d, mode=%d, value=%d\n " ,
@@ -2060,7 +2061,7 @@ namespace Plugin {
2060
2061
inputInfo.source = " Current" ;
2061
2062
inputInfo.format = " Current" ;
2062
2063
2063
- if (getParamIndex (paramName, inputInfo, indexInfo) == 0 &&
2064
+ if (getParamIndexV2 (paramName, inputInfo, indexInfo) == 0 &&
2064
2065
getLocalparam (paramName, indexInfo, level, pqIndex) == 0 )
2065
2066
{
2066
2067
LOGINFO (" %s: getLocalparam success for %s: format=%d, source=%d, mode=%d, value=%d\n " ,
0 commit comments