comparison stream/audio_in.h @ 19271:64d82a45a05d

introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
author ben
date Mon, 31 Jul 2006 17:39:17 +0000
parents libmpdemux/audio_in.h@66e491c35dc8
children 3f0d00abc073
comparison
equal deleted inserted replaced
19270:7d39b911f0bd 19271:64d82a45a05d
1 #ifndef _audio_in_h
2 #define _audio_in_h
3
4 #define AUDIO_IN_ALSA 1
5 #define AUDIO_IN_OSS 2
6
7 #include "config.h"
8
9 #if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
10 #include <alsa/asoundlib.h>
11
12 typedef struct {
13 char *device;
14
15 snd_pcm_t *handle;
16 snd_output_t *log;
17 int buffer_time, period_time, chunk_size;
18 size_t bits_per_sample, bits_per_frame;
19 } ai_alsa_t;
20 #endif
21
22 #ifdef USE_OSS_AUDIO
23 typedef struct {
24 char *device;
25
26 int audio_fd;
27 } ai_oss_t;
28 #endif
29
30 typedef struct
31 {
32 int type;
33 int setup;
34
35 /* requested values */
36 int req_channels;
37 int req_samplerate;
38
39 /* real values read-only */
40 int channels;
41 int samplerate;
42 int blocksize;
43 int bytes_per_sample;
44 int samplesize;
45
46 #if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
47 ai_alsa_t alsa;
48 #endif
49 #ifdef USE_OSS_AUDIO
50 ai_oss_t oss;
51 #endif
52 } audio_in_t;
53
54 int audio_in_init(audio_in_t *ai, int type);
55 int audio_in_setup(audio_in_t *ai);
56 int audio_in_set_device(audio_in_t *ai, char *device);
57 int audio_in_set_samplerate(audio_in_t *ai, int rate);
58 int audio_in_set_channels(audio_in_t *ai, int channels);
59 int audio_in_uninit(audio_in_t *ai);
60 int audio_in_start_capture(audio_in_t *ai);
61 int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer);
62
63 #if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
64 int ai_alsa_setup(audio_in_t *ai);
65 int ai_alsa_init(audio_in_t *ai);
66 int ai_alsa_xrun(audio_in_t *ai);
67 #endif
68
69 #ifdef USE_OSS_AUDIO
70 int ai_oss_set_samplerate(audio_in_t *ai);
71 int ai_oss_set_channels(audio_in_t *ai);
72 int ai_oss_init(audio_in_t *ai);
73 #endif
74
75 #endif /* _audio_in_h */