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
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)
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
00179 PFACTORY_LOAD(OpalWAVRecordManager);
00180 #ifdef P_VFW_CAPTURE
00181 PFACTORY_LOAD(OpalAVIRecordManager);
00182 #endif
00183
00184
00185 #endif // OPAL_OPAL_AUDIORECORD_H