Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d3a2867
RDKEMW-11168, RDKEMW-4848: pass the proper handle to dsEnableHDCP (#182)
arun-madhavan-013 Dec 5, 2025
6abd424
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Oct 30, 2025
59bbd5c
fix build issue
santoshcomcast Oct 30, 2025
b08a24d
fix build issue
santoshcomcast Oct 30, 2025
9cc6b5f
addressed review comments
santoshcomcast Nov 5, 2025
ade5a61
fix build issue
santoshcomcast Nov 5, 2025
6ac6e50
fix build issue
santoshcomcast Nov 5, 2025
2dc944b
fix build issue
santoshcomcast Nov 5, 2025
f6f3d48
fix build issue
santoshcomcast Nov 5, 2025
441361b
fix build issue
santoshcomcast Nov 5, 2025
8d36de9
fix coverity issue and removed unwanted code.
santoshcomcast Nov 5, 2025
c676229
Fix build issue.
santoshcomcast Nov 5, 2025
968901d
Addressed review comments.
santoshcomcast Nov 6, 2025
513b3c7
Addressed review comments.
santoshcomcast Nov 6, 2025
fb4785d
addressed review comments.
santoshcomcast Nov 10, 2025
35661b4
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 11, 2025
4c52eeb
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 12, 2025
e645685
fix build issue
santoshcomcast Nov 12, 2025
db4fa61
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 13, 2025
f5838f4
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 14, 2025
82e1bf4
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 17, 2025
2ee6669
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 17, 2025
f68259b
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 17, 2025
45e0530
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 20, 2025
43ad5ad
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 20, 2025
de32c1b
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Nov 20, 2025
efe2f43
debug. disable dumpconfig and add logs
santoshcomcast Dec 9, 2025
a84c6eb
enable debugconfig
santoshcomcast Dec 10, 2025
2b96a08
move the debug prints within if condtion for all config dumpconfig
santoshcomcast Dec 10, 2025
703701e
added few more logs, lock_guard in searchconfig
santoshcomcast Dec 10, 2025
0ba55bf
add delay while every load
santoshcomcast Dec 10, 2025
b69cb63
RDKEMW-8587: Fix dl symbol crash issue
yuvaramachandran-gurusamy Dec 11, 2025
0b96ee2
RDKEMW-8587: Fix dl symbol crash issue
yuvaramachandran-gurusamy Dec 11, 2025
32d57fb
RDKEMW-8587: Fix dl symbol crash issue
yuvaramachandran-gurusamy Dec 11, 2025
7ae4eb6
RDKEMW-8587: Fix build error
yuvaramachandran-gurusamy Dec 11, 2025
cca3783
RDKEMW-8587: Fix FPD std::logical_error crash issue and enhanced the …
yuvaramachandran-gurusamy Dec 12, 2025
01776ad
RDKEMW-8587: Fixed the coverity issues
yuvaramachandran-gurusamy Dec 12, 2025
17564c6
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Dec 16, 2025
b8cdf99
RDKEMW-8587: consume the config variables using dlsym() in MW.
santoshcomcast Dec 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 149 additions & 60 deletions ds/audioOutputPortConfig.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in ds/audioOutputPortConfig.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ds/audioOutputPortConfig.cpp' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2.1-20161031, 280 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/2.1-20161031.tar.gz, file: ds/audioOutputPortConfig.cpp)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -34,6 +34,8 @@
#include "dsUtl.h"
#include "stdlib.h"
#include "dslogger.h"
#include <dlfcn.h>
#include "manager.hpp"

namespace device {

Expand Down Expand Up @@ -108,68 +110,155 @@
return supportedTypes;
}

void AudioOutputPortConfig::load()
void dumpconfig(audioConfigs_t *config)
{
try {
/*
* Load Constants First.
*/
for (int i = 0; i < dsAUDIO_ENC_MAX; i++) {
_aEncodings.push_back(AudioEncoding(i));
}

for (int i = 0; i < dsAUDIO_CMP_MAX; i++) {
_aCompressions.push_back(AudioCompression(i));

}

for (int i = 0; i < dsAUDIO_STEREO_MAX; i++) {
_aStereoModes.push_back(AudioStereoMode(i));

}

for (int i = 0; i < dsAUDIOPORT_TYPE_MAX; i++) {
_aPortTypes.push_back(AudioOutputPortType(i));

}

/*
* Initialize Audio portTypes (encodings, compressions etc.)
* and its port instances (db, level etc)
*/
for (size_t i = 0; i < dsUTL_DIM(kConfigs); i++) {
const dsAudioTypeConfig_t *typeCfg = &kConfigs[i];
AudioOutputPortType &aPortType = AudioOutputPortType::getInstance(typeCfg->typeId);
aPortType.enable();
for (size_t j = 0; j < typeCfg->numSupportedEncodings; j++) {
aPortType.addEncoding(AudioEncoding::getInstance(typeCfg->encodings[j]));
_aEncodings.at(typeCfg->encodings[j]).enable();
}
for (size_t j = 0; j < typeCfg->numSupportedCompressions; j++) {
aPortType.addCompression(typeCfg->compressions[j]);
_aCompressions.at(typeCfg->compressions[j]).enable();

}
for (size_t j = 0; j < typeCfg->numSupportedStereoModes; j++) {
aPortType.addStereoMode(typeCfg->stereoModes[j]);
_aStereoModes.at(typeCfg->stereoModes[j]).enable();

}
}

/*
* set up ports based on kPorts[]
*/
for (size_t i = 0; i < dsUTL_DIM(kPorts); i++) {
const dsAudioPortConfig_t *port = &kPorts[i];
_aPorts.push_back(AudioOutputPort((port->id.type), port->id.index, i));
_aPortTypes.at(port->id.type).addPort(_aPorts.at(i));
}
if (nullptr == config) {
INT_ERROR("Audio config is NULL");
return;
}
if ( -1 == access("/opt/dsMgrDumpDeviceConfigs", F_OK) ) {
INT_INFO("Dumping of Device configs is disabled");
return;
}

int configSize = -1, portSize = -1;
INT_INFO("\n=============== Starting to Dump Audio Configs ===============\n");
if( nullptr != config->pKConfigs )
{
configSize = (config->pKConfigSize) ? *(config->pKConfigSize) : -1;

for (int i = 0; i < configSize; i++) {
const dsAudioTypeConfig_t *typeCfg = &(config->pKConfigs[i]);
INT_INFO("typeCfg->typeId = %d", typeCfg->typeId);
INT_INFO("typeCfg->name = %s", typeCfg->name);
INT_INFO("typeCfg->numSupportedEncodings = %zu", typeCfg->numSupportedEncodings);
INT_INFO("typeCfg->numSupportedCompressions = %zu", typeCfg->numSupportedCompressions);
INT_INFO("typeCfg->numSupportedStereoModes = %zu", typeCfg->numSupportedStereoModes);
}
}
else
{
INT_ERROR("kAudioConfigs is NULL");
}

if( nullptr != config->pKPorts )
{
portSize = (config->pKPortSize) ? *(config->pKPortSize) : -1;
for (int i = 0; i < portSize; i++) {
const dsAudioPortConfig_t *portCfg = &(config->pKPorts[i]);
INT_INFO("portCfg->id.type = %d", portCfg->id.type);
INT_INFO("portCfg->id.index = %d", portCfg->id.index);
}
}
else
{
INT_ERROR("kAudioPorts is NULL");
}

INT_INFO("\n=============== Dump Audio Configs done ===============\n");
}

}
catch(const Exception &e) {
throw e;
}
void AudioOutputPortConfig::load(audioConfigs_t* dynamicAudioConfigs)
{
int configSize = -1, portSize = -1;
audioConfigs_t configuration = {0};

INT_INFO("Enter function");
try {
/*
* Load Constants First.
*/
for (int i = 0; i < dsAUDIO_ENC_MAX; i++) {
_aEncodings.push_back(AudioEncoding(i));
}

for (int i = 0; i < dsAUDIO_CMP_MAX; i++) {
_aCompressions.push_back(AudioCompression(i));

}

for (int i = 0; i < dsAUDIO_STEREO_MAX; i++) {
_aStereoModes.push_back(AudioStereoMode(i));

}

for (int i = 0; i < dsAUDIOPORT_TYPE_MAX; i++) {
_aPortTypes.push_back(AudioOutputPortType(i));

}

INT_INFO("Using '%s' config", dynamicAudioConfigs ? "dynamic" : "static");
if ( nullptr != dynamicAudioConfigs )
{
configuration = *dynamicAudioConfigs;
configSize = (configuration.pKConfigSize) ? *(configuration.pKConfigSize) : -1;
portSize = (configuration.pKPortSize) ? *(configuration.pKPortSize) : -1;
}
else {
configuration.pKConfigs = kConfigs;
configSize = dsUTL_DIM(kConfigs);
configuration.pKConfigSize = &configSize;
configuration.pKPorts = kPorts;
portSize = dsUTL_DIM(kPorts);
configuration.pKPortSize = &portSize;
}

INT_INFO("Audio Config[%p] ConfigSize[%d] Ports[%p] PortSize[%d]",
configuration.pKConfigs,
configSize,
configuration.pKPorts,
portSize);

dumpconfig(&configuration);

/*
* Check if configs are loaded properly
*/
if (( nullptr != configuration.pKConfigs ) && ( nullptr != configuration.pKPorts ))
{
/*
* Initialize Audio portTypes (encodings, compressions etc.)
* and its port instances (db, level etc)
*/
for (int i = 0; i < configSize; i++) {
const dsAudioTypeConfig_t *typeCfg = &(configuration.pKConfigs[i]);
AudioOutputPortType &aPortType = AudioOutputPortType::getInstance(typeCfg->typeId);
aPortType.enable();
for (int j = 0; j < typeCfg->numSupportedEncodings; j++) {
const dsAudioEncoding_t* encoding = &typeCfg->encodings[j];
aPortType.addEncoding(AudioEncoding::getInstance(*encoding));
_aEncodings.at(*encoding).enable();
}
for (int j = 0; j < typeCfg->numSupportedCompressions; j++) {
const dsAudioCompression_t* compression = &typeCfg->compressions[j];
aPortType.addCompression(*compression);
_aCompressions.at(*compression).enable();
}
for (int j = 0; j < typeCfg->numSupportedStereoModes; j++) {
const dsAudioStereoMode_t *stereoMode = &typeCfg->stereoModes[j];
aPortType.addStereoMode(*stereoMode);
_aStereoModes.at(*stereoMode).enable();
}
}

/*
* set up ports based on kPorts[]
*/
for (int i = 0; i < portSize; i++) {
const dsAudioPortConfig_t *portCfg = &configuration.pKPorts[i];
_aPorts.push_back(AudioOutputPort((portCfg->id.type), portCfg->id.index, i));
_aPortTypes.at(portCfg->id.type).addPort(_aPorts.at(i));
}
INT_INFO("Audio Configs loaded successfully");
}
else {
INT_ERROR("Audio Configs loading failed");
}
}
catch(const Exception &e) {
throw e;
}
INT_INFO("Exit function");
}

void AudioOutputPortConfig::release()
Expand Down
10 changes: 9 additions & 1 deletion ds/audioOutputPortConfig.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in ds/audioOutputPortConfig.hpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'ds/audioOutputPortConfig.hpp' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2.1-20161031, 85 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/2.1-20161031.tar.gz, file: ds/audioOutputPortConfig.hpp)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -38,6 +38,14 @@
#include <list>
#include <string>

