diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2019-11-21 08:52:28 +0000 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2020-07-07 13:09:14 +0100 |
commit | 8d9a79dd7de0987395c1220d47afe759e3f88cff (patch) | |
tree | 6ab62818a3fc3fc1a62637bd1bda6b7ba77639db | |
parent | a95ba61d324e6e30e1c5b8e936176ff71af4d938 (diff) |
snd_codec: Use better types for snd_codec_is_capable
mode should be an enumeration value of SpiceAudioDataMode.
Return type is just a boolean.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Ropé <jrope@gmail.com>
-rw-r--r-- | common/snd_codec.c | 10 | ||||
-rw-r--r-- | 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 <stdbool.h> +#include <spice/enums.h> + #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); |