recording.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: 22494 $
00028  * $Author: rjongbloed $
00029  * $Date: 2009-04-30 00:39:57 +0000 (Thu, 30 Apr 2009) $
00030  */
00031 
00032 
00033 #ifndef OPAL_OPAL_AUDIORECORD_H
00034 #define OPAL_OPAL_AUDIORECORD_H
00035 
00036 
00037 #include <opal/buildopts.h>
00038 
00039 
00044 class OpalRecordManager
00045 {
00046   public:
00047     typedef PFactory<OpalRecordManager, PCaselessString> Factory;
00048 
00049     enum VideoMode {
00050       eSideBySideLetterbox, 
00054       eSideBySideScaled,    
00058       eStackedPillarbox,    
00062       eStackedScaled,       
00066       eSeparateStreams,     
00067       NumVideoMixingModes
00068     };
00069 
00070     struct Options {
00071       bool      m_stereo;
00072       PString   m_audioFormat;
00073 
00074       VideoMode m_videoMixing;
00075       PString   m_videoFormat;
00076       unsigned  m_videoWidth;
00077       unsigned  m_videoHeight;
00078       unsigned  m_videoRate;
00079 
00080       Options(
00081         bool         stereo = true,
00082         VideoMode    videoMixing = eSideBySideLetterbox,
00083         const char * audioFormat = NULL,
00084         const char * videoFormat = NULL,
00085         unsigned width = PVideoFrameInfo::CIFWidth,
00086         unsigned height = PVideoFrameInfo::CIFHeight,
00087         unsigned rate = 15
00088       ) : m_stereo(stereo)
00089         , m_audioFormat(audioFormat)
00090         , m_videoMixing(videoMixing)
00091         , m_videoFormat(videoFormat)
00092         , m_videoWidth(width)
00093         , m_videoHeight(height)
00094         , m_videoRate(rate)
00095       {
00096       }
00097     };
00098 
00099     virtual ~OpalRecordManager() { }
00100 
00103     bool Open(const PFilePath & fn)
00104     {
00105       return OpenFile(fn);
00106     }
00107 
00110     bool Open(const PFilePath & fn, bool mono) // For backward compatibility
00111     {
00112       m_options.m_stereo = !mono;
00113       return OpenFile(fn);
00114     }
00115 
00118     bool Open(const PFilePath & fn, const Options & options)
00119     {
00120       m_options = options;
00121       return Open(fn);
00122     }
00123 
00126     virtual bool IsOpen() const = 0;
00127 
00132     virtual bool Close() = 0;
00133 
00136     virtual bool OpenStream(
00137       const PString & strmId,         
00138       const OpalMediaFormat & format  
00139     ) = 0;
00140 
00143     virtual bool CloseStream(
00144       const PString & strmId  
00145     ) = 0;
00146 
00149     virtual bool WriteAudio(
00150       const PString & strmId,     
00151       const RTP_DataFrame & rtp   
00152     ) = 0;
00153 
00156     virtual bool WriteVideo(
00157       const PString & strmId,     
00158       const RTP_DataFrame & rtp   
00159     ) = 0;
00160 
00163     const Options & GetOptions() const { return m_options; }
00164 
00167     void SetOptions(const Options & options)
00168     {
00169       m_options = options;
00170     }
00171 
00172   protected:
00173     virtual bool OpenFile(const PFilePath & fn) = 0;
00174 
00175     Options m_options;
00176 };
00177 
00178 // Force linking of modules
00179 PFACTORY_LOAD(OpalWAVRecordManager);
00180 #ifdef P_VFW_CAPTURE
00181 PFACTORY_LOAD(OpalAVIRecordManager);
00182 #endif
00183 
00184 
00185 #endif // OPAL_OPAL_AUDIORECORD_H

Generated on Mon Aug 3 20:50:25 2009 for OPAL by  doxygen 1.5.1