diff options
author | Guodong Hu <quic_guodhu@quicinc.com> | 2023-08-15 13:37:26 +0800 |
---|---|---|
committer | Guodong Hu <quic_guodhu@quicinc.com> | 2023-09-04 13:15:03 +0800 |
commit | bc3af517534346742a2e753f753a0ad21f51513b (patch) | |
tree | d8f0fabf18bb5338c21819d8b1669c1031eccb2e /src/pcm.c | |
parent | 7c467a1179cca66bb65a4a04f889319e4bfb9b3e (diff) |
Support pcm drain ops
Signed-off-by: Guodong Hu <quic_guodhu@quicinc.com>
Diffstat (limited to 'src/pcm.c')
-rw-r--r-- | src/pcm.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1218,6 +1218,22 @@ int pcm_start(struct pcm *pcm) return 0; } +/** Drains a PCM. + * @param pcm A PCM handle. + * @return On success, zero; on failure, a negative number. + * @ingroup libtinyalsa-pcm + */ +int pcm_drain(struct pcm *pcm) +{ + if (!pcm_is_ready(pcm)) + return -1; + + if (pcm->ops->ioctl(pcm->data, SNDRV_PCM_IOCTL_DRAIN) < 0) + return oops(pcm, errno, "cannot drain channel"); + + return 0; +} + /** Stops a PCM. * @param pcm A PCM handle. * @return On success, zero; on failure, a negative number. |