OPAL  Version 3.10.10
recording.h
Go to the documentation of this file.
1 /*
2  * audiorecord.h
3  *
4  * OPAL audio record manager
5  *
6  * Open Phone Abstraction Library (OPAL)
7  * Formally known as the Open H323 project.
8  *
9  * Copyright (C) 2007 Post Increment
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Open Phone Abstraction Library.
22  *
23  * The Initial Developer of the Original Code is Post Increment
24  *
25  * Contributor(s): ______________________________________.
26  *
27  * $Revision: 27110 $
28  * $Author: rjongbloed $
29  * $Date: 2012-03-04 22:12:36 -0600 (Sun, 04 Mar 2012) $
30  */
31 
32 
33 #ifndef OPAL_OPAL_AUDIORECORD_H
34 #define OPAL_OPAL_AUDIORECORD_H
35 
36 
37 #include <opal/buildopts.h>
38 
39 #if OPAL_HAS_MIXER
40 
41 
47 {
48  public:
54  typedef PFactory<OpalRecordManager, PCaselessString> Factory;
55 
56 #if OPAL_VIDEO
57  enum VideoMode {
76  };
77 #endif
78 
79  // Options for recording calls.
80  struct Options {
81  bool m_stereo;
83  PString m_audioFormat;
89 #if OPAL_VIDEO
91  PString m_videoFormat;
96  unsigned m_videoWidth;
97  unsigned m_videoHeight;
98  unsigned m_videoRate;
100 #endif
101 
103  bool stereo = true,
104 #if OPAL_VIDEO
105  VideoMode videoMixing = eSideBySideLetterbox,
106 #endif
107  const char * audioFormat = NULL
108 #if OPAL_VIDEO
109  ,
110  const char * videoFormat = NULL,
111  unsigned width = PVideoFrameInfo::CIFWidth,
112  unsigned height = PVideoFrameInfo::CIFHeight,
113  unsigned rate = 15
114 #endif
115  ) : m_stereo(stereo)
116  , m_audioFormat(audioFormat)
117 #if OPAL_VIDEO
118  , m_videoMixing(videoMixing)
119  , m_videoFormat(videoFormat)
120  , m_videoWidth(width)
121  , m_videoHeight(height)
122  , m_videoRate(rate)
123 #endif
124  {
125  }
126  };
127 
128  virtual ~OpalRecordManager() { }
129 
132  bool Open(const PFilePath & fn)
133  {
134  return OpenFile(fn);
135  }
136 
139  bool Open(const PFilePath & fn, bool mono) // For backward compatibility
140  {
141  m_options.m_stereo = !mono;
142  return OpenFile(fn);
143  }
144 
147  bool Open(const PFilePath & fn, const Options & options)
148  {
149  m_options = options;
150  return Open(fn);
151  }
152 
155  virtual bool IsOpen() const = 0;
156 
161  virtual bool Close() = 0;
162 
165  virtual bool OpenStream(
166  const PString & strmId,
167  const OpalMediaFormat & format
168  ) = 0;
169 
172  virtual bool CloseStream(
173  const PString & strmId
174  ) = 0;
175 
178  virtual bool WriteAudio(
179  const PString & strmId,
180  const RTP_DataFrame & rtp
181  ) = 0;
182 
183 #if OPAL_VIDEO
184 
186  virtual bool WriteVideo(
187  const PString & strmId,
188  const RTP_DataFrame & rtp
189  ) = 0;
190 #endif
191 
194  const Options & GetOptions() const { return m_options; }
195 
198  void SetOptions(const Options & options)
199  {
200  m_options = options;
201  }
202 
203  protected:
204  virtual bool OpenFile(const PFilePath & fn) = 0;
205 
207 };
208 
209 // Force linking of modules
210 PFACTORY_LOAD(OpalWAVRecordManager);
211 #if OPAL_VIDEO && P_VFW_CAPTURE
212 PFACTORY_LOAD(OpalAVIRecordManager);
213 #endif
214 
215 #endif // OPAL_HAS_MIXER
216 
217 
218 #endif // OPAL_OPAL_AUDIORECORD_H
VideoMode
Definition: recording.h:57
bool Open(const PFilePath &fn, bool mono)
Definition: recording.h:139
VideoMode m_videoMixing
Mode for how incoming video is mixed.
Definition: recording.h:90
Definition: recording.h:70
virtual bool IsOpen() const =0
Definition: recording.h:66
unsigned m_videoHeight
Video mixer buffer heigth. Inputs are scaled accordingly.
Definition: recording.h:97
bool Open(const PFilePath &fn)
Definition: recording.h:132
virtual bool Close()=0
Definition: recording.h:58
Definition: recording.h:75
PString m_videoFormat
Definition: recording.h:91
Definition: rtp.h:71
PFACTORY_LOAD(OpalWAVRecordManager)
bool Open(const PFilePath &fn, const Options &options)
Definition: recording.h:147
Definition: mediafmt.h:724
Options m_options
Definition: recording.h:206
virtual bool CloseStream(const PString &strmId)=0
unsigned m_videoWidth
Video mixer buffer width. Inputs are scaled accordingly.
Definition: recording.h:96
const Options & GetOptions() const
Definition: recording.h:194
PFactory< OpalRecordManager, PCaselessString > Factory
Definition: recording.h:54
PString m_audioFormat
Definition: recording.h:83
void SetOptions(const Options &options)
Definition: recording.h:198
Unsupported.
Definition: recording.h:74
Definition: recording.h:46
virtual bool WriteVideo(const PString &strmId, const RTP_DataFrame &rtp)=0
Definition: recording.h:62
virtual bool OpenFile(const PFilePath &fn)=0
bool m_stereo
Definition: recording.h:81
Options(bool stereo=true, VideoMode videoMixing=eSideBySideLetterbox, const char *audioFormat=NULL, const char *videoFormat=NULL, unsigned width=PVideoFrameInfo::CIFWidth, unsigned height=PVideoFrameInfo::CIFHeight, unsigned rate=15)
Definition: recording.h:102
unsigned m_videoRate
Definition: recording.h:98
Definition: recording.h:80
virtual ~OpalRecordManager()
Definition: recording.h:128
virtual bool WriteAudio(const PString &strmId, const RTP_DataFrame &rtp)=0
virtual bool OpenStream(const PString &strmId, const OpalMediaFormat &format)=0