Author: sayer Date: 2008-08-21 21:18:12 +0200 (Thu, 21 Aug 2008) New Revision: 1071
Modified: branches/wb/Makefile.defs branches/wb/core/AmAudio.h branches/wb/core/plug-in/g722/g722.c branches/wb/core/plug-in/l16/l16.c Log: ifdeffed wideband Modified: branches/wb/Makefile.defs =================================================================== --- branches/wb/Makefile.defs 2008-08-21 18:29:40 UTC (rev 1070) +++ branches/wb/Makefile.defs 2008-08-21 19:18:12 UTC (rev 1071) @@ -22,6 +22,41 @@ # -DOpenSER \ # -DSUPPORT_IPV6 \ +# compile with wideband (16khz) support? +# + SUPPORT_WIDEBAND = yes + +# compile with ultra-wideband (32khz)support? (UWB includes WB) +# +# SUPPORT_ULTRAWIDEBAND = yes + +# or specify internal samplerate directly, e.g. +# +# SYSTEM_SAMPLERATE = 48000 + +ifndef SYSTEM_SAMPLERATE +ifdef SUPPORT_ULTRAWIDEBAND +SYSTEM_SAMPLERATE = 32000 +else +ifdef SUPPORT_WIDEBAND +SYSTEM_SAMPLERATE = 16000 +else +SYSTEM_SAMPLERATE = 8000 +endif +endif +endif + +CPPFLAGS += -DSYSTEM_SAMPLERATE=$(SYSTEM_SAMPLERATE) + +# compile with sample rate conversion from secret rabbit code? +# (see http://www.mega-nerd.com/SRC/) +# +#USE_LIBSAMPLERATE = yes +# for wideband support SRC is always needed +ifneq ($(SYSTEM_SAMPLERATE),8000) +USE_LIBSAMPLERATE = yes +endif + # compile with spandsp DTMF detection? see soft-switch.org # this needs a fairly new version of spandsp - tested with 0.0.4pre11 # will not work with spandsp 0.0.2 . @@ -33,13 +68,7 @@ #LIBSPANDSP_STATIC = yes #LIBSPANDSP_LDIR = /usr/local/lib/ - -# compile with sample rate conversion from secret rabbit code? -# (see http://www.mega-nerd.com/SRC/) # -USE_LIBSAMPLERATE = yes - -# # ZRTP support? (see zfoneproject.com) #WITH_ZRTP = yes Modified: branches/wb/core/AmAudio.h =================================================================== --- branches/wb/core/AmAudio.h 2008-08-21 18:29:40 UTC (rev 1070) +++ branches/wb/core/AmAudio.h 2008-08-21 19:18:12 UTC (rev 1071) @@ -47,7 +47,7 @@ #define PCM16_B2S(b) ((b) >> 1) #define PCM16_S2B(s) ((s) << 1) -#define SYSTEM_SAMPLERATE 16000 // fixme: sr per session +// #define SYSTEM_SAMPLERATE 16000 // fixme: sr per session class SdpPayload; class CodecContainer; Modified: branches/wb/core/plug-in/g722/g722.c =================================================================== --- branches/wb/core/plug-in/g722/g722.c 2008-08-21 18:29:40 UTC (rev 1070) +++ branches/wb/core/plug-in/g722/g722.c 2008-08-21 19:18:12 UTC (rev 1071) @@ -52,7 +52,13 @@ END_CODECS BEGIN_PAYLOADS -PAYLOAD(9, "g722", 16000, 8000, 1, CODEC_G722_NB, AMCI_PT_AUDIO_FRAME) +PAYLOAD(9, "g722", +#if SYSTEM_SAMPLERATE >=16000 + 16000, +#else + 8000, +#endif +8000, 1, CODEC_G722_NB, AMCI_PT_AUDIO_FRAME) END_PAYLOADS BEGIN_FILE_FORMATS @@ -77,14 +83,26 @@ } if (!g722_encode_init(&gs->encode_state, - 64000, 0 /* G722_SAMPLE_RATE_8000 */)) { + 64000, +#if SYSTEM_SAMPLERATE >=16000 + 0 +#else + G722_SAMPLE_RATE_8000 +#endif + )) { ERROR("error initializing G722 encoder\n"); free(gs); return 0; } if (!g722_decode_init(&gs->decode_state, - 64000, 0 /* G722_SAMPLE_RATE_8000 */)) { + 64000, +#if SYSTEM_SAMPLERATE >=16000 + 0 +#else + G722_SAMPLE_RATE_8000 +#endif + )) { ERROR("error initializing G722 decoder\n"); free(gs); return 0; @@ -116,10 +134,17 @@ return 0; } - if (rate != 16000 /* 8000 */) { - ERROR("only supports NB (8khz)\n"); +#if SYSTEM_SAMPLERATE >=16000 + if (rate != 16000) { + ERROR("g722 only supports WB (16khz)\n"); return 0; } +#else + if (rate != 8000) { + ERROR("g722 internally only supports NB (8khz)\n"); + return 0; + } +#endif gs = (G722State*) h_codec; @@ -137,10 +162,17 @@ return 0; } - if (rate != 16000 /* 8000 */) { - ERROR("only supports NB (8khz)\n"); +#if SYSTEM_SAMPLERATE >=16000 + if (rate != 16000) { + ERROR("g722 only supports WB (16khz)\n"); return 0; } +#else + if (rate != 8000) { + ERROR("g722 internally only supports NB (8khz)\n"); + return 0; + } +#endif gs = (G722State*) h_codec; Modified: branches/wb/core/plug-in/l16/l16.c =================================================================== --- branches/wb/core/plug-in/l16/l16.c 2008-08-21 18:29:40 UTC (rev 1070) +++ branches/wb/core/plug-in/l16/l16.c 2008-08-21 19:18:12 UTC (rev 1071) @@ -62,8 +62,15 @@ BEGIN_PAYLOADS PAYLOAD( -1, "L16", 8000, 8000, 1, CODEC_L16, AMCI_PT_AUDIO_LINEAR ) +#if SYSTEM_SAMPLERATE >=16000 PAYLOAD( -1, "L16", 16000, 16000, 1, CODEC_L16, AMCI_PT_AUDIO_LINEAR ) +#if SYSTEM_SAMPLERATE >=32000 PAYLOAD( -1, "L16", 32000, 32000, 1, CODEC_L16, AMCI_PT_AUDIO_LINEAR ) +#if SYSTEM_SAMPLERATE >=48000 +PAYLOAD( -1, "L16", 48000, 48000, 1, CODEC_L16, AMCI_PT_AUDIO_LINEAR ) +#endif +#endif +#endif END_PAYLOADS BEGIN_FILE_FORMATS _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
