@@ -515,6 +515,18 @@ namespace Plugin {
515
515
uint32_t AVOutputTV::getBacklightV2 (const JsonObject& parameters, JsonObject& response)
516
516
{
517
517
LOGINFO (" Entry: %s" , __FUNCTION__);
518
+ #define TODO_MOVE_TO_INIT 1
519
+ #if TODO_MOVE_TO_INIT
520
+ // Retrieve Backlight Caps (Initialization)
521
+ LOGINFO (" Calling GetBacklightCaps\n " );
522
+ tvError_t error = GetBacklightCaps (&m_maxBacklight, &m_backlightCaps);
523
+ if (error == tvERROR_NONE) {
524
+ LOGINFO (" Backlight capabilities retrieved successfully. Max: %d\n " , m_maxBacklight);
525
+ } else {
526
+ LOGERR (" Failed to retrieve backlight capabilities. Error code: %d\n " , error);
527
+ returnResponse (false );
528
+ }
529
+ #endif
518
530
std::vector<tvConfigContext_t> validContexts = getValidContextsFromParameters (parameters);
519
531
if (validContexts.empty ()) {
520
532
LOGERR (" %s: No valid context found for the given parameters" , __FUNCTION__);
@@ -581,30 +593,22 @@ namespace Plugin {
581
593
}
582
594
583
595
uint32_t AVOutputTV::getCapsV2 (
584
- const std::function<tvError_t( tvContextCaps_t**,int *, std::vector<std::string>& )>& getCapsFunc,
596
+ const std::function<tvError_t( tvContextCaps_t**,int *)>& getCapsFunc,
585
597
const char* key,
586
598
const JsonObject& parameters,
587
599
JsonObject& response)
588
600
{
589
601
int max_value = 0 ;
590
602
tvContextCaps_t* context_caps = nullptr ;
591
- std::vector<std::string> options;
592
603
// Call the HAL function
593
- tvError_t result = getCapsFunc ( &context_caps, &max_value, options );
604
+ tvError_t result = getCapsFunc ( &context_caps, &max_value);
594
605
LOGWARN (" AVOutputPlugins: %s: result: %d" , __FUNCTION__, result);
595
606
if (result != tvERROR_NONE) {
596
607
returnResponse (false );
597
608
}
598
609
JsonObject capsInfo;
599
610
JsonObject rangeInfo;
600
- if (!options.empty ()) {
601
- JsonArray optionsArray;
602
- for (const auto & option : options) {
603
- optionsArray.Add (option);
604
- }
605
- rangeInfo[" options" ] = optionsArray;
606
- capsInfo[" rangeInfo" ] = rangeInfo;
607
- } else if (max_value){
611
+ if (max_value){
608
612
rangeInfo[" from" ] = 0 ;
609
613
rangeInfo[" to" ] = max_value;
610
614
capsInfo[" rangeInfo" ] = rangeInfo;
@@ -665,55 +669,55 @@ namespace Plugin {
665
669
}
666
670
667
671
uint32_t AVOutputTV::getBacklightCapsV2 (const JsonObject& parameters, JsonObject& response) {
668
- return getCapsV2 ([this ]( tvContextCaps_t** context_caps, int * max_backlight, std::vector<std::string>& ) {
672
+ return getCapsV2 ([this ]( tvContextCaps_t** context_caps, int * max_backlight) {
669
673
return this ->GetBacklightCaps (max_backlight, context_caps);
670
674
}, " Backlight" , parameters, response);
671
675
}
672
676
673
677
uint32_t AVOutputTV::getBrightnessCapsV2 (const JsonObject& parameters, JsonObject& response) {
674
- return getCapsV2 ([this ]( tvContextCaps_t** context_caps, int * max_brightness, std::vector<std::string>& options ) {
678
+ return getCapsV2 ([this ]( tvContextCaps_t** context_caps, int * max_brightness) {
675
679
return this ->GetBrightnessCaps (max_brightness, context_caps);
676
680
},
677
681
" Brightness" , parameters, response);
678
682
}
679
683
680
684
uint32_t AVOutputTV::getContrastCapsV2 (const JsonObject& parameters, JsonObject& response) {
681
- return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_contrast, std::vector<std::string>& options ) {
685
+ return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_contrast) {
682
686
return this ->GetContrastCaps (max_contrast, context_caps);
683
687
},
684
688
" Contrast" , parameters, response);
685
689
}
686
690
687
691
uint32_t AVOutputTV::getSharpnessCapsV2 (const JsonObject& parameters, JsonObject& response) {
688
- return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_sharpness, std::vector<std::string>& options ) {
692
+ return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_sharpness) {
689
693
return this ->GetSharpnessCaps (max_sharpness, context_caps);
690
694
},
691
695
" Sharpness" , parameters, response);
692
696
}
693
697
694
698
uint32_t AVOutputTV::getSaturationCapsV2 (const JsonObject& parameters, JsonObject& response) {
695
- return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_saturation, std::vector<std::string>& options ) {
699
+ return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_saturation) {
696
700
return this ->GetSaturationCaps (max_saturation, context_caps);
697
701
},
698
702
" Saturation" , parameters, response);
699
703
}
700
704
701
705
uint32_t AVOutputTV::getHueCapsV2 (const JsonObject& parameters, JsonObject& response) {
702
- return getCapsV2 ([this ]( tvContextCaps_t** context_caps, int * max_hue, std::vector<std::string>& options ) {
706
+ return getCapsV2 ([this ]( tvContextCaps_t** context_caps, int * max_hue) {
703
707
return this ->GetHueCaps (max_hue, context_caps);
704
708
},
705
709
" Hue" , parameters, response);
706
710
}
707
711
708
712
uint32_t AVOutputTV::getPrecisionDetailCapsV2 (const JsonObject& parameters, JsonObject& response) {
709
- return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_precision, std::vector<std::string>& options ) {
713
+ return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_precision) {
710
714
return this ->GetPrecisionDetailCaps (max_precision, context_caps);
711
715
},
712
716
" PrecisionDetails" , parameters, response);
713
717
}
714
718
715
719
uint32_t AVOutputTV::getLowLatencyStateCapsV2 (const JsonObject& parameters, JsonObject& response) {
716
- return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_latency, std::vector<std::string>& options ) {
720
+ return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * max_latency) {
717
721
return this ->GetLowLatencyStateCaps (max_latency, context_caps);
718
722
},
719
723
" LowLatencyState" , parameters, response);
@@ -860,10 +864,45 @@ namespace Plugin {
860
864
}
861
865
862
866
uint32_t AVOutputTV::getPictureModeCapsV2 (const JsonObject& parameters, JsonObject& response) {
863
- return getCapsV2 ([this ](tvContextCaps_t** context_caps, int * options_count) {
864
- return this ->GetTVPictureModeCaps (context_caps);
865
- },
866
- " PictureMode" , parameters, response);
867
+ tvPQModeIndex_t* modes = nullptr ;
868
+ size_t num_pic_modes = 0 ;
869
+ tvContextCaps_t* context_caps = nullptr ;
870
+
871
+ tvError_t err = GetTVPictureModeCaps (&modes, &num_pic_modes, &context_caps);
872
+ if (err != tvERROR_NONE) {
873
+ return err;
874
+ }
875
+
876
+ JsonObject pictureModeJson;
877
+ JsonObject rangeInfo;
878
+ JsonArray optionsArray;
879
+
880
+ for (size_t i = 0 ; i < num_pic_modes; ++i) {
881
+ switch (modes[i]) {
882
+ case PQ_MODE_STANDARD: optionsArray.Add (" Standard" ); break ;
883
+ case PQ_MODE_VIVID: optionsArray.Add (" Vivid" ); break ;
884
+ case PQ_MODE_ENERGY_SAVING: optionsArray.Add (" EnergySaving" ); break ;
885
+ case PQ_MODE_CUSTOM: optionsArray.Add (" Custom" ); break ;
886
+ case PQ_MODE_THEATER: optionsArray.Add (" Theater" ); break ;
887
+ case PQ_MODE_GAME: optionsArray.Add (" Game" ); break ;
888
+ case PQ_MODE_SPORTS: optionsArray.Add (" Sports" ); break ;
889
+ case PQ_MODE_AIPQ: optionsArray.Add (" AI PQ" ); break ;
890
+ case PQ_MODE_DARK: optionsArray.Add (" Dark" ); break ;
891
+ case PQ_MODE_BRIGHT: optionsArray.Add (" Bright" ); break ;
892
+ case PQ_MODE_DVIQ: optionsArray.Add (" IQ" ); break ;
893
+ default : break ; // Skip invalid/unsupported modes
894
+ }
895
+ }
896
+
897
+ rangeInfo[" options" ] = optionsArray;
898
+ pictureModeJson[" rangeInfo" ] = rangeInfo;
899
+ pictureModeJson[" platformSupport" ] = true ;
900
+ pictureModeJson[" context" ] = parseContextCaps (context_caps); // Assuming same parser works
901
+
902
+ response[" PictureMode" ] = pictureModeJson;
903
+
904
+ free (modes);
905
+ returnResponse (true );
867
906
}
868
907
869
908
uint32_t AVOutputTV::getDVCalibrationCapsV2 (const JsonObject& parameters, JsonObject& response) {
0 commit comments