Home --> Documentations --> PJMEDIA Reference
#include <codec.h>
|
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) |
|
This structure describes codec operations. Each codec MUST implement all of these functions.
◆ init
Initialize codec using the specified attribute.
Application should call pjmedia_codec_init() instead of calling this function directly.
- Parameters
-
codec | The codec instance. |
pool | Pool to use when the codec needs to allocate some memory. |
- Returns
- PJ_SUCCESS on success.
◆ open
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).
Application should call pjmedia_codec_open() instead of calling this function directly.
- Parameters
-
codec | The codec instance. |
param | Codec initialization parameter. |
- Returns
- PJ_SUCCESS on success.
◆ close
Close and shutdown codec, releasing all resources allocated by this codec, if any.
Application should call pjmedia_codec_close() instead of calling this function directly.
- Parameters
-
- Returns
- PJ_SUCCESS on success.
◆ modify
Modify the codec parameter after the codec is open. Note that not all codec parameters can be modified during run-time. Currently, only Opus codec supports changing key codec parameters such as bitrate and bandwidth, while other codecs may only be able to modify minor settings such as VAD or PLC.
Application should call pjmedia_codec_modify() instead of calling this function directly.
- Parameters
-
codec | The codec instance. |
param | The new codec parameter. |
- Returns
- PJ_SUCCESS on success.
◆ parse
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).
Application should call pjmedia_codec_parse() instead of calling this function directly.
- 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.
◆ encode
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).
Application should call pjmedia_codec_encode() instead of calling this function directly.
- 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;
◆ decode
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.
Application should call pjmedia_codec_decode() instead of calling this function directly.
- 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;
◆ recover
Instruct the codec to recover a missing frame.
Application should call pjmedia_codec_recover() instead of calling this function directly.
- 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
Copyright (C) 2006-2008 Teluu Inc.
|