go back to including libresample in the main Asterisk binary, but this time including...
authorKevin P. Fleming <kpfleming@digium.com>
Wed, 2 Jan 2008 14:05:30 +0000 (14:05 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Wed, 2 Jan 2008 14:05:30 +0000 (14:05 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95816 65c4cc65-6c06-0410-ace0-fbb531ad65f3

28 files changed:
build_tools/strip_nonapi
codecs/Makefile
codecs/codec_resample.c
main/Makefile
main/libresample/LICENSE.txt [moved from res/libresample/LICENSE.txt with 100% similarity]
main/libresample/Makefile.asterisk [moved from res/libresample/Makefile.asterisk with 100% similarity]
main/libresample/Makefile.in [moved from res/libresample/Makefile.in with 100% similarity]
main/libresample/README.txt [moved from res/libresample/README.txt with 100% similarity]
main/libresample/config.guess [moved from res/libresample/config.guess with 100% similarity]
main/libresample/config.sub [moved from res/libresample/config.sub with 100% similarity]
main/libresample/configure [moved from res/libresample/configure with 100% similarity]
main/libresample/configure.in [moved from res/libresample/configure.in with 100% similarity]
main/libresample/include/libresample.h [moved from res/libresample/include/libresample.h with 100% similarity]
main/libresample/install-sh [moved from res/libresample/install-sh with 100% similarity]
main/libresample/src/configtemplate.h [moved from res/libresample/src/configtemplate.h with 100% similarity]
main/libresample/src/filterkit.c [moved from res/libresample/src/filterkit.c with 100% similarity]
main/libresample/src/filterkit.h [moved from res/libresample/src/filterkit.h with 100% similarity]
main/libresample/src/resample.c [moved from res/libresample/src/resample.c with 98% similarity]
main/libresample/src/resample_defs.h [moved from res/libresample/src/resample_defs.h with 100% similarity]
main/libresample/src/resamplesubs.c [moved from res/libresample/src/resamplesubs.c with 100% similarity]
main/libresample/tests/compareresample.c [moved from res/libresample/tests/compareresample.c with 100% similarity]
main/libresample/tests/resample-sndfile.c [moved from res/libresample/tests/resample-sndfile.c with 100% similarity]
main/libresample/tests/testresample.c [moved from res/libresample/tests/testresample.c with 100% similarity]
main/libresample/win/libresample.dsp [moved from res/libresample/win/libresample.dsp with 100% similarity]
main/libresample/win/libresample.vcproj [moved from res/libresample/win/libresample.vcproj with 100% similarity]
main/translate.c
res/Makefile
res/res_resample.c [deleted file]

index 5a52eef..8a8d06f 100755 (executable)
@@ -14,8 +14,9 @@
 #      __ast_
 #      astman_
 #      pbx_
+#      resample_
 
-FILTER="${GREP} -v -e ^ast_ -e ^_ast_ -e ^__ast_ -e ^astman_ -e ^pbx_"
+FILTER="${GREP} -v -e ^ast_ -e ^_ast_ -e ^__ast_ -e ^astman_ -e ^pbx_ -e ^resample_"
 
 case "${OSARCH}" in
     linux-gnu|FreeBSD)
index ef76962..a09f671 100644 (file)
@@ -55,4 +55,4 @@ $(LIBG722):
 
 $(if $(filter codec_g722,$(EMBEDDED_MODS)),modules.link,codec_g722.so): $(LIBG722)
 
-codec_resample.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res/libresample/include
+codec_resample.o: ASTCFLAGS+=-I$(ASTTOPDIR)/main/libresample/include
index 718ab88..66d6016 100644 (file)
  * \ingroup codecs
  */
 
-/*** MODULEINFO
-       <depend>res_resample</depend>
- ***/
-
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
index ffbd4bf..304d486 100644 (file)
@@ -111,6 +111,9 @@ editline/libedit.a: CHECK_SUBDIR
 db1-ast/libdb1.a: CHECK_SUBDIR
        CFLAGS="$(ASTCFLAGS)" LDFLAGS="$(ASTLDFLAGS)" $(MAKE) -C db1-ast libdb1.a
 
+libresample/libresample.a: CHECK_SUBDIR
+       $(MAKE) -f Makefile.asterisk -C libresample libresample.a
+
 ast_expr2.c ast_expr2.h:
        bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
 
@@ -127,6 +130,8 @@ testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
 
 channel.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE)
 
+translate.o: ASTCFLAGS+=-Ilibresample/include
+
 AST_EMBED_LDSCRIPTS:=$(sort $(EMBED_LDSCRIPTS))
 AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED_LDFLAGS),$(value $(dep)))
 AST_EMBED_LIBS:=$(foreach dep,$(EMBED_LIBS),$(value $(dep)))
@@ -152,7 +157,7 @@ else
 MAIN_TGT:=asterisk
 endif
 
