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
00027
00028
00029
00030
00031
00032
00033 #ifndef OPAL_OPAL_AUDIORECORD_H
00034 #define OPAL_OPAL_AUDIORECORD_H
00035
00037
00038
00039
00040 #include <opal/buildopts.h>
00041
00042 #include <opal/opalmixer.h>
00043
00044 class OpalRecordManager
00045 {
00046 public:
00047 virtual ~OpalRecordManager() { }
00048
00049 virtual bool Open(const PString & callToken, const PFilePath & fn, bool mono) = 0;
00050 virtual bool IsOpen(const PString & callToken) const = 0;
00051 virtual bool CloseStream(const PString & callToken, const std::string & strmId) = 0;
00052 virtual bool Close(const PString & callToken) = 0;
00053 virtual bool WriteAudio(const PString & callToken, const std::string & strmId, const RTP_DataFrame & rtp) = 0;
00054 };
00055
00056
00057 class OpalWAVRecordManager : public OpalRecordManager
00058 {
00059 public:
00060 class Mixer_T : public OpalAudioMixer
00061 {
00062 protected:
00063 OpalWAVFile m_file;
00064 bool m_mono;
00065 bool m_started;
00066
00067 public:
00068 Mixer_T();
00069 bool Open(const PFilePath & fn, bool mono);
00070 bool IsOpen() const { return m_file.IsOpen(); }
00071 bool Close();
00072 virtual PBoolean OnWriteAudio(const MixerFrame & mixerFrame);
00073 };
00074
00075 public:
00076 OpalWAVRecordManager();
00077 ~OpalWAVRecordManager();
00078
00079 virtual bool Open(const PString & callToken, const PFilePath & fn, bool mono);
00080 virtual bool IsOpen(const PString & callToken) const;
00081 virtual bool CloseStream(const PString & callToken, const std::string & strmId);
00082 virtual bool Close(const PString & callToken);
00083 virtual bool WriteAudio(const PString & callToken, const std::string & strmId, const RTP_DataFrame & rtp);
00084
00085 protected:
00086 typedef std::map<PString, Mixer_T *> MixerMap_T;
00087 MixerMap_T m_mixers;
00088 PMutex m_mutex;
00089 };
00090
00091
00092 #endif // OPAL_OPAL_AUDIORECORD_H