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
00036
00037 #include <opal/buildopts.h>
00038
00039 #if OPAL_HAS_MIXER
00040
00041
00046 class OpalRecordManager
00047 {
00048 public:
00049 typedef PFactory<OpalRecordManager, PCaselessString> Factory;
00050
00051 #if OPAL_VIDEO
00052 enum VideoMode {
00053 eSideBySideLetterbox,
00057 eSideBySideScaled,
00061 eStackedPillarbox,
00065 eStackedScaled,
00069 eSeparateStreams,
00070 NumVideoMixingModes
00071 };
00072 #endif
00073
00074 struct Options {
00075 bool m_stereo;
00076 PString m_audioFormat;
00077
00078 #if OPAL_VIDEO
00079 VideoMode m_videoMixing;
00080 PString m_videoFormat;
00081 unsigned m_videoWidth;
00082 unsigned m_videoHeight;
00083 unsigned m_videoRate;
00084 #endif
00085
00086 Options(
00087 bool stereo = true,
00088 #if OPAL_VIDEO
00089 VideoMode videoMixing = eSideBySideLetterbox,
00090 #endif
00091 const char * audioFormat = NULL
00092 #if OPAL_VIDEO
00093 ,
00094 const char * videoFormat = NULL,
00095 unsigned width = PVideoFrameInfo::CIFWidth,
00096 unsigned height = PVideoFrameInfo::CIFHeight,
00097 unsigned rate = 15
00098 #endif
00099 ) : m_stereo(stereo)
00100 , m_audioFormat(audioFormat)
00101 #if OPAL_VIDEO
00102 , m_videoMixing(videoMixing)
00103 , m_videoFormat(videoFormat)
00104 , m_videoWidth(width)
00105 , m_videoHeight(height)
00106 , m_videoRate(rate)
00107 #endif
00108 {
00109 }
00110 };
00111
00112 virtual ~OpalRecordManager() { }
00113
00116 bool Open(const PFilePath & fn)
00117 {
00118 return OpenFile(fn);
00119 }
00120
00123 bool Open(const PFilePath & fn, bool mono)
00124 {
00125 m_options.m_stereo = !mono;
00126 return OpenFile(fn);
00127 }
00128
00131 bool Open(const PFilePath & fn, const Options & options)
00132 {
00133 m_options = options;
00134 return Open(fn);
00135 }
00136
00139 virtual bool IsOpen() const = 0;
00140
00145 virtual bool Close() = 0;
00146
00149 virtual bool OpenStream(
00150 const PString & strmId,
00151 const OpalMediaFormat & format
00152 ) = 0;
00153
00156 virtual bool CloseStream(
00157 const PString & strmId
00158 ) = 0;
00159
00162 virtual bool WriteAudio(
00163 const PString & strmId,
00164 const RTP_DataFrame & rtp
00165 ) = 0;
00166
00167 #if OPAL_VIDEO
00168
00170 virtual bool WriteVideo(
00171 const PString & strmId,
00172 const RTP_DataFrame & rtp
00173 ) = 0;
00174 #endif
00175
00178 const Options & GetOptions() const { return m_options; }
00179
00182 void SetOptions(const Options & options)
00183 {
00184 m_options = options;
00185 }
00186
00187 protected:
00188 virtual bool OpenFile(const PFilePath & fn) = 0;
00189
00190 Options m_options;
00191 };
00192
00193
00194 PFACTORY_LOAD(OpalWAVRecordManager);
00195 #ifdef P_VFW_CAPTURE
00196 PFACTORY_LOAD(OpalAVIRecordManager);
00197 #endif
00198
00199 #endif // OPAL_HAS_MIXER
00200
00201
00202 #endif // OPAL_OPAL_AUDIORECORD_H