buffer: add helper to check if buffer format is matched to param

Add a helper buffer_param_match() to check if the configured runtime
buffer frame format/rate/channels are matched to the param ones

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This commit is contained in:
Keyon Jie 2020-04-15 18:17:57 +08:00 committed by Liam Girdwood
parent d4109e090f
commit 2ae18268a8
1 changed files with 21 additions and 0 deletions

View File

@ -295,4 +295,25 @@ static inline int buffer_set_params(struct comp_buffer *buffer,
return 0;
}
static inline bool buffer_params_match(struct comp_buffer *buffer,
struct sof_ipc_stream_params *params,
uint32_t flag)
{
assert(params && buffer);
if ((flag & BUFF_PARAMS_FRAME_FMT) &&
buffer->stream.frame_fmt != params->frame_fmt)
return false;
if ((flag & BUFF_PARAMS_RATE) &&
buffer->stream.rate != params->rate)
return false;
if ((flag & BUFF_PARAMS_CHANNELS) &&
buffer->stream.channels != params->channels)
return false;
return true;
}
#endif /* __SOF_AUDIO_BUFFER_H__ */