Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OpalTranscoder Class Reference

#include <transcoders.h>

Inheritance diagram for OpalTranscoder:

OpalMediaFormatPair OpalFramedTranscoder OpalStreamedTranscoder OpalVideoTranscoder Opal_GSM0610 Opal_iLBC_Decoder Opal_iLBC_Encoder Opal_LPC10_PCM Opal_MSIMA_PCM Opal_PCM_LPC10 Opal_PCM_MSIMA Opal_Speex_Transcoder Opal_G711_ALaw_PCM Opal_G711_uLaw_PCM Opal_G726_Transcoder Opal_Linear16Mono_PCM Opal_PCM_G711_ALaw Opal_PCM_G711_uLaw Opal_PCM_Linear16Mono Opal_H261_YUV420P Opal_YUV420P_H261 OpalUncompVideoTranscoder List of all members.

Operations

virtual BOOL UpdateOutputMediaFormat (const OpalMediaFormat &mediaFormat)
virtual BOOL ExecuteCommand (const OpalMediaCommand &command)
virtual PINDEX GetOptimalDataFrameSize (BOOL input) const=0
virtual BOOL ConvertFrames (const RTP_DataFrame &input, RTP_DataFrameList &output)
virtual BOOL Convert (const RTP_DataFrame &input, RTP_DataFrame &output)=0
OpalTranscoder * Create (const OpalMediaFormat &srcFormat, const OpalMediaFormat &dstFormat)
BOOL SelectFormats (unsigned sessionID, const OpalMediaFormatList &srcFormats, const OpalMediaFormatList &dstFormats, OpalMediaFormat &srcFormat, OpalMediaFormat &dstFormat)
BOOL FindIntermediateFormat (OpalMediaFormat &srcFormat, OpalMediaFormat &dstFormat, OpalMediaFormat &intermediateFormat)
OpalMediaFormatList GetDestinationFormats (const OpalMediaFormat &srcFormat)
OpalMediaFormatList GetSourceFormats (const OpalMediaFormat &dstFormat)
OpalMediaFormatList GetPossibleFormats (const OpalMediaFormatList &formats)

Public Methods

