Hi All,
I'm new in SIP and PjSip. Wonder if somebody here have experience using and adding new codec to PjSip.
They got it explained in FAQ (in PjSip.org) only that its a bit difficult for me to understand the codec framework and how to integrate a new codec to the framework.
In my project I have a tetra codec to be added to PjMedia. I have copy my codec source code to the "pjmedia/src/Pjmedia-codec/" in the Pjproject dir then I added tetra.c by editing gsm.c file like in the FAQ. I also added portion related to my codec in :
pjmedia/include/pjmedia-codec.h :
| Code: |
| #include <pjmedia-codec/tetra.h> |
pjmedia/include/pjmedia-codec/config.h :
| Code: |
#ifndef PJMEDIA_HAS_TETRA_CODEC
# define PJMEDIA_HAS_TETRA_CODEC 1
#endif |
pjmedia/include/pjmedia-codec/config_auto.h :
| Code: |
#ifndef PJMEDIA_HAS_TETRA_CODEC
/* #undef PJMEDIA_HAS_TETRA_CODEC */
#endif |
pjmedia/include/pjmedia-codec/config_auto.h.in :
| Code: |
#ifndef PJMEDIA_HAS_TETRA_CODEC
#undef PJMEDIA_HAS_TETRA_CODEC
#endif |
For the enum i added in pjmedia/include/pjmedia-codec/types.h
| Code: |
| PJMEDIA_RTP_PT_TETRA |
And lastly added pjmedia/include/pjmedia-codec/tetra.h containing the init an deinit function declaration for tetra.c.
My first concern is are these all the file needed for adding new codec to the framework or there are any other that needs to be add/edited?
Secondly in the tetra.c there will be 3 functions :
1)
| Code: |
/*
* Get frames in the packet.
*/
static pj_status_t tetra_codec_parse( pjmedia_codec *codec,
void *pkt,
pj_size_t pkt_size,
const pj_timestamp *ts,
unsigned *frame_cnt,
pjmedia_frame frames[])
{
} |
2)
| Code: |
/*
* Encode frame.
*/
static pj_status_t tetra_codec_encode( pjmedia_codec *codec,
const struct pjmedia_frame *input,
unsigned output_buf_len,
struct pjmedia_frame *output)
{
} |
and
3)
| Code: |
/*
* Decode frame.
*/
static pj_status_t tetra_codec_decode( pjmedia_codec *codec,
const struct pjmedia_frame *input,
unsigned output_buf_len,
struct pjmedia_frame *output)
{
}
|
are tetra_codec_parse() going to be use by both encode and decode functions? since encode input length is different than decode input length. So I'm confuse on how to edit the parse function.
Hope someone can point me to the right direction.