cleanup: reindent audio_out.[ch]

Reindent audio_out.c and audio_out.h. Also remove trailing '_s' from
two struct names (which are not currently used anywhere) and make the
audio_out_drivers[] table static.
This commit is contained in:
Uoti Urpala 2011-05-04 01:15:58 +03:00
parent 618f760866
commit df7825eb31
2 changed files with 61 additions and 65 deletions

View File

@ -54,81 +54,82 @@ extern const ao_functions_t audio_out_mpegpes;
extern const ao_functions_t audio_out_pcm; extern const ao_functions_t audio_out_pcm;
extern const ao_functions_t audio_out_pss; extern const ao_functions_t audio_out_pss;
const ao_functions_t* const audio_out_drivers[] = static const ao_functions_t *const audio_out_drivers[] = {
{
// native: // native:
#ifdef CONFIG_DIRECTX #ifdef CONFIG_DIRECTX
&audio_out_dsound, &audio_out_dsound,
#endif #endif
#ifdef CONFIG_WIN32WAVEOUT #ifdef CONFIG_WIN32WAVEOUT
&audio_out_win32, &audio_out_win32,
#endif #endif
#ifdef CONFIG_KAI #ifdef CONFIG_KAI
&audio_out_kai, &audio_out_kai,
#endif #endif
#ifdef CONFIG_DART #ifdef CONFIG_DART
&audio_out_dart, &audio_out_dart,
#endif #endif
#ifdef CONFIG_COREAUDIO #ifdef CONFIG_COREAUDIO
&audio_out_coreaudio, &audio_out_coreaudio,
#endif #endif
#ifdef CONFIG_OSS_AUDIO #ifdef CONFIG_OSS_AUDIO
&audio_out_oss, &audio_out_oss,
#endif #endif
#ifdef CONFIG_ALSA #ifdef CONFIG_ALSA
&audio_out_alsa, &audio_out_alsa,
#endif #endif
#ifdef CONFIG_ALSA5 #ifdef CONFIG_ALSA5
&audio_out_alsa5, &audio_out_alsa5,
#endif #endif
#ifdef CONFIG_SGI_AUDIO #ifdef CONFIG_SGI_AUDIO
&audio_out_sgi, &audio_out_sgi,
#endif #endif
#ifdef CONFIG_SUN_AUDIO #ifdef CONFIG_SUN_AUDIO
&audio_out_sun, &audio_out_sun,
#endif #endif
// wrappers: // wrappers:
#ifdef CONFIG_ARTS #ifdef CONFIG_ARTS
&audio_out_arts, &audio_out_arts,
#endif #endif
#ifdef CONFIG_ESD #ifdef CONFIG_ESD
&audio_out_esd, &audio_out_esd,
#endif #endif
#ifdef CONFIG_PULSE #ifdef CONFIG_PULSE
&audio_out_pulse, &audio_out_pulse,
#endif #endif
#ifdef CONFIG_JACK #ifdef CONFIG_JACK
&audio_out_jack, &audio_out_jack,
#endif #endif
#ifdef CONFIG_NAS #ifdef CONFIG_NAS
&audio_out_nas, &audio_out_nas,
#endif #endif
#ifdef CONFIG_SDL #ifdef CONFIG_SDL
&audio_out_sdl, &audio_out_sdl,
#endif #endif
#ifdef CONFIG_OPENAL #ifdef CONFIG_OPENAL
&audio_out_openal, &audio_out_openal,
#endif #endif
&audio_out_mpegpes, &audio_out_mpegpes,
#ifdef CONFIG_IVTV #ifdef CONFIG_IVTV
&audio_out_ivtv, &audio_out_ivtv,
#endif #endif
#ifdef CONFIG_V4L2_DECODER #ifdef CONFIG_V4L2_DECODER
&audio_out_v4l2, &audio_out_v4l2,
#endif #endif
&audio_out_null, &audio_out_null,
// should not be auto-selected: // should not be auto-selected:
&audio_out_pcm, &audio_out_pcm,
NULL NULL
}; };
void list_audio_out(void){ void list_audio_out(void)
{
int i=0; int i=0;
mp_tmsg(MSGT_AO, MSGL_INFO, "Available audio output drivers:\n"); mp_tmsg(MSGT_AO, MSGL_INFO, "Available audio output drivers:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n"); mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n");
while (audio_out_drivers[i]) { while (audio_out_drivers[i]) {
const ao_info_t *info = audio_out_drivers[i++]->info; const ao_info_t *info = audio_out_drivers[i++]->info;
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name); mp_msg(MSGT_GLOBAL, MSGL_INFO, "\t%s\t%s\n", info->short_name,
info->name);
} }
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n"); mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
} }
@ -162,7 +163,7 @@ void ao_init(struct ao *ao, char **ao_list)
mp_tmsg(MSGT_AO, MSGL_V, mp_tmsg(MSGT_AO, MSGL_V,
"Trying preferred audio driver '%.*s', options '%s'\n", "Trying preferred audio driver '%.*s', options '%s'\n",
ao_len, ao_name, ao_subdevice ? ao_subdevice : "[none]"); ao_len, ao_name, ao_subdevice ? ao_subdevice : "[none]");
const ao_functions_t *audio_out = NULL; const ao_functions_t *audio_out = NULL;
for (int i = 0; audio_out_drivers[i]; i++) { for (int i = 0; audio_out_drivers[i]; i++) {

View File

@ -21,42 +21,40 @@
#include <stdbool.h> #include <stdbool.h>
typedef struct ao_info_s typedef struct ao_info {
{ /* driver name ("Matrox Millennium G200/G400" */
/* driver name ("Matrox Millennium G200/G400" */ const char *name;
const char *name; /* short name (for config strings) ("mga") */
/* short name (for config strings) ("mga") */ const char *short_name;
const char *short_name; /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
/* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */ const char *author;
const char *author; /* any additional comments */
/* any additional comments */ const char *comment;
const char *comment;
} ao_info_t; } ao_info_t;
/* interface towards mplayer and */ /* interface towards mplayer and */
typedef struct ao_functions typedef struct ao_functions {
{ const ao_info_t *info;
const ao_info_t *info; int (*control)(int cmd, void *arg);
int (*control)(int cmd,void *arg); int (*init)(int rate, int channels, int format, int flags);
int (*init)(int rate,int channels,int format,int flags); void (*uninit)(int immed);
void (*uninit)(int immed); void (*reset)(void);
void (*reset)(void); int (*get_space)(void);
int (*get_space)(void); int (*play)(void *data, int len, int flags);
int (*play)(void* data,int len,int flags); float (*get_delay)(void);
float (*get_delay)(void); void (*pause)(void);
void (*pause)(void); void (*resume)(void);
void (*resume)(void);
} ao_functions_t; } ao_functions_t;
/* global data used by mplayer and plugins */ /* global data used by mplayer and plugins */
struct ao { struct ao {
int samplerate; int samplerate;
int channels; int channels;
int format; int format;
int bps; int bps;
int outburst; int outburst;
int buffersize; int buffersize;
int pts; int pts;
bool initialized; bool initialized;
const struct ao_functions *driver; const struct ao_functions *driver;
}; };
@ -65,9 +63,6 @@ extern char *ao_subdevice;
void list_audio_out(void); void list_audio_out(void);
// NULL terminated array of all drivers
extern const ao_functions_t* const audio_out_drivers[];
#define CONTROL_OK 1 #define CONTROL_OK 1
#define CONTROL_TRUE 1 #define CONTROL_TRUE 1
#define CONTROL_FALSE 0 #define CONTROL_FALSE 0
@ -85,9 +80,9 @@ extern const ao_functions_t* const audio_out_drivers[];
#define AOPLAY_FINAL_CHUNK 1 #define AOPLAY_FINAL_CHUNK 1
typedef struct ao_control_vol_s { typedef struct ao_control_vol {
float left; float left;
float right; float right;
} ao_control_vol_t; } ao_control_vol_t;
struct ao *ao_create(void); struct ao *ao_create(void);