opalmixer.h
Go to the documentation of this file.
/*
* opalmixer.h
*
* OPAL media mixers
*
* 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): Craig Southeren (craigs@postincrement.com)
* Robert Jongbloed (robertj@voxlucida.com.au)
*
* $Revision: 27149 $
* $Author: rjongbloed $
* $Date: 2012-03-07 18:32:36 -0600 (Wed, 07 Mar 2012) $
*/
#ifndef OPAL_OPAL_OPALMIXER_H
#define OPAL_OPAL_OPALMIXER_H
#ifndef _PTLIB_H
#include <ptlib.h>
#endif
#include <opal/buildopts.h>
#include <queue>
#include <opal/localep.h>
#include <codec/vidcodec.h>
#include <ptclib/threadpool.h>
class RTP_DataFrame;
class OpalJitterBuffer;
class OpalMixerConnection;
//#define OPAL_MIXER_AUDIO_DEBUG 1
#define OPAL_OPT_LISTEN_ONLY "Listen-Only"
class OpalBaseMixer
{
public:
OpalBaseMixer(
bool pushThread,
unsigned periodMS,
unsigned periodTS
);
virtual ~OpalBaseMixer();
typedef PString Key_T;
virtual bool AddStream(
const Key_T & key
);
virtual void RemoveStream(
const Key_T & key
);
virtual void RemoveAllStreams();
virtual bool WriteStream(
const Key_T & key,
const RTP_DataFrame & input
);
virtual RTP_DataFrame * ReadMixed();
virtual bool ReadMixed(RTP_DataFrame & mixed);
virtual bool OnMixed(
RTP_DataFrame * & mixed
);
void StartPushThread();
void StopPushThread(bool lock = true);
unsigned GetPeriodTS() const { return m_periodTS; }
protected:
struct Stream {
virtual ~Stream() { }
virtual void QueuePacket(const RTP_DataFrame & rtp) = 0;
queue<RTP_DataFrame> m_queue;
};
typedef std::map<Key_T, Stream *> StreamMap_T;
virtual Stream * CreateStream() = 0;
virtual bool MixStreams(RTP_DataFrame & frame) = 0;
virtual size_t GetOutputSize() const = 0;
virtual bool OnPush();
void PushThreadMain();
bool m_pushThread; // true if to use a thread to push data out
unsigned m_periodMS; // Mixing interval in milliseconds
unsigned m_periodTS; // Mixing interval in timestamp units
StreamMap_T m_inputStreams; // Map of key to stream for input RTP frame queues
unsigned m_outputTimestamp; // RTP timestamp for output data
RTP_DataFrame * m_pushFrame; // Cached frame for pushing RTP
PThread * m_workerThread; // reader thread handle
bool m_threadRunning; // used to stop reader thread
PMutex m_mutex; // mutex for list of streams and thread handle
};
class OpalAudioMixer : public OpalBaseMixer
{
public:
OpalAudioMixer(
bool stereo = false,
unsigned sampleRate = OpalMediaFormat::AudioClockRate,
bool pushThread = true,
unsigned period = 10
);
~OpalAudioMixer() { StopPushThread(); }
virtual void RemoveStream(
const Key_T & key
);
virtual void RemoveAllStreams();
bool IsStereo() const { return m_stereo; }
unsigned GetSampleRate() const { return m_sampleRate; }
bool SetSampleRate(
unsigned rate
);
bool SetJitterBufferSize(
const Key_T & key,
unsigned minJitterDelay,
unsigned maxJitterDelay
);
protected:
struct AudioStream : public Stream
{
AudioStream(OpalAudioMixer & mixer);
~AudioStream();
virtual void QueuePacket(const RTP_DataFrame & rtp);
const short * GetAudioDataPtr();
OpalAudioMixer & m_mixer;
OpalJitterBuffer * m_jitter;
unsigned m_nextTimestamp;
PShortArray m_cacheSamples;
size_t m_samplesUsed;
};
virtual Stream * CreateStream();
virtual bool MixStreams(RTP_DataFrame & frame);
virtual size_t GetOutputSize() const;
void PreMixStreams();
void MixStereo(RTP_DataFrame & frame);
void MixAdditive(RTP_DataFrame & frame, const short * audioToSubtract);
protected:
bool m_stereo;
unsigned m_sampleRate;
AudioStream * m_left;
AudioStream * m_right;
std::vector<int> m_mixedAudio;
};
#if OPAL_VIDEO
class OpalVideoMixer : public OpalBaseMixer
{
public:
enum Styles {
eSideBySideLetterbox,
eSideBySideScaled,
eStackedPillarbox,
eStackedScaled,
eGrid,
};
OpalVideoMixer(
Styles style,
unsigned width,
unsigned height,
unsigned rate = 15,
bool pushThread = true
);
~OpalVideoMixer() { StopPushThread(); }
unsigned GetFrameWidth() const { return m_width; }
unsigned GetFrameHeight() const { return m_height; }
unsigned GetFrameRate() const { return 1000/m_periodMS; }
bool SetFrameRate(
unsigned rate // New frames per second.
);
bool SetFrameSize(
unsigned width,
unsigned height
);
protected:
struct VideoStream : public Stream
{
VideoStream(OpalVideoMixer & mixer);
virtual void QueuePacket(const RTP_DataFrame & rtp);
void InsertVideoFrame(unsigned x, unsigned y, unsigned w, unsigned h);
OpalVideoMixer & m_mixer;
};
friend struct VideoStream;
virtual Stream * CreateStream();
virtual bool MixStreams(RTP_DataFrame & frame);
virtual size_t GetOutputSize() const;
protected:
Styles m_style;
unsigned m_width, m_height;
BYTE m_bgFillRed,m_bgFillGreen,m_bgFillBlue;
PBYTEArray m_frameStore;
size_t m_lastStreamCount;
};
#endif // OPAL_VIDEO
struct OpalMixerNodeInfo
{
OpalMixerNodeInfo(const char * name = NULL)
: m_name(name)
, m_listenOnly(false)
, m_sampleRate(OpalMediaFormat::AudioClockRate)
#if OPAL_VIDEO
, m_audioOnly(false)
, m_style(OpalVideoMixer::eGrid)
, m_width(PVideoFrameInfo::CIFWidth)
, m_height(PVideoFrameInfo::CIFHeight)
, m_rate(15)
#endif
, m_mediaPassThru(false)
{ }
virtual ~OpalMixerNodeInfo() { }
virtual OpalMixerNodeInfo * Clone() const { return new OpalMixerNodeInfo(*this); }
PString m_name;
bool m_listenOnly;
unsigned m_sampleRate;
#if OPAL_VIDEO
bool m_audioOnly;
OpalVideoMixer::Styles m_style;
unsigned m_width;
unsigned m_height;
unsigned m_rate;
#endif
bool m_mediaPassThru;
};
class OpalMixerNode;
class OpalMixerNodeManager : public PObject
{
PCLASSINFO(OpalMixerNodeManager, PObject);
public:
OpalMixerNodeManager();
virtual ~OpalMixerNodeManager();
virtual void ShutDown();
virtual PBoolean GarbageCollection();
virtual OpalMixerNode * CreateNode(
OpalMixerNodeInfo * info
);
virtual PSafePtr<OpalMixerNode> AddNode(
OpalMixerNodeInfo * info
);
void AddNode(OpalMixerNode * node);
PSafePtr<OpalMixerNode> GetFirstNode(
PSafetyMode mode = PSafeReference
) const { return PSafePtr<OpalMixerNode>(m_nodesByUID, mode); }
virtual PSafePtr<OpalMixerNode> FindNode(
const PString & name,
PSafetyMode mode = PSafeReference
);
virtual void RemoveNode(
OpalMixerNode & node
);
void AddNodeName(
PString name,
OpalMixerNode * node
);
void RemoveNodeName(
PString name
);
void RemoveNodeNames(
PStringList names
);
void QueueUserInput(
const PSafePtr<OpalMixerNode> & node,
const OpalMixerConnection * connection,
const PString & value
);
protected:
PSafeDictionary<PGloballyUniqueID, OpalMixerNode> m_nodesByUID;
PDictionary<PString, OpalMixerNode> m_nodesByName;
struct UserInput {
UserInput(
const PSafePtr<OpalMixerNode> & node,
const OpalMixerConnection * connection,
const PString & value
) : m_node(node)
, m_connection(connection)
, m_value(value)
{ }
PSafePtr<OpalMixerNode> m_node;
const OpalMixerConnection * m_connection;
PString m_value;
void Work();
};
PQueuedThreadPool<UserInput> m_userInputPool;
};
class OpalMixerEndPoint : public OpalLocalEndPoint
{
PCLASSINFO(OpalMixerEndPoint, OpalLocalEndPoint);
public:
OpalMixerEndPoint(
OpalManager & manager,
const char * prefix
);
~OpalMixerEndPoint();
virtual void ShutDown();
virtual OpalMediaFormatList GetMediaFormats() const;
virtual PSafePtr<OpalConnection> MakeConnection(
OpalCall & call,
const PString & party,
void * userData = NULL,
unsigned options = 0,
OpalConnection::StringOptions * stringOptions = NULL
);
virtual PBoolean GarbageCollection();
PSafePtr<OpalMixerConnection> GetMixerConnectionWithLock(
const PString & token,
PSafetyMode mode = PSafeReadWrite
) { return GetConnectionWithLockAs<OpalMixerConnection>(token, mode); }
virtual OpalMixerConnection * CreateConnection(
PSafePtr<OpalMixerNode> node,
OpalCall & call,
void * userData,
unsigned options,
OpalConnection::StringOptions * stringOptions
);
PSafePtr<OpalMixerNode> AddNode(
OpalMixerNodeInfo * info
);
virtual OpalMixerNode * CreateNode(
OpalMixerNodeInfo * info
);
PSafePtr<OpalMixerNode> GetFirstNode(
PSafetyMode mode = PSafeReference
) const { return m_nodeManager.GetFirstNode(mode); }
PSafePtr<OpalMixerNode> FindNode(
const PString & name,
PSafetyMode mode = PSafeReference
) { return m_nodeManager.FindNode(name, mode); }
void RemoveNode(
OpalMixerNode & node
) { m_nodeManager.RemoveNode(node); }
void SetAdHocNodeInfo(
const OpalMixerNodeInfo & info
);
void SetAdHocNodeInfo(
OpalMixerNodeInfo * info
);
OpalMixerNodeInfo * GetAdHocNodeInfo() { return m_adHocNodeInfo; }
const OpalMixerNodeManager & GetNodeManager() const { return m_nodeManager; }
OpalMixerNodeManager & GetNodeManager() { return m_nodeManager; }
protected:
OpalMixerNodeInfo * m_adHocNodeInfo;
OpalMixerNodeManager m_nodeManager;
};
class OpalMixerConnection : public OpalLocalConnection
{
PCLASSINFO(OpalMixerConnection, OpalLocalConnection);
public:
OpalMixerConnection(
PSafePtr<OpalMixerNode> node,
OpalCall & call,
OpalMixerEndPoint & endpoint,
void * userData,
unsigned options = 0,
OpalConnection::StringOptions * stringOptions = NULL
);
~OpalMixerConnection();
virtual void OnReleased();
virtual OpalMediaFormatList GetMediaFormats() const;
virtual OpalMediaStream * CreateMediaStream(
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
PBoolean isSource
);
virtual void OnStartMediaPatch(
OpalMediaPatch & patch
);
virtual void OnApplyStringOptions();
virtual PBoolean SendUserInputString(
const PString & value
);
virtual PBoolean SendUserInputTone(
char tone,
unsigned duration = 0
);
void SetListenOnly(
bool listenOnly
);
bool GetListenOnly() const { return m_listenOnly; }
PSafePtr<OpalMixerNode> GetNode() const { return m_node; }
protected:
OpalMixerEndPoint & m_endpoint;
PSafePtr<OpalMixerNode> m_node;
bool m_listenOnly;
};
class OpalMixerMediaStream : public OpalMediaStream
{
PCLASSINFO(OpalMixerMediaStream, OpalMediaStream);
public:
OpalMixerMediaStream(
OpalConnection & conn,
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
bool isSource,
PSafePtr<OpalMixerNode> node,
bool listenOnly
);
~OpalMixerMediaStream();
virtual PBoolean Open();
virtual PBoolean WritePacket(
RTP_DataFrame & packet
);
virtual PBoolean IsSynchronous() const;
virtual PBoolean RequiresPatchThread() const;
virtual bool EnableJitterBuffer(bool enab = true) const;
PSafePtr<OpalMixerNode> GetNode() { return m_node; }
protected:
virtual void InternalClose();
PSafePtr<OpalMixerNode> m_node;
bool m_listenOnly;
#if OPAL_VIDEO
bool m_video;
#endif
};
class OpalMixerNode : public PSafeObject
{
PCLASSINFO(OpalMixerNode, PSafeObject);
public:
OpalMixerNode(
OpalMixerNodeManager & manager,
OpalMixerNodeInfo * info
);
OpalMixerNode(
OpalMixerEndPoint & endpoint,
OpalMixerNodeInfo * info
);
~OpalMixerNode();
void ShutDown();
void PrintOn(
ostream & strm
) const;
void AttachConnection(
OpalConnection * connection
);
void DetachConnection(
OpalConnection * connection
);
bool AttachStream(
OpalMixerMediaStream * stream
);
void DetachStream(
OpalMixerMediaStream * stream
);
void UseMediaPassThrough(
unsigned sessionID,
OpalConnection * connection = NULL
);
bool SetJitterBufferSize(
const OpalBaseMixer::Key_T & key,
unsigned minJitterDelay,
unsigned maxJitterDelay
) { return m_audioMixer.SetJitterBufferSize(key, minJitterDelay, maxJitterDelay); }
bool WriteAudio(
const OpalBaseMixer::Key_T & key,
const RTP_DataFrame & input
) { return m_audioMixer.WriteStream(key, input); }
#if OPAL_VIDEO
bool WriteVideo(
const OpalBaseMixer::Key_T & key,
const RTP_DataFrame & input
) { return m_videoMixer.WriteStream(key, input); }
#endif // OPAL_VIDEO
virtual void BroadcastUserInput(
const OpalConnection * connection,
const PString & value
);
const PGloballyUniqueID & GetGUID() const { return m_guid; }
const PStringList & GetNames() const { return m_names; }
void AddName(
const PString & name
);
void RemoveName(
const PString & name
);
PINDEX GetConnectionCount() const { return m_connections.GetSize(); }
template <class Subclass>
PSafePtr<Subclass> GetFirstConnectionAs(
PSafetyMode mode = PSafeReference
) const { return PSafePtr<Subclass>(m_connections, mode); }
PSafePtr<OpalConnection> GetFirstConnection(
PSafetyMode mode = PSafeReference
) const { return GetFirstConnectionAs<OpalConnection>(mode); }
const OpalMixerNodeInfo & GetNodeInfo() { return *m_info; }
const PTime & GetCreationTime() const { return m_creationTime; }
protected:
void Construct();
OpalMixerNodeManager & m_manager;
PGloballyUniqueID m_guid;
PStringList m_names;
OpalMixerNodeInfo * m_info;
PTime m_creationTime;
PSafeList<OpalConnection> m_connections;
struct MediaMixer
{
MediaMixer();
PSafeList<OpalMixerMediaStream> m_outputStreams;
};
struct AudioMixer : public OpalAudioMixer, public MediaMixer
{
AudioMixer(const OpalMixerNodeInfo & info);
~AudioMixer();
virtual bool OnPush();
struct CachedAudio {
CachedAudio();
~CachedAudio();
enum { Collecting, Collected, Completed } m_state;
RTP_DataFrame m_raw;
RTP_DataFrame m_encoded;
OpalTranscoder * m_transcoder;
};
std::map<PString, CachedAudio> m_cache;
void PushOne(
PSafePtr<OpalMixerMediaStream> & stream,
CachedAudio & cache,
const short * audioToSubtract
);
#ifdef OPAL_MIXER_AUDIO_DEBUG
class PAudioMixerDebug * m_audioDebug;
#endif
};
AudioMixer m_audioMixer;
#if OPAL_VIDEO
struct VideoMixer : public OpalVideoMixer, public MediaMixer
{
VideoMixer(const OpalMixerNodeInfo & info);
~VideoMixer();
virtual bool OnMixed(RTP_DataFrame * & output);
PDictionary<PString, OpalTranscoder> m_transcoders;
};
VideoMixer m_videoMixer;
#endif // OPAL_VIDEO
};
#endif // OPAL_OPAL_OPAL_MIXER
vidcodec.h
OpalAudioMixer::OpalAudioMixer
OpalAudioMixer(bool stereo=false, unsigned sampleRate=OpalMediaFormat::AudioClockRate, bool pushThread=true, unsigned period=10)
OpalMixerNode::MediaMixer::MediaMixer
MediaMixer()
OpalMixerNodeInfo::m_mediaPassThru
bool m_mediaPassThru
Definition: opalmixer.h:411
OpalMixerMediaStream::WritePacket
virtual PBoolean WritePacket(RTP_DataFrame &packet)
OpalManager
Definition: manager.h:74
OpalMixerNodeManager::GetFirstNode
PSafePtr< OpalMixerNode > GetFirstNode(PSafetyMode mode=PSafeReference) const
Definition: opalmixer.h:480
OpalVideoMixer::Styles
Styles
Definition: opalmixer.h:288
OpalAudioMixer::AudioStream::~AudioStream
~AudioStream()
OpalMixerNode::VideoMixer::~VideoMixer
~VideoMixer()
OpalBaseMixer::StreamMap_T
std::map< Key_T, Stream * > StreamMap_T
Definition: opalmixer.h:158
OpalMixerNode::MediaMixer::m_outputStreams
PSafeList< OpalMixerMediaStream > m_outputStreams
Definition: opalmixer.h:1159
OpalAudioMixer::m_right
AudioStream * m_right
Definition: opalmixer.h:270
OpalMixerNodeManager::GarbageCollection
virtual PBoolean GarbageCollection()
OpalMixerNode::AudioMixer::PushOne
void PushOne(PSafePtr< OpalMixerMediaStream > &stream, CachedAudio &cache, const short *audioToSubtract)
OpalMediaStream::isSource
bool isSource
Definition: mediastrm.h:421
OpalMixerNodeManager::UserInput::Work
void Work()
OpalMixerNodeInfo::m_audioOnly
bool m_audioOnly
No video is to be allowed.
Definition: opalmixer.h:405
OpalMixerNode::MediaMixer
Definition: opalmixer.h:1155
OpalMixerNode::m_creationTime
PTime m_creationTime
Definition: opalmixer.h:1151
OpalBaseMixer::Stream
Definition: opalmixer.h:153
buildopts.h
OpalMixerNode::AudioMixer
Definition: opalmixer.h:1162
OpalMixerNodeManager::m_nodesByName
PDictionary< PString, OpalMixerNode > m_nodesByName
Definition: opalmixer.h:531
OpalMixerEndPoint::GetNodeManager
const OpalMixerNodeManager & GetNodeManager() const
Definition: opalmixer.h:747
OpalLocalConnection
Definition: localep.h:360
OpalMixerNodeManager::QueueUserInput
void QueueUserInput(const PSafePtr< OpalMixerNode > &node, const OpalMixerConnection *connection, const PString &value)
OpalMixerEndPoint::GetFirstNode
PSafePtr< OpalMixerNode > GetFirstNode(PSafetyMode mode=PSafeReference) const
Definition: opalmixer.h:690
OpalBaseMixer::CreateStream
virtual Stream * CreateStream()=0
OpalBaseMixer::m_pushThread
bool m_pushThread
Definition: opalmixer.h:167
OpalAudioMixer::AudioStream::m_mixer
OpalAudioMixer & m_mixer
Definition: opalmixer.h:250
OpalVideoMixer::SetFrameRate
bool SetFrameRate(unsigned rate)
OpalVideoMixer::m_frameStore
PBYTEArray m_frameStore
Definition: opalmixer.h:367
OpalMixerNode::SetJitterBufferSize
bool SetJitterBufferSize(const OpalBaseMixer::Key_T &key, unsigned minJitterDelay, unsigned maxJitterDelay)
Definition: opalmixer.h:1063
OpalMixerNode::WriteAudio
bool WriteAudio(const OpalBaseMixer::Key_T &key, const RTP_DataFrame &input)
Definition: opalmixer.h:1071
OpalAudioMixer::CreateStream
virtual Stream * CreateStream()
OpalMixerNodeInfo::m_listenOnly
bool m_listenOnly
Mixer only transmits data to "listeners".
Definition: opalmixer.h:402
OpalMixerNodeManager::m_userInputPool
PQueuedThreadPool< UserInput > m_userInputPool
Definition: opalmixer.h:549
OpalMixerNodeManager::CreateNode
virtual OpalMixerNode * CreateNode(OpalMixerNodeInfo *info)
OpalMixerEndPoint::GarbageCollection
virtual PBoolean GarbageCollection()
OpalMixerConnection::GetNode
PSafePtr< OpalMixerNode > GetNode() const
Definition: opalmixer.h:887
OpalMixerNode::GetFirstConnection
PSafePtr< OpalConnection > GetFirstConnection(PSafetyMode mode=PSafeReference) const
Definition: opalmixer.h:1131
OpalVideoMixer::m_bgFillGreen
BYTE m_bgFillGreen
Definition: opalmixer.h:365
OpalMixerNodeInfo::m_width
unsigned m_width
Width of mixed video.
Definition: opalmixer.h:407
OpalAudioMixer::AudioStream::m_jitter
OpalJitterBuffer * m_jitter
Definition: opalmixer.h:251
OpalMixerNodeManager::m_nodesByUID
PSafeDictionary< PGloballyUniqueID, OpalMixerNode > m_nodesByUID
Definition: opalmixer.h:530
OpalBaseMixer::StopPushThread
void StopPushThread(bool lock=true)
OpalVideoMixer::VideoStream
Definition: opalmixer.h:347
OpalAudioMixer::m_left
AudioStream * m_left
Definition: opalmixer.h:269
OpalMixerNodeInfo::m_height
unsigned m_height
Height of mixed video.
Definition: opalmixer.h:408
OpalAudioMixer::m_stereo
bool m_stereo
Definition: opalmixer.h:266
OpalBaseMixer::m_mutex
PMutex m_mutex
Definition: opalmixer.h:176
OpalVideoMixer::m_style
Styles m_style
Definition: opalmixer.h:363
OpalVideoMixer::CreateStream
virtual Stream * CreateStream()
OpalMixerConnection::~OpalMixerConnection
~OpalMixerConnection()
OpalMixerMediaStream
Definition: opalmixer.h:900
OpalBaseMixer::m_workerThread
PThread * m_workerThread
Definition: opalmixer.h:174
OpalAudioMixer::~OpalAudioMixer
~OpalAudioMixer()
Definition: opalmixer.h:199
OpalMixerEndPoint::AddNode
PSafePtr< OpalMixerNode > AddNode(OpalMixerNodeInfo *info)
OpalMixerNode::AudioMixer::CachedAudio::Completed
Definition: opalmixer.h:1172
OpalMixerEndPoint::m_adHocNodeInfo
OpalMixerNodeInfo * m_adHocNodeInfo
Definition: opalmixer.h:752
OpalVideoMixer::VideoStream::m_mixer
OpalVideoMixer & m_mixer
Definition: opalmixer.h:353
OpalBaseMixer::~OpalBaseMixer
virtual ~OpalBaseMixer()
OpalMixerEndPoint::GetNodeManager
OpalMixerNodeManager & GetNodeManager()
Definition: opalmixer.h:748
OpalAudioMixer::AudioStream::AudioStream
AudioStream(OpalAudioMixer &mixer)
OpalMixerConnection::SendUserInputTone
virtual PBoolean SendUserInputTone(char tone, unsigned duration=0)
OpalVideoMixer::OpalVideoMixer
OpalVideoMixer(Styles style, unsigned width, unsigned height, unsigned rate=15, bool pushThread=true)
OpalMixerMediaStream::m_listenOnly
bool m_listenOnly
Definition: opalmixer.h:975
OpalMixerEndPoint::CreateConnection
virtual OpalMixerConnection * CreateConnection(PSafePtr< OpalMixerNode > node, OpalCall &call, void *userData, unsigned options, OpalConnection::StringOptions *stringOptions)
OpalMixerNode::AudioMixer::CachedAudio::~CachedAudio
~CachedAudio()
OpalMixerEndPoint::OpalMixerEndPoint
OpalMixerEndPoint(OpalManager &manager, const char *prefix)
OpalMixerNodeManager
Definition: opalmixer.h:425
OpalMixerNode::VideoMixer::OnMixed
virtual bool OnMixed(RTP_DataFrame *&output)
OpalMixerNode::AudioMixer::CachedAudio
Definition: opalmixer.h:1169
OpalMixerConnection::OpalMixerConnection
OpalMixerConnection(PSafePtr< OpalMixerNode > node, OpalCall &call, OpalMixerEndPoint &endpoint, void *userData, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalMixerNodeManager::UserInput::UserInput
UserInput(const PSafePtr< OpalMixerNode > &node, const OpalMixerConnection *connection, const PString &value)
Definition: opalmixer.h:534
OpalMixerEndPoint::RemoveNode
void RemoveNode(OpalMixerNode &node)
Definition: opalmixer.h:706
localep.h
OpalVideoMixer::m_bgFillBlue
BYTE m_bgFillBlue
Definition: opalmixer.h:365
OpalAudioMixer::RemoveStream
virtual void RemoveStream(const Key_T &key)
OpalMixerConnection::OnApplyStringOptions
virtual void OnApplyStringOptions()
Call back for connection to act on changed string options.
OpalMixerNodeManager::UserInput
Definition: opalmixer.h:533
OpalMixerNodeInfo
Definition: opalmixer.h:381
OpalAudioMixer::AudioStream::m_samplesUsed
size_t m_samplesUsed
Definition: opalmixer.h:254
OpalAudioMixer::IsStereo
bool IsStereo() const
Definition: opalmixer.h:213
OpalVideoMixer::GetFrameWidth
unsigned GetFrameWidth() const
Definition: opalmixer.h:321
OpalMixerConnection::SetListenOnly
void SetListenOnly(bool listenOnly)
OpalBaseMixer::Stream::m_queue
queue< RTP_DataFrame > m_queue
Definition: opalmixer.h:156
OpalBaseMixer::OpalBaseMixer
OpalBaseMixer(bool pushThread, unsigned periodMS, unsigned periodTS)
OpalMixerNode::GetFirstConnectionAs
PSafePtr< Subclass > GetFirstConnectionAs(PSafetyMode mode=PSafeReference) const
Definition: opalmixer.h:1125
OpalMixerEndPoint::GetMixerConnectionWithLock
PSafePtr< OpalMixerConnection > GetMixerConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: opalmixer.h:649
OpalMediaFormatList
Definition: mediafmt.h:72
OpalVideoMixer::VideoStream::QueuePacket
virtual void QueuePacket(const RTP_DataFrame &rtp)
OpalMixerNode::AddName
void AddName(const PString &name)
OpalAudioMixer::PreMixStreams
void PreMixStreams()
OpalMixerMediaStream::m_node
PSafePtr< OpalMixerNode > m_node
Definition: opalmixer.h:974
OpalMixerNode::GetNames
const PStringList & GetNames() const
Definition: opalmixer.h:1101
OpalMixerEndPoint::SetAdHocNodeInfo
void SetAdHocNodeInfo(const OpalMixerNodeInfo &info)
OpalLocalConnection::endpoint
OpalLocalEndPoint & endpoint
Definition: localep.h:522
OpalBaseMixer::RemoveAllStreams
virtual void RemoveAllStreams()
OpalConnection::StringOptions
Definition: connection.h:462
OpalMixerEndPoint::CreateNode
virtual OpalMixerNode * CreateNode(OpalMixerNodeInfo *info)
OpalMixerMediaStream::OpalMixerMediaStream
OpalMixerMediaStream(OpalConnection &conn, const OpalMediaFormat &mediaFormat, unsigned sessionID, bool isSource, PSafePtr< OpalMixerNode > node, bool listenOnly)
OpalVideoMixer::VideoStream::VideoStream
VideoStream(OpalVideoMixer &mixer)
OpalMediaStream::sessionID
unsigned sessionID
Definition: mediastrm.h:417
OpalMixerConnection::SendUserInputString
virtual PBoolean SendUserInputString(const PString &value)
OpalMixerNodeInfo::Clone
virtual OpalMixerNodeInfo * Clone() const
Definition: opalmixer.h:399
OpalMixerNodeManager::AddNode
virtual PSafePtr< OpalMixerNode > AddNode(OpalMixerNodeInfo *info)
OpalMixerNode::AudioMixer::CachedAudio::m_state
enum OpalMixerNode::AudioMixer::CachedAudio::@33 m_state
RTP_DataFrame
Definition: rtp.h:71
OpalLocalEndPoint
Definition: localep.h:50
OpalVideoMixer
Definition: opalmixer.h:285
OpalVideoMixer::SetFrameSize
bool SetFrameSize(unsigned width, unsigned height)
OpalJitterBuffer
Definition: jitter.h:55
OpalMediaPatch
Definition: patch.h:60
OpalVideoMixer::m_lastStreamCount
size_t m_lastStreamCount
Definition: opalmixer.h:368
OpalBaseMixer::RemoveStream
virtual void RemoveStream(const Key_T &key)
OpalVideoMixer::eStackedPillarbox
Definition: opalmixer.h:297
OpalMixerNode::AttachConnection
void AttachConnection(OpalConnection *connection)
OpalMediaFormat
Definition: mediafmt.h:724
OpalMixerConnection::GetListenOnly
bool GetListenOnly() const
Definition: opalmixer.h:883
OpalAudioMixer::AudioStream::m_cacheSamples
PShortArray m_cacheSamples
Definition: opalmixer.h:253
OpalAudioMixer::m_sampleRate
unsigned m_sampleRate
Definition: opalmixer.h:267
OpalMixerNode::Construct
void Construct()
OpalMixerConnection::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalMixerEndPoint::MakeConnection
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalMixerNode::VideoMixer
Definition: opalmixer.h:1191
OpalMixerNode::AudioMixer::~AudioMixer
~AudioMixer()
OpalMixerNode::~OpalMixerNode
~OpalMixerNode()
OpalCall
Definition: call.h:65
OpalMixerNode::AudioMixer::m_cache
std::map< PString, CachedAudio > m_cache
Definition: opalmixer.h:1177
OpalMixerMediaStream::~OpalMixerMediaStream
~OpalMixerMediaStream()
OpalMixerNode::GetGUID
const PGloballyUniqueID & GetGUID() const
Definition: opalmixer.h:1097
OpalBaseMixer::m_periodMS
unsigned m_periodMS
Definition: opalmixer.h:168
OpalMixerConnection::OnReleased
virtual void OnReleased()
OpalMixerEndPoint::~OpalMixerEndPoint
~OpalMixerEndPoint()
OpalAudioMixer::SetSampleRate
bool SetSampleRate(unsigned rate)
OpalMixerNode::AudioMixer::CachedAudio::m_raw
RTP_DataFrame m_raw
Definition: opalmixer.h:1173
OpalMixerEndPoint
Definition: opalmixer.h:559
OpalAudioMixer
Definition: opalmixer.h:189
OpalMixerNodeManager::~OpalMixerNodeManager
virtual ~OpalMixerNodeManager()
OpalVideoMixer::GetFrameRate
unsigned GetFrameRate() const
Definition: opalmixer.h:329
OpalAudioMixer::GetSampleRate
unsigned GetSampleRate() const
Definition: opalmixer.h:217
OpalAudioMixer::m_mixedAudio
std::vector< int > m_mixedAudio
Definition: opalmixer.h:271
OpalMixerNodeManager::FindNode
virtual PSafePtr< OpalMixerNode > FindNode(const PString &name, PSafetyMode mode=PSafeReference)
OpalTranscoder
Definition: transcoders.h:137
OpalMixerNode::DetachConnection
void DetachConnection(OpalConnection *connection)
OpalBaseMixer::Stream::QueuePacket
virtual void QueuePacket(const RTP_DataFrame &rtp)=0
OpalMixerNode::RemoveName
void RemoveName(const PString &name)
OpalMixerNodeManager::OpalMixerNodeManager
OpalMixerNodeManager()
OpalMixerMediaStream::Open
virtual PBoolean Open()
OpalBaseMixer::m_pushFrame
RTP_DataFrame * m_pushFrame
Definition: opalmixer.h:173
OpalAudioMixer::MixAdditive
void MixAdditive(RTP_DataFrame &frame, const short *audioToSubtract)
OpalMixerNode::m_info
OpalMixerNodeInfo * m_info
Definition: opalmixer.h:1150
OpalVideoMixer::GetFrameHeight
unsigned GetFrameHeight() const
Definition: opalmixer.h:325
OpalMixerConnection::OnStartMediaPatch
virtual void OnStartMediaPatch(OpalMediaPatch &patch)
OpalMixerNodeManager::RemoveNode
virtual void RemoveNode(OpalMixerNode &node)
OpalMixerConnection
Definition: opalmixer.h:761
OpalAudioMixer::RemoveAllStreams
virtual void RemoveAllStreams()
OpalAudioMixer::AudioStream::QueuePacket
virtual void QueuePacket(const RTP_DataFrame &rtp)
OpalVideoMixer::VideoStream::InsertVideoFrame
void InsertVideoFrame(unsigned x, unsigned y, unsigned w, unsigned h)
OpalMixerNodeManager::UserInput::m_node
PSafePtr< OpalMixerNode > m_node
Definition: opalmixer.h:543
OpalMixerNodeInfo::m_name
PString m_name
Name for mixer node.
Definition: opalmixer.h:401
OpalMixerNode::AudioMixer::CachedAudio::m_transcoder
OpalTranscoder * m_transcoder
Definition: opalmixer.h:1175
OpalAudioMixer::GetOutputSize
virtual size_t GetOutputSize() const
OpalMixerNodeManager::RemoveNodeNames
void RemoveNodeNames(PStringList names)
OpalVideoMixer::eSideBySideLetterbox
Definition: opalmixer.h:289
OpalMixerNode::GetNodeInfo
const OpalMixerNodeInfo & GetNodeInfo()
Definition: opalmixer.h:1137
OpalMixerNode
Definition: opalmixer.h:985
OpalMixerEndPoint::FindNode
PSafePtr< OpalMixerNode > FindNode(const PString &name, PSafetyMode mode=PSafeReference)
Definition: opalmixer.h:697
OpalVideoMixer::MixStreams
virtual bool MixStreams(RTP_DataFrame &frame)
OpalEndPoint::manager
OpalManager & manager
Definition: endpoint.h:807
OpalAudioMixer::AudioStream::m_nextTimestamp
unsigned m_nextTimestamp
Definition: opalmixer.h:252
OpalMixerConnection::m_listenOnly
bool m_listenOnly
Definition: opalmixer.h:893
OpalBaseMixer::OnMixed
virtual bool OnMixed(RTP_DataFrame *&mixed)
OpalMixerNode::DetachStream
void DetachStream(OpalMixerMediaStream *stream)
OpalMixerNode::m_guid
PGloballyUniqueID m_guid
Definition: opalmixer.h:1148
OpalMixerNode::VideoMixer::VideoMixer
VideoMixer(const OpalMixerNodeInfo &info)
OpalVideoMixer::m_height
unsigned m_height
Definition: opalmixer.h:364
OpalVideoMixer::m_width
unsigned m_width
Definition: opalmixer.h:364
OpalMixerMediaStream::GetNode
PSafePtr< OpalMixerNode > GetNode()
Definition: opalmixer.h:968
OpalMixerNode::BroadcastUserInput
virtual void BroadcastUserInput(const OpalConnection *connection, const PString &value)
OpalMixerNode::AudioMixer::AudioMixer
AudioMixer(const OpalMixerNodeInfo &info)
OpalMixerNodeInfo::~OpalMixerNodeInfo
virtual ~OpalMixerNodeInfo()
Definition: opalmixer.h:397
OpalBaseMixer::StartPushThread
void StartPushThread()
OpalVideoMixer::m_bgFillRed
BYTE m_bgFillRed
Definition: opalmixer.h:365
OpalVideoMixer::eSideBySideScaled
Definition: opalmixer.h:293
OpalMixerMediaStream::EnableJitterBuffer
virtual bool EnableJitterBuffer(bool enab=true) const
OpalMixerNode::VideoMixer::m_transcoders
PDictionary< PString, OpalTranscoder > m_transcoders
Definition: opalmixer.h:1198
OpalVideoMixer::~OpalVideoMixer
~OpalVideoMixer()
Definition: opalmixer.h:317
OpalMixerConnection::CreateMediaStream
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
OpalMixerEndPoint::GetAdHocNodeInfo
OpalMixerNodeInfo * GetAdHocNodeInfo()
Definition: opalmixer.h:743
OpalBaseMixer::PushThreadMain
void PushThreadMain()
OpalMediaFormat::AudioClockRate
8kHz sample rate
Definition: mediafmt.h:955
OpalVideoMixer::GetOutputSize
virtual size_t GetOutputSize() const
OpalMixerNodeInfo::m_rate
unsigned m_rate
Frame rate of mixed video.
Definition: opalmixer.h:409
OpalMediaStream
Definition: mediastrm.h:111
OpalAudioMixer::AudioStream
Definition: opalmixer.h:242
OpalMediaStream::mediaFormat
OpalMediaFormat mediaFormat
Definition: mediastrm.h:419
OpalMixerNodeManager::RemoveNodeName
void RemoveNodeName(PString name)
OpalBaseMixer
Definition: opalmixer.h:72
OpalBaseMixer::m_threadRunning
bool m_threadRunning
Definition: opalmixer.h:175
OpalVideoMixer::eStackedScaled
Definition: opalmixer.h:301
OpalMixerNode::PrintOn
void PrintOn(ostream &strm) const
OpalMixerNode::OpalMixerNode
OpalMixerNode(OpalMixerNodeManager &manager, OpalMixerNodeInfo *info)
OpalConnection
Definition: connection.h:353
OpalMixerNode::AudioMixer::CachedAudio::m_encoded
RTP_DataFrame m_encoded
Definition: opalmixer.h:1174
OpalMixerMediaStream::InternalClose
virtual void InternalClose()
OpalAudioMixer::MixStereo
void MixStereo(RTP_DataFrame &frame)
OpalMixerNode::AttachStream
bool AttachStream(OpalMixerMediaStream *stream)
OpalMixerNode::m_connections
PSafeList< OpalConnection > m_connections
Definition: opalmixer.h:1153
OpalMixerEndPoint::m_nodeManager
OpalMixerNodeManager m_nodeManager
Definition: opalmixer.h:753
OpalMixerConnection::m_node
PSafePtr< OpalMixerNode > m_node
Definition: opalmixer.h:892
OpalMixerNode::AudioMixer::CachedAudio::Collecting
Definition: opalmixer.h:1172
OpalVideoMixer::eGrid
Definition: opalmixer.h:305
OpalAudioMixer::MixStreams
virtual bool MixStreams(RTP_DataFrame &frame)
OpalMixerNode::m_manager
OpalMixerNodeManager & m_manager
Definition: opalmixer.h:1147
OpalBaseMixer::Stream::~Stream
virtual ~Stream()
Definition: opalmixer.h:154
OpalMixerNodeInfo::m_style
OpalVideoMixer::Styles m_style
Method for mixing video.
Definition: opalmixer.h:406
OpalMixerNode::WriteVideo
bool WriteVideo(const OpalBaseMixer::Key_T &key, const RTP_DataFrame &input)
Definition: opalmixer.h:1079
OpalBaseMixer::WriteStream
virtual bool WriteStream(const Key_T &key, const RTP_DataFrame &input)
OpalMixerNodeManager::UserInput::m_connection
const OpalMixerConnection * m_connection
Definition: opalmixer.h:544
OpalMixerNodeManager::AddNodeName
void AddNodeName(PString name, OpalMixerNode *node)
OpalMixerMediaStream::IsSynchronous
virtual PBoolean IsSynchronous() const
OpalMixerNode::GetCreationTime
const PTime & GetCreationTime() const
Definition: opalmixer.h:1141
OpalMixerNode::m_audioMixer
AudioMixer m_audioMixer
Definition: opalmixer.h:1188
OpalMixerNode::ShutDown
void ShutDown()
OpalAudioMixer::SetJitterBufferSize
bool SetJitterBufferSize(const Key_T &key, unsigned minJitterDelay, unsigned maxJitterDelay)
OpalMixerNodeManager::UserInput::m_value
PString m_value
Definition: opalmixer.h:545
OpalAudioMixer::AudioStream::GetAudioDataPtr
const short * GetAudioDataPtr()
OpalMixerNodeInfo::m_sampleRate
unsigned m_sampleRate
Audio sample rate, usually 8000.
Definition: opalmixer.h:403
OpalBaseMixer::MixStreams
virtual bool MixStreams(RTP_DataFrame &frame)=0
OpalMixerNode::GetConnectionCount
PINDEX GetConnectionCount() const
Definition: opalmixer.h:1120
OpalMixerNodeInfo::OpalMixerNodeInfo
OpalMixerNodeInfo(const char *name=NULL)
Definition: opalmixer.h:383
OpalBaseMixer::OnPush
virtual bool OnPush()
OpalBaseMixer::m_outputTimestamp
unsigned m_outputTimestamp
Definition: opalmixer.h:172
OpalBaseMixer::GetPeriodTS
unsigned GetPeriodTS() const
Definition: opalmixer.h:150
OpalMixerNode::UseMediaPassThrough
void UseMediaPassThrough(unsigned sessionID, OpalConnection *connection=NULL)
OpalMixerEndPoint::ShutDown
virtual void ShutDown()
OpalBaseMixer::ReadMixed
virtual RTP_DataFrame * ReadMixed()
OpalMixerNode::m_videoMixer
VideoMixer m_videoMixer
Definition: opalmixer.h:1200
OpalBaseMixer::GetOutputSize
virtual size_t GetOutputSize() const =0
OpalMixerNode::AudioMixer::CachedAudio::Collected
Definition: opalmixer.h:1172
OpalBaseMixer::m_inputStreams
StreamMap_T m_inputStreams
Definition: opalmixer.h:171
OpalMixerConnection::m_endpoint
OpalMixerEndPoint & m_endpoint
Definition: opalmixer.h:891
OpalMixerMediaStream::RequiresPatchThread
virtual PBoolean RequiresPatchThread() const
OpalMixerEndPoint::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalMixerMediaStream::m_video
bool m_video
Definition: opalmixer.h:977
OpalMixerNode::AudioMixer::CachedAudio::CachedAudio
CachedAudio()
OpalBaseMixer::Key_T
PString Key_T
Definition: opalmixer.h:83
OpalBaseMixer::m_periodTS
unsigned m_periodTS
Definition: opalmixer.h:169
OpalMixerNode::AudioMixer::OnPush
virtual bool OnPush()
OpalBaseMixer::AddStream
virtual bool AddStream(const Key_T &key)
OpalMixerNodeManager::ShutDown
virtual void ShutDown()
OpalMixerNode::m_names
PStringList m_names
Definition: opalmixer.h:1149