comp: add API to get sample size in bytes

Add an API to get the size of an individual sample in bytes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2017-11-17 15:42:59 +00:00
parent e6b9594d79
commit 094153aece
1 changed files with 15 additions and 0 deletions

View File

@ -335,6 +335,21 @@ static inline uint32_t comp_frame_bytes(struct comp_dev *dev)
}
}
static inline uint32_t comp_sample_bytes(struct comp_dev *dev)
{
/* calculate period size based on params */
switch (dev->params.frame_fmt) {
case SOF_IPC_FRAME_S16_LE:
return 2;
case SOF_IPC_FRAME_S24_4LE:
case SOF_IPC_FRAME_S32_LE:
case SOF_IPC_FRAME_FLOAT:
return 4;
default:
return 0;
}
}
/* XRUN handling */
static inline void comp_underrun(struct comp_dev *dev, struct comp_buffer *source,
uint32_t copy_bytes, uint32_t min_bytes)