OPAL  Version 3.18.8
OpalVideoTranscoder Class Reference

#include <vidcodec.h>

Inheritance diagram for OpalVideoTranscoder:
Collaboration diagram for OpalVideoTranscoder:

Public Types

typedef
PluginCodec_Video_FrameHeader 
FrameHeader
 

Public Member Functions

Construction
 OpalVideoTranscoder (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
 
Operations
virtual void GetStatistics (OpalMediaStatistics &statistics) const
 
virtual bool UpdateMediaFormats (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
 
virtual PINDEX GetOptimalDataFrameSize (PBoolean input) const
 
virtual PBoolean ExecuteCommand (const OpalMediaCommand &command)
 
virtual PBoolean Convert (const RTP_DataFrame &input, RTP_DataFrame &output)
 
virtual bool HasErrorConcealment () const
 
virtual bool ShouldDropFrame (RTP_Timestamp ts)
 
virtual void UpdateFrameDrop (const RTP_DataFrameList &encoded)
 
bool WasLastFrameIFrame () const
 
virtual void SendIFrameRequest (unsigned sequenceNumber, unsigned timestamp)
 
virtual bool HandleIFrameRequest ()
 
void SetEncodingIntraFrameControlTimes (const PTimeInterval &minThrottle, const PTimeInterval &maxThrottle, const PTimeInterval &periodic, const PTimeInterval &retry)
 
void SetDecodingIntraFrameControlTimes (const PTimeInterval &minThrottle, const PTimeInterval &maxThrottle, const PTimeInterval &periodic, const PTimeInterval &retry)
 
- Public Member Functions inherited from OpalTranscoder
 OpalTranscoder (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
 
virtual PBoolean ConvertFrames (const RTP_DataFrame &input, RTP_DataFrameList &output)
 
PINDEX GetMaxOutputSize () const
 
void SetMaxOutputSize (PINDEX size)
 
void SetCommandNotifier (const PNotifier &notifier)
 
const PNotifier & GetCommandNotifier () const
 
void NotifyCommand (const OpalMediaCommand &command) const
 Notify command notifier of command. More...
 
unsigned GetSessionID () const
 Get session ID for the transcoder (from OpalMediaStream) More...
 
void SetSessionID (unsigned id)
 Set session ID for the transcoder (from OpalMediaStream) More...
 
RTP_DataFrame::PayloadTypes GetPayloadType (PBoolean input) const
 
virtual bool AcceptComfortNoise () const
 
virtual bool AcceptEmptyPayload () const
 
virtual bool AcceptOtherPayloads () const
 
void CopyTimestamp (RTP_DataFrame &dst, const RTP_DataFrame &src, bool inToOut) const
 
- Public Member Functions inherited from OpalMediaFormatPair
 OpalMediaFormatPair (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
 
void PrintOn (ostream &strm) const
 
virtual Comparison Compare (const PObject &obj) const
 
const OpalMediaFormatGetInputFormat () const
 
const OpalMediaFormatGetOutputFormat () const
 

Protected Attributes

PINDEX m_inDataSize
 
PINDEX m_outDataSize
 
bool m_errorConcealment
 
bool m_freezeTillIFrame
 
bool m_frozenTillIFrame
 
bool m_lastFrameWasIFrame
 
unsigned m_frameDropRate
 
int m_frameDropBits
 
RTP_Timestamp m_lastTimestamp
 
unsigned m_framesDropped
 
OpalIntraFrameControl m_encodingIntraFrameControl
 
OpalIntraFrameControl m_decodingIntraFrameControl
 
- Protected Attributes inherited from OpalTranscoder
PINDEX maxOutputSize
 
PNotifier commandNotifier
 
unsigned m_sessionID
 
bool outputIsRTP
 
bool inputIsRTP
 
bool acceptEmptyPayload
 
bool acceptOtherPayloads
 
unsigned m_inClockRate
 
unsigned m_outClockRate
 
RTP_DataFrame::PayloadTypes m_lastPayloadType
 
unsigned m_consecutivePayloadTypeMismatches
 
- Protected Attributes inherited from OpalMediaFormatPair
OpalMediaFormat inputMediaFormat
 
OpalMediaFormat outputMediaFormat
 

Additional Inherited Members

- Static Public Member Functions inherited from OpalTranscoder
static OpalTranscoderCreate (const OpalMediaFormat &srcFormat, const OpalMediaFormat &dstFormat, const BYTE *instance=NULL, unsigned instanceLen=0)
 
static bool SelectFormats (const OpalMediaType &mediaType, const OpalMediaFormatList &srcFormats, const OpalMediaFormatList &dstFormats, const OpalMediaFormatList &masterFormats, OpalMediaFormat &srcFormat, OpalMediaFormat &dstFormat)
 
static bool FindIntermediateFormat (const OpalMediaFormat &srcFormat, const OpalMediaFormat &dstFormat, OpalMediaFormat &intermediateFormat)
 
static OpalMediaFormatList GetDestinationFormats (const OpalMediaFormat &srcFormat)
 
static OpalMediaFormatList GetSourceFormats (const OpalMediaFormat &dstFormat)
 
static OpalMediaFormatList GetPossibleFormats (const OpalMediaFormatList &formats)
 
- Protected Member Functions inherited from OpalTranscoder
virtual bool OnCreated (const OpalMediaFormat &srcFormat, const OpalMediaFormat &destFormat, const BYTE *instance, unsigned instanceLen)
 
 PDECLARE_MUTEX (updateMutex)
 

Detailed Description

This class defines a transcoder implementation class that will encode/decode video.

An application may create a descendent off this class and override functions as required for descibing a specific transcoder.

Member Typedef Documentation

Constructor & Destructor Documentation

OpalVideoTranscoder::OpalVideoTranscoder ( const OpalMediaFormat inputMediaFormat,
const OpalMediaFormat outputMediaFormat 
)

Create a new video transcoder implementation.

Parameters
inputMediaFormatInput media format
outputMediaFormatOutput media format

Member Function Documentation

virtual PBoolean OpalVideoTranscoder::Convert ( const RTP_DataFrame input,
RTP_DataFrame output 
)
virtual

Convert the data from one format to another. This function takes the input data as a RTP_DataFrame and converts it to its output format, placing it into the RTP_DataFrame provided.

This is a dummy function as nearly all video conversion will does not have a one to one input to output frames ratio, so the ConvertFrames() function is used instead.

Returns false if the conversion fails.

Parameters
inputInput data
outputOutput data

Implements OpalTranscoder.

virtual PBoolean OpalVideoTranscoder::ExecuteCommand ( const OpalMediaCommand command)
virtual

Execute the command specified to the transcoder. The commands are highly context sensitive, for example OpalVideoUpdatePicture would only apply to a video transcoder.

The default behaviour checks for a OpalVideoUpdatePicture and sets the updatePicture member variable if that is the command.

Returns
true if command is handled.
Parameters
commandCommand to execute.

Reimplemented from OpalTranscoder.

Reimplemented in OpalPluginVideoTranscoder.

virtual PINDEX OpalVideoTranscoder::GetOptimalDataFrameSize ( PBoolean  input) const
virtual

Get the optimal size for data frames to be converted. This function returns the size of frames that will be most efficient in conversion. A RTP_DataFrame will attempt to provide or use data in multiples of this size. Note that it may not do so, so the transcoder must be able to handle any sized packets.

Parameters
inputFlag for input or output data size

Implements OpalTranscoder.

virtual void OpalVideoTranscoder::GetStatistics ( OpalMediaStatistics statistics) const
virtual

Reimplemented from OpalTranscoder.

Reimplemented in OpalPluginVideoTranscoder.

virtual bool OpalVideoTranscoder::HandleIFrameRequest ( )
virtual
virtual bool OpalVideoTranscoder::HasErrorConcealment ( ) const
inlinevirtual

References m_errorConcealment.

virtual void OpalVideoTranscoder::SendIFrameRequest ( unsigned  sequenceNumber,
unsigned  timestamp 
)
virtual
void OpalVideoTranscoder::SetDecodingIntraFrameControlTimes ( const PTimeInterval &  minThrottle,
const PTimeInterval &  maxThrottle,
const PTimeInterval &  periodic,
const PTimeInterval &  retry 
)
inline
Parameters
minThrottleMinimum time between intra frames
maxThrottleIf many requests, throttle period increases to this
periodicMake sure Intra frames are at least this often
retryRetry request, typically the media round trip time, plus a bit.

References m_decodingIntraFrameControl, and OpalIntraFrameControl::SetTimes().

void OpalVideoTranscoder::SetEncodingIntraFrameControlTimes ( const PTimeInterval &  minThrottle,
const PTimeInterval &  maxThrottle,
const PTimeInterval &  periodic,
const PTimeInterval &  retry 
)
inline
Parameters
minThrottleMinimum time between intra frames
maxThrottleIf many requests, throttle period increases to this
periodicMake sure Intra frames are at least this often
retryRetry request, typically the media round trip time, plus a bit.

References m_encodingIntraFrameControl, and OpalIntraFrameControl::SetTimes().

virtual bool OpalVideoTranscoder::ShouldDropFrame ( RTP_Timestamp  ts)
virtual
virtual void OpalVideoTranscoder::UpdateFrameDrop ( const RTP_DataFrameList &  encoded)
virtual
virtual bool OpalVideoTranscoder::UpdateMediaFormats ( const OpalMediaFormat inputMediaFormat,
const OpalMediaFormat outputMediaFormat 
)
virtual

Update the input and output media formats. This can be used to adjust the parameters of a codec at run time. Note you cannot change the basic media format, eg change GSM0610 to G.711, only options for that format, eg 6k3 mode to 5k3 mode in G.723.1. If the formats are different then a OpalMediaFormat::Merge() is performed.

If a format is empty (invalid) it is ignored and does not update the internal variable. In this way only the input or output side can be updated.

The default behaviour updates the inputMediaFormat and outputMediaFormat member variables.

Parameters
inputMediaFormatInput media format
outputMediaFormatOutput media format

Reimplemented from OpalTranscoder.

Reimplemented in OpalPluginVideoTranscoder.

bool OpalVideoTranscoder::WasLastFrameIFrame ( ) const
inline

References m_lastFrameWasIFrame.

Field Documentation

OpalIntraFrameControl OpalVideoTranscoder::m_decodingIntraFrameControl
protected
OpalIntraFrameControl OpalVideoTranscoder::m_encodingIntraFrameControl
protected
bool OpalVideoTranscoder::m_errorConcealment
protected

Referenced by HasErrorConcealment().

int OpalVideoTranscoder::m_frameDropBits
protected
unsigned OpalVideoTranscoder::m_frameDropRate
protected
unsigned OpalVideoTranscoder::m_framesDropped
protected
bool OpalVideoTranscoder::m_freezeTillIFrame
protected
bool OpalVideoTranscoder::m_frozenTillIFrame
protected
PINDEX OpalVideoTranscoder::m_inDataSize
protected
bool OpalVideoTranscoder::m_lastFrameWasIFrame
protected

Referenced by WasLastFrameIFrame().

RTP_Timestamp OpalVideoTranscoder::m_lastTimestamp
protected
PINDEX OpalVideoTranscoder::m_outDataSize
protected

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