PluginCodec< NAME > Class Template Referenceabstract

`#include <opalplugin.hpp>`

## Public Member Functions

virtual | ~PluginCodec ()
virtual bool | Construct ()
| Complete construction of the plug in codec. More...
virtual bool | Transcode (const void *fromPtr, unsigned &fromLen, void *toPtr, unsigned &toLen, unsigned &flags)=0
| Convert from one media format to another. More...
virtual bool | GetStatistics (char *, unsigned)
| Gather any statistics as a string into the provide buffer. More...
virtual size_t | GetOutputDataSize ()
| Get the required output buffer size to be passed into Transcode. More...
virtual bool | SetInstanceID (const char *, unsigned)
virtual bool | SetOptions (const char *const *options)
| Set all the options for the codec. More...
virtual bool | OnChangedOptions ()
| Callback for if any options are changed. More...
virtual bool | SetOption (const char *optionName, const char *optionValue)
| Set an individual option of teh given name. More...
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 (const PluginCodec_Definition *defn)
static void | Destroy (const PluginCodec_Definition *, void *context)
static int | Transcode (const PluginCodec_Definition *, void *context, const void *fromPtr, unsigned *fromLen, void *toPtr, unsigned *toLen, unsigned int *flags)
static int | GetOutputDataSize (const PluginCodec_Definition *, void *context, const char *, void *, unsigned *)
static int | ToNormalised (const PluginCodec_Definition *defn, void *, const char *, void *parm, unsigned *len)
static int | ToCustomised (const PluginCodec_Definition *defn, void *, const char *, void *parm, unsigned *len)
static int | FreeOptions (const PluginCodec_Definition *, void *, const char *, void *parm, unsigned *len)
static int | GetOptions (const struct PluginCodec_Definition *codec, void *, const char *, void *parm, unsigned *len)
static int | SetOptions (const PluginCodec_Definition *, void *context, const char *, void *parm, unsigned *len)
static int | ValidForProtocol (const PluginCodec_Definition *defn, void *, const char *, void *parm, unsigned *len)
static int | SetInstanceID (const PluginCodec_Definition *, void *context, const char *, void *parm, unsigned *len)
static int | GetStatistics (const PluginCodec_Definition *, void *context, const char *, void *parm, unsigned *len)
static int | Terminate (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

## Constructor & Destructor Documentation

template<typename NAME >

PluginCodec< NAME >::PluginCodec | ( | const PluginCodec_Definition * | defn | ) |

inline protected

References PluginCodec_GetCodecFunction::descr, PluginCodec_GetCodecFunction::destFormat, PTRACE, and PluginCodec_GetCodecFunction::sourceFormat.

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 | ( | const PluginCodec_Definition * | defn | ) |

inline static

References PTRACE.

template<typename NAME >

static void PluginCodec< NAME >::Destroy | ( | const PluginCodec_Definition * | ,
|  | void * | context
| ) |  |

inline static

template<typename NAME >

static int PluginCodec< NAME >::FreeOptions | ( | const PluginCodec_Definition * | ,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

Referenced by PluginCodec< NAME >::GetControls().

template<typename NAME >

static struct PluginCodec_ControlDefn* PluginCodec< NAME >::GetControls | ( |  | ) |

inline static

References PluginCodec< NAME >::FreeOptions(), PluginCodec< NAME >::GetOptions(), PluginCodec< NAME >::GetOutputDataSize(), PluginCodec< NAME >::GetStatistics(), PLUGINCODEC_CONTROL_FREE_CODEC_OPTIONS, PLUGINCODEC_CONTROL_GET_CODEC_OPTIONS, PLUGINCODEC_CONTROL_GET_OUTPUT_DATA_SIZE, PLUGINCODEC_CONTROL_GET_STATISTICS, PLUGINCODEC_CONTROL_LOG_FUNCTION_INC, PLUGINCODEC_CONTROL_SET_CODEC_OPTIONS, PLUGINCODEC_CONTROL_SET_INSTANCE_ID, PLUGINCODEC_CONTROL_TERMINATE_CODEC, PLUGINCODEC_CONTROL_TO_CUSTOMISED_OPTIONS, PLUGINCODEC_CONTROL_TO_NORMALISED_OPTIONS, PLUGINCODEC_CONTROL_VALID_FOR_PROTOCOL, PluginCodec< NAME >::SetInstanceID(), PluginCodec< NAME >::SetOptions(), PluginCodec< NAME >::Terminate(), PluginCodec< NAME >::ToCustomised(), PluginCodec< NAME >::ToNormalised(), and PluginCodec< NAME >::ValidForProtocol().

template<typename NAME >

static int PluginCodec< NAME >::GetOptions | ( | const struct PluginCodec_Definition * | codec,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

References PluginCodec_GetCodecFunction::userData.

Referenced by PluginCodec< NAME >::GetControls().

template<typename NAME >

virtual size_t PluginCodec< NAME >::GetOutputDataSize | ( |  | ) |

inline virtual

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

Referenced by PluginCodec< NAME >::GetControls().

template<typename NAME >

static int PluginCodec< NAME >::GetOutputDataSize | ( | 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.

Referenced by PluginCodec< NAME >::GetControls(), and PluginCodec< NAME >::GetStatistics().

template<typename NAME >

static int PluginCodec< NAME >::GetStatistics | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

References PluginCodec< NAME >::GetStatistics().

template<typename NAME >

virtual bool PluginCodec< NAME >::OnChangedOptions | ( |  | ) |

inline virtual

Callback for if any options are changed.

Referenced by PluginCodec< NAME >::SetOptions().

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.

Referenced by PluginCodec< NAME >::GetControls(), and PluginCodec< NAME >::SetInstanceID().

template<typename NAME >

static int PluginCodec< NAME >::SetInstanceID | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

References PluginCodec< NAME >::SetInstanceID().

template<typename NAME >

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

inline virtual

Set an individual option of teh given name.

References PluginCodec_GetCodecFunction::bitsPerSec, PluginCodec< NAME >::m_definition, PluginCodec< NAME >::m_frameTime, PluginCodec< NAME >::m_maxBitRate, PLUGINCODEC_OPTION_FRAME_TIME, PLUGINCODEC_OPTION_TARGET_BIT_RATE, PluginCodec_GetCodecFunction::sampleRate, and PluginCodec< NAME >::SetOptionUnsigned().

Referenced by PluginCodec< NAME >::SetOptions().

template<typename NAME >

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

inline

template<typename NAME >

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

inline

References PluginCodec< NAME >::m_optionsSame.

template<typename NAME >
template<typename T >

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

inline

template<typename NAME >

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

inline

References PluginCodec< NAME >::m_optionsSame.

template<typename NAME >

virtual bool PluginCodec< NAME >::SetOptions | ( | const char *const * | options | ) |

inline virtual

Set all the options for the codec.

References PluginCodec< NAME >::m_optionsSame, PluginCodec< NAME >::OnChangedOptions(), PTRACE, and PluginCodec< NAME >::SetOption().

Referenced by PluginCodec< NAME >::GetControls(), and PluginCodec< NAME >::SetOptions().

template<typename NAME >

static int PluginCodec< NAME >::SetOptions | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

References PluginCodec< NAME >::SetOptions().

template<typename NAME >
template<typename T >

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

inline

Referenced by PluginCodec< NAME >::SetOption().

template<typename NAME >

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

inline

References PluginCodec< NAME >::m_optionsSame.

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.

Referenced by PluginCodec< NAME >::GetControls(), and PluginCodec< NAME >::Terminate().

template<typename NAME >

static int PluginCodec< NAME >::Terminate | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const char * | ,
|  | void * | ,
|  | unsigned * |
| ) |  |

inline static

References PluginCodec< NAME >::Terminate().

template<typename NAME >

static int PluginCodec< NAME >::ToCustomised | ( | const PluginCodec_Definition * | defn,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

References PluginCodec_MediaFormat::ToCustomised(), and PluginCodec_GetCodecFunction::userData.

Referenced by PluginCodec< NAME >::GetControls().

template<typename NAME >

static int PluginCodec< NAME >::ToNormalised | ( | const PluginCodec_Definition * | defn,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

References PluginCodec_MediaFormat::ToNormalised(), and PluginCodec_GetCodecFunction::userData.

Referenced by PluginCodec< NAME >::GetControls().

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 | ( | const PluginCodec_Definition * | ,
|  | void * | context,
|  | const void * | fromPtr,
|  | unsigned * | fromLen,
|  | void * | toPtr,
|  | unsigned * | toLen,
|  | unsigned int * | flags
| ) |  |

inline static

References PTRACE.

template<typename NAME >

static int PluginCodec< NAME >::ValidForProtocol | ( | const PluginCodec_Definition * | defn,
|  | void * | ,
|  | const char * | ,
|  | void * | parm,
|  | unsigned * | len
| ) |  |

inline static

References PluginCodec_GetCodecFunction::userData.

Referenced by PluginCodec< NAME >::GetControls().

## Field Documentation

template<typename NAME >

const PluginCodec_Definition* PluginCodec< NAME >::m_definition

protected

Referenced by PluginCodec< NAME >::SetOption().

template<typename NAME >

unsigned PluginCodec< NAME >::m_frameTime

protected

Referenced by PluginCodec< NAME >::SetOption().

template<typename NAME >

unsigned PluginCodec< NAME >::m_maxBitRate

protected

Referenced by PluginCodec< NAME >::SetOption().

template<typename NAME >

bool PluginCodec< NAME >::m_optionsSame

protected

Referenced by PluginCodec< NAME >::SetOptionBit(), PluginCodec< NAME >::SetOptionBoolean(), PluginCodec< NAME >::SetOptions(), and PluginCodec< NAME >::SetOptionUnsigned().

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

- opalplugin.hpp