OPAL  Version 3.14.3
OpalVideoMixer Class Reference

#include <opalmixer.h>

Inheritance diagram for OpalVideoMixer:
Collaboration diagram for OpalVideoMixer:

Data Structures

struct  VideoStream
 

Public Types

enum  Styles {
  eSideBySideLetterbox, eSideBySideScaled, eStackedPillarbox, eStackedScaled,
  eGrid, eUser
}
 
- Public Types inherited from OpalBaseMixer
typedef PString Key_T
 

Public Member Functions

 OpalVideoMixer (Styles style, unsigned width, unsigned height, unsigned rate=15, bool pushThread=true)
 
 ~OpalVideoMixer ()
 
unsigned GetFrameWidth () const
 
unsigned GetFrameHeight () const
 
unsigned GetFrameRate () const
 
bool SetFrameRate (unsigned rate)
 
bool SetFrameSize (unsigned width, unsigned height)
 
- Public Member Functions inherited from OpalBaseMixer
 OpalBaseMixer (bool pushThread, unsigned periodMS, unsigned periodTS)
 
virtual ~OpalBaseMixer ()
 
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_DataFrameReadMixed ()
 
virtual bool ReadMixed (RTP_DataFrame &mixed)
 
virtual bool OnMixed (RTP_DataFrame *&mixed)
 
void StartPushThread ()
 
void StopPushThread (bool lock=true)
 
unsigned GetPeriodTS () const
 

Protected Member Functions

virtual StreamCreateStream ()
 
virtual bool MixStreams (RTP_DataFrame &frame)
 
virtual size_t GetOutputSize () const
 
virtual bool MixVideo ()
 
virtual bool StartMix (unsigned &x, unsigned &y, unsigned &w, unsigned &h, unsigned &left)
 
virtual bool NextMix (unsigned &x, unsigned &y, unsigned &w, unsigned &h, unsigned &left)
 
void InsertVideoFrame (const StreamMap_T::iterator &it, unsigned x, unsigned y, unsigned w, unsigned h)
 
- Protected Member Functions inherited from OpalBaseMixer
virtual bool OnPush ()
 
void PushThreadMain ()
 

Protected Attributes

Styles m_style
 
unsigned m_width
 
unsigned m_height
 
BYTE m_bgFillRed
 
BYTE m_bgFillGreen
 
BYTE m_bgFillBlue
 
PBYTEArray m_frameStore
 
size_t m_lastStreamCount
 
- Protected Attributes inherited from OpalBaseMixer
bool m_pushThread
 
unsigned m_periodMS
 
unsigned m_periodTS
 
StreamMap_T m_inputStreams
 
unsigned m_outputTimestamp
 
RTP_DataFramem_pushFrame
 
PThread * m_workerThread
 
bool m_threadRunning
 
PMutex m_mutex
 

Friends

struct VideoStream
 

Additional Inherited Members

- Protected Types inherited from OpalBaseMixer
typedef std::map< Key_T, Stream * > StreamMap_T
 

Detailed Description

Video mixer. This takes raw YUV420P frames with a PluginCodec_Video_FrameHeader in the RTP data frames, scales them and places them in particular positions of the output data frame. A number of different patterns for positioning the sub images are available in the Styles enum.

Member Enumeration Documentation

Enumerator
eSideBySideLetterbox 

Two images side by side with black bars top and bottom. It is expected that the input frames and output are all the same aspect ratio, e.g. 4:3. Works well if inputs are QCIF and output is CIF for example.

eSideBySideScaled 

Two images side by side, scaled to fit halves of output frame. It is expected that the output frame be double the width of the input data to maintain aspect ratio. e.g. for CIF inputs, output would be 704x288.

eStackedPillarbox 

Two images, one on top of the other with black bars down the sides. It is expected that the input frames and output are all the same aspect ratio, e.g. 4:3. Works well if inputs are QCIF and output is CIF for example.

eStackedScaled 

Two images, one on top of the other, scaled to fit halves of output frame. It is expected that the output frame be double the height of the input data to maintain aspect ratio. e.g. for CIF inputs, output would be 352x576.

eGrid 
     Standard 2x2, 3x3, 4x4 grid pattern. Size of grid is

dependent on the number of video streams.

eUser 

User defined

Constructor & Destructor Documentation

OpalVideoMixer::OpalVideoMixer ( Styles  style,
unsigned  width,
unsigned  height,
unsigned  rate = 15,
bool  pushThread = true 
)
Parameters
styleStyle for mixing video
widthWidth of output frame
heightHeight of output frame
rateFrames per second for output
pushThreadA push thread is to be created
OpalVideoMixer::~OpalVideoMixer ( )
inline

Member Function Documentation

virtual Stream* OpalVideoMixer::CreateStream ( )
protectedvirtual

Implements OpalBaseMixer.

unsigned OpalVideoMixer::GetFrameHeight ( ) const
inline

Get output video frame height.

References m_height.

unsigned OpalVideoMixer::GetFrameRate ( ) const
inline

Get output video frame rate (frames per second)

References OpalBaseMixer::m_periodMS.

unsigned OpalVideoMixer::GetFrameWidth ( ) const
inline

Get output video frame width.

References m_width.

virtual size_t OpalVideoMixer::GetOutputSize ( ) const
protectedvirtual

Implements OpalBaseMixer.

void OpalVideoMixer::InsertVideoFrame ( const StreamMap_T::iterator &  it,
unsigned  x,
unsigned  y,
unsigned  w,
unsigned  h 
)
protected
virtual bool OpalVideoMixer::MixStreams ( RTP_DataFrame frame)
protectedvirtual

Implements OpalBaseMixer.

virtual bool OpalVideoMixer::MixVideo ( )
protectedvirtual
virtual bool OpalVideoMixer::NextMix ( unsigned &  x,
unsigned &  y,
unsigned &  w,
unsigned &  h,
unsigned &  left 
)
protectedvirtual
bool OpalVideoMixer::SetFrameRate ( unsigned  rate)

Set output video frame rate. May be dynamically changed at any time.

bool OpalVideoMixer::SetFrameSize ( unsigned  width,
unsigned  height 
)

Set the output video frame width and height. May be dynamically changed at any time.

Parameters
widthNew width
heightnew height
virtual bool OpalVideoMixer::StartMix ( unsigned &  x,
unsigned &  y,
unsigned &  w,
unsigned &  h,
unsigned &  left 
)
protectedvirtual

Friends And Related Function Documentation

friend struct VideoStream
friend

Field Documentation

BYTE OpalVideoMixer::m_bgFillBlue
protected
BYTE OpalVideoMixer::m_bgFillGreen
protected
BYTE OpalVideoMixer::m_bgFillRed
protected
PBYTEArray OpalVideoMixer::m_frameStore
protected
unsigned OpalVideoMixer::m_height
protected

Referenced by GetFrameHeight().

size_t OpalVideoMixer::m_lastStreamCount
protected
Styles OpalVideoMixer::m_style
protected
unsigned OpalVideoMixer::m_width
protected

Referenced by GetFrameWidth().


The documentation for this class was generated from the following file: