# OpalVideoTranscoder Class Reference

`#include <vidcodec.h>`

Inheritance diagram for OpalVideoTranscoder:

[legend]
Collaboration diagram for OpalVideoTranscoder:
[legend]

## Public Types

typedef PluginCodec_Video_FrameHeader | FrameHeader

## Public Member Functions

Construction
| OpalVideoTranscoder (const OpalMediaFormat &inputMediaFormat, const OpalMediaFormat &outputMediaFormat)
Operations
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 void | GetStatistics (OpalMediaStatistics &statistics) const
virtual bool | HasErrorConcealment () const
bool | WasLastFrameIFrame () const
void | ForceIFrame ()

## Protected Attributes

bool | m_errorConcealment
PINDEX | inDataSize
PINDEX | outDataSize
bool | forceIFrame
bool | lastFrameWasIFrame
DWORD | m_totalFrames
DWORD | m_keyFrames

## 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

typedef PluginCodec_Video_FrameHeader OpalVideoTranscoder::FrameHeader

## Constructor & Destructor Documentation

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

Create a new video transcoder implementation.

Parameters:

  inputMediaFormat | Input media format
  outputMediaFormat | Output 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:

  input | Input data
  output | Output 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:

  command | Command to execute.

Reimplemented from OpalTranscoder.

Reimplemented in OpalPluginVideoTranscoder.

void OpalVideoTranscoder::ForceIFrame | ( |  | ) | `[inline]`

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:

  input | Flag 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::HasErrorConcealment | ( |  | ) | const`[inline, 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:

  inputMediaFormat | Input media format
  outputMediaFormat | Output media format

Reimplemented from OpalTranscoder.

Reimplemented in OpalPluginVideoTranscoder.

bool OpalVideoTranscoder::WasLastFrameIFrame | ( |  | ) | const`[inline]`

## Field Documentation

bool OpalVideoTranscoder::forceIFrame `[protected]`

PINDEX OpalVideoTranscoder::inDataSize `[protected]`

bool OpalVideoTranscoder::lastFrameWasIFrame `[protected]`

bool OpalVideoTranscoder::m_errorConcealment `[protected]`

DWORD OpalVideoTranscoder::m_keyFrames `[protected]`

DWORD OpalVideoTranscoder::m_totalFrames `[protected]`

PINDEX OpalVideoTranscoder::outDataSize `[protected]`

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

- vidcodec.h