recording.h
Go to the documentation of this file.
/*
* audiorecord.h
*
* OPAL audio record manager
*
* Open Phone Abstraction Library (OPAL)
* Formally known as the Open H323 project.
*
* Copyright (C) 2007 Post Increment
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open Phone Abstraction Library.
*
* The Initial Developer of the Original Code is Post Increment
*
* Contributor(s): ______________________________________.
*
* $Revision: 27110 $
* $Author: rjongbloed $
* $Date: 2012-03-04 22:12:36 -0600 (Sun, 04 Mar 2012) $
*/
#ifndef OPAL_OPAL_AUDIORECORD_H
#define OPAL_OPAL_AUDIORECORD_H
#include <opal/buildopts.h>
#if OPAL_HAS_MIXER
class OpalRecordManager
{
public:
typedef PFactory<OpalRecordManager, PCaselessString> Factory;
#if OPAL_VIDEO
enum VideoMode {
eSideBySideLetterbox,
eSideBySideScaled,
eStackedPillarbox,
eStackedScaled,
eSeparateStreams,
NumVideoMixingModes
};
#endif
// Options for recording calls.
struct Options {
bool m_stereo;
PString m_audioFormat;
#if OPAL_VIDEO
VideoMode m_videoMixing;
PString m_videoFormat;
unsigned m_videoWidth;
unsigned m_videoHeight;
unsigned m_videoRate;
#endif
Options(
bool stereo = true,
#if OPAL_VIDEO
VideoMode videoMixing = eSideBySideLetterbox,
#endif
const char * audioFormat = NULL
#if OPAL_VIDEO
,
const char * videoFormat = NULL,
unsigned width = PVideoFrameInfo::CIFWidth,
unsigned height = PVideoFrameInfo::CIFHeight,
unsigned rate = 15
#endif
) : m_stereo(stereo)
, m_audioFormat(audioFormat)
#if OPAL_VIDEO
, m_videoMixing(videoMixing)
, m_videoFormat(videoFormat)
, m_videoWidth(width)
, m_videoHeight(height)
, m_videoRate(rate)
#endif
{
}
};
virtual ~OpalRecordManager() { }
bool Open(const PFilePath & fn)
{
return OpenFile(fn);
}
bool Open(const PFilePath & fn, bool mono) // For backward compatibility
{
m_options.m_stereo = !mono;
return OpenFile(fn);
}
bool Open(const PFilePath & fn, const Options & options)
{
m_options = options;
return Open(fn);
}
virtual bool IsOpen() const = 0;
virtual bool Close() = 0;
virtual bool OpenStream(
const PString & strmId,
const OpalMediaFormat & format
) = 0;
virtual bool CloseStream(
const PString & strmId
) = 0;
virtual bool WriteAudio(
const PString & strmId,
const RTP_DataFrame & rtp
) = 0;
#if OPAL_VIDEO
virtual bool WriteVideo(
const PString & strmId,
const RTP_DataFrame & rtp
) = 0;
#endif
const Options & GetOptions() const { return m_options; }
void SetOptions(const Options & options)
{
m_options = options;
}
protected:
virtual bool OpenFile(const PFilePath & fn) = 0;
Options m_options;
};
// Force linking of modules
PFACTORY_LOAD(OpalWAVRecordManager);
#if OPAL_VIDEO && P_VFW_CAPTURE
PFACTORY_LOAD(OpalAVIRecordManager);
#endif
#endif // OPAL_HAS_MIXER
#endif // OPAL_OPAL_AUDIORECORD_H
OpalRecordManager::VideoMode
VideoMode
Definition: recording.h:57
OpalRecordManager::Open
bool Open(const PFilePath &fn, bool mono)
Definition: recording.h:139
OpalRecordManager::Options::m_videoMixing
VideoMode m_videoMixing
Mode for how incoming video is mixed.
Definition: recording.h:90
OpalRecordManager::eStackedScaled
Definition: recording.h:70
OpalRecordManager::IsOpen
virtual bool IsOpen() const =0
OpalRecordManager::eStackedPillarbox
Definition: recording.h:66
buildopts.h
OpalRecordManager::Options::m_videoHeight
unsigned m_videoHeight
Video mixer buffer heigth. Inputs are scaled accordingly.
Definition: recording.h:97
OpalRecordManager::Open
bool Open(const PFilePath &fn)
Definition: recording.h:132
OpalRecordManager::Close
virtual bool Close()=0
OpalRecordManager::eSideBySideLetterbox
Definition: recording.h:58
OpalRecordManager::NumVideoMixingModes
Definition: recording.h:75
OpalRecordManager::Options::m_videoFormat
PString m_videoFormat
Definition: recording.h:91
RTP_DataFrame
Definition: rtp.h:71
PFACTORY_LOAD
PFACTORY_LOAD(OpalWAVRecordManager)
OpalRecordManager::Open
bool Open(const PFilePath &fn, const Options &options)
Definition: recording.h:147
OpalMediaFormat
Definition: mediafmt.h:724
OpalRecordManager::m_options
Options m_options
Definition: recording.h:206
OpalRecordManager::CloseStream
virtual bool CloseStream(const PString &strmId)=0
OpalRecordManager::Options::m_videoWidth
unsigned m_videoWidth
Video mixer buffer width. Inputs are scaled accordingly.
Definition: recording.h:96
OpalRecordManager::GetOptions
const Options & GetOptions() const
Definition: recording.h:194
OpalRecordManager::Factory
PFactory< OpalRecordManager, PCaselessString > Factory
Definition: recording.h:54
OpalRecordManager::Options::m_audioFormat
PString m_audioFormat
Definition: recording.h:83
OpalRecordManager::SetOptions
void SetOptions(const Options &options)
Definition: recording.h:198
OpalRecordManager::eSeparateStreams
Unsupported.
Definition: recording.h:74
OpalRecordManager
Definition: recording.h:46
OpalRecordManager::WriteVideo
virtual bool WriteVideo(const PString &strmId, const RTP_DataFrame &rtp)=0
OpalRecordManager::eSideBySideScaled
Definition: recording.h:62
OpalRecordManager::OpenFile
virtual bool OpenFile(const PFilePath &fn)=0
OpalRecordManager::Options::m_stereo
bool m_stereo
Definition: recording.h:81
OpalRecordManager::Options::Options
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
OpalRecordManager::Options::m_videoRate
unsigned m_videoRate
Definition: recording.h:98
OpalRecordManager::Options
Definition: recording.h:80
OpalRecordManager::~OpalRecordManager
virtual ~OpalRecordManager()
Definition: recording.h:128
OpalRecordManager::WriteAudio
virtual bool WriteAudio(const PString &strmId, const RTP_DataFrame &rtp)=0
OpalRecordManager::OpenStream
virtual bool OpenStream(const PString &strmId, const OpalMediaFormat &format)=0