From d2cecb3fb1b8aa8e6d91bed844b0564f0593ecf3 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov <lemenkov@gmail.com> Date: Wed, 21 Nov 2012 14:20:11 +0400 Subject: [PATCH 3/7] Initial support for bcg729 Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> --- configure.ac | 6 +++--- makeann.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 508c51f..00919c1 100644 --- a/configure.ac +++ b/configure.ac @@ -45,11 +45,11 @@ then fi # G.729 -AC_CHECK_HEADERS(g729_encoder.h, found_libg729=yes) +AC_CHECK_HEADERS(bcg729/encoder.h, found_libg729=yes) if test "$found_libg729" = yes then - AC_CHECK_LIB(g729, g729_encoder_new, - LIBS_G729="-lg729" + AC_CHECK_LIB(bcg729, initBcg729EncoderChannel, + LIBS_G729=`pkg-config --libs libbcg729` G729_SUPPORT=ext AC_DEFINE([ENABLE_G729], 1, [Define if you have libg729 library installed]) ) diff --git a/makeann.c b/makeann.c index b33b772..f48cd28 100644 --- a/makeann.c +++ b/makeann.c @@ -42,7 +42,7 @@ #include "g711.h" #ifdef ENABLE_G729 -#include "g729_encoder.h" +#include <bcg729/encoder.h> #define G729_ENABLED 1 #else #define G729_ENABLED 0 @@ -86,7 +86,7 @@ int main(int argc, char **argv) int16_t slbuf[160]; int i, j, k, rsize, wsize, loop, limit, rlimit, ch; #ifdef ENABLE_G729 - G729_CTX *ctx_g729; + bcg729EncoderChannelContextStruct* ctx_g729; #endif #ifdef ENABLE_GSM gsm ctx_gsm; @@ -126,7 +126,7 @@ int main(int argc, char **argv) template = argv[0]; #ifdef ENABLE_G729 - ctx_g729 = g729_encoder_new(); + ctx_g729 = initBcg729EncoderChannel(); if (ctx_g729 == NULL) errx(1, "can't create G.729 encoder"); #endif @@ -181,7 +181,7 @@ int main(int argc, char **argv) #ifdef ENABLE_G729 case RTP_G729: for (j = 0; j < 2; j++) - g729_encode_frame(ctx_g729, &(slbuf[j * 80]), &(lawbuf[j * 10])); + bcg729Encoder(ctx_g729, &(slbuf[j * 80]), &(lawbuf[j * 10])); wsize = 20; break; #endif @@ -208,5 +208,9 @@ int main(int argc, char **argv) fclose(efiles[k].f); } +#ifdef ENABLE_G729 + closeBcg729EncoderChannel(ctx_g729); +#endif + return 0; } -- 1.8.1