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: 19840 $ 00028 * $Author: rjongbloed $ 00029 * $Date: 2008-03-30 21:59:27 +0000 (Sun, 30 Mar 2008) $ 00030 */ 00031 00032 00033 #ifndef _OPALAUDIORECORD_H 00034 #define _OPALAUDIORECORD_H 00035 00037 // 00038 // This class manages the recording of OPAL calls using the AudioMixer class 00039 // 00040 00041 #include <opal/opalmixer.h> 00042 00043 class OpalRecordManager 00044 { 00045 public: 00046 class Mixer_T : public OpalAudioMixer 00047 { 00048 protected: 00049 OpalWAVFile file; 00050 PBoolean mono; 00051 PBoolean started; 00052 00053 public: 00054 Mixer_T(); 00055 PBoolean Open(const PFilePath & fn); 00056 bool IsOpen() const { return file.IsOpen(); } 00057 PBoolean Close(); 00058 PBoolean OnWriteAudio(const MixerFrame & mixerFrame); 00059 }; 00060 00061 Mixer_T mixer; 00062 00063 protected: 00064 PMutex mutex; 00065 PString token; 00066 PBoolean started; 00067 00068 public: 00069 OpalRecordManager(); 00070 PBoolean Open(const PString & _callToken, const PFilePath & fn); 00071 bool IsOpen() const { return mixer.IsOpen(); } 00072 PBoolean CloseStream(const PString & _callToken, const std::string & _strm); 00073 PBoolean Close(const PString & _callToken); 00074 PBoolean WriteAudio(const PString & _callToken, const std::string & strm, const RTP_DataFrame & rtp); 00075 }; 00076 00077 00078 #endif // _OPALAUDIOMIXER_H