audiorecord.h

Go to the documentation of this file.
00001 /*
00002  * audiorecord.h
00003  *
00004  * OPAL audio record manager
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  * Formally known as the Open H323 project.
00008  *
00009  * Copyright (C) 2007 Post Increment
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.0 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Software distributed under the License is distributed on an "AS IS"
00017  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00018  * the License for the specific language governing rights and limitations
00019  * under the License.
00020  *
00021  * The Original Code is Open Phone Abstraction Library.
00022  *
00023  * The Initial Developer of the Original Code is Post Increment
00024  *
00025  * Contributor(s): ______________________________________.
00026  *
00027  * $Revision: 21937 $
00028  * $Author: rjongbloed $
00029  * $Date: 2009-01-17 11:46:56 +0000 (Sat, 17 Jan 2009) $
00030  */
00031 
00032 
00033 #ifndef OPAL_OPAL_AUDIORECORD_H
00034 #define OPAL_OPAL_AUDIORECORD_H
00035 
00037 //
00038 //  This class manages the recording of OPAL calls using the AudioMixer class
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

Generated on Mon Feb 1 00:25:19 2010 for OPAL by  doxygen 1.5.1