Skip to content

Commit

Permalink
RDKTV-32644: Remove ODM specific apis from tvsettings HAL to make it …
Browse files Browse the repository at this point in the history
…generic- phase1
  • Loading branch information
arjunbinusky committed Oct 31, 2024
1 parent 5c3a72f commit a4b35c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
16 changes: 9 additions & 7 deletions AVOutput/AVOutputTV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2274,13 +2274,13 @@ namespace Plugin {
uint32_t AVOutputTV::getSupportedDolbyVisionModes(const JsonObject& parameters, JsonObject& response)
{
LOGINFO("Entry\n");
tvDolbyMode_t *dvModes[1]={0};
tvDolbyMode_t *dvModes[1] = {NULL};
unsigned short totalAvailable = 0;

// Allocate memory for the modes
dvModes[0] = (tvDolbyMode_t *)malloc(MAX_DV_MODES * sizeof(tvDolbyMode_t));
if (dvModes == NULL) {
printf("Memory allocation failed for dvModes\n");
if (dvModes[0] == NULL) {
printf("Memory allocation failed for dvModes[0]\n");
return tvERROR_GENERAL;
}

Expand All @@ -2289,8 +2289,9 @@ namespace Plugin {

tvError_t ret = GetTVSupportedDolbyVisionModes(dvModes, &totalAvailable);
if(ret != tvERROR_NONE) {
if (dvModes != NULL) {
free(dvModes);
if (dvModes[0] != NULL) {
free(dvModes[0]);
dvModes[0] = NULL;
}
returnResponse(false);
}
Expand All @@ -2303,8 +2304,9 @@ namespace Plugin {

response["supportedDVModes"] = SupportedDVModes;
LOGINFO("Exit\n");
if (dvModes != NULL) {
free(dvModes);
if (dvModes[0] != NULL) {
free(dvModes[0]);
dvModes[0] = NULL;
}
returnResponse(true);
}
Expand Down
11 changes: 6 additions & 5 deletions AVOutput/AVOutputTVHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ namespace Plugin {
int AVOutputTV::getDolbyModeIndex(const char * dolbyMode)
{
int mode = 0;
tvDolbyMode_t *dolbyModes[1]={0};
tvDolbyMode_t *dolbyModes[1] = {NULL};
unsigned short totalAvailable = 0;

// Allocate memory for the modes
dolbyModes[0] = (tvDolbyMode_t *)malloc(MAX_DV_MODES * sizeof(tvDolbyMode_t));
if (dolbyModes == NULL) {
printf("Memory allocation failed for dolbyModes\n");
if (dolbyModes[0] == NULL) {
printf("Memory allocation failed for dolbyModes[0]\n");
return tvERROR_GENERAL;
}

Expand All @@ -262,8 +262,9 @@ namespace Plugin {
mode = -1;
printf("(%s):get supported mode is failed\n", __func__);
}
if (dolbyModes != NULL) {
free(dolbyModes);
if (dolbyModes[0] != NULL) {
free(dolbyModes[0]);
dolbyModes[0] = NULL;
}

return mode;
Expand Down

0 comments on commit a4b35c5

Please sign in to comment.