Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
2 changes: 1 addition & 1 deletion ds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ all: install

library: $(OBJS)
@echo "Building $(LIBNAMEFULL) ...."
$(CXX) $(OBJS) $(CFLAGS) $(DSHAL_LDFLAGS) -L$(INSTALL)/lib -ldshalcli -shared -o $(LIBNAMEFULL)
$(CXX) $(OBJS) $(CFLAGS) $(DSHAL_LDFLAGS) -L$(INSTALL)/lib -ldshalcli -ldshalsrv -shared -o $(LIBNAMEFULL)
$(CXX) $(OBJS) $(CFLAGS) -L$(INSTALL)/lib -ldshalcli -shared -o $(LIBNAMECLI)

%.o: %.cpp
Expand Down
229 changes: 228 additions & 1 deletion 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, 418 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 @@ -35,6 +35,23 @@
#include "stdlib.h"
#include "dslogger.h"

#include <dlfcn.h>
#include "libIARM.h"
#include "libIBus.h"
#include "iarmUtil.h"

#define IARM_BUS_Lock(lock) pthread_mutex_lock(&dsLock)
#define IARM_BUS_Unlock(lock) pthread_mutex_unlock(&dsLock)
extern dsAudioTypeConfig_t kConfig_audio [dsAUDIOPORT_TYPE_MAX];
extern dsAudioPortConfig_t kPort_audio [dsAUDIOPORT_TYPE_MAX];
extern int kConfig_size, kPort_size;
static dsAudioTypeConfig_t *kConfigs1 = NULL;
static dsAudioPortConfig_t *kPorts1 = NULL;
int *pKConSize, *pKPortSize;


static pthread_mutex_t dsLock = PTHREAD_MUTEX_INITIALIZER;

namespace device {

//To Make the instance as thread-safe, using = default, that can request special methods from the compiler. They are Special because only compiler can create them.
Expand Down Expand Up @@ -108,6 +125,168 @@
return supportedTypes;
}

