OpalFramedTranscoder Class Reference

`#include <transcoders.h>`

Inheritance diagram for OpalFramedTranscoder:

## Public Member Functions

Construction
| OpalFramedTranscoder (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
Operations
virtual bool | UpdateMediaFormats (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
virtual PINDEX | GetOptimalDataFrameSize (PBoolean input) const
virtual PBoolean | Convert (const RTP_DataFrame &input, RTP_DataFrame &output)
virtual PBoolean | ConvertFrame (const BYTE *input, BYTE *output)
virtual PBoolean | ConvertFrame (const BYTE *input, PINDEX &consumed, BYTE *output, PINDEX &created)
virtual PBoolean | ConvertSilentFrame (BYTE *output)
Public Member Functions inherited from OpalTranscoder
| OpalTranscoder (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
virtual PBoolean | ExecuteCommand (const OpalMediaCommand &command)
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...
virtual void | SetInstanceID (const BYTE *instance, unsigned instanceLen)
RTP_DataFrame::PayloadTypes | GetPayloadType (PBoolean input) const
virtual bool | AcceptComfortNoise () const
virtual bool | AcceptEmptyPayload () const
virtual bool | AcceptOtherPayloads () const
virtual void | GetStatistics (OpalMediaStatistics &statistics) 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 OpalMediaFormat & | GetInputFormat () const
const OpalMediaFormat & | GetOutputFormat () const

## Protected Member Functions

void | CalculateSizes ()

## Protected Attributes

PINDEX | inputBytesPerFrame
PINDEX | outputBytesPerFrame
PINDEX | maxOutputDataSize
Protected Attributes inherited from OpalTranscoder
PINDEX | maxOutputSize
PNotifier | commandNotifier
PMutex | updateMutex
unsigned | m_sessionID
bool | outputIsRTP
bool | inputIsRTP
bool | acceptEmptyPayload
bool | acceptOtherPayloads
unsigned | m_inClockRate
unsigned | m_outClockRate
Protected Attributes inherited from OpalMediaFormatPair
OpalMediaFormat | inputMediaFormat
OpalMediaFormat | outputMediaFormat

## Additional Inherited Members

Static Public Member Functions inherited from OpalTranscoder
static OpalTranscoder * | Create (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 &allFormats, 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)

## Detailed Description

This class defines a transcoder implementation class that will encode/decode fixed sized blocks. That is each input block of n bytes is encoded to exactly m bytes of data, eg GSM etc.

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

## Constructor & Destructor Documentation

OpalFramedTranscoder::OpalFramedTranscoder | ( | const OpalMediaFormat & | inputMediaFormat,
|  | const OpalMediaFormat & | outputMediaFormat
| ) |  |

Create a new framed transcoder implementation.

Parameters

  inputMediaFormat | Input media format
  outputMediaFormat | Output media format

## Member Function Documentation

void OpalFramedTranscoder::CalculateSizes | ( |  | ) |

protected

virtual PBoolean OpalFramedTranscoder::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.

Returns FALSE if the conversion fails.

Parameters

  input | Input data
  output | Output data

Implements OpalTranscoder.

virtual PBoolean OpalFramedTranscoder::ConvertFrame | ( | const BYTE * | input,
|  | BYTE * | output
| ) |  |

virtual

Convert a frame of data from one format to another. This function implicitly knows the input and output frame sizes.

Parameters

  input | Input data
  output | Output data

virtual PBoolean OpalFramedTranscoder::ConvertFrame | ( | const BYTE * | input,
|  | PINDEX & | consumed,
|  | BYTE * | output,
|  | PINDEX & | created
| ) |  |

virtual

Parameters

  input | Input data
  consumed | number of input bytes consumed
  output | Output data
  created | number of output bytes created

Reimplemented in OpalEmptyFramedAudioTranscoder, and OpalPluginFramedAudioTranscoder.

virtual PBoolean OpalFramedTranscoder::ConvertSilentFrame | ( | BYTE * | output | ) |

virtual

Parameters

  output | Output data

Reimplemented in OpalPluginFramedAudioTranscoder.

virtual PINDEX OpalFramedTranscoder::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

  input | Flag for input or output data size

Implements OpalTranscoder.

virtual bool OpalFramedTranscoder::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

  inputMediaFormat | Input media format
  outputMediaFormat | Output media format

Reimplemented from OpalTranscoder.

Reimplemented in OpalPluginFramedAudioTranscoder.

## Field Documentation

PINDEX OpalFramedTranscoder::inputBytesPerFrame

protected

PINDEX OpalFramedTranscoder::maxOutputDataSize

protected

PINDEX OpalFramedTranscoder::outputBytesPerFrame

protected

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

- transcoders.h