Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

audiooss.h

Go to the documentation of this file.
00001 #ifndef AUDIOOSS_H
00002 #define AUDIOOSS_H
00003 
00004 #include "audiodevice.h"
00005 #include "condition.inc"
00006 #include "playbackconfig.inc"
00007 
00008 #ifdef HAVE_OSS
00009 #include <sys/soundcard.h>
00010 
00011 class OSSThread : public Thread
00012 {
00013 public:
00014         OSSThread(AudioOSS *device);
00015         ~OSSThread();
00016         
00017         void run();
00018         void write_data(int fd, unsigned char *data, int bytes);
00019         void read_data(int fd, unsigned char *data, int bytes);
00020 // Must synchronize reads and writes
00021         void wait_read();
00022         void wait_write();
00023         
00024         Condition *input_lock;
00025         Condition *output_lock;
00026         Condition *read_lock;
00027         Condition *write_lock;
00028         int rd, wr, fd;
00029         unsigned char *data;
00030         int bytes;
00031         int done;
00032         AudioOSS *device;
00033 };
00034 
00035 class AudioOSS : public AudioLowLevel
00036 {
00037 public:
00038         AudioOSS(AudioDevice *device);
00039         ~AudioOSS();
00040         
00041         int open_input();
00042         int open_output();
00043         int open_duplex();
00044         int write_buffer(char *buffer, int bytes);
00045         int read_buffer(char *buffer, int bytes);
00046         int close_all();
00047         int64_t device_position();
00048         int flush_device();
00049         int interrupt_playback();
00050 
00051 private:
00052         int get_fmt(int bits);
00053         int sizetofrag(int samples, int channels, int bits);
00054         int set_cloexec_flag(int desc, int value);
00055         int get_output(int number);
00056         int get_input(int number);
00057         int dsp_in[MAXDEVICES], dsp_out[MAXDEVICES], dsp_duplex[MAXDEVICES];
00058         OSSThread *thread[MAXDEVICES];
00059 // Temp for each device
00060         unsigned char *data[MAXDEVICES];
00061 // Bytes allocated
00062         int data_allocated[MAXDEVICES];
00063 };
00064 
00065 #endif
00066 
00067 #endif

Generated on Sun Jan 8 13:38:50 2006 for Cinelerra-svn by  doxygen 1.4.4