bool searchConfigs()
{
//static dsAudioTypeConfig_t *kConfigs1 = NULL;
//static dsAudioPortConfig_t *kPorts1 = NULL;
int kConfig_size_local = -1, kPort_size_local = -1;
int kConfig_size_dl = -1, kPort_size_dl = -1;
IARM_BUS_Lock(lock);
//if ( kConfigs1 == NULL)
{
void *dllib = dlopen("libdshalsrv.so", RTLD_LAZY);
if (dllib) {
kConfigs1 = (dsAudioTypeConfig_t *) dlsym(dllib, "kConfig_audio");
if (kConfigs1) {
INT_DEBUG("kConfig_audio is defined and loaded kConfigs1 = %p\r\n", kConfigs1);
printf("%d:%s: kConfig_audio is defined and loaded kConfigs1 = %p\n", __LINE__, __func__, kConfigs1);
}
else {
INT_INFO("kConfig_audio is not defined\r\n");
printf("%d:%s: kConfig_audio is not defined\n", __LINE__, __func__);
IARM_BUS_Unlock(lock);
dlclose(dllib);
//return IARM_RESULT_INVALID_STATE;
}
kPorts1 = (dsAudioPortConfig_t *) dlsym(dllib, "kPort_audio");
if (kPorts1) {
INT_DEBUG("kPort_audio is defined and loaded kPorts1 = %p\r\n", kPorts1);
printf("%d:%s: kPort_audio is defined and loaded kPorts1 = %p\n", __LINE__, __func__, kPorts1);
}
else {
INT_INFO("kPort_audio is not defined\r\n");
printf("%d:%s: kPort_audio is not defined\n", __LINE__, __func__);
IARM_BUS_Unlock(lock);
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double unlock

"pthread_mutex_unlock" unlocks "dsLock" while it is unlocked.

Medium Impact, CWE-765
LOCK

//dlclose(dllib);
//return IARM_RESULT_INVALID_STATE;
}
pKConSize = (int *) dlsym(dllib, "kConfig_size");
pKPortSize = (int *) dlsym(dllib, "kPort_size");
if(pKConSize)
{
kConfig_size_local = *pKConSize;
printf("%d:%s: pKConSize is defined and loaded kConfig_size_local = %d\n", __LINE__, __func__, kConfig_size_local);
}
else
{
printf("%d:%s: pKConSize is not defined\n", __LINE__, __func__);
kConfig_size_local = -1;
}
if(pKPortSize)
{
kPort_size_local = *pKPortSize;
printf("%d:%s: pKPortSize is defined and loaded kPort_size_local = %d\n", __LINE__, __func__, kPort_size_local);
}
else
{
printf("%d:%s: pKPortSize is not defined\n", __LINE__, __func__);
kPort_size_local = -1;
}
dlclose(dllib);
}
else {
INT_ERROR("Opening libdshalsrv.so failed\r\n");
printf("%d:%s: Opening libdshalsrv.so failed\n", __LINE__, __func__);
}
}

//if ( kPorts1 == NULL)
{
void *dllib = dlopen("libdshalsrv.so", RTLD_LAZY);
if (dllib) {
kPorts1 = (dsAudioPortConfig_t *) dlsym(dllib, "kPort_audio");
if (kPorts1) {
INT_DEBUG("kPort_audio is defined and loaded kPorts1 = %p\r\n", kPorts1);
printf("%d:%s: kPort_audio is defined and loaded kPorts1 = %p\n", __LINE__, __func__, kPorts1);
}
else {
INT_INFO("kPort_audio is not defined\r\n");
printf("%d:%s: kPort_audio is not defined\n", __LINE__, __func__);
IARM_BUS_Unlock(lock);
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double unlock

"pthread_mutex_unlock" unlocks "dsLock" while it is unlocked.

Medium Impact, CWE-765
LOCK

Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double unlock

"pthread_mutex_unlock" unlocks "dsLock" while it is unlocked.

Medium Impact, CWE-765
LOCK

dlclose(dllib);
//return IARM_RESULT_INVALID_STATE;
}
dlclose(dllib);
}
else {
INT_ERROR("Opening libdshalsrv.so failed\r\n");
printf("%d:%s: Opening libdshalsrv.so failed\n", __LINE__, __func__);
}
}
IARM_BUS_Unlock(lock);
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double unlock

"pthread_mutex_unlock" unlocks "dsLock" while it is unlocked.

Medium Impact, CWE-765
LOCK

Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double unlock

"pthread_mutex_unlock" unlocks "dsLock" while it is unlocked.

Medium Impact, CWE-765
LOCK

Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Double unlock

"pthread_mutex_unlock" unlocks "dsLock" while it is unlocked.

Medium Impact, CWE-765
LOCK

kConfig_size_dl = dsUTL_DIM(kConfigs1);
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Incorrect sizeof expression

The expression "sizeof (kConfigs1) / sizeof (kConfigs1[0])" is suspicious. Note that "kConfigs1" is a pointer and therefore the division will not return the number of array elements which may have been the intent.

Medium Impact, CWE-467
BAD_SIZEOF

kPort_size_dl = dsUTL_DIM(kPorts1);
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Incorrect sizeof expression

The expression "sizeof (kPorts1) / sizeof (kPorts1[0])" is suspicious. Note that "kPorts1" is a pointer and therefore the division will not return the number of array elements which may have been the intent.

Medium Impact, CWE-467
BAD_SIZEOF

printf("%d:%s: dsUTL_DIM kConfig_size_dl = %d kPort_size_dl = %d\n", __LINE__, __func__, kConfig_size_dl, kPort_size_dl);
#if 1
printf("\n\n=========================================================================================================================\n\n");
printf("\n%d:%s print configs dlsym\n", __LINE__, __func__);

for (size_t i = 0; i < kConfig_size_local; i++) {
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Negative loop bound

Using unsigned variable "kConfig_size_local" in a loop exit condition.

Medium Impact, CWE-606
NEGATIVE_RETURNS

const dsAudioTypeConfig_t *typeCfg = &kConfigs1[i];
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Data race condition

Accessing "kConfigs1" without holding lock "dsLock". Elsewhere, "kConfigs1" is written to with "dsLock" held 1 out of 1 times.

Medium Impact, CWE-366
MISSING_LOCK

AudioOutputPortType &aPortType = AudioOutputPortType::getInstance(typeCfg->typeId);
aPortType.enable();
printf("%d:%s: typeCfg->typeId = %d\n", __LINE__, __func__, typeCfg->typeId);
printf("%d:%s: typeCfg->name = %s\n", __LINE__, __func__, typeCfg->name);
printf("%d:%s: typeCfg->numSupportedEncodings = %zu\n", __LINE__, __func__, typeCfg->numSupportedEncodings);
printf("%d:%s: typeCfg->numSupportedCompressions = %zu\n", __LINE__, __func__, typeCfg->numSupportedCompressions);
printf("%d:%s: typeCfg->numSupportedStereoModes = %zu\n", __LINE__, __func__, typeCfg->numSupportedStereoModes);
}


/*
* set up ports based on kPorts[]
*/
for (size_t i = 0; i < kPort_size_local; i++) {
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Negative loop bound

Using unsigned variable "kPort_size_local" in a loop exit condition.

Medium Impact, CWE-606
NEGATIVE_RETURNS

const dsAudioPortConfig_t *port = &kPorts1[i];
printf("%d:%s: port->id.type = %d\n", __LINE__, __func__, port->id.type);
printf("%d:%s: port->id.index = %d\n", __LINE__, __func__, port->id.index);
}
printf("\n\n=========================================================================================================================\n\n");
#else
printf("\n\n=========================================================================================================================\n\n");
printf("\n%d:%s print configs using extern\n", __LINE__, __func__);
//printf("%d:%s: size of(kConfig_audio) = %d size of(kPort_audio) = %d\n", __LINE__, __func__, kConfig_size, kPort_size);
//kConfig_size_local = kConfig_size;
//kPort_size_local = kPort_size;

if(kConfigs1 != NULL)
{
for (size_t i = 0; i < kConfig_size_local; i++) {
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Negative loop bound

Using unsigned variable "kConfig_size_local" in a loop exit condition.

Medium Impact, CWE-606
NEGATIVE_RETURNS

const dsAudioTypeConfig_t *typeCfg = &kConfig_audio[i];
AudioOutputPortType &aPortType = AudioOutputPortType::getInstance(typeCfg->typeId);
aPortType.enable();
printf("%d:%s: typeCfg->typeId = %d\n", __LINE__, __func__, typeCfg->typeId);
printf("%d:%s: typeCfg->name = %s\n", __LINE__, __func__, typeCfg->name);
printf("%d:%s: typeCfg->numSupportedEncodings = %zu\n", __LINE__, __func__, typeCfg->numSupportedEncodings);
printf("%d:%s: typeCfg->numSupportedCompressions = %zu\n", __LINE__, __func__, typeCfg->numSupportedCompressions);
printf("%d:%s: typeCfg->numSupportedStereoModes = %zu\n", __LINE__, __func__, typeCfg->numSupportedStereoModes);
}
}
else
{
printf("%d:%s: kConfig_audio is NULL\n", __LINE__, __func__);
}
if(kPorts1 != NULL)
{
/*
* set up ports based on kPorts[]
*/
for (size_t i = 0; i < kPort_size_local; i++) {
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Negative loop bound

Using unsigned variable "kPort_size_local" in a loop exit condition.

Medium Impact, CWE-606
NEGATIVE_RETURNS

const dsAudioPortConfig_t *port = &kPort_audio[i];
printf("%d:%s: port->id.type = %d\n", __LINE__, __func__, port->id.type);
printf("%d:%s: port->id.index = %d\n", __LINE__, __func__, port->id.index);
}
}
else
{
printf("%d:%s: kPort_audio is NULL\n", __LINE__, __func__);
}
printf("\n\n=========================================================================================================================\n\n");
#endif

return (kConfigs1 || kPorts1);
}

