mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-08-08 18:03:55 +00:00
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>
This commit is contained in:
parent
a95ba61d32
commit
8d9a79dd7d
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user