pjsip logo pjsip.org
Open source SIP stack and media stack for presence, im/instant messaging, and multimedia communication

HOME

SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port

FAQ

Documentation

Licensing

Download

Development (Trac)

Projects using pjsip

Mailing List

Open Source Links


About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono
<bennylp@pjsip.org>


 

Home --> Documentations --> PJMEDIA Reference

pjmedia_codec_op Struct Reference
[Codec Framework]


Detailed Description

This structure describes codec operations. Each codec MUST implement all of these functions.

Data Fields

pj_status_t(* init )(pjmedia_codec *codec, pj_pool_t *pool)
pj_status_t(* open )(pjmedia_codec *codec, pjmedia_codec_param *param)
pj_status_t(* close )(pjmedia_codec *codec)
pj_status_t(* modify )(pjmedia_codec *codec, const pjmedia_codec_param *param)
pj_status_t(* parse )(pjmedia_codec *codec, void *pkt, pj_size_t pkt_size, const pj_timestamp *timestamp, unsigned *frame_cnt, pjmedia_frame frames[])
pj_status_t(* encode )(pjmedia_codec *codec, const struct pjmedia_frame *input, unsigned out_size, struct pjmedia_frame *output)
pj_status_t(* decode )(pjmedia_codec *codec, const struct pjmedia_frame *input, unsigned out_size, struct pjmedia_frame *output)
pj_status_t(* recover )(pjmedia_codec *codec, unsigned out_size, struct pjmedia_frame *output)

Field Documentation

Initialize codec using the specified attribute.

Parameters:
codec The codec instance.
pool Pool to use when the codec needs to allocate some memory.
Returns:
PJ_SUCCESS on success.

Open the codec and initialize with the specified parameter. Upon successful initialization, the codec may modify the parameter and fills in the unspecified values (such as enc_ptime, when encoder ptime is different than decoder ptime).

Parameters:
codec The codec instance.
param Codec initialization parameter.
Returns:
PJ_SUCCESS on success.

Close and shutdown codec, releasing all resources allocated by this codec, if any.

Parameters:
codec The codec instance.
Returns:
PJ_SUCCESS on success.

Modify the codec parameter after the codec is open. Note that not all codec parameters can be modified during run-time. When the parameter cannot be changed, this function will return non-PJ_SUCCESS, and the original parameters will not be changed.

Application can expect changing trivial codec settings such as changing VAD setting to succeed.

Parameters:
codec The codec instance.
param The new codec parameter.
Returns:
PJ_SUCCESS on success.

pj_status_t(* pjmedia_codec_op::parse)(pjmedia_codec *codec, void *pkt, pj_size_t pkt_size, const pj_timestamp *timestamp, unsigned *frame_cnt, pjmedia_frame frames[])

Instruct the codec to inspect the specified payload/packet and split the packet into individual base frames. Each output frames will have ptime that is equal to basic frame ptime (i.e. the value of info.frm_ptime in pjmedia_codec_param).

Parameters:
codec The codec instance
pkt The input packet.
pkt_size Size of the packet.
timestamp The timestamp of the first sample in the packet.
frame_cnt On input, specifies the maximum number of frames in the array. On output, the codec must fill with number of frames detected in the packet.
frames On output, specifies the frames that have been detected in the packet.
Returns:
PJ_SUCCESS on success.

pj_status_t(* pjmedia_codec_op::encode)(pjmedia_codec *codec, const struct pjmedia_frame *input, unsigned out_size, struct pjmedia_frame *output)

Instruct the codec to encode the specified input frame. The input PCM samples MUST have ptime that is multiplication of base frame ptime (i.e. the value of info.frm_ptime in pjmedia_codec_param).

Parameters:
codec The codec instance.
input The input frame.
out_size The length of buffer in the output frame.
output The output frame.
Returns:
PJ_SUCCESS on success;

pj_status_t(* pjmedia_codec_op::decode)(pjmedia_codec *codec, const struct pjmedia_frame *input, unsigned out_size, struct pjmedia_frame *output)

Instruct the codec to decode the specified input frame. The input frame MUST have ptime that is exactly equal to base frame ptime (i.e. the value of info.frm_ptime in pjmedia_codec_param). Application can achieve this by parsing the packet into base frames before decoding each frame.

Parameters:
codec The codec instance.
input The input frame.
out_size The length of buffer in the output frame.
output The output frame.
Returns:
PJ_SUCCESS on success;

pj_status_t(* pjmedia_codec_op::recover)(pjmedia_codec *codec, unsigned out_size, struct pjmedia_frame *output)

Instruct the codec to recover a missing frame.

Parameters:
codec The codec instance.
out_size The length of buffer in the output frame.
output The output frame where generated signal will be placed.
Returns:
PJ_SUCCESS on success;


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

 


PJMEDIA small footprint Open Source media stack
(C)2003-2008 Benny Prijono