2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_AUDIO_IN_H
|
|
|
|
#define MPLAYER_AUDIO_IN_H
|
2002-08-21 22:50:40 +00:00
|
|
|
|
|
|
|
#define AUDIO_IN_ALSA 1
|
|
|
|
#define AUDIO_IN_OSS 2
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2004-01-11 17:07:32 +00:00
|
|
|
#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
|
2002-08-21 22:50:40 +00:00
|
|
|
#include <alsa/asoundlib.h>
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *device;
|
|
|
|
|
|
|
|
snd_pcm_t *handle;
|
|
|
|
snd_output_t *log;
|
|
|
|
int buffer_time, period_time, chunk_size;
|
|
|
|
size_t bits_per_sample, bits_per_frame;
|
|
|
|
} ai_alsa_t;
|
|
|
|
#endif
|
|
|
|
|
2002-12-28 13:39:51 +00:00
|
|
|
#ifdef USE_OSS_AUDIO
|
2002-08-21 22:50:40 +00:00
|
|
|
typedef struct {
|
|
|
|
char *device;
|
|
|
|
|
|
|
|
int audio_fd;
|
|
|
|
} ai_oss_t;
|
2002-12-28 13:39:51 +00:00
|
|
|
#endif
|
2002-08-21 22:50:40 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
int setup;
|
|
|
|
|
|
|
|
/* requested values */
|
|
|
|
int req_channels;
|
|
|
|
int req_samplerate;
|
|
|
|
|
|
|
|
/* real values read-only */
|
|
|
|
int channels;
|
|
|
|
int samplerate;
|
|
|
|
int blocksize;
|
|
|
|
int bytes_per_sample;
|
|
|
|
int samplesize;
|
|
|
|
|
2004-01-11 17:07:32 +00:00
|
|
|
#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
|
2002-08-21 22:50:40 +00:00
|
|
|
ai_alsa_t alsa;
|
|
|
|
#endif
|
2002-12-28 13:39:51 +00:00
|
|
|
#ifdef USE_OSS_AUDIO
|
2002-08-21 22:50:40 +00:00
|
|
|
ai_oss_t oss;
|
2002-12-28 13:39:51 +00:00
|
|
|
#endif
|
2002-08-21 22:50:40 +00:00
|
|
|
} audio_in_t;
|
|
|
|
|
|
|
|
int audio_in_init(audio_in_t *ai, int type);
|
|
|
|
int audio_in_setup(audio_in_t *ai);
|
|
|
|
int audio_in_set_device(audio_in_t *ai, char *device);
|
|
|
|
int audio_in_set_samplerate(audio_in_t *ai, int rate);
|
|
|
|
int audio_in_set_channels(audio_in_t *ai, int channels);
|
|
|
|
int audio_in_uninit(audio_in_t *ai);
|
|
|
|
int audio_in_start_capture(audio_in_t *ai);
|
|
|
|
int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer);
|
|
|
|
|
2004-01-11 17:07:32 +00:00
|
|
|
#if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
|
2002-08-21 22:50:40 +00:00
|
|
|
int ai_alsa_setup(audio_in_t *ai);
|
|
|
|
int ai_alsa_init(audio_in_t *ai);
|
2002-10-02 16:46:55 +00:00
|
|
|
int ai_alsa_xrun(audio_in_t *ai);
|
2002-08-21 22:50:40 +00:00
|
|
|
#endif
|
|
|
|
|
2002-12-28 13:39:51 +00:00
|
|
|
#ifdef USE_OSS_AUDIO
|
2002-08-21 22:50:40 +00:00
|
|
|
int ai_oss_set_samplerate(audio_in_t *ai);
|
|
|
|
int ai_oss_set_channels(audio_in_t *ai);
|
|
|
|
int ai_oss_init(audio_in_t *ai);
|
2002-12-28 13:39:51 +00:00
|
|
|
#endif
|
2002-08-21 22:50:40 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_AUDIO_IN_H */
|