mirror of https://github.com/thesofproject/sof.git
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:
parent
d4109e090f
commit
2ae18268a8
|
@ -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__ */
|
||||
|
|
Loading…
Reference in New Issue