# PluginCodec< NAME > Class Template Reference

`#include <opalplugin.hpp>`

Inheritance diagram for PluginCodec< NAME >:

[legend]
Collaboration diagram for PluginCodec< NAME >:
[legend]

## Public Types

typedef PluginCodec_MediaFormat< NAME > | MediaFormat

## Public Member Functions

virtual | ~PluginCodec ()
virtual bool | Construct ()
| Complete construction of the plug in codec.
virtual bool | Transcode (const void *fromPtr, unsigned &fromLen, void *toPtr, unsigned &toLen, unsigned &flags)=0
| Convert from one media format to another.
virtual bool | GetStatistics (char *, unsigned)
| Gather any statistics as a string into the provide buffer.
virtual size_t | GetOutputDataSize ()
| Get the required output buffer size to be passed into Transcode.
virtual bool | SetInstanceID (const char *, unsigned)
virtual bool | GetActiveOptions (PluginCodec_OptionMap &)
| Get options that are "active" and may be different from the last SetOptions() call.
virtual bool | SetOptions (const char *const *options)
| Set all the options for the codec.
virtual bool | OnChangedOptions ()
| Callback for if any options are changed.
virtual bool | SetOption (const char *optionName, const char *optionValue)
| Set an individual option of the given name.
template<typename T>
bool | SetOptionUnsigned (T &oldValue, const char *optionValue, unsigned minimum, unsigned maximum=UINT_MAX)
bool | SetOptionUnsigned (unsigned &oldValue, const char *optionValue, unsigned minimum, unsigned maximum=UINT_MAX)
template<typename T>
bool | SetOptionBoolean (T &oldValue, const char *optionValue)
bool | SetOptionBoolean (bool &oldValue, const char *optionValue)
bool | SetOptionBit (int &oldValue, unsigned bit, const char *optionValue)
bool | SetOptionBit (unsigned &oldValue, unsigned bit, const char *optionValue)

## Static Public Member Functions

static bool | Terminate ()
template<class CodecClass>
static void * | Create_s (const PluginCodec_Definition *defn)
static void | Destroy_s (const PluginCodec_Definition *, void *context)
static int | Transcode_s (const PluginCodec_Definition *, void *context, const void *fromPtr, unsigned *fromLen, void *toPtr, unsigned *toLen, unsigned int *flags)
static int | GetOutputDataSize_s (const PluginCodec_Definition *, void *context, const char *, void *, unsigned *)
static int | ToNormalised_s (const PluginCodec_Definition *defn, void *, const char *, void *parm, unsigned *len)
static int | ToCustomised_s (const PluginCodec_Definition *defn, void *, const char *, void *parm, unsigned *len)
static int | GetActiveOptions_s (const PluginCodec_Definition *, void *context, const char *, void *parm, unsigned *parmLen)
static int | FreeOptions_s (const PluginCodec_Definition *, void *, const char *, void *parm, unsigned *len)
static int | GetOptions_s (const struct PluginCodec_Definition *codec, void *, const char *, void *parm, unsigned *len)
static int | SetOptions_s (const PluginCodec_Definition *, void *context, const char *, void *parm, unsigned *len)
static int | ValidForProtocol_s (const PluginCodec_Definition *defn, void *, const char *, void *parm, unsigned *len)
static int | SetInstanceID_s (const PluginCodec_Definition *, void *context, const char *, void *parm, unsigned *len)
static int | GetStatistics_s (const PluginCodec_Definition *, void *context, const char *, void *parm, unsigned *len)
static int | Terminate_s (const PluginCodec_Definition *, void *context, const char *, void *, unsigned *)
static struct PluginCodec_ControlDefn * | GetControls ()

## Protected Member Functions

| PluginCodec (const PluginCodec_Definition *defn)

## Protected Attributes

const PluginCodec_Definition * | m_definition
bool | m_optionsSame
unsigned | m_maxBitRate
unsigned | m_frameTime

### template<typename NAME>
class PluginCodec< NAME >

## Member Typedef Documentation

template<typename NAME>

typedef PluginCodec_MediaFormat<NAME> PluginCodec< NAME >::MediaFormat

## Constructor & Destructor Documentation

template<typename NAME>

PluginCodec< NAME >::PluginCodec | ( | const PluginCodec_Definition * | defn | ) | `[inline, protected]`

template<typename NAME>

virtual PluginCodec< NAME >::~PluginCodec | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

template<typename NAME>

virtual bool PluginCodec< NAME >::Construct | ( |  | ) | `[inline, virtual]`

Complete construction of the plug in codec.

template<typename NAME>
template<class CodecClass>

static void* PluginCodec< NAME >::Create_s | ( | const PluginCodec_Definition * | defn | ) | `[inline, static]`

template<typename NAME>

static void PluginCodec< NAME >::Destroy_s | ( | const PluginCodec_Definition * | ,
|  | void * | context |
| ) |  |  | `[inline, static]`

template<typename NAME>

static int PluginCodec< NAME >::FreeOptions_s | ( | const PluginCodec_Definition * | ,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

template<typename NAME>

virtual bool PluginCodec< NAME >::GetActiveOptions | ( | PluginCodec_OptionMap & |  | ) | `[inline, virtual]`

Get options that are "active" and may be different from the last SetOptions() call.

Reimplemented in PluginVideoEncoder< NAME >.

template<typename NAME>

static int PluginCodec< NAME >::GetActiveOptions_s | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | parmLen |
| ) |  |  | `[inline, static]`

