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: 21283 $ 00028 * $Author: rjongbloed $ 00029 * $Date: 2008-10-11 07:10:58 +0000 (Sat, 11 Oct 2008) $ 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 class Mixer_T : public OpalAudioMixer 00048 { 00049 protected: 00050 OpalWAVFile file; 00051 PBoolean mono; 00052 PBoolean started; 00053 00054 public: 00055 Mixer_T(); 00056 PBoolean Open(const PFilePath & fn); 00057 bool IsOpen() const { return file.IsOpen(); } 00058 PBoolean Close(); 00059 PBoolean OnWriteAudio(const MixerFrame & mixerFrame); 00060 }; 00061 00062 Mixer_T mixer; 00063 00064 protected: 00065 PMutex mutex; 00066 PString token; 00067 PBoolean started; 00068 00069 public: 00070 OpalRecordManager(); 00071 PBoolean Open(const PString & _callToken, const PFilePath & fn); 00072 bool IsOpen() const { return mixer.IsOpen(); } 00073 PBoolean CloseStream(const PString & _callToken, const std::string & _strm); 00074 PBoolean Close(const PString & _callToken); 00075 PBoolean WriteAudio(const PString & _callToken, const std::string & strm, const RTP_DataFrame & rtp); 00076 }; 00077 00078 00079 #endif // OPAL_OPAL_AUDIORECORD_H