audio: added output enumeration functions
Added audio_output_get(), audio_output_find().
This commit is contained in:
parent
3e87033145
commit
e8787ac4a4
22
src/audio.c
22
src/audio.c
@ -45,6 +45,28 @@ unsigned int audio_output_count(void)
|
|||||||
return audioOutputArraySize;
|
return audioOutputArraySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct audio_output *
|
||||||
|
audio_output_get(unsigned i)
|
||||||
|
{
|
||||||
|
assert(i < audioOutputArraySize);
|
||||||
|
|
||||||
|
return &audioOutputArray[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
struct audio_output *
|
||||||
|
audio_output_find(const char *name)
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < audioOutputArraySize; ++i) {
|
||||||
|
struct audio_output *ao = audio_output_get(i);
|
||||||
|
|
||||||
|
if (strcmp(ao->name, name) == 0)
|
||||||
|
return ao;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* name not found */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
audio_output_config_count(void)
|
audio_output_config_count(void)
|
||||||
{
|
{
|
||||||
|
13
src/audio.h
13
src/audio.h
@ -35,6 +35,19 @@ struct config_param;
|
|||||||
*/
|
*/
|
||||||
unsigned int audio_output_count(void);
|
unsigned int audio_output_count(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the "i"th audio output device.
|
||||||
|
*/
|
||||||
|
struct audio_output *
|
||||||
|
audio_output_get(unsigned i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the audio output device with the specified name. Returns
|
||||||
|
* NULL if the name does not exist.
|
||||||
|
*/
|
||||||
|
struct audio_output *
|
||||||
|
audio_output_find(const char *name);
|
||||||
|
|
||||||
void getOutputAudioFormat(const struct audio_format *inFormat,
|
void getOutputAudioFormat(const struct audio_format *inFormat,
|
||||||
struct audio_format *outFormat);
|
struct audio_format *outFormat);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user