[Ekiga-list] RTP payload and G729 codec
- From: Jure Petrovic <fonz siol net>
- To: ekiga-list <ekiga-list gnome org>
- Subject: [Ekiga-list] RTP payload and G729 codec
- Date: Fri, 04 May 2007 19:41:36 +0200
Sorry for my previous post. Made a mistake.
THIS is encoding part:
static int codec_encoder(const struct PluginCodec_Definition * codec,
void * context,
const void * from,
unsigned * fromLen,
void * to,
unsigned * toLen,
unsigned int * flag)
{
//if (!encoderInUse)
// return 0;
// If there is no complete frame, return at once
if (*fromLen < SAMPLES_PER_FRAME*2 || *toLen < L_FRAME_COMPRESSED) {
printf("DEBUG::codec_encoder()::frame incomplete, cannot decode!\n");
return 0;
}
// Let us see, how many frames we have
int frames;
frames = MIN(*fromLen/(SAMPLES_PER_FRAME*2), (*toLen/BYTES_PER_FRAME));
printf("DEBUG::codec_encoder()::frames: %d\n", frames);
// Set frame information accordingly
*fromLen = frames * SAMPLES_PER_FRAME * 2;
*toLen = frames * BYTES_PER_FRAME;
// While there are any frames left, encode audio
while (frames-- > 0) {
g729_encode((struct G729STRUCT_ENCODE*)context, (char*)from, to);
to = to + BYTES_PER_FRAME;
from = from + (SAMPLES_PER_FRAME*2);
}
return 1;
}
Everything else should be ok...:-)
Regards,
jure
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]