AmAudioFile.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028 #ifndef _AmAudioFile_h_
00029 #define _AmAudioFile_h_
00030
00031 #include "AmAudio.h"
00032 #include "AmBufferedAudio.h"
00033
00035 class AmAudioFileFormat: public AmAudioFormat
00036 {
00038 string name;
00039
00041 int subtype;
00042
00044 amci_subtype_t* p_subtype;
00045
00046 protected:
00047 int getCodecId();
00048
00049 public:
00056 AmAudioFileFormat(const string& name, int subtype = -1);
00057
00058 virtual ~AmAudioFileFormat() { }
00059
00061 string getName() { return name; }
00063 int getSubtypeId() { return subtype; }
00065 virtual amci_subtype_t* getSubtype();
00066
00067 void setSubtypeId(int subtype_id);
00068 };
00069
00073 class AmAudioFile: public AmBufferedAudio
00074 {
00075 public:
00077 enum OpenMode { Read=1, Write=2 };
00078
00079 protected:
00081 FILE* fp;
00082 long begin;
00083
00085 amci_inoutfmt_t* iofmt;
00087 int open_mode;
00088
00090 int data_size;
00091
00092 bool on_close_done;
00093 bool close_on_exit;
00094
00096 int read(unsigned int user_ts, unsigned int size);
00097
00099 int write(unsigned int user_ts, unsigned int size);
00100
00102 virtual AmAudioFileFormat* fileName2Fmt(const string& name);
00103
00105 int fpopen_int(const string& filename, OpenMode mode, FILE* n_fp);
00106
00107 public:
00108 AmSharedVar<bool> loop;
00109
00110 AmAudioFile();
00111 ~AmAudioFile();
00112
00128 int open(const string& filename, OpenMode mode,
00129 bool is_tmp=false);
00130
00131 int fpopen(const string& filename, OpenMode mode, FILE* n_fp);
00132
00136 void rewind();
00137
00139 void close();
00140
00142 void on_close();
00143
00145 FILE* getfp() { return fp; }
00146
00147 OpenMode getMode() { return (OpenMode)open_mode; }
00148
00150 int getDataSize() { return data_size; }
00151
00153 int getLength();
00154
00158 string getMimeType();
00159
00160 void setCloseOnDestroy(bool cod){
00161 close_on_exit = cod;
00162 }
00163 };
00164
00165 #endif
00166
00167
00168
00169
Generated on Fri May 16 12:02:05 2008 for SEMS by
1.5.1