typedef struct audioConfigs
{
const dsAudioTypeConfig_t *pKConfigs;
const dsAudioPortConfig_t *pKPorts;
int *pKConfigSize;
int *pKPortSize;
}audioConfigs_t;

namespace device {

class AudioOutputPortConfig {
Expand Down Expand Up @@ -66,7 +74,7 @@
List<AudioOutputPort> getPorts();
List<AudioOutputPortType> getSupportedTypes();

void load();
void load(audioConfigs_t* dynamicAudioConfigs);
void release();

};
Expand Down
41 changes: 25 additions & 16 deletions ds/dslogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@

#include "dslogger.h"

#include <sys/syscall.h> // for SYS_gettid
#include <unistd.h> // for syscall

#define unlikely(x) (__builtin_expect(!!(x), 0))
#define MAX_LOG_BUFF 512
#define MAX_LOG_BUFF 1024
#define kFormatMessageSize (MAX_LOG_BUFF - 128)

DS_LogCb logCb = NULL;

Expand All @@ -40,29 +44,34 @@ void DS_RegisterForLog(DS_LogCb cb)
logCb = cb;
}

int ds_log(int priority, const char* fileName, int lineNum, const char *format, ...)
int ds_log(LogLevel priority, const char* fileName, int lineNum, const char *func, const char *format, ...)
{
char tmp_buff[MAX_LOG_BUFF] = {'\0'};

int offset = snprintf(tmp_buff, MAX_LOG_BUFF, "[%s:%d] ", fileName, lineNum);
char formatted[MAX_LOG_BUFF] = {'\0'};
enum LogLevel {INFO_LEVEL = 0, WARN_LEVEL, ERROR_LEVEL, DEBUG_LEVEL, TRACE_LEVEL};
const char *levelMap[] = { "INFO", "WARN", "ERROR", "DEBUG", "TRACE"};

// formatting error
if (unlikely(offset < 0)) {
offset = 0;
tmp_buff[0] = '\0'; // Ensure buffer is null-terminated if snprintf fails
if (!func || !fileName || !format)
{
return -1;
}

va_list args;
va_start(args, format);
vsnprintf(tmp_buff + offset, MAX_LOG_BUFF - offset, format, args);
va_end(args);
va_list argptr;
va_start(argptr, format);
vsnprintf(formatted, kFormatMessageSize, format, argptr);
va_end(argptr);

if (nullptr != logCb) {
logCb(priority, tmp_buff);
logCb(priority, formatted);
} else {
return printf("%s\n", tmp_buff);
fprintf(stderr, "[DS][%d] %s [%s:%d] %s: %s \n",
(int)syscall(SYS_gettid),
levelMap[static_cast<int>(priority)],
fileName,
lineNum,
func,
formatted);
fflush(stderr);
}

return 0;
}

Expand Down
Loading