-$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS)
+$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS) libresample/libresample.a
        @$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
        $(ECHO_PREFIX) echo "   [LD] $^ -> $@"
 ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
@@ -169,3 +174,4 @@ clean::
        @$(MAKE) -C db1-ast clean
        @$(MAKE) -C stdtime clean
        @$(MAKE) -C minimime clean
+       @$(MAKE) -f Makefile.asterisk -C libresample clean
similarity index 98%
rename from res/libresample/src/resample.c
rename to main/libresample/src/resample.c
index 9dba5af..85ff75f 100644 (file)
@@ -87,7 +87,7 @@ void *resample_open(int highQuality, double minFactor, double maxFactor)
 
    /* Just exit if we get invalid factors */
    if (minFactor <= 0.0 || maxFactor <= 0.0 || maxFactor < minFactor) {
-      #ifdef DEBUG
+      #if defined(DEBUG)
       fprintf(stderr,
               "libresample: "
               "minFactor and maxFactor must be positive real numbers,\n"
@@ -187,7 +187,7 @@ int resample_process(void   *handle,
    int Nx;
    int i, len;
 
-   #ifdef DEBUG
+   #if defined(DEBUG)
    fprintf(stderr, "resample_process: in=%d, out=%d lastFlag=%d\n",
            inBufferLen, outBufferLen, lastFlag);
    #endif
@@ -197,7 +197,7 @@ int resample_process(void   *handle,
    outSampleCount = 0;
 
    if (factor < hp->minFactor || factor > hp->maxFactor) {
-      #ifdef DEBUG
+      #if defined(DEBUG)
       fprintf(stderr,
               "libresample: factor %f is not between "
               "minFactor=%f and maxFactor=%f",
@@ -232,7 +232,7 @@ int resample_process(void   *handle,
       /* This is the maximum number of samples we can process
          per loop iteration */
 
-      #ifdef DEBUG
+      #if defined(DEBUG)
       printf("XSize: %d Xoff: %d Xread: %d Xp: %d lastFlag: %d\n",
              hp->XSize, hp->Xoff, hp->Xread, hp->Xp, lastFlag);
       #endif
@@ -260,7 +260,7 @@ int resample_process(void   *handle,
       else
          Nx = hp->Xread - 2 * hp->Xoff;
 
-      #ifdef DEBUG
+      #if defined(DEBUG)
       fprintf(stderr, "new len=%d Nx=%d\n", len, Nx);
       #endif
 
@@ -277,7 +277,7 @@ int resample_process(void   *handle,
                          Nwing, LpScl, Imp, ImpD, interpFilt);
       }
 
-      #ifdef DEBUG
+      #if defined(DEBUG)
       printf("Nout: %d\n", Nout);
       #endif
       
@@ -297,7 +297,7 @@ int resample_process(void   *handle,
       for (i=0; i<Nreuse; i++)
          hp->X[i] = hp->X[i + (hp->Xp - hp->Xoff)];
 
-      #ifdef DEBUG
+      #if defined(DEBUG)
       printf("New Xread=%d\n", Nreuse);
       #endif
 
@@ -306,7 +306,7 @@ int resample_process(void   *handle,
       
       /* Check to see if output buff overflowed (shouldn't happen!) */
       if (Nout > hp->YSize) {
-         #ifdef DEBUG
+         #if defined(DEBUG)
          printf("Nout: %d YSize: %d\n", Nout, hp->YSize);
          #endif
          fprintf(stderr, "libresample: Output array overflow!\n");
index d9270e9..617e465 100644 (file)
@@ -39,8 +39,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/cli.h"
 #include "asterisk/term.h"
 
+#include "libresample.h"
+
 #define MAX_RECALC 1000 /* max sample recalc */
 
+/* hack to ensure that the libresample code gets linked in */
+
+static attribute_unused void (*resample_hack)(void *) = resample_close;
+
 /*! \brief the list of translators */
 static AST_RWLIST_HEAD_STATIC(translators, ast_translator);
 
index 496264f..cfac318 100644 (file)
@@ -47,9 +47,6 @@ ael/ael.tab.c ael/ael.tab.h:
 
 ael/pval.o: ael/pval.c
 
-res_resample.so: libresample/src/resample.o libresample/src/resamplesubs.o libresample/src/filterkit.o
-
 clean::
        rm -f snmp/*.o
        rm -f ael/*.o
-       rm -f libresample/src/*.o
diff --git a/res/res_resample.c b/res/res_resample.c
deleted file mode 100644 (file)
index ac85c3f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Asterisk -- A telephony toolkit for Linux.
- *
- * Copyright (C) 2007, Digium, Inc.
- *
- * Russell Bryant <russell@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*!
- * \file
- *
- * \author Russell Bryant <russell@digium.com>
- */
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/module.h"
-
-static int load_module(void)
-{
-       return 0;
-}
-
-static int unload_module(void)
-{
-       return -1;
-}
-
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Resampling Support via libresample",
-               .load = load_module,
-               .unload = unload_module,
-              );