Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions src/audio/codec_adapter/codec/cadence.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
#include <sof/audio/codec_adapter/codec/generic.h>
#include <sof/audio/codec_adapter/codec/cadence.h>

/* d8218443-5ff3-4a4c-b388-6cfe07b956aa */
DECLARE_SOF_RT_UUID("cadence_codec", cadence_uuid, 0xd8218443, 0x5ff3, 0x4a4c,
0xb3, 0x88, 0x6c, 0xfe, 0x07, 0xb9, 0x56, 0xaa);

DECLARE_TR_CTX(cadence_tr, SOF_UUID(cadence_uuid), LOG_LEVEL_INFO);

/*****************************************************************************/
/* Cadence API functions array */
/*****************************************************************************/
Expand Down Expand Up @@ -478,3 +484,15 @@ int cadence_codec_free(struct comp_dev *dev)
/* Nothing to do */
return 0;
}

static struct codec_interface cadence_interface = {
.init = cadence_codec_init,
.prepare = cadence_codec_prepare,
.init_process = cadence_codec_init_process,
.process = cadence_codec_process,
.apply_config = cadence_codec_apply_config,
.reset = cadence_codec_reset,
.free = cadence_codec_free
};

DECLARE_CODEC_ADAPTER(cadence_interface, cadence_uuid, cadence_tr);
14 changes: 1 addition & 13 deletions src/audio/codec_adapter/codec/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

#include <sof/audio/codec_adapter/codec/generic.h>
#include <sof/audio/codec_adapter/interfaces.h>

/*****************************************************************************/
/* Local helper functions */
Expand Down Expand Up @@ -77,16 +76,12 @@ codec_load_config(struct comp_dev *dev, void *cfg, size_t size,
return ret;
}

int codec_init(struct comp_dev *dev)
int codec_init(struct comp_dev *dev, struct codec_interface *interface)
{
int ret;
struct comp_data *cd = comp_get_drvdata(dev);
uint32_t codec_id = cd->ca_config.codec_id;
uint32_t interface_id = CODEC_GET_INTERFACE_ID(codec_id);
struct codec_data *codec = &cd->codec;
struct codec_interface *interface = NULL;
uint32_t i;
uint32_t no_of_interfaces = ARRAY_SIZE(interfaces);

comp_info(dev, "codec_init() start");

Expand All @@ -97,13 +92,6 @@ int codec_init(struct comp_dev *dev)

codec->id = codec_id;

/* Find proper interface */
for (i = 0; i < no_of_interfaces; i++) {
if (interfaces[i].id == interface_id) {
interface = &interfaces[i];
break;
}
}
if (!interface) {
comp_err(dev, "codec_init(): could not find codec interface for codec id %x",
codec_id);
Expand Down
32 changes: 24 additions & 8 deletions src/audio/codec_adapter/codec/passthrough.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
// Passthrough codec implementation to demonstrate Codec Adapter API

#include <sof/audio/codec_adapter/codec/generic.h>
#include <sof/audio/codec_adapter/codec/passthrough.h>

int passthrough_codec_init(struct comp_dev *dev)
/* 376b5e44-9c82-4ec2-bc83-10ea101afa8f */
DECLARE_SOF_RT_UUID("passthrough_codec", passthrough_uuid, 0x376b5e44, 0x9c82, 0x4ec2,
0xbc, 0x83, 0x10, 0xea, 0x10, 0x1a, 0xf8, 0x8f);
DECLARE_TR_CTX(passthrough_tr, SOF_UUID(passthrough_uuid), LOG_LEVEL_INFO);

static int passthrough_codec_init(struct comp_dev *dev)
{
comp_info(dev, "passthrough_codec_init() start");
return 0;
}

int passthrough_codec_prepare(struct comp_dev *dev)
static int passthrough_codec_prepare(struct comp_dev *dev)
{
struct codec_data *codec = comp_get_codec(dev);
struct comp_data *cd = comp_get_drvdata(dev);
Expand All @@ -40,7 +44,7 @@ int passthrough_codec_prepare(struct comp_dev *dev)
return 0;
}

int passthrough_codec_init_process(struct comp_dev *dev)
static int passthrough_codec_init_process(struct comp_dev *dev)
{
struct codec_data *codec = comp_get_codec(dev);

Expand All @@ -53,7 +57,7 @@ int passthrough_codec_init_process(struct comp_dev *dev)
return 0;
}

int passthrough_codec_process(struct comp_dev *dev)
static int passthrough_codec_process(struct comp_dev *dev)
{
struct codec_data *codec = comp_get_codec(dev);
struct comp_data *cd = comp_get_drvdata(dev);
Expand All @@ -68,23 +72,23 @@ int passthrough_codec_process(struct comp_dev *dev)
return 0;
}

int passthrough_codec_apply_config(struct comp_dev *dev)
static int passthrough_codec_apply_config(struct comp_dev *dev)
{
comp_info(dev, "passthrough_codec_apply_config()");

/* nothing to do */
return 0;
}

int passthrough_codec_reset(struct comp_dev *dev)
static int passthrough_codec_reset(struct comp_dev *dev)
{
comp_info(dev, "passthrough_codec_reset()");

/* nothing to do */
return 0;
}

int passthrough_codec_free(struct comp_dev *dev)
static int passthrough_codec_free(struct comp_dev *dev)
{
struct codec_data *codec = comp_get_codec(dev);

Expand All @@ -95,3 +99,15 @@ int passthrough_codec_free(struct comp_dev *dev)

return 0;
}

static struct codec_interface passthrough_interface = {
.init = passthrough_codec_init,
.prepare = passthrough_codec_prepare,
.init_process = passthrough_codec_init_process,
.process = passthrough_codec_process,
.apply_config = passthrough_codec_apply_config,
.reset = passthrough_codec_reset,
.free = passthrough_codec_free
};

DECLARE_CODEC_ADAPTER(passthrough_interface, passthrough_uuid, passthrough_tr);
17 changes: 17 additions & 0 deletions src/audio/codec_adapter/codec/waves.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
#define MAX_CONFIG_SIZE_BYTES (8192)
#define NUM_IO_STREAMS (1)

/* d944281a-afe9-4695-a043-d7f62b89538e*/
DECLARE_SOF_RT_UUID("waves_codec", waves_uuid, 0xd944281a, 0xafe9, 0x4695,
0xa0, 0x43, 0xd7, 0xf6, 0x2b, 0x89, 0x53, 0x8e);
DECLARE_TR_CTX(waves_tr, SOF_UUID(waves_uuid), LOG_LEVEL_INFO);

struct waves_codec_data {
uint32_t sample_rate;
uint32_t buffer_bytes;
Expand Down Expand Up @@ -758,3 +763,15 @@ int waves_codec_free(struct comp_dev *dev)
comp_dbg(dev, "waves_codec_free()");
return 0;
}

static struct codec_interface waves_interface = {
.init = waves_codec_init,
.prepare = waves_codec_prepare,
.init_process = waves_codec_init_process,
.process = waves_codec_process,
.apply_config = waves_codec_apply_config,
.reset = waves_codec_reset,
.free = waves_codec_free
};

DECLARE_CODEC_ADAPTER(waves_interface, waves_uuid, waves_tr);
Loading