r668: Configure.in and autogen.sh cleanup based on ideas by giskard.
[cinelerra_cv.git] / cinelerra / audiooss.h
blob42d6e835e76993552f76906280e564bac78e72f3
1 #ifndef AUDIOOSS_H
2 #define AUDIOOSS_H
4 #include "audiodevice.h"
5 #include "condition.inc"
6 #include "playbackconfig.inc"
8 #ifdef HAVE_OSS
9 #include <sys/soundcard.h>
11 class OSSThread : public Thread
13 public:
14 OSSThread(AudioOSS *device);
15 ~OSSThread();
17 void run();
18 void write_data(int fd, unsigned char *data, int bytes);
19 void read_data(int fd, unsigned char *data, int bytes);
20 // Must synchronize reads and writes
21 void wait_read();
22 void wait_write();
24 Condition *input_lock;
25 Condition *output_lock;
26 Condition *read_lock;
27 Condition *write_lock;
28 int rd, wr, fd;
29 unsigned char *data;
30 int bytes;
31 int done;
32 AudioOSS *device;
35 class AudioOSS : public AudioLowLevel
37 public:
38 AudioOSS(AudioDevice *device);
39 ~AudioOSS();
41 int open_input();
42 int open_output();
43 int open_duplex();
44 int write_buffer(char *buffer, int bytes);
45 int read_buffer(char *buffer, int bytes);
46 int close_all();
47 int64_t device_position();
48 int flush_device();
49 int interrupt_playback();
51 private:
52 int get_fmt(int bits);
53 int sizetofrag(int samples, int channels, int bits);
54 int set_cloexec_flag(int desc, int value);
55 int get_output(int number);
56 int get_input(int number);
57 int dsp_in[MAXDEVICES], dsp_out[MAXDEVICES], dsp_duplex[MAXDEVICES];
58 OSSThread *thread[MAXDEVICES];
59 // Temp for each device
60 unsigned char *data[MAXDEVICES];
61 // Bytes allocated
62 int data_allocated[MAXDEVICES];
65 #endif
67 #endif