template<typename NAME>

static struct PluginCodec_ControlDefn* PluginCodec< NAME >::GetControls | ( |  | ) | `[inline, static]`

template<typename NAME>

static int PluginCodec< NAME >::GetOptions_s | ( | const struct PluginCodec_Definition * | codec,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

template<typename NAME>

virtual size_t PluginCodec< NAME >::GetOutputDataSize | ( |  | ) | `[inline, virtual]`

Get the required output buffer size to be passed into Transcode.

Reimplemented in PluginVideoDecoder< NAME >.

template<typename NAME>

static int PluginCodec< NAME >::GetOutputDataSize_s | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | ,
|  | unsigned * |  |
| ) |  |  | `[inline, static]`

template<typename NAME>

virtual bool PluginCodec< NAME >::GetStatistics | ( | char * | ,
|  | unsigned |  |
| ) |  |  | `[inline, virtual]`

Gather any statistics as a string into the provide buffer.

template<typename NAME>

static int PluginCodec< NAME >::GetStatistics_s | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

template<typename NAME>

virtual bool PluginCodec< NAME >::OnChangedOptions | ( |  | ) | `[inline, virtual]`

Callback for if any options are changed.

template<typename NAME>

virtual bool PluginCodec< NAME >::SetInstanceID | ( | const char * | ,
|  | unsigned |  |
| ) |  |  | `[inline, virtual]`

Set the instance ID for the codec. This is used to match up the encode and decoder pairs of instances for a given call. While most codecs like G.723.1 are purely unidirectional, some a bidirectional and have information flow between encoder and decoder.

template<typename NAME>

static int PluginCodec< NAME >::SetInstanceID_s | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

template<typename NAME>

virtual bool PluginCodec< NAME >::SetOption | ( | const char * | optionName,
|  | const char * | optionValue |
| ) |  |  | `[inline, virtual]`

Set an individual option of the given name.

Reimplemented in PluginVideoEncoder< NAME >.

template<typename NAME>

bool PluginCodec< NAME >::SetOptionBit | ( | unsigned & | oldValue,
|  | unsigned | bit,
|  | const char * | optionValue |
| ) |  |  | `[inline]`

template<typename NAME>

bool PluginCodec< NAME >::SetOptionBit | ( | int & | oldValue,
|  | unsigned | bit,
|  | const char * | optionValue |
| ) |  |  | `[inline]`

template<typename NAME>

bool PluginCodec< NAME >::SetOptionBoolean | ( | bool & | oldValue,
|  | const char * | optionValue |
| ) |  |  | `[inline]`

template<typename NAME>
template<typename T>

bool PluginCodec< NAME >::SetOptionBoolean | ( | T & | oldValue,
|  | const char * | optionValue |
| ) |  |  | `[inline]`

template<typename NAME>

virtual bool PluginCodec< NAME >::SetOptions | ( | const char *const * | options | ) | `[inline, virtual]`

Set all the options for the codec.

template<typename NAME>

static int PluginCodec< NAME >::SetOptions_s | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

template<typename NAME>

bool PluginCodec< NAME >::SetOptionUnsigned | ( | unsigned & | oldValue,
|  | const char * | optionValue,
|  | unsigned | minimum,
|  | unsigned | maximum = `UINT_MAX` |
| ) |  |  | `[inline]`

template<typename NAME>
template<typename T>

bool PluginCodec< NAME >::SetOptionUnsigned | ( | T & | oldValue,
|  | const char * | optionValue,
|  | unsigned | minimum,
|  | unsigned | maximum = `UINT_MAX` |
| ) |  |  | `[inline]`

template<typename NAME>

static bool PluginCodec< NAME >::Terminate | ( |  | ) | `[inline, static]`

Terminate operation of plug in codec. This is generally not needed but sometimes (e.g. fax) there is some clean up required to be done on completion of the codec run.

template<typename NAME>

static int PluginCodec< NAME >::Terminate_s | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | ,
|  | unsigned * |  |
| ) |  |  | `[inline, static]`

template<typename NAME>

static int PluginCodec< NAME >::ToCustomised_s | ( | const PluginCodec_Definition * | defn,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

template<typename NAME>

static int PluginCodec< NAME >::ToNormalised_s | ( | const PluginCodec_Definition * | defn,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

template<typename NAME>

virtual bool PluginCodec< NAME >::Transcode | ( | const void * | fromPtr,
|  | unsigned & | fromLen,
|  | void * | toPtr,
|  | unsigned & | toLen,
|  | unsigned & | flags |
| ) |  |  | `[pure virtual]`

Convert from one media format to another.

template<typename NAME>

static int PluginCodec< NAME >::Transcode_s | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const void * | fromPtr,
|  | unsigned * | fromLen,
|  | void * | toPtr,
|  | unsigned * | toLen,
|  | unsigned int * | flags |
| ) |  |  | `[inline, static]`

template<typename NAME>

static int PluginCodec< NAME >::ValidForProtocol_s | ( | const PluginCodec_Definition * | defn,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len |
| ) |  |  | `[inline, static]`

## Field Documentation

template<typename NAME>

const PluginCodec_Definition* PluginCodec< NAME >::m_definition `[protected]`

template<typename NAME>

unsigned PluginCodec< NAME >::m_frameTime `[protected]`

template<typename NAME>

unsigned PluginCodec< NAME >::m_maxBitRate `[protected]`

template<typename NAME>

bool PluginCodec< NAME >::m_optionsSame `[protected]`

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

- opalplugin.hpp