Skip to content

Commit

Permalink
Merge pull request #5909 from arjunbinu/feature/ODM_Phase1
Browse files Browse the repository at this point in the history
Remove ODM specific apis from tvsettings HAL to make it generic- phase1
  • Loading branch information
ddevad authored Dec 10, 2024
2 parents c821a16 + f2c50b5 commit 5205a91
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 41 deletions.
29 changes: 13 additions & 16 deletions AVOutput/AVOutputTV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,6 @@ namespace Plugin {
}
else {
LOGINFO("Platform Init successful...\n");
ret = TvSyncCalibrationInfoODM();
if(ret != tvERROR_NONE) {
LOGERR(" SD3 <->cri_data sync failed, ret: %s \n", getErrorString(ret).c_str());
}
else {
LOGERR(" SD3 <->cri_data sync success, ret: %s \n", getErrorString(ret).c_str());
}
}

tvVideoFormatCallbackData callbackData = {this,tvVideoFormatChangeHandler};
Expand Down Expand Up @@ -2280,28 +2273,32 @@ namespace Plugin {

uint32_t AVOutputTV::getSupportedDolbyVisionModes(const JsonObject& parameters, JsonObject& response)
{

LOGINFO("Entry\n");
pic_modes_t *dvModes;
tvDolbyMode_t dvModes[tvMode_Max];
tvDolbyMode_t *dvModesPtr = dvModes; // Pointer to statically allocated tvDolbyMode_t array
unsigned short totalAvailable = 0;
tvError_t ret = GetTVSupportedDolbyVisionModesODM(&dvModes,&totalAvailable);

// Set an initial value to indicate the mode type
dvModes[0] = tvDolbyMode_Dark;

tvError_t ret = GetTVSupportedDolbyVisionModes(&dvModesPtr, &totalAvailable);
if(ret != tvERROR_NONE) {
returnResponse(false);
}
else {
JsonArray SupportedDVModes;

for(int count = 0;count <totalAvailable;count++ ) {
SupportedDVModes.Add(dvModes[count].name);
SupportedDVModes.Add(getDolbyModeStringFromEnum(dvModes[count]));
}

response["supportedDVModes"] = SupportedDVModes;
LOGINFO("Exit\n");
returnResponse(true);
}

}


uint32_t AVOutputTV::getDolbyVisionMode(const JsonObject& parameters, JsonObject& response)
{
LOGINFO("Entry");
Expand Down Expand Up @@ -2376,7 +2373,7 @@ namespace Plugin {

if( isSetRequired("Current",source,"DV") ) {
LOGINFO("Proceed with setDolbyVisionMode\n\n");
ret = SetTVDolbyVisionModeODM(value.c_str());
ret = SetTVDolbyVisionMode(GetDolbyVisionEnumFromModeString(value.c_str()));
}

if(ret != tvERROR_NONE) {
Expand Down Expand Up @@ -2437,7 +2434,7 @@ namespace Plugin {
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());
ret = SetTVDolbyVisionModeODM(dolbyModeValue.c_str());
ret = SetTVDolbyVisionMode((tvDolbyMode_t)dolbyMode);
}
else {
LOGERR("%s : GetLocalParam Failed \n",__FUNCTION__);
Expand Down Expand Up @@ -2822,7 +2819,7 @@ namespace Plugin {
if ( tr181Success == err ) {
//get curren source and if matches save for that alone
tvVideoSrcType_t current_source = VIDEO_SOURCE_IP;
GetCurrentSource(&current_source);
GetCurrentVideoSource(&current_source);

tvVideoFormatType_t current_format = VIDEO_FORMAT_NONE;
GetCurrentVideoFormat(&current_format);
Expand Down Expand Up @@ -3077,7 +3074,7 @@ namespace Plugin {
LOGINFO("Entry\n");
tvVideoSrcType_t currentSource = VIDEO_SOURCE_IP;

tvError_t ret = GetCurrentSource(&currentSource);
tvError_t ret = GetCurrentVideoSource(&currentSource);
if(ret != tvERROR_NONE) {
response["currentVideoSource"] = "NONE";
returnResponse(false);
Expand Down
49 changes: 49 additions & 0 deletions AVOutput/AVOutputTV.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include "string.h"
#include <set>
#include <boost/filesystem.hpp>
#include <boost/property_tree/ini_parser.hpp>

#include "tvTypes.h"
#include "tvSettings.h"
Expand Down Expand Up @@ -67,6 +69,49 @@
#define STRING_DEFAULT "Default"
#define STRING_SOURCE "Source."
#define CREATE_DIRTY(__X__) (__X__+=STRING_DIRTY)
#define CAPABLITY_FILE_NAME "pq_capabilities.ini"


class CIniFile
{
std::string m_path;
std::string opt_path;
boost::property_tree::ptree m_data;

public:
CIniFile(const std::string & filename, const std::string & filepath = "/etc/" )
{
opt_path = "/opt/panel/";
m_path = filepath;
m_path.append(filename);
opt_path.append(filename);

if(!boost::filesystem::exists( opt_path)) {
std::cout << "AVOutput : Using " << m_path <<std::endl;
boost::property_tree::ini_parser::read_ini(m_path, m_data);
}
else {
std::cout << "AVOutput : Using " << opt_path << std::endl;
boost::property_tree::ini_parser::read_ini(opt_path, m_data);
}
}

~CIniFile()
{
}

template <typename T>
T Get(const std::string & key)
{
return m_data.get<T>(key);
}

template <typename T>
void Set(const std::string & key, const T & value){
//TODO DD: Not required currently
//m_data.put(key, value);
}
};

namespace WPEFramework {
namespace Plugin {
Expand Down Expand Up @@ -217,10 +262,14 @@ class AVOutputTV : public AVOutputBase {
tvError_t getParamsCaps(std::vector<std::string> &range, std::vector<std::string> &pqmode, std::vector<std::string> &source,
std::vector<std::string> &format,std::string param , std::string & isPlatformSupport,
std::vector<std::string> & index);
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);
void getDimmingModeStringFromEnum(int value, std::string &toStore);
void getColorTempStringFromEnum(int value, std::string &toStore);
int getCurrentPictureMode(char *picMode);
int getDolbyParamToSync(int sourceIndex, int formatIndex, int& value);
tvDolbyMode_t GetDolbyVisionEnumFromModeString(const char* modeString);
std::string getDolbyModeStringFromEnum( tvDolbyMode_t mode);
JsonArray getSupportedVideoSource(void);
int getAvailableCapabilityModesWrapper(std::string param, std::string & outparam);
Expand Down
Loading

0 comments on commit 5205a91

Please sign in to comment.