void AudioOutputPortConfig::load()
{
try {
Expand All @@ -132,7 +311,7 @@
_aPortTypes.push_back(AudioOutputPortType(i));

}

#if 1
/*
* Initialize Audio portTypes (encodings, compressions etc.)
* and its port instances (db, level etc)
Expand Down Expand Up @@ -165,6 +344,54 @@
_aPorts.push_back(AudioOutputPort((port->id.type), port->id.index, i));
_aPortTypes.at(port->id.type).addPort(_aPorts.at(i));
}
searchConfigs();
#else //gsk
if(searchConfigs())
{
/*if(kConfig_audio == NULL || kPort_audio == NULL) {
throw IllegalArgumentException();
}*/
//dsAudioTypeConfig_t *kConfigs = kConfig_audio;
//dsAudioPortConfig_t *kPorts = kPort_audio;
/*
* Initialize Audio portTypes (encodings, compressions etc.)
* and its port instances (db, level etc)
*/
for (size_t i = 0; i < dsUTL_DIM(kConfigs1); i++) {
const dsAudioTypeConfig_t *typeCfg = &kConfigs1[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(kPorts1); i++) {
const dsAudioPortConfig_t *port = &kPorts1[i];
_aPorts.push_back(AudioOutputPort((port->id.type), port->id.index, i));
_aPortTypes.at(port->id.type).addPort(_aPorts.at(i));
}
}
else
{
printf("%d:%s: kConfig and kPorts are not available\n", __LINE__, __func__);
}
#endif

}
catch(const Exception &e) {
Expand Down
126 changes: 126 additions & 0 deletions rpc/srv/dsAudio.c
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 rpc/srv/dsAudio.c

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 'rpc/srv/dsAudio.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/b34ed54, 7184 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/b34ed545b533a0cf4d29d221cc23daad47f32644.tar.gz, file: rpc/srv/dsAudio.c)

Check failure on line 3 in rpc/srv/dsAudio.c

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 'rpc/srv/dsAudio.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2003, 7184 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-2003.tar.gz, file: rpc/srv/dsAudio.c)

Check failure on line 3 in rpc/srv/dsAudio.c

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 'rpc/srv/dsAudio.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2009, 7184 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-2009.tar.gz, file: rpc/srv/dsAudio.c)

Check failure on line 3 in rpc/srv/dsAudio.c

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 'rpc/srv/dsAudio.c' (Match: rdk/components/generic/devicesettings/rdk/components/generic/devicesettings/2102, 7184 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/devicesettings/+archive/rdk-dev-2102.tar.gz, file: rpc/srv/dsAudio.c)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -53,6 +53,132 @@

#include "safec_lib.h"

//const dsAudioTypeConfig_t kConfig_audio ;
//const dsAudioPortConfig_t kPort_audio ;

/*
* Setup the supported configurations here.
*/
#ifdef HAS_SPDIF_SUPPORT
static const dsAudioPortType_t kSupportedPortTypes1[] = { dsAUDIOPORT_TYPE_SPDIF, dsAUDIOPORT_TYPE_SPEAKER, dsAUDIOPORT_TYPE_HDMI_ARC, dsAUDIOPORT_TYPE_HEADPHONE };
#else
static const dsAudioPortType_t kSupportedPortTypes1[] = { dsAUDIOPORT_TYPE_SPEAKER, dsAUDIOPORT_TYPE_HDMI_ARC };
#endif
#ifdef HAS_SPDIF_SUPPORT
static const dsAudioEncoding_t kSupportedSPDIFEncodings1[] = { dsAUDIO_ENC_PCM, dsAUDIO_ENC_AC3, };
static const dsAudioCompression_t kSupportedSPDIFCompressions1[] = { dsAUDIO_CMP_NONE, dsAUDIO_CMP_LIGHT, dsAUDIO_CMP_MEDIUM, dsAUDIO_CMP_HEAVY, };
static const dsAudioStereoMode_t kSupportedSPDIFStereoModes1[] = { dsAUDIO_STEREO_STEREO, dsAUDIO_STEREO_SURROUND, dsAUDIO_STEREO_PASSTHRU };
#endif
#ifdef HAS_HEADPHONE_SUPPORT
static const dsAudioEncoding_t kSupportedHEADPHONEEncodings1[] = { dsAUDIO_ENC_PCM, };
static const dsAudioCompression_t kSupportedHEADPHONECompressions1[] = { dsAUDIO_CMP_NONE, dsAUDIO_CMP_LIGHT, dsAUDIO_CMP_MEDIUM, dsAUDIO_CMP_HEAVY, };
static const dsAudioStereoMode_t kSupportedHEADPHONEStereoModes1[] = { dsAUDIO_STEREO_STEREO, dsAUDIO_STEREO_SURROUND, };
#endif
static const dsAudioEncoding_t kSupportedSPEAKEREncodings1[] = { dsAUDIO_ENC_PCM, dsAUDIO_ENC_AC3, };
static const dsAudioCompression_t kSupportedSPEAKERCompressions1[] = { dsAUDIO_CMP_NONE, dsAUDIO_CMP_LIGHT, dsAUDIO_CMP_MEDIUM, dsAUDIO_CMP_HEAVY, };
static const dsAudioStereoMode_t kSupportedSPEAKERStereoModes1[] = { dsAUDIO_STEREO_STEREO, dsAUDIO_STEREO_SURROUND, };

static const dsAudioEncoding_t kSupportedARCEncodings1[] = { dsAUDIO_ENC_PCM, dsAUDIO_ENC_AC3, };
static const dsAudioCompression_t kSupportedARCCompressions1[] = { dsAUDIO_CMP_NONE, dsAUDIO_CMP_LIGHT, dsAUDIO_CMP_MEDIUM, dsAUDIO_CMP_HEAVY, };
static const dsAudioStereoMode_t kSupportedARCStereoModes1[] = { dsAUDIO_STEREO_STEREO, dsAUDIO_STEREO_SURROUND, dsAUDIO_STEREO_PASSTHRU };


static const dsAudioTypeConfig_t kConfig_audio[]= {
#ifdef HAS_SPDIF_SUPPORT
{
/*.typeId = */ dsAUDIOPORT_TYPE_SPDIF,
/*.name = */ "SPDIF", //SPDIF
/*.numSupportedCompressions = */dsUTL_DIM(kSupportedSPDIFCompressions1),
/*.compressions = */ kSupportedSPDIFCompressions1,
/*.numSupportedEncodings = */ dsUTL_DIM(kSupportedSPDIFEncodings1),
/*.encodings = */ kSupportedSPDIFEncodings1,
/*.numSupportedStereoModes = */ dsUTL_DIM(kSupportedSPDIFStereoModes1),
/*.stereoModes = */ kSupportedSPDIFStereoModes1,
},
#endif
#ifdef HAS_HEADPHONE_SUPPORT
{
/*.typeId = */ dsAUDIOPORT_TYPE_HEADPHONE,
/*.name = */ "HEADPHONE", //HEADPHONE
/*.numSupportedCompressions = */dsUTL_DIM(kSupportedHEADPHONECompressions1),
/*.compressions = */ kSupportedHEADPHONECompressions1,
/*.numSupportedEncodings = */ dsUTL_DIM(kSupportedHEADPHONEEncodings1),
/*.encodings = */ kSupportedHEADPHONEEncodings1,
/*.numSupportedStereoModes = */ dsUTL_DIM(kSupportedHEADPHONEStereoModes1),
/*.stereoModes = */ kSupportedHEADPHONEStereoModes1,
},
#endif
{
/*.typeId = */ dsAUDIOPORT_TYPE_SPEAKER,
/*.name = */ "SPEAKER", //SPEAKER
/*.numSupportedCompressions = */dsUTL_DIM(kSupportedSPEAKERCompressions1),
/*.compressions = */ kSupportedSPEAKERCompressions1,
/*.numSupportedEncodings = */ dsUTL_DIM(kSupportedSPEAKEREncodings1),
/*.encodings = */ kSupportedSPEAKEREncodings1,
/*.numSupportedStereoModes = */ dsUTL_DIM(kSupportedSPEAKERStereoModes1),
/*.stereoModes = */ kSupportedSPEAKERStereoModes1,
},
{
/*.typeId = */ dsAUDIOPORT_TYPE_HDMI_ARC,
/*.name = */ "HDMI_ARC", //ARC/eARC
/*.numSupportedCompressions = */dsUTL_DIM(kSupportedARCCompressions1),
/*.compressions = */ kSupportedARCCompressions1,
/*.numSupportedEncodings = */ dsUTL_DIM(kSupportedARCEncodings1),
/*.encodings = */ kSupportedARCEncodings1,
/*.numSupportedStereoModes = */ dsUTL_DIM(kSupportedARCStereoModes1),
/*.stereoModes = */ kSupportedARCStereoModes1,
}
};

static const dsVideoPortPortId_t connectedVOPs1[dsAUDIOPORT_TYPE_MAX][dsVIDEOPORT_TYPE_MAX] = {
{/*VOPs connected to LR Audio */

},
{/*VOPs connected to HDMI Audio */
},
{/*VOPs connected to SPDIF Audio */
{dsVIDEOPORT_TYPE_INTERNAL, 0},
},
{/*VOPs connected to SPEAKER Audio */
{dsVIDEOPORT_TYPE_INTERNAL, 0},
},
{/*VOPs connected to ARC Audio */
{dsVIDEOPORT_TYPE_INTERNAL, 0},
},
{/*VOPs connected to HEADPHONE Audio */
{dsVIDEOPORT_TYPE_INTERNAL, 0},
}
};

static const dsAudioPortConfig_t kPort_audio[] = {
#ifdef HAS_SPDIF_SUPPORT
{
/*.typeId = */ {dsAUDIOPORT_TYPE_SPDIF, 0},
/*.connectedVOPs = */ connectedVOPs1[dsAUDIOPORT_TYPE_SPDIF],
},
#endif
#ifdef HAS_HEADPHONE_SUPPORT
{
/*.typeId = */ {dsAUDIOPORT_TYPE_HEADPHONE, 0},
/*.connectedVOPs = */ connectedVOPs1[dsAUDIOPORT_TYPE_HEADPHONE],
},
#endif
{
/*.typeId = */ {dsAUDIOPORT_TYPE_SPEAKER, 0},
/*.connectedVOPs = */ connectedVOPs1[dsAUDIOPORT_TYPE_SPEAKER],
},
{
/*.typeId = */ {dsAUDIOPORT_TYPE_HDMI_ARC, 0},
/*.connectedVOPs = */ connectedVOPs1[dsAUDIOPORT_TYPE_HDMI_ARC],
}
};

int kConfig_size = sizeof(kConfig_audio) / sizeof(kConfig_audio[0]);
int kPort_size = sizeof(kPort_audio) / sizeof(kPort_audio[0]);




static int m_isInitialized = 0;
static int m_isPlatInitialized = 0;

Expand Down
Loading