r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / audiooss.h
blob8affcceb6e3e3b146ddec1263f3692853fe27ba6
1 #ifndef AUDIOOSS_H
2 #define AUDIOOSS_H
4 #include "audiodevice.h"
5 #include "playbackconfig.inc"
7 #ifdef HAVE_OSS
8 #include <sys/soundcard.h>
10 class OSSThread : public Thread
12 public:
13 OSSThread(AudioOSS *device);
14 ~OSSThread();
16 void run();
17 void write_data(int fd, unsigned char *data, int bytes);
18 void read_data(int fd, unsigned char *data, int bytes);
19 // Must synchronize reads and writes
20 void wait_read();
21 void wait_write();
23 Mutex input_lock, output_lock, read_lock, write_lock;
24 int rd, wr, fd;
25 unsigned char *data;
26 int bytes;
27 int done;
28 AudioOSS *device;
31 class AudioOSS : public AudioLowLevel
33 public:
34 AudioOSS(AudioDevice *device);
35 ~AudioOSS();
37 int open_input();
38 int open_output();
39 int open_duplex();
40 int write_buffer(char *buffer, int bytes);
41 int read_buffer(char *buffer, int bytes);
42 int close_all();
43 int64_t device_position();
44 int flush_device(int number);
45 int interrupt_playback();
47 private:
48 int get_fmt(int bits);
49 int sizetofrag(int samples, int channels, int bits);
50 int set_cloexec_flag(int desc, int value);
51 int get_output(int number);
52 int get_input(int number);
53 int dsp_in[MAXDEVICES], dsp_out[MAXDEVICES], dsp_duplex[MAXDEVICES];
54 OSSThread *thread[MAXDEVICES];
55 // Temp for each device
56 unsigned char *data[MAXDEVICES];
57 // Bytes allocated
58 int data_allocated[MAXDEVICES];
61 #endif
63 #endif