From 8d9a79dd7de0987395c1220d47afe759e3f88cff Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Thu, 21 Nov 2019 08:52:28 +0000 Subject: snd_codec: Use better types for snd_codec_is_capable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mode should be an enumeration value of SpiceAudioDataMode. Return type is just a boolean. Signed-off-by: Frediano Ziglio Acked-by: Julien Ropé --- common/snd_codec.c | 10 +++++----- common/snd_codec.h | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/common/snd_codec.c b/common/snd_codec.c index 2b55b91..4a617f4 100644 --- a/common/snd_codec.c +++ b/common/snd_codec.c @@ -134,11 +134,11 @@ static int snd_codec_decode_opus(SndCodecInternal *codec, uint8_t *in_ptr, int i /* snd_codec_is_capable - Returns TRUE if the current spice implementation can - use the given codec, FALSE otherwise. + Returns true if the current spice implementation can + use the given codec, false otherwise. mode must be a SPICE_AUDIO_DATA_MODE_XXX enum from spice/enum.h */ -int snd_codec_is_capable(int mode, int frequency) +bool snd_codec_is_capable(SpiceAudioDataMode mode, int frequency) { #if HAVE_OPUS if (mode == SPICE_AUDIO_DATA_MODE_OPUS && @@ -146,10 +146,10 @@ int snd_codec_is_capable(int mode, int frequency) frequency == 48000 || frequency == 24000 || frequency == 16000 || frequency == 12000 || frequency == 8000) ) - return TRUE; + return true; #endif - return FALSE; + return false; } /* diff --git a/common/snd_codec.h b/common/snd_codec.h index aaba867..b58f758 100644 --- a/common/snd_codec.h +++ b/common/snd_codec.h @@ -19,6 +19,9 @@ #ifndef H_SPICE_COMMON_SND_CODEC #define H_SPICE_COMMON_SND_CODEC +#include +#include + #define SND_CODEC_OPUS_FRAME_SIZE 480 #define SND_CODEC_OPUS_PLAYBACK_FREQ 48000 #define SND_CODEC_OPUS_COMPRESSED_FRAME_BYTES 480 @@ -46,7 +49,7 @@ SPICE_BEGIN_DECLS typedef struct SndCodecInternal * SndCodec; -int snd_codec_is_capable(int mode, int frequency); +bool snd_codec_is_capable(SpiceAudioDataMode mode, int frequency); int snd_codec_create(SndCodec *codec, int mode, int frequency, int purpose); void snd_codec_destroy(SndCodec *codec); -- cgit v1.2.3