mirror of https://github.com/thesofproject/sof.git
module: cadence: Support params for more than 1 codec
We want to be able to play different compress stream types using the same topology: e.g $ cplay -I MP3 -d 0 -c 0 sample.mp3 [ end of playback ] $ cplay -I AAC -d 0 -c 0 sample.aac Some static parameters for compress streams are set up in topology bytes in the form: [0:3]: param ID [4:7]: size in bytes [8:n-1]: data[] We need now a way to specify codec ID, so we borrow 2 bytes from param ID, like this: [0:3]: (param ID, codec ID) [4:7]: size in bytes [8:n-1]: data[] Using 0 for codec ID means 'dont care'. Topologies supporting just 1 codec are not affected and need not to be changed. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This commit is contained in:
parent
29af2df766
commit
376d0520f8
|
@ -260,6 +260,8 @@ static int cadence_codec_apply_config(struct processing_module *mod)
|
|||
{
|
||||
int ret = 0;
|
||||
int size;
|
||||
uint16_t param_id;
|
||||
uint16_t codec_id;
|
||||
struct module_config *cfg;
|
||||
void *data;
|
||||
struct module_param *param;
|
||||
|
@ -291,8 +293,20 @@ static int cadence_codec_apply_config(struct processing_module *mod)
|
|||
param = data;
|
||||
comp_dbg(dev, "cadence_codec_apply_config() applying param %d value %d",
|
||||
param->id, param->data[0]);
|
||||
|
||||
param_id = param->id & 0xFF;
|
||||
codec_id = param->id >> 16;
|
||||
|
||||
/* if the parameter is not for current codec skip it! */
|
||||
if (codec_id && codec_id != cd->api_id) {
|
||||
/* Obtain next parameter */
|
||||
data = (char *)data + param->size;
|
||||
size -= param->size;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Set read parameter */
|
||||
API_CALL(cd, XA_API_CMD_SET_CONFIG_PARAM, param->id,
|
||||
API_CALL(cd, XA_API_CMD_SET_CONFIG_PARAM, param_id,
|
||||
param->data, ret);
|
||||
if (ret != LIB_NO_ERROR) {
|
||||
if (LIB_IS_FATAL_ERROR(ret)) {
|
||||
|
|
Loading…
Reference in New Issue