From a667236c6216641f0d6158d554335097f25ee373 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 23 Feb 2022 20:19:00 -0500 Subject: Implement xas_audio_format_eq() Implement xas_audio_format_eq() to compare xas_audio_format objects for equivalence --- include/xas/audio.h | 2 ++ src/audio.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/xas/audio.h b/include/xas/audio.h index 4cf3221..d79615d 100644 --- a/include/xas/audio.h +++ b/include/xas/audio.h @@ -58,6 +58,8 @@ struct _xas_audio_stream { void *ctx; }; +int xas_audio_format_eq(xas_audio_format a, xas_audio_format b); + void xas_audio_zero(xas_audio_format format, void *dest, size_t index, diff --git a/src/audio.c b/src/audio.c index da656f2..bc2e04d 100644 --- a/src/audio.c +++ b/src/audio.c @@ -4,6 +4,12 @@ #include +int xas_audio_format_eq(xas_audio_format a, xas_audio_format b) { + return a.channels == b.channels + && a.sample_size == b.sample_size + && a.sample_rate == b.sample_rate; +} + void xas_audio_copy(xas_audio_format format, void *dest, void *src, -- cgit v1.2.3