void SetRTPPayloadMap (const RTP_DataFrame::PayloadMapType &v)
void AddRTPPayloadMapping (RTP_DataFrame::PayloadTypes from, RTP_DataFrame::PayloadTypes to)
Construction
 OpalTranscoder (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
Operations
PINDEX GetMaxOutputSize () const
void SetMaxOutputSize (PINDEX size)
void SetCommandNotifier (const PNotifier &notifier)
const PNotifier & GetCommandNotifier () const

Protected Attributes

PINDEX maxOutputSize
bool outputMediaFormatUpdated
PNotifier commandNotifier
PMutex updateMutex
RTP_DataFrame::PayloadMapType payloadTypeMap

Detailed Description

This class embodies the implementation of a specific transcoder instance used to convert data from one format to another.

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


Constructor & Destructor Documentation

OpalTranscoder::OpalTranscoder const OpalMediaFormat   inputMediaFormat,
const OpalMediaFormat   outputMediaFormat
 

Create a new transcoder implementation.

Parameters:
inputMediaFormat  Input media format
outputMediaFormat  Output media format


Member Function Documentation

void OpalTranscoder::AddRTPPayloadMapping RTP_DataFrame::PayloadTypes    from,
RTP_DataFrame::PayloadTypes    to
[inline]
 

virtual BOOL OpalTranscoder::Convert const RTP_DataFrame   input,
RTP_DataFrame   output
[pure 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.

Returns FALSE if the conversion fails.

Parameters:
input  Input data
output  Output data

Implemented in Opal_GSM0610_PCM, OpalVideoTranscoder, OpalFramedTranscoder, and OpalStreamedTranscoder.

virtual BOOL OpalTranscoder::ConvertFrames const RTP_DataFrame   input,
RTP_DataFrameList &    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 (possibly) into multiple RTP_DataFrame objects.

The default behaviour makes sure the output list has only one element in it and calls the Convert() function.

Returns FALSE if the conversion fails.

Parameters:
input  Input data
output  Output data

Reimplemented in Opal_H261_YUV420P, Opal_YUV420P_H261, and OpalUncompVideoTranscoder.

OpalTranscoder* OpalTranscoder::Create const OpalMediaFormat   srcFormat,
const OpalMediaFormat   dstFormat
[static]
 

Create an instance of a media conversion function. Returns NULL if there is no registered media transcoder between the two named formats.

Parameters:
srcFormat  Name of source format
dstFormat  Name of destination format

virtual BOOL OpalTranscoder::ExecuteCommand const OpalMediaCommand   command [virtual]
 

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

The default behaviour simply returns FALSE.

Parameters:
command  Command to execute.

Reimplemented in OpalVideoTranscoder.

BOOL OpalTranscoder::FindIntermediateFormat OpalMediaFormat   srcFormat,
OpalMediaFormat   dstFormat,
OpalMediaFormat   intermediateFormat
[static]
 

Find media intermediate format for transcoders. This function attempts to find the intermediate media format that will allow two transcoders to be used to get data from the source format to the destination format.

Returns FALSE if there is no registered media transcoder that can be used between the two named formats.

Parameters:
srcFormat  Selected destination format to be used
dstFormat  Selected destination format to be used
intermediateFormat  Intermediate format that can be used

const PNotifier& OpalTranscoder::GetCommandNotifier   const [inline]
 

Get the notifier to receive commands generated by the transcoder. The commands are highly context sensitive, for example VideoFastUpdate would only apply to a video transcoder.

OpalMediaFormatList OpalTranscoder::GetDestinationFormats const OpalMediaFormat   srcFormat [static]
 

Get a list of possible destination media formats for the destination.

Parameters:
srcFormat  Selected source format

PINDEX OpalTranscoder::GetMaxOutputSize   const [inline]
 

Get maximum output size.

virtual PINDEX OpalTranscoder::GetOptimalDataFrameSize BOOL    input const [pure 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:
input  Flag for input or output data size

Implemented in Opal_H261_YUV420P, Opal_YUV420P_H261, OpalUncompVideoTranscoder, OpalFramedTranscoder, and OpalStreamedTranscoder.

OpalMediaFormatList OpalTranscoder::GetPossibleFormats const OpalMediaFormatList   formats [static]
 

Get a list of possible media formats that can do bi-directional media.

Parameters:
formats  Destination format list

OpalMediaFormatList OpalTranscoder::GetSourceFormats const OpalMediaFormat   dstFormat [static]
 

Get a list of possible source media formats for the destination.

Parameters:
dstFormat  Selected destination format

BOOL OpalTranscoder::SelectFormats unsigned    sessionID,
const OpalMediaFormatList   srcFormats,
const OpalMediaFormatList   dstFormats,
OpalMediaFormat   srcFormat,
OpalMediaFormat   dstFormat
[static]
 

Find media format(s) for transcoders. This function attempts to find and intermediate media format that will allow two transcoders to be used to get data from the source format to the destination format.

There could be many possible matches between the two lists, so preference is given to the order of the destination formats.

Returns FALSE if there is no registered media transcoder that can be used between the two named formats.

Parameters:
sessionID  Session ID for media formats
srcFormats  Names of possible source formats
dstFormats  Names of possible destination formats
srcFormat  Selected source format to be used
dstFormat  Selected destination format to be used

void OpalTranscoder::SetCommandNotifier const PNotifier &    notifier [inline]
 

Set a notifier to receive commands generated by the transcoder. The commands are highly context sensitive, for example VideoFastUpdate would only apply to a video transcoder.

Parameters:
notifier  Command to execute.

void OpalTranscoder::SetMaxOutputSize PINDEX    size [inline]
 

Set the maximum output size.

void OpalTranscoder::SetRTPPayloadMap const RTP_DataFrame::PayloadMapType   v [inline]
 

virtual BOOL OpalTranscoder::UpdateOutputMediaFormat const OpalMediaFormat   mediaFormat [virtual]
 

Update the output media format. 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.

The default behaviour updates the outputMediaFormat member variable and sets the outputMediaFormatUpdated flag.

Parameters:
mediaFormat  New media format

Reimplemented in OpalVideoTranscoder.


Member Data Documentation

PNotifier OpalTranscoder::commandNotifier [protected]
 

PINDEX OpalTranscoder::maxOutputSize [protected]
 

bool OpalTranscoder::outputMediaFormatUpdated [protected]
 

RTP_DataFrame::PayloadMapType OpalTranscoder::payloadTypeMap [protected]
 

PMutex OpalTranscoder::updateMutex [protected]
 


The documentation for this class was generated from the following file:
Generated on Sun Jul 23 09:40:36 2006 for OPAL by doxygen1.2.18