mirror of https://github.com/thesofproject/sof.git
codec_adapter: update .params() method
This patch updates the .params() method with verification of runtime parameters and stores them in component data for future use. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This commit is contained in:
parent
9d1ebecb8f
commit
e79893ee02
|
@ -225,8 +225,21 @@ static int codec_adapter_prepare(struct comp_dev *dev)
|
|||
static int codec_adapter_params(struct comp_dev *dev,
|
||||
struct sof_ipc_stream_params *params)
|
||||
{
|
||||
comp_dbg(dev, "codec_adapter_params(): codec_adapter doesn't support .params() method.");
|
||||
int ret;
|
||||
struct comp_data *cd = comp_get_drvdata(dev);
|
||||
|
||||
ret = comp_verify_params(dev, 0, params);
|
||||
if (ret < 0) {
|
||||
comp_err(dev, "codec_adapter_params(): comp_verify_params() failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = memcpy_s(&cd->stream_params, sizeof(struct sof_ipc_stream_params),
|
||||
params, sizeof(struct sof_ipc_stream_params));
|
||||
assert(!ret);
|
||||
|
||||
cd->period_bytes = params->sample_container_bytes *
|
||||
params->channels * params->rate / 1000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,6 +183,8 @@ struct comp_data {
|
|||
struct comp_buffer *ca_sink;
|
||||
struct comp_buffer *ca_source;
|
||||
void *runtime_params;
|
||||
struct sof_ipc_stream_params stream_params;
|
||||
uint32_t period_bytes; /** pipeline period bytes */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue