2001-06-02 23:25:43 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "../config.h"
|
|
|
|
#include "audio_out.h"
|
2001-06-08 23:31:06 +00:00
|
|
|
#include "afmt.h"
|
2001-06-05 18:40:44 +00:00
|
|
|
|
2001-06-02 23:25:43 +00:00
|
|
|
// there are some globals:
|
|
|
|
int ao_samplerate=0;
|
|
|
|
int ao_channels=0;
|
|
|
|
int ao_format=0;
|
|
|
|
int ao_bps=0;
|
|
|
|
int ao_outburst=OUTBURST; // config.h default
|
|
|
|
int ao_buffersize=-1;
|
2001-06-21 22:34:58 +00:00
|
|
|
char *ao_subdevice = NULL;
|
2001-06-02 23:25:43 +00:00
|
|
|
|
2001-06-05 18:40:44 +00:00
|
|
|
#ifdef USE_OSS_AUDIO
|
2001-06-02 23:25:43 +00:00
|
|
|
extern ao_functions_t audio_out_oss;
|
2001-06-05 18:40:44 +00:00
|
|
|
#endif
|
2001-06-02 23:25:43 +00:00
|
|
|
//extern ao_functions_t audio_out_ossold;
|
|
|
|
extern ao_functions_t audio_out_null;
|
2001-06-04 18:42:31 +00:00
|
|
|
#ifdef HAVE_ALSA5
|
|
|
|
extern ao_functions_t audio_out_alsa5;
|
|
|
|
#endif
|
2001-06-05 10:37:50 +00:00
|
|
|
#ifdef HAVE_ALSA9
|
|
|
|
extern ao_functions_t audio_out_alsa9;
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ESD
|
|
|
|
extern ao_functions_t audio_out_esd;
|
|
|
|
#endif
|
2001-06-03 10:48:36 +00:00
|
|
|
#ifdef HAVE_SDL
|
|
|
|
extern ao_functions_t audio_out_sdl;
|
|
|
|
#endif
|
2001-06-05 18:40:44 +00:00
|
|
|
#ifdef USE_SUN_AUDIO
|
|
|
|
extern ao_functions_t audio_out_sun;
|
|
|
|
#endif
|
2001-06-12 11:00:15 +00:00
|
|
|
extern ao_functions_t audio_out_pcm;
|
2001-06-21 22:34:58 +00:00
|
|
|
extern ao_functions_t audio_out_pss;
|
2001-06-02 23:25:43 +00:00
|
|
|
|
|
|
|
ao_functions_t* audio_out_drivers[] =
|
|
|
|
{
|
2001-06-05 18:40:44 +00:00
|
|
|
#ifdef USE_OSS_AUDIO
|
2001-06-02 23:25:43 +00:00
|
|
|
&audio_out_oss,
|
2001-06-05 18:40:44 +00:00
|
|
|
#endif
|
2001-06-02 23:25:43 +00:00
|
|
|
&audio_out_null,
|
2001-06-04 18:42:31 +00:00
|
|
|
#ifdef HAVE_ALSA5
|
2001-06-04 17:40:56 +00:00
|
|
|
&audio_out_alsa5,
|
2001-06-04 18:42:31 +00:00
|
|
|
#endif
|
2001-06-05 10:37:50 +00:00
|
|
|
#ifdef HAVE_ALSA9
|
|
|
|
&audio_out_alsa9,
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ESD
|
|
|
|
&audio_out_esd,
|
|
|
|
#endif
|
2001-06-03 10:48:36 +00:00
|
|
|
#ifdef HAVE_SDL
|
|
|
|
&audio_out_sdl,
|
2001-06-05 18:40:44 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_SUN_AUDIO
|
|
|
|
&audio_out_sun,
|
2001-06-03 10:48:36 +00:00
|
|
|
#endif
|
2001-06-12 11:00:15 +00:00
|
|
|
&audio_out_pcm,
|
2001-06-21 22:34:58 +00:00
|
|
|
// &audio_out_pss,
|
2001-06-02 23:25:43 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2001-06-04 17:40:56 +00:00
|
|
|
char *audio_out_format_name(int format)
|
|
|
|
{
|
|
|
|
switch (format)
|
|
|
|
{
|
2001-06-07 13:06:03 +00:00
|
|
|
case AFMT_MU_LAW:
|
2001-06-13 11:18:20 +00:00
|
|
|
return("Mu-Law");
|
2001-06-07 13:06:03 +00:00
|
|
|
case AFMT_A_LAW:
|
2001-06-13 11:18:20 +00:00
|
|
|
return("A-Law");
|
2001-06-07 13:06:03 +00:00
|
|
|
case AFMT_IMA_ADPCM:
|
2001-06-13 11:18:20 +00:00
|
|
|
return("Ima-ADPCM");
|
2001-06-04 17:40:56 +00:00
|
|
|
case AFMT_S8:
|
2001-06-07 13:06:03 +00:00
|
|
|
return("Signed 8-bit");
|
2001-06-04 17:40:56 +00:00
|
|
|
case AFMT_U8:
|
2001-06-07 13:06:03 +00:00
|
|
|
return("Unsigned 8-bit");
|
2001-06-04 17:40:56 +00:00
|
|
|
case AFMT_U16_LE:
|
2001-06-07 13:06:03 +00:00
|
|
|
return("Unsigned 16-bit (Little-Endian)");
|
2001-06-04 17:40:56 +00:00
|
|
|
case AFMT_U16_BE:
|
2001-06-07 13:06:03 +00:00
|
|
|
return("Unsigned 16-bit (Big-Endian)");
|
2001-06-04 17:40:56 +00:00
|
|
|
case AFMT_S16_LE:
|
2001-06-07 13:06:03 +00:00
|
|
|
return("Signed 16-bit (Little-Endian)");
|
2001-06-04 17:40:56 +00:00
|
|
|
case AFMT_S16_BE:
|
2001-06-07 13:06:03 +00:00
|
|
|
return("Unsigned 16-bit (Big-Endian)");
|
|
|
|
case AFMT_MPEG:
|
|
|
|
return("MPEG (2) audio");
|
2001-06-13 11:18:20 +00:00
|
|
|
/*
|
|
|
|
the following two formats are not available with old linux kernel
|
|
|
|
headers (e.g. in 2.2.16)
|
|
|
|
*/
|
2001-06-08 23:31:06 +00:00
|
|
|
#ifdef AFMT_S32_LE
|
2001-06-07 13:06:03 +00:00
|
|
|
case AFMT_S32_LE:
|
2001-06-08 23:31:06 +00:00
|
|
|
return("Signed 32-bit (Little-Endian)");
|
|
|
|
#endif
|
|
|
|
#ifdef AFMT_S32_BE
|
2001-06-07 13:06:03 +00:00
|
|
|
case AFMT_S32_BE:
|
2001-06-08 23:31:06 +00:00
|
|
|
return("Signed 32-bit (Big-Endian)");
|
|
|
|
#endif
|
2001-06-04 17:40:56 +00:00
|
|
|
}
|
2001-06-07 13:06:03 +00:00
|
|
|
return("Unknown");
|
2001-06-04 17:40:56 +00:00
|
|
|
}
|