Freeswitch-trunk
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
March 2007
- 3 participants
- 369 discussions
Author: anthm
Date: Thu Mar 15 13:40:31 2007
New Revision: 4606
Modified:
freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
Log:
update
Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c Thu Mar 15 13:40:31 2007
@@ -63,6 +63,7 @@
switch_file_t *fd;
FILE *fp;
int samplerate;
+ uint8_t thread_running;
};
typedef struct shout_context shout_context_t;
@@ -73,7 +74,7 @@
static inline void free_context(shout_context_t *context)
{
if (context) {
- int sanity = 0;
+ context->err++;
if (context->fd) {
switch_file_close(context->fd);
@@ -108,15 +109,12 @@
lame_close(context->gfp);
context->gfp = NULL;
}
- if (context->stream_url) {
- int err;
- switch_mutex_lock(context->audio_mutex);
- err = ++context->err;
- switch_mutex_unlock(context->audio_mutex);
-
- while(context->err == err) {
- switch_yield(1000000);
+ if (context->stream_url) {
+ int sanity = 0;
+
+ while(context->thread_running) {
+ switch_yield(500000);
if (++sanity > 10) {
break;
}
@@ -235,6 +233,7 @@
outlen = (int) sizeof(context->decode_buf);
usedlen = 0;
x = 0;
+
if (inlen < bytes) {
done = 1;
}
@@ -296,7 +295,7 @@
}
}
- if (switch_buffer_inuse(context->audio_buffer) >= bytes) {
+ if (done || switch_buffer_inuse(context->audio_buffer) >= bytes) {
rb = switch_buffer_read(context->audio_buffer, data, bytes);
return rb;
}
@@ -311,6 +310,7 @@
}
+#define error_check() if (context->err) goto error;
static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data)
{
@@ -324,20 +324,42 @@
char *out;
int outlen;
int usedlen;
-
-
+ uint32_t used, buf_size = 1024 * 64;
+
in = ptr;
inlen = realsize;
out = context->decode_buf;
outlen = sizeof(context->decode_buf);
usedlen = 0;
+ error_check();
+
+ /* make sure we aren't over zealous by slowing down the stream when the buffer is too full */
+ for(;;) {
+ error_check();
+
+ switch_mutex_lock(context->audio_mutex);
+ if (!context->audio_buffer) {
+ context->err++;
+ break;
+ }
+
+ used = switch_buffer_inuse(context->audio_buffer);
+ switch_mutex_unlock(context->audio_mutex);
+
+ if (used < buf_size) {
+ break;
+ }
+
+ switch_yield(1000000);
+ }
+
+ error_check();
+
do {
decode_status = decodeMP3(&context->mp, in, inlen, out, outlen, &dlen);
- if (context->err) {
- goto error;
- }
+ error_check();
if (!x) {
in = NULL;
@@ -415,6 +437,7 @@
switch_mutex_lock(context->audio_mutex);
context->err++;
switch_mutex_unlock(context->audio_mutex);
+ context->thread_running = 0;
return NULL;
}
@@ -422,7 +445,12 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
+ if (context->err) {
+ return;
+ }
+
+ context->thread_running = 1;
switch_threadattr_create(&thd_attr, context->memory_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -473,7 +501,7 @@
lame_set_num_channels(context->gfp, handle->channels);
lame_set_in_samplerate(context->gfp, handle->samplerate);
- lame_set_brate(context->gfp, 24);
+ lame_set_brate(context->gfp, 64);
lame_set_mode(context->gfp, 3);
lame_set_quality(context->gfp, 2); /* 2=high 5 = medium 7=low */
@@ -548,7 +576,7 @@
goto error;
}
- if (shout_set_audio_info(context->shout, "bitrate", "24000") != SHOUTERR_SUCCESS) {
+ if (shout_set_audio_info(context->shout, "bitrate", "64000") != SHOUTERR_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
goto error;
}
@@ -563,6 +591,7 @@
goto error;
}
} else {
+ handle->seekable = 1;
/* lame being lame and all has FILE * coded into it's API for some functions so we gotta use it */
if (!(context->fp = fopen(path, "wb+"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
@@ -571,8 +600,12 @@
}
}
+ handle->samples = 0;
+ handle->format = 0;
+ handle->sections = 0;
+ handle->speed = 0;
handle->private_info = context;
-
+
return SWITCH_STATUS_SUCCESS;
error:
@@ -588,7 +621,6 @@
{
shout_context_t *context = handle->private_info;
-
free_context(context);
return SWITCH_STATUS_SUCCESS;
@@ -596,10 +628,26 @@
static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
{
- //shout_context_t *context = handle->private_info;
-
- return SWITCH_STATUS_FALSE;
+ shout_context_t *context = handle->private_info;
+ if (handle->handler) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot seek on a stream.\n");
+ return SWITCH_STATUS_FALSE;
+ } else {
+ switch_mutex_lock(context->audio_mutex);
+ if (context->audio_buffer) {
+ if (context->fd) {
+ switch_file_seek(context->fd, whence, &samples);
+ } else if (context->fp) {
+ *cur_sample = fseek(context->fp, *cur_sample, whence);
+ }
+ switch_buffer_zero(context->audio_buffer);
+ } else {
+ context->err++;
+ }
+ switch_mutex_unlock(context->audio_mutex);
+ return SWITCH_STATUS_SUCCESS;
+ }
}
static switch_status_t shout_file_read(switch_file_handle_t *handle, void *data, size_t *len)
1
0
Author: mikej
Date: Thu Mar 15 13:17:44 2007
New Revision: 4605
Modified:
freeswitch/trunk/libs/sofia-sip/acinclude.m4
freeswitch/trunk/libs/sofia-sip/aclocal.m4
Log:
add macro in so we can bootstrap without having to find pkg.m4
Modified: freeswitch/trunk/libs/sofia-sip/acinclude.m4
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/acinclude.m4 (original)
+++ freeswitch/trunk/libs/sofia-sip/acinclude.m4 Thu Mar 15 13:17:44 2007
@@ -3,3 +3,60 @@
m4_include([m4/sac-su2.m4])
m4_include([m4/sac-su.m4])
m4_include([m4/sac-tport.m4])
+
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN([PKG_CHECK_MODULES], [
+ succeeded=no
+
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ AC_MSG_CHECKING(for $2)
+
+ if $PKG_CONFIG --exists "$2" ; then
+ AC_MSG_RESULT(yes)
+ succeeded=yes
+
+ AC_MSG_CHECKING($1_CFLAGS)
+ $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+ AC_MSG_RESULT($$1_CFLAGS)
+
+ AC_MSG_CHECKING($1_LIBS)
+ $1_LIBS=`$PKG_CONFIG --libs "$2"`
+ AC_MSG_RESULT($$1_LIBS)
+ else
+ $1_CFLAGS=""
+ $1_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ ifelse([$4], ,echo $$1_PKG_ERRORS,)
+ fi
+
+ AC_SUBST($1_CFLAGS)
+ AC_SUBST($1_LIBS)
+ else
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
+ fi
+ fi
+
+ if test $succeeded = yes; then
+ ifelse([$3], , :, [$3])
+ else
+ ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
+ fi
+])
+
+
Modified: freeswitch/trunk/libs/sofia-sip/aclocal.m4
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/aclocal.m4 (original)
+++ freeswitch/trunk/libs/sofia-sip/aclocal.m4 Thu Mar 15 13:17:44 2007
@@ -6388,64 +6388,6 @@
AC_MSG_RESULT([$SED])
])
-
-dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
-dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
-dnl also defines GSTUFF_PKG_ERRORS on error
-AC_DEFUN([PKG_CHECK_MODULES], [
- succeeded=no
-
- if test -z "$PKG_CONFIG"; then
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
- fi
-
- if test "$PKG_CONFIG" = "no" ; then
- echo "*** The pkg-config script could not be found. Make sure it is"
- echo "*** in your path, or set the PKG_CONFIG environment variable"
- echo "*** to the full path to pkg-config."
- echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
- else
- PKG_CONFIG_MIN_VERSION=0.9.0
- if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- AC_MSG_CHECKING(for $2)
-
- if $PKG_CONFIG --exists "$2" ; then
- AC_MSG_RESULT(yes)
- succeeded=yes
-
- AC_MSG_CHECKING($1_CFLAGS)
- $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
- AC_MSG_RESULT($$1_CFLAGS)
-
- AC_MSG_CHECKING($1_LIBS)
- $1_LIBS=`$PKG_CONFIG --libs "$2"`
- AC_MSG_RESULT($$1_LIBS)
- else
- $1_CFLAGS=""
- $1_LIBS=""
- ## If we have a custom action on failure, don't print errors, but
- ## do set a variable so people can do so.
- $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
- ifelse([$4], ,echo $$1_PKG_ERRORS,)
- fi
-
- AC_SUBST($1_CFLAGS)
- AC_SUBST($1_LIBS)
- else
- echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
- echo "*** See http://www.freedesktop.org/software/pkgconfig"
- fi
- fi
-
- if test $succeeded = yes; then
- ifelse([$3], , :, [$3])
- else
- ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
- fi
-])
-
-
-
# -*- Autoconf -*-
# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
# Generated from amversion.in; do not edit by hand.
1
0
15 Mar '07
Author: mikej
Date: Thu Mar 15 10:50:31 2007
New Revision: 4604
Modified:
freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile
Log:
try to fix spidermonkey build
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile Thu Mar 15 10:50:31 2007
@@ -9,9 +9,9 @@
depend_install: $(DESTDIR)$(PREFIX)/lib/libjs.la
-$(DESTDIR)$(PREFIX)/lib/libjs.la: $(JS_DIR)/nsprpub/pr/src/libnspr4.so $(JS_DIR)/nsprpub/lib/ds/libplds4.so $(JS_DIR)/nsprpub/lib/libc/src/libplc4.so $(JS_DIR)/libjs.la
- cd $(JS_DIR)/nsprpub/pr/src && $(INSTALL) libnspr4.so $(DESTDIR)$(PREFIX)/lib
- cd $(JS_DIR)/nsprpub/lib/ds && $(INSTALL) libplds4.so $(DESTDIR)$(PREFIX)/lib
- cd $(JS_DIR)/nsprpub/lib/libc/src && $(INSTALL) libplc4.so $(DESTDIR)$(PREFIX)/lib
- cd $(JS_DIR) && $(LTINSTALL) libjs.la $(DESTDIR)$(PREFIX)/lib
+
+
+$(DESTDIR)$(PREFIX)/lib/libjs.la: $(JSLA)
+ cd $(JS_DIR)/nsprpub/ && $(MAKE) install
+ cd $(JS_DIR) && $(MAKE) install
1
0
Author: mikej
Date: Thu Mar 15 01:31:10 2007
New Revision: 4603
Modified:
freeswitch/trunk/src/mod/formats/mod_shout/Makefile
Log:
build when other source files change as well
Modified: freeswitch/trunk/src/mod/formats/mod_shout/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/Makefile (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/Makefile Thu Mar 15 01:31:10 2007
@@ -14,13 +14,17 @@
LOCAL_CFLAGS=-I$(SHOUT_DIR)/include -I$(LAME_DIR)/include
LOCAL_LIBADD=$(LAMELA) $(SHOUTLA)
+MP3SOURCES=common.c dct64_i386.c decode_ntom.c layer3.c tabinit.c interface.c
MP3OBJS=common.o dct64_i386.o decode_ntom.o layer3.o tabinit.o interface.o
LOCAL_OBJS=$(MP3OBJS)
+LOCAL_SOURCES=$(MP3SOURCES)
include $(switch_srcdir)/build/modmake.rules
DEFAULT_ARGS=--prefix=$(PREFIX) --disable-shared --with-pic
+$(LOCAL_OBJS): $(LOCAL_SOURCES)
+
$(LAME_DIR)/Makefile:
$(GETLIB) $(LAME).tar.gz
cd $(LAME_DIR) && ./configure $(DEFAULT_ARGS) --disable-decoder
1
0
Author: mikej
Date: Thu Mar 15 00:32:09 2007
New Revision: 4602
Added:
freeswitch/trunk/libs/iksemel/configure.gnu
Modified:
freeswitch/trunk/Makefile.am
freeswitch/trunk/Makefile.in
freeswitch/trunk/libs/libdingaling/Makefile.am
freeswitch/trunk/libs/libdingaling/Makefile.in
freeswitch/trunk/src/mod/Makefile.am
freeswitch/trunk/src/mod/Makefile.in
freeswitch/trunk/src/mod/applications/mod_enum/Makefile
freeswitch/trunk/src/mod/codecs/mod_amr/Makefile
freeswitch/trunk/src/mod/codecs/mod_g722/Makefile
freeswitch/trunk/src/mod/codecs/mod_g723_1/Makefile
freeswitch/trunk/src/mod/codecs/mod_g726/Makefile
freeswitch/trunk/src/mod/codecs/mod_g729/Makefile
freeswitch/trunk/src/mod/codecs/mod_gsm/Makefile
freeswitch/trunk/src/mod/codecs/mod_ilbc/Makefile
freeswitch/trunk/src/mod/codecs/mod_lpc10/Makefile
freeswitch/trunk/src/mod/codecs/mod_speex/Makefile
freeswitch/trunk/src/mod/directories/mod_ldap/Makefile
freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile
freeswitch/trunk/src/mod/endpoints/mod_iax/Makefile
freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile
freeswitch/trunk/src/mod/endpoints/mod_sofia/Makefile
freeswitch/trunk/src/mod/event_handlers/mod_xmpp_event/Makefile
freeswitch/trunk/src/mod/formats/mod_sndfile/Makefile
freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/Makefile
Log:
do a better job with dependency tracking so the the mods don't keep trying to build or install when they don't need to. This should start to help with the speed of the build.
Modified: freeswitch/trunk/Makefile.am
==============================================================================
--- freeswitch/trunk/Makefile.am (original)
+++ freeswitch/trunk/Makefile.am Thu Mar 15 00:32:09 2007
@@ -85,7 +85,7 @@
libfreeswitch_la_LIBADD = $(CORE_LIBS)
nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h
-$(libfreeswitch_la_SOURCES): deps
+$(libfreeswitch_la_SOURCES): $(CORE_LIBS)
MOD_LINK = $(BASE)/libfreeswitch.la
@@ -144,29 +144,15 @@
yesdepends:
rm .nodepends
-sqlite:
+$(CORE_LIBS):
cd libs/sqlite && $(MAKE)
-
-apr:
cd libs/apr && $(MAKE)
-
-apr-util:
cd libs/apr-util && $(MAKE)
-
-pcre:
cd libs/pcre && $(MAKE)
-
-srtp:
cd libs/srtp && $(MAKE)
-
-resample:
cd libs/libresample && $(MAKE)
-
-teletone:
cd libs/libteletone && $(MAKE)
-deps: sqlite apr apr-util pcre srtp resample teletone
-
core: deps libfreeswitch.la
install_core: install-libLTLIBRARIES
Modified: freeswitch/trunk/Makefile.in
==============================================================================
--- freeswitch/trunk/Makefile.in (original)
+++ freeswitch/trunk/Makefile.in Thu Mar 15 00:32:09 2007
@@ -1085,7 +1085,7 @@
uninstall-libLTLIBRARIES uninstall-library_includeHEADERS
-$(libfreeswitch_la_SOURCES): deps
+$(libfreeswitch_la_SOURCES): $(CORE_LIBS)
install-data-local:
@echo Installing $(NAME)
@@ -1133,29 +1133,15 @@
yesdepends:
rm .nodepends
-sqlite:
+$(CORE_LIBS):
cd libs/sqlite && $(MAKE)
-
-apr:
cd libs/apr && $(MAKE)
-
-apr-util:
cd libs/apr-util && $(MAKE)
-
-pcre:
cd libs/pcre && $(MAKE)
-
-srtp:
cd libs/srtp && $(MAKE)
-
-resample:
cd libs/libresample && $(MAKE)
-
-teletone:
cd libs/libteletone && $(MAKE)
-deps: sqlite apr apr-util pcre srtp resample teletone
-
core: deps libfreeswitch.la
install_core: install-libLTLIBRARIES
Added: freeswitch/trunk/libs/iksemel/configure.gnu
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/iksemel/configure.gnu Thu Mar 15 00:32:09 2007
@@ -0,0 +1,3 @@
+#! /bin/sh
+./configure "$@" --disable-shared --with-pic
+
Modified: freeswitch/trunk/libs/libdingaling/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/libdingaling/Makefile.am (original)
+++ freeswitch/trunk/libs/libdingaling/Makefile.am Thu Mar 15 00:32:09 2007
@@ -16,12 +16,13 @@
AM_CFLAGS += $(shell $(APU_CONFIG) --includes)
AM_LDFLAGS += $(shell $(APU_CONFIG) --link-ld --libs )
AM_CFLAGS += -I../iksemel/include
-AM_LDFLAGS += ../iksemel/src/libiksemel.la
+
lib_LTLIBRARIES = libdingaling.la
libdingaling_la_SOURCES = src/libdingaling.c src/sha1.c
libdingaling_la_CFLAGS = $(AM_CFLAGS)
libdingaling_la_LDFLAGS =
+libdingaling_la_LIBADD = ../iksemel/src/libiksemel.la
library_includedir = $(prefix)/include
library_include_HEADERS = src/libdingaling.h
Modified: freeswitch/trunk/libs/libdingaling/Makefile.in
==============================================================================
--- freeswitch/trunk/libs/libdingaling/Makefile.in (original)
+++ freeswitch/trunk/libs/libdingaling/Makefile.in Thu Mar 15 00:32:09 2007
@@ -74,7 +74,7 @@
"$(DESTDIR)$(library_includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
-libdingaling_la_LIBADD =
+libdingaling_la_DEPENDENCIES = ../iksemel/src/libiksemel.la
am_libdingaling_la_OBJECTS = libdingaling_la-libdingaling.lo \
libdingaling_la-sha1.lo
libdingaling_la_OBJECTS = $(am_libdingaling_la_OBJECTS)
@@ -227,14 +227,14 @@
-I../iksemel/include
AM_CPPFLAGS = $(AM_CFLAGS)
AM_LDFLAGS = $(new_AM_LDFLAGS) -L$(PREFIX)/lib $(shell $(APR_CONFIG) \
- --link-ld --libs ) $(shell $(APU_CONFIG) --link-ld --libs ) \
- ../iksemel/src/libiksemel.la
+ --link-ld --libs ) $(shell $(APU_CONFIG) --link-ld --libs )
APR_CONFIG = $(shell which ../apr/apr-1-config || which $(prefix)/bin/apr-1-config )
APU_CONFIG = $(shell which ../apr-util/apu-1-config || which $(prefix)/bin/apu-1-config)
lib_LTLIBRARIES = libdingaling.la
libdingaling_la_SOURCES = src/libdingaling.c src/sha1.c
libdingaling_la_CFLAGS = $(AM_CFLAGS)
libdingaling_la_LDFLAGS =
+libdingaling_la_LIBADD = ../iksemel/src/libiksemel.la
library_includedir = $(prefix)/include
library_include_HEADERS = src/libdingaling.h
all: all-recursive
Modified: freeswitch/trunk/src/mod/Makefile.am
==============================================================================
--- freeswitch/trunk/src/mod/Makefile.am (original)
+++ freeswitch/trunk/src/mod/Makefile.am Thu Mar 15 00:32:09 2007
@@ -13,8 +13,8 @@
echo making $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules || exit 1; \
fi; \
done
@@ -23,8 +23,8 @@
echo making clean $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) clean ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) clean || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean || exit 1; \
fi; \
done
@@ -34,8 +34,8 @@
echo making install $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) install ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules install ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) install || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules install || exit 1; \
fi; \
done
@echo done
@@ -46,8 +46,8 @@
echo making uninstall $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) uninstall ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules uninstall ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) uninstall || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules uninstall || exit 1; \
fi; \
done
@echo done
Modified: freeswitch/trunk/src/mod/Makefile.in
==============================================================================
--- freeswitch/trunk/src/mod/Makefile.in (original)
+++ freeswitch/trunk/src/mod/Makefile.in Thu Mar 15 00:32:09 2007
@@ -362,8 +362,8 @@
echo making $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules || exit 1; \
fi; \
done
@@ -372,8 +372,8 @@
echo making clean $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) clean ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) clean || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules clean || exit 1; \
fi; \
done
@@ -383,8 +383,8 @@
echo making install $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) install ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules install ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) install || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules install || exit 1; \
fi; \
done
@echo done
@@ -395,8 +395,8 @@
echo making uninstall $$i ; \
moddir=$(MOD_DIR); \
if test -f $$moddir/Makefile ; then \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) uninstall ; else \
- cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules uninstall ; \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) uninstall || exit 1; else \
+ cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules uninstall || exit 1; \
fi; \
done
@echo done
Modified: freeswitch/trunk/src/mod/applications/mod_enum/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/Makefile (original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/Makefile Thu Mar 15 00:32:09 2007
@@ -1,14 +1,11 @@
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-
-# and define these variables to impact your build
MODNAME=mod_enum
+BASE=../../../..
+UDNSA=$(BASE)/libs/udns/libudns.a
LOCAL_CFLAGS=-I$(BASE)/libs/udns
-LOCAL_LDFLAGS=
-LOCAL_OBJS=$(BASE)/libs/udns/libudns.a
-include ../../../../build/modmake.rules
+LOCAL_LIBADD=$(UDNSA)
+include $(BASE)/build/modmake.rules
-local_depend:
+$(UDNSA):
cd $(BASE)/libs/udns && $(MAKE) staticlib
Modified: freeswitch/trunk/src/mod/codecs/mod_amr/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_amr/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_amr/Makefile Thu Mar 15 00:32:09 2007
@@ -1,13 +1,16 @@
MODNAME=mod_amr
-ifeq ($(shell ls -d $(BASE)/libs/amr),$(BASE)/libs/amr)
+BASE=../../../..
-LOCAL_CFLAGS += -I$(PREFIX)/include/amr
-LOCAL_LDFLAGS +=-lamr
+topdir=$(shell cd $(BASE) && pwd)
+ifeq ($(shell test -d $(topdir)/libs/amr && cd $(topdir)/libs/amr && pwd),$(topdir)/libs/amr)
+
+LOCAL_CFLAGS = -I$(PREFIX)/include/amr
+LOCAL_LDFLAGS =-lamr
else
-LOCAL_CFLAGS += -DAMR_PASSTHROUGH
+LOCAL_CFLAGS = -DAMR_PASSTHROUGH
endif
-include ../../../../build/modmake.rules
+include $(BASE)/build/modmake.rules
Modified: freeswitch/trunk/src/mod/codecs/mod_g722/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g722/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_g722/Makefile Thu Mar 15 00:32:09 2007
@@ -1,13 +1,10 @@
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-
-# and define these variables to impact your build
MODNAME=mod_g722
+BASE=../../../..
+G7XXLA=$(BASE)/libs/codec/g7xx/libg7xx.la
LOCAL_CFLAGS=-I$(BASE)/libs/codec/g7xx/src/include/
-LOCAL_LDFLAGS=$(BASE)/libs/codec/g7xx/libg7xx.la
-LOCAL_OBJS=
-include ../../../../build/modmake.rules
+LOCAL_LIBADD=$(G7XXLA)
+include $(BASE)/build/modmake.rules
-local_depend:
+$(G7XXLA):
cd $(BASE)/libs/codec/g7xx && $(MAKE)
Modified: freeswitch/trunk/src/mod/codecs/mod_g723_1/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g723_1/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_g723_1/Makefile Thu Mar 15 00:32:09 2007
@@ -1,8 +1,10 @@
MODNAME=mod_g723_1
-ifeq ($(shell ls -d $(BASE)/libs/libg723_1),$(BASE)/libs/libg723_1)
+BASE=../../../..
+topdir=$(shell cd $(BASE) && pwd)
+ifeq ($(shell test -d $(topdir)/libs/libg723_1 && cd $(topdir)/libs/libg723_1 && pwd),$(topdir)/libs/libg723_1)
LOCAL_CFLAGS += -I$(PREFIX)/include/g723
LOCAL_LDFLAGS +=-lg723
else
LOCAL_CFLAGS += -DG723_PASSTHROUGH
endif
-include ../../../../build/modmake.rules
+include $(BASE)/build/modmake.rules
Modified: freeswitch/trunk/src/mod/codecs/mod_g726/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g726/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_g726/Makefile Thu Mar 15 00:32:09 2007
@@ -1,13 +1,10 @@
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-
-# and define these variables to impact your build
MODNAME=mod_g726
+BASE=../../../..
+G726LA=$(BASE)/libs/codec/g726/libg726.la
LOCAL_CFLAGS=-I$(BASE)/libs/codec/g726/src
-LOCAL_LDFLAGS=
-LOCAL_OBJS=$(BASE)/libs/codec/g726/libg726.la
-include ../../../../build/modmake.rules
+LOCAL_LIBADD=$(G726LA)
+include $(BASE)/build/modmake.rules
-local_depend:
+$(G726LA):
cd $(BASE)/libs/codec/g726 && $(MAKE)
Modified: freeswitch/trunk/src/mod/codecs/mod_g729/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g729/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_g729/Makefile Thu Mar 15 00:32:09 2007
@@ -1,9 +1,11 @@
MODNAME=mod_g729
-ifeq ($(shell ls -d $(BASE)/libs/libg729),$(BASE)/libs/libg729)
+BASE=../../../..
+topdir=$(shell cd $(BASE) && pwd)
+ifeq ($(shell test -d $(topdir)/libs/libg729 && cd $(topdir)/libs/libg729 && pwd),$(topdir)/libs/libg729)
LOCAL_CFLAGS += -I$(PREFIX)/include/libg729
LOCAL_LDFLAGS +=-lg729
else
LOCAL_CFLAGS += -DG729_PASSTHROUGH
endif
-include ../../../../build/modmake.rules
+include $(BASE)/build/modmake.rules
Modified: freeswitch/trunk/src/mod/codecs/mod_gsm/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_gsm/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_gsm/Makefile Thu Mar 15 00:32:09 2007
@@ -1,12 +1,9 @@
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-
-# and define these variables to impact your build
MODNAME=mod_gsm
+BASE=../../../..
+GSMLA=$(BASE)/libs/codec/gsm/libgsm.la
LOCAL_CFLAGS=-I$(BASE)/libs/codec/gsm/inc
-LOCAL_LDFLAGS=$(BASE)/libs/codec/gsm/libgsm.la
-LOCAL_OBJS=
-include ../../../../build/modmake.rules
+LOCAL_LIBADD=$(GSMLA)
+include $(BASE)/build/modmake.rules
-local_depend:
+$(GSMLA):
cd $(BASE)/libs/codec/gsm && $(MAKE)
Modified: freeswitch/trunk/src/mod/codecs/mod_ilbc/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_ilbc/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_ilbc/Makefile Thu Mar 15 00:32:09 2007
@@ -1,12 +1,9 @@
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-
-# and define these variables to impact your build
MODNAME=mod_ilbc
+BASE=../../../..
+ILBCLA=$(BASE)/libs/codec/ilbc/libilbc.la
LOCAL_CFLAGS=-I$(BASE)/libs/codec/ilbc/src
-LOCAL_LDFLAGS=$(BASE)/libs/codec/ilbc/libilbc.la
-LOCAL_OBJS=
-include ../../../../build/modmake.rules
+LOCAL_LIBADD=$(ILBCLA)
+include $(BASE)/build/modmake.rules
-local_depend:
+$(ILBCLA):
cd $(BASE)/libs/codec/ilbc && $(MAKE)
Modified: freeswitch/trunk/src/mod/codecs/mod_lpc10/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_lpc10/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_lpc10/Makefile Thu Mar 15 00:32:09 2007
@@ -1,12 +1,9 @@
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-
-# and define these variables to impact your build
MODNAME=mod_lpc10
+BASE=../../../..
+LPC10LA=$(BASE)/libs/codec/lpc10/liblpc10.la
LOCAL_CFLAGS=-I$(BASE)/libs/codec/lpc10/src
-LOCAL_LDFLAGS=$(BASE)/libs/codec/lpc10/liblpc10.la
-LOCAL_OBJS=
-include ../../../../build/modmake.rules
+LOCAL_LIBADD=$(LPC10LA)
+include $(BASE)/build/modmake.rules
-local_depend:
+$(LPC10LA):
cd $(BASE)/libs/codec/lpc10 && $(MAKE)
Modified: freeswitch/trunk/src/mod/codecs/mod_speex/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_speex/Makefile (original)
+++ freeswitch/trunk/src/mod/codecs/mod_speex/Makefile Thu Mar 15 00:32:09 2007
@@ -3,10 +3,17 @@
# and define these variables to impact your build
MODNAME=mod_speex
+
+BASE=../../../..
+
+SPEEXLA=$(BASE)/libs/speex/libspeex/libspeex.la
+
LOCAL_CFLAGS=-I$(BASE)/libs/speex/include
-LOCAL_LDFLAGS=$(BASE)/libs/speex/libspeex/libspeex.la
+LOCAL_LDFLAGS=$(SPEEXLA)
LOCAL_OBJS=
-include ../../../../build/modmake.rules
+include $(BASE)/build/modmake.rules
+
+local_depend: $(SPEEXLA)
-local_depend:
+$(SPEEXLA): $(BASE)/libs/speex/stamp-h1
cd $(BASE)/libs/speex && $(MAKE)
Modified: freeswitch/trunk/src/mod/directories/mod_ldap/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/directories/mod_ldap/Makefile (original)
+++ freeswitch/trunk/src/mod/directories/mod_ldap/Makefile Thu Mar 15 00:32:09 2007
@@ -19,5 +19,5 @@
$(GETLIB) $(LDAP).tgz
cd $(LDAP_DIR) && ./configure $(DEFAULT_ARGS) --disable-bdb --disable-hdb
-$(LDAPLA) $(LIBLBERLA): $(LDAP_DIR)/Makefile
+$(LDAPLA) $(LIBLBERLA): $(LDAP_DIR)/Makefile $(LDAP_DIR)/stamp-h
cd $(LDAP_DIR) && $(MAKE)
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile Thu Mar 15 00:32:09 2007
@@ -3,16 +3,28 @@
# and define these variables to impact your build
MODNAME=mod_dingaling
+BASE=../../../..
+
+IKSEMELLA=$(BASE)/libs/iksemel/src/libiksemel.la
+DINGLA=$(BASE)/libs/libdingaling/libdingaling.la
+
LOCAL_CFLAGS=-I$(BASE)/libs/libdingaling/src
-LOCAL_LDFLAGS=$(BASE)/libs/libdingaling/libdingaling.la
+LOCAL_LDFLAGS=
LOCAL_OBJS=
-include ../../../../build/modmake.rules
+LOCAL_LIBADD=$(DINGLA)
+
+include $(BASE)/build/modmake.rules
-local_depend:
+INST_DINGLA=$(PREFIX)/lib/libdingaling.la
+
+$(IKSEMELLA):
cd $(BASE)/libs/iksemel && $(MAKE)
+
+$(DINGLA): $(IKSEMELLA)
cd $(BASE)/libs/libdingaling && $(MAKE)
-depend_install:
- cd $(BASE)/libs/iksemel && $(MAKE) install
+depend_install: $(INST_DINGLA)
+
+$(INST_DINGLA): $(DINGLA)
cd $(BASE)/libs/libdingaling && $(MAKE) install
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/Makefile (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/Makefile Thu Mar 15 00:32:09 2007
@@ -3,11 +3,13 @@
# and define these variables to impact your build
MODNAME=mod_iax
+BASE=../../../..
+IAXLA=$(BASE)/libs/iax/src/libiax.la
LOCAL_CFLAGS=-I$(BASE)/libs/iax/src
-LOCAL_LDFLAGS=$(BASE)/libs/iax/src/libiax.la
-LOCAL_OBJS=
-include ../../../../build/modmake.rules
+LOCAL_LDFLAGS=
+LOCAL_LIBADD=$(IAXLA)
+include $(BASE)/build/modmake.rules
-local_depend:
+$(IAXLA):
cd $(BASE)/libs/iax && $(MAKE)
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile Thu Mar 15 00:32:09 2007
@@ -1,19 +1,20 @@
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
BASE=../../../..
OSARCH=$(shell uname -s)
-# and define these variables to impact your build
MODNAME=mod_portaudio
+BASE=../../../..
+
+PALA=$(BASE)/libs/portaudio/lib/libportaudio.la
LOCAL_CFLAGS=-I. -I$(BASE)/libs/portaudio/include
-LOCAL_LDFLAGS=$(BASE)/libs/portaudio/lib/libportaudio.la
+LOCAL_LDFLAGS=
ifeq ($(OSARCH),Darwin)
LOCAL_LDFLAGS += -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
endif
+LOCAL_LIBADD=$(PALA)
LOCAL_OBJS=pablio.o pa_ringbuffer.o
-include ../../../../build/modmake.rules
+include $(BASE)/build/modmake.rules
-local_depend:
+$(PALA):
cd $(BASE)/libs/portaudio && $(MAKE)
pa_ringbuffer.o: pa_ringbuffer.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/Makefile (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/Makefile Thu Mar 15 00:32:09 2007
@@ -1,4 +1,7 @@
MODNAME=mod_sofia
+
+BASE=../../../..
+
OS_ARCH := $(subst /,_,$(shell uname -s | sed /\ /s//_/))
LOCAL_CFLAGS = -I. -I$(BASE)/libs/sofia-sip/libsofia-sip-ua/bnf -I$(BASE)/libs/sofia-sip/libsofia-sip-ua/features
@@ -11,7 +14,9 @@
LOCAL_CFLAGS += -I$(BASE)/libs/sofia-sip/libsofia-sip-ua/stun -I$(BASE)/libs/sofia-sip/libsofia-sip-ua/su
LOCAL_CFLAGS += -I$(BASE)/libs/sofia-sip/libsofia-sip-ua/tport -I$(BASE)/libs/sofia-sip/libsofia-sip-ua/url
-LOCAL_LDFLAGS=$(BASE)/libs/sofia-sip/libsofia-sip-ua/libsofia-sip-ua.la
+SOFIALA=$(BASE)/libs/sofia-sip/libsofia-sip-ua/libsofia-sip-ua.la
+
+LOCAL_LDFLAGS=$(SOFIALA)
ifeq ($(OS_ARCH),Darwin)
LOCAL_LDFLAGS +=-framework CoreFoundation -framework SystemConfiguration
@@ -19,5 +24,7 @@
include ../../../../build/modmake.rules
-local_depend:
+local_depend: $(SOFIALA)
+
+$(SOFIALA):
cd $(BASE)/libs/sofia-sip && $(MAKE)
Modified: freeswitch/trunk/src/mod/event_handlers/mod_xmpp_event/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_xmpp_event/Makefile (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_xmpp_event/Makefile Thu Mar 15 00:32:09 2007
@@ -3,10 +3,16 @@
# and define these variables to impact your build
MODNAME=mod_xmpp_event
+BASE=../../../..
+
+IKSEMELLA=$(BASE)/libs/iksemel/src/libiksemel.la
+
LOCAL_CFLAGS=-I$(BASE)/libs/iksemel/include
-LOCAL_LDFLAGS=$(BASE)/libs/iksemel/src/libiksemel.la
+LOCAL_LDFLAGS=$(IKSEMELA)
LOCAL_OBJS=
-include ../../../../build/modmake.rules
+include $(BASE)/build/modmake.rules
+
+local_depend: $(IKSEMELLA)
-local_depend:
+$(IKSEMELLA):
cd $(BASE)/libs/iksemel && $(MAKE)
Modified: freeswitch/trunk/src/mod/formats/mod_sndfile/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_sndfile/Makefile (original)
+++ freeswitch/trunk/src/mod/formats/mod_sndfile/Makefile Thu Mar 15 00:32:09 2007
@@ -2,11 +2,19 @@
# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
# and define these variables to impact your build
-MONAME=mod_sndfile
+MODNAME=mod_sndfile
+
+BASE=../../../..
+
+SNDFILELA=$(BASE)/libs/libsndfile/src/libsndfile.la
+
LOCAL_CFLAGS=-I$(BASE)/libs/libsndfile/src
-LOCAL_LDFLAGS=$(BASE)/libs/libsndfile/src/libsndfile.la
+LOCAL_LDFLAGS=$(SNDFILELA)
LOCAL_OBJS=
-include ../../../../build/modmake.rules
-local_depend:
+include $(BASE)/build/modmake.rules
+
+local_depend: $(SNDFILELA)
+
+$(SNDFILELA):
cd $(BASE)/libs/libsndfile && $(MAKE)
Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/Makefile (original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/Makefile Thu Mar 15 00:32:09 2007
@@ -1,12 +1,17 @@
MODNAME=mod_xml_rpc
-LOCAL_LDFLAGS = $(BASE)/libs/xmlrpc-c/src/libxmlrpc.la $(BASE)/libs/xmlrpc-c/src/libxmlrpc_server.la
-LOCAL_LDFLAGS += $(BASE)/libs/xmlrpc-c/src/libxmlrpc_server_abyss.la $(BASE)/libs/xmlrpc-c/lib/abyss/src/libxmlrpc_abyss.la
-LOCAL_LDFLAGS += $(BASE)/libs/xmlrpc-c/lib/expat/xmlparse/libxmlrpc_xmlparse.la
+BASE=../../../..
+XMLRPCLAS = $(BASE)/libs/xmlrpc-c/src/libxmlrpc.la $(BASE)/libs/xmlrpc-c/src/libxmlrpc_server.la
+XMLRPCLAS += $(BASE)/libs/xmlrpc-c/src/libxmlrpc_server_abyss.la $(BASE)/libs/xmlrpc-c/lib/abyss/src/libxmlrpc_abyss.la
+XMLRPCLAS += $(BASE)/libs/xmlrpc-c/lib/expat/xmlparse/libxmlrpc_xmlparse.la
+
+LOCAL_LDFLAGS = $(XMLRPCLAS)
LOCAL_CFLAGS=-I$(BASE)/libs/xmlrpc-c/include
include ../../../../build/modmake.rules
-local_depend:
+local_depend: $(XMLRPCLAS)
+
+$(XMLRPCLAS):
cd $(BASE)/libs/xmlrpc-c && $(MAKE)
1
0
15 Mar '07
Author: mikej
Date: Thu Mar 15 00:31:17 2007
New Revision: 4601
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
fix build. arguments out of order.
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Thu Mar 15 00:31:17 2007
@@ -1782,8 +1782,8 @@
if (switch_core_file_open(&fh,
rec->path,
+ (uint8_t)1,
conference->rate,
- 1,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
rec->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s]\n", rec->path);
@@ -1960,8 +1960,8 @@
/* Open the file */
if (switch_core_file_open(&fnode->fh,
file,
+ (uint8_t)1,
conference->rate,
- 1,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
switch_core_destroy_memory_pool(&pool);
@@ -2047,8 +2047,8 @@
/* Open the file */
if (switch_core_file_open(&fnode->fh,
file,
- conference->rate,
- 1,
+ (uint8_t)1,
+ member->conference->rate,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
switch_core_destroy_memory_pool(&pool);
1
0
[commit] r4600 - in freeswitch/trunk/src: . include mod/applications/mod_conference mod/endpoints/mod_portaudio mod/formats/mod_shout
by Freeswitch SVN 15 Mar '07
by Freeswitch SVN 15 Mar '07
15 Mar '07
Author: brian
Date: Wed Mar 14 21:58:41 2007
New Revision: 4600
Modified:
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/include/switch_module_interfaces.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_ivr.c
Log:
update2
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Wed Mar 14 21:58:41 2007
@@ -1109,7 +1109,8 @@
/*!
\brief Open a media file using file format modules
\param fh a file handle to use
- \param codec_imp the codec implementation being used
+ \param channels the number of channels
+ \param rate the sample rate
\param file_path the path to the file
\param flags read/write flags
\param pool the pool to use (NULL for new pool)
@@ -1117,8 +1118,9 @@
\note the loadable module used is chosen based on the file extension
*/
SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
- const switch_codec_implementation_t *codec_imp,
char *file_path,
+ uint8_t channels,
+ uint32_t rate,
unsigned int flags,
switch_memory_pool_t *pool);
/*!
Modified: freeswitch/trunk/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/trunk/src/include/switch_module_interfaces.h (original)
+++ freeswitch/trunk/src/include/switch_module_interfaces.h Wed Mar 14 21:58:41 2007
@@ -312,7 +312,6 @@
/*! private data for the format module to store handle specific info */
void *private_info;
char *handler;
- const switch_codec_implementation_t *codec_imp;
int64_t pos;
switch_buffer_t *audio_buffer;
uint32_t thresh;
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Wed Mar 14 21:58:41 2007
@@ -1781,8 +1781,9 @@
}
if (switch_core_file_open(&fh,
- NULL,
rec->path,
+ conference->rate,
+ 1,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
rec->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s]\n", rec->path);
@@ -1958,8 +1959,9 @@
/* Open the file */
if (switch_core_file_open(&fnode->fh,
- NULL,
file,
+ conference->rate,
+ 1,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
switch_core_destroy_memory_pool(&pool);
@@ -2044,8 +2046,9 @@
/* Open the file */
if (switch_core_file_open(&fnode->fh,
- switch_core_session_get_read_codec(member->session)->implementation,
file,
+ conference->rate,
+ 1,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
switch_core_destroy_memory_pool(&pool);
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile Wed Mar 14 21:58:41 2007
@@ -1,5 +1,6 @@
# define these targets in your makefile if you wish
# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
+BASE=../../../..
OSARCH=$(shell uname -s)
# and define these variables to impact your build
MODNAME=mod_portaudio
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Wed Mar 14 21:58:41 2007
@@ -225,8 +225,9 @@
switch_set_flag_locked((&globals), GFLAG_RING);
if (ring_file) {
if (switch_core_file_open(&fh,
- globals.read_codec.implementation,
ring_file,
+ globals.read_codec.implementation->number_of_channels,
+ globals.read_codec.implementation->samples_per_second,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
NULL) == SWITCH_STATUS_SUCCESS) {
@@ -589,8 +590,9 @@
}
if (switch_core_file_open(&tech_pvt->fh,
- globals.read_codec.implementation,
tech_pvt->hold_file,
+ globals.read_codec.implementation->number_of_channels,
+ globals.read_codec.implementation->samples_per_second,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
switch_core_codec_destroy(&tech_pvt->write_codec);
Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c Wed Mar 14 21:58:41 2007
@@ -440,8 +440,12 @@
return SWITCH_STATUS_MEMERR;
}
+ if (!handle->samplerate) {
+ handle->samplerate = 8000;
+ }
+
context->memory_pool = handle->memory_pool;
- context->samplerate = handle->codec_imp ? handle->codec_imp->samples_per_second : 8000;
+ context->samplerate = handle->samplerate;
if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) {
if (switch_buffer_create_dynamic(&context->audio_buffer, MY_BLOCK_SIZE, MY_BUF_LEN, 0) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Wed Mar 14 21:58:41 2007
@@ -1012,11 +1012,12 @@
}
return SWITCH_STATUS_SUCCESS;
-}
+ }
SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
- const switch_codec_implementation_t *codec_imp,
char *file_path,
+ uint8_t channels,
+ uint32_t rate,
unsigned int flags,
switch_memory_pool_t *pool)
{
@@ -1056,8 +1057,18 @@
fh->handler = switch_core_strdup(fh->memory_pool, rhs);
}
- fh->codec_imp = codec_imp;
+ if (rate) {
+ fh->samplerate = rate;
+ } else {
+ rate = 8000;
+ }
+ if (channels) {
+ fh->channels = channels;
+ } else {
+ fh->channels = 1;
+ }
+
return fh->file_interface->file_open(fh, file_path);
}
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Wed Mar 14 21:58:41 2007
@@ -390,8 +390,9 @@
if (switch_core_file_open(fh,
- read_codec->implementation,
file,
+ read_codec->implementation->number_of_channels,
+ read_codec->implementation->samples_per_second,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -629,8 +630,9 @@
if (switch_core_file_open(fh,
- read_codec->implementation,
file,
+ read_codec->implementation->number_of_channels,
+ read_codec->implementation->samples_per_second,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -1157,8 +1159,9 @@
}
if (switch_core_file_open(fh,
- read_codec->implementation,
file,
+ read_codec->implementation->number_of_channels,
+ read_codec->implementation->samples_per_second,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_core_session_reset(session);
@@ -2857,8 +2860,9 @@
ringback.fhb.channels = read_codec->implementation->number_of_channels;
ringback.fhb.samplerate = read_codec->implementation->samples_per_second;
if (switch_core_file_open(&ringback.fhb,
- read_codec->implementation,
ringback_data,
+ read_codec->implementation->number_of_channels,
+ read_codec->implementation->samples_per_second,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
1
0
15 Mar '07
Author: mikej
Date: Wed Mar 14 21:32:18 2007
New Revision: 4599
Added:
freeswitch/trunk/libs/libetpan/configure.gnu
Modified:
freeswitch/trunk/build/modmake.rules.in
freeswitch/trunk/src/mod/Makefile.am
freeswitch/trunk/src/mod/Makefile.in
freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile
freeswitch/trunk/src/mod/languages/mod_spidermonkey/sm.mak
freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/Makefile
freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/Makefile
freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/Makefile
freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/Makefile
freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/Makefile
Log:
do a better job with dependency tracking so the the mods don't keep trying to build or install when they don't need to. This should start to help with the speed of the build.
Modified: freeswitch/trunk/build/modmake.rules.in
==============================================================================
--- freeswitch/trunk/build/modmake.rules.in (original)
+++ freeswitch/trunk/build/modmake.rules.in Wed Mar 14 21:32:18 2007
@@ -79,12 +79,12 @@
$(CXXLINK) $(SOLINK) $(MODNAME).o -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(LOCAL_LIBADD); \
fi;
-
-
mod_clean:
rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ .libs
-mod_install:
+mod_install: $(DESTDIR)$(PREFIX)/mod/$(MODNAME).$(DYNAMIC_LIB_EXTEN)
+
+$(DESTDIR)$(PREFIX)/mod/$(MODNAME).$(DYNAMIC_LIB_EXTEN):$(MODNAME).$(DYNAMIC_LIB_EXTEN)
$(LTINSTALL) $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(DESTDIR)$(PREFIX)/mod
mod_uninstall:
Added: freeswitch/trunk/libs/libetpan/configure.gnu
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/libetpan/configure.gnu Wed Mar 14 21:32:18 2007
@@ -0,0 +1,3 @@
+#! /bin/sh
+./configure "$@" --disable-shared --with-pic
+
Modified: freeswitch/trunk/src/mod/Makefile.am
==============================================================================
--- freeswitch/trunk/src/mod/Makefile.am (original)
+++ freeswitch/trunk/src/mod/Makefile.am Wed Mar 14 21:32:18 2007
@@ -1,7 +1,7 @@
CONF_MODULES=$(shell grep -v "\#" $(switch_builddir)/modules.conf)
FOUND_MODULES=$(shell find . -type d -name mod_\*)
-OUR_MODULES=`if test -z $(MODULES) ; then echo $(CONF_MODULES) ; else echo $(MODULES) ; fi ;`
-OUR_CLEAN_MODULES=`if test -z $(MODULES) ; then echo $(CONF_MODULES) $(FOUND_MODULES) ; else echo $(MODULES) ; fi ;`
+OUR_MODULES=`if test -z "$(MODULES)" ; then echo $(CONF_MODULES) ; else echo $(MODULES) ; fi ;`
+OUR_CLEAN_MODULES=`if test -z "$(MODULES)" ; then echo $(CONF_MODULES) $(FOUND_MODULES) ; else echo $(MODULES) ; fi ;`
MOD_NAME=`echo $$i | sed -e 's|^.*/||'`
MOD_DIR=`if test -d $(switch_srcdir)/src/mod/$$i ; then echo $(switch_srcdir)/src/mod/$$i ; else echo $$i ; fi;`
@@ -12,7 +12,6 @@
@for i in $(OUR_MODULES) ; do \
echo making $$i ; \
moddir=$(MOD_DIR); \
- echo $(MOD_NAME); \
if test -f $$moddir/Makefile ; then \
cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) ; else \
cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
Modified: freeswitch/trunk/src/mod/Makefile.in
==============================================================================
--- freeswitch/trunk/src/mod/Makefile.in (original)
+++ freeswitch/trunk/src/mod/Makefile.in Wed Mar 14 21:32:18 2007
@@ -194,8 +194,8 @@
voidp_size = @voidp_size@
CONF_MODULES = $(shell grep -v "\#" $(switch_builddir)/modules.conf)
FOUND_MODULES = $(shell find . -type d -name mod_\*)
-OUR_MODULES = `if test -z $(MODULES) ; then echo $(CONF_MODULES) ; else echo $(MODULES) ; fi ;`
-OUR_CLEAN_MODULES = `if test -z $(MODULES) ; then echo $(CONF_MODULES) $(FOUND_MODULES) ; else echo $(MODULES) ; fi ;`
+OUR_MODULES = `if test -z "$(MODULES)" ; then echo $(CONF_MODULES) ; else echo $(MODULES) ; fi ;`
+OUR_CLEAN_MODULES = `if test -z "$(MODULES)" ; then echo $(CONF_MODULES) $(FOUND_MODULES) ; else echo $(MODULES) ; fi ;`
MOD_NAME = `echo $$i | sed -e 's|^.*/||'`
MOD_DIR = `if test -d $(switch_srcdir)/src/mod/$$i ; then echo $(switch_srcdir)/src/mod/$$i ; else echo $$i ; fi;`
all: all-am
@@ -361,7 +361,6 @@
@for i in $(OUR_MODULES) ; do \
echo making $$i ; \
moddir=$(MOD_DIR); \
- echo $(MOD_NAME); \
if test -f $$moddir/Makefile ; then \
cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) ; else \
cd $$moddir && MODNAME=$(MOD_NAME) BASE=$(switch_builddir) $(MAKE) -f $(switch_builddir)/build/modmake.rules ; \
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile Wed Mar 14 21:32:18 2007
@@ -1,15 +1,17 @@
MODNAME=mod_spidermonkey
-include sm.mak
WANT_CURL=yes
-include ../../../../build/modmake.rules
-local_depend:
- cd $(BASE)/libs/curl && $(MAKE)
- cd $(BASE)/libs/js/nsprpub && $(MAKE)
- cd $(BASE)/libs/js && $(MAKE)
+LOCAL_CFLAGS=
+LOCAL_LDFLAGS=
+LOCAL_LIBADD=
+
+include sm.mak
+
+depend_install: $(DESTDIR)$(PREFIX)/lib/libjs.la
-depend_install:
- cd $(BASE)/libs/js/nsprpub && $(MAKE) install
- cd $(BASE)/libs/js && $(MAKE) install
- $(LINK) $(SOLINK) $(MODNAME).o -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS)
+$(DESTDIR)$(PREFIX)/lib/libjs.la: $(JS_DIR)/nsprpub/pr/src/libnspr4.so $(JS_DIR)/nsprpub/lib/ds/libplds4.so $(JS_DIR)/nsprpub/lib/libc/src/libplc4.so $(JS_DIR)/libjs.la
+ cd $(JS_DIR)/nsprpub/pr/src && $(INSTALL) libnspr4.so $(DESTDIR)$(PREFIX)/lib
+ cd $(JS_DIR)/nsprpub/lib/ds && $(INSTALL) libplds4.so $(DESTDIR)$(PREFIX)/lib
+ cd $(JS_DIR)/nsprpub/lib/libc/src && $(INSTALL) libplc4.so $(DESTDIR)$(PREFIX)/lib
+ cd $(JS_DIR) && $(LTINSTALL) libjs.la $(DESTDIR)$(PREFIX)/lib
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/sm.mak
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/sm.mak (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/sm.mak Wed Mar 14 21:32:18 2007
@@ -1,2 +1,13 @@
-LOCAL_CFLAGS = -I$(BASE)/libs/js/src -I$(BASE)/libs/js/nsprpub/dist/include/nspr -DXP_UNIX -I../mod_spidermonkey -DJS_THREADSAFE -DJS_HAS_FILE_OBJECT=1
-LOCAL_LDFLAGS = -L$(BASE)/libs/js/nsprpub/pr/src -L$(BASE)/libs/js/nsprpub/dist/lib -lnspr4 $(BASE)/libs/js/libjs.la
+switch_srcdir=../../../..
+JS_DIR=$(switch_srcdir)/libs/js
+JSLA=$(JS_DIR)/libjs.la
+
+LOCAL_CFLAGS+=-I$(JS_DIR)/src -I$(JS_DIR)/nsprpub/dist/include/nspr -DXP_UNIX -I../mod_spidermonkey -DJS_THREADSAFE -DJS_HAS_FILE_OBJECT=1
+LOCAL_LDFLAGS+=-L$(JS_DIR)/nsprpub/pr/src -L$(JS_DIR)/nsprpub/dist/lib -lnspr4
+LOCAL_LIBADD+=$(JSLA)
+
+include $(switch_srcdir)/build/modmake.rules
+
+$(JSLA):
+ cd $(JS_DIR)/nsprpub && $(MAKE)
+ cd $(JS_DIR) && $(MAKE)
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/Makefile Wed Mar 14 21:32:18 2007
@@ -1,3 +1,7 @@
-include ../mod_spidermonkey/sm.mak
MODNAME=mod_spidermonkey_core_db
-include ../../../../build/modmake.rules
+switch_srcdir=../../../..
+LOCAL_CFLAGS=
+LOCAL_LDFLAGS=
+LOCAL_LIBADD=
+include ../mod_spidermonkey/sm.mak
+
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/Makefile Wed Mar 14 21:32:18 2007
@@ -1,14 +1,16 @@
-include ../mod_spidermonkey/sm.mak
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-
-# and define these variables to impact your build
MODNAME=mod_spidermonkey_etpan
-#LOCAL_CFLAGS=
-LOCAL_LDFLAGS+=-letpan
-#LOCAL_OBJS=
-include ../../../../build/modmake.rules
-local_depend:
- MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install libetpan --prefix=$(PREFIX)
+switch_srcdir=../../../..
+
+ETPAN_DIR=$(switch_srcdir)/libs/libetpan
+ETPANLA=$(ETPAN_DIR)/src/libetpan.la
+
+LOCAL_CFLAGS=-I$(ETPAN_DIR)/include
+LOCAL_LDFLAGS=
+LOCAL_LIBADD=$(ETPANLA)
+
+include ../mod_spidermonkey/sm.mak
+
+$(ETPANLA):
+ cd $(ETPAN_DIR) && $(MAKE)
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/Makefile Wed Mar 14 21:32:18 2007
@@ -1,14 +1,26 @@
+MODNAME=mod_spidermonkey_odbc
+switch_srcdir=../../../..
+
+ODBC=unixODBC-2.2.12
+ODBC_DIR=$(switch_srcdir)/libs/$(ODBC)
+ODBCLA=libodbc.la
+UNINST_ODBCLA=$(ODBC_DIR)/DriverManager/$(ODBCLA)
+INST_ODBCLA=$(DESTDIR)$(PREFIX)/lib/$(ODBCLA)
+LOCAL_CFLAGS=-I$(ODBC_DIR)/include
+LOCAL_LDFLAGS=
+LOCAL_LIBADD=$(UNINST_ODBCLA)
+
include ../mod_spidermonkey/sm.mak
-# define these targets in your makefile if you wish
-# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
-# and define these variables to impact your build
-MODNAME=mod_spidermonkey_odbc
-#LOCAL_CFLAGS=
-LOCAL_LDFLAGS+=-lodbc
-#LOCAL_OBJS=
-include ../../../../build/modmake.rules
+$(ODBC_DIR)/Makefile:
+ $(GETLIB) $(ODBC).tar.gz
+ cd $(ODBC_DIR) && ./configure --prefix=$(PREFIX) --disable-gui --without-x --with-pic
+
+$(UNINST_ODBCLA): $(ODBC_DIR)/Makefile
+ cd $(ODBC_DIR) && $(MAKE)
+
+depend_install: $(INST_ODBCLA)
-local_depend:
- MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install unixODBC-2.2.12.tar.gz --prefix=$(PREFIX) --disable-gui --without-x --with-pic
+$(INST_ODBCLA): $(UNINST_ODBCLA)
+ cd $(ODBC_DIR) && $(MAKE) install
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/Makefile Wed Mar 14 21:32:18 2007
@@ -1,4 +1,7 @@
-include ../mod_spidermonkey/sm.mak
MODNAME=mod_spidermonkey_skel
-include ../../../../build/modmake.rules
+switch_srcdir=../../../..
+LOCAL_CFLAGS=
+LOCAL_LDFLAGS=
+LOCAL_LIBADD=
+include ../mod_spidermonkey/sm.mak
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/Makefile Wed Mar 14 21:32:18 2007
@@ -1,5 +1,7 @@
MODNAME=mod_spidermonkey_teletone
+switch_srcdir=../../../..
+LOCAL_CFLAGS=-I$(switch_srcdir)/libs/libteletone/src
+LOCAL_LDFLAGS=
+LOCAL_LIBADD=$(switch_srcdir)/libs/libteletone/libteletone.la
include ../mod_spidermonkey/sm.mak
-LOCAL_CFLAGS+=-I$(BASE)/libs/libteletone/src
-LOCAL_LDFLAGS+=$(BASE)/libs/libteletone/libteletone.la
-include ../../../../build/modmake.rules
+
1
0
[commit] r4598 - in freeswitch/trunk/src: . include mod/applications/mod_conference mod/endpoints/mod_portaudio
by Freeswitch SVN 15 Mar '07
by Freeswitch SVN 15 Mar '07
15 Mar '07
Author: anthm
Date: Wed Mar 14 20:36:14 2007
New Revision: 4598
Modified:
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/include/switch_module_interfaces.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_ivr.c
Log:
update
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Wed Mar 14 20:36:14 2007
@@ -1109,14 +1109,18 @@
/*!
\brief Open a media file using file format modules
\param fh a file handle to use
+ \param codec_imp the codec implementation being used
\param file_path the path to the file
\param flags read/write flags
\param pool the pool to use (NULL for new pool)
\return SWITCH_STATUS_SUCCESS if the file is opened
\note the loadable module used is chosen based on the file extension
*/
-SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh, char *file_path, unsigned int flags, switch_memory_pool_t *pool);
-
+SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
+ const switch_codec_implementation_t *codec_imp,
+ char *file_path,
+ unsigned int flags,
+ switch_memory_pool_t *pool);
/*!
\brief Read media from a file handle
\param fh the file handle to read from (must be initilized by you memset all 0 for read, fill in channels and rate for write)
Modified: freeswitch/trunk/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/trunk/src/include/switch_module_interfaces.h (original)
+++ freeswitch/trunk/src/include/switch_module_interfaces.h Wed Mar 14 20:36:14 2007
@@ -311,6 +311,8 @@
switch_memory_pool_t *memory_pool;
/*! private data for the format module to store handle specific info */
void *private_info;
+ char *handler;
+ const switch_codec_implementation_t *codec_imp;
int64_t pos;
switch_buffer_t *audio_buffer;
uint32_t thresh;
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Wed Mar 14 20:36:14 2007
@@ -1781,6 +1781,7 @@
}
if (switch_core_file_open(&fh,
+ NULL,
rec->path,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
rec->pool) != SWITCH_STATUS_SUCCESS) {
@@ -1957,6 +1958,7 @@
/* Open the file */
if (switch_core_file_open(&fnode->fh,
+ NULL,
file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
@@ -2042,6 +2044,7 @@
/* Open the file */
if (switch_core_file_open(&fnode->fh,
+ switch_core_session_get_read_codec(member->session)->implementation,
file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Wed Mar 14 20:36:14 2007
@@ -225,6 +225,7 @@
switch_set_flag_locked((&globals), GFLAG_RING);
if (ring_file) {
if (switch_core_file_open(&fh,
+ globals.read_codec.implementation,
ring_file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
NULL) == SWITCH_STATUS_SUCCESS) {
@@ -588,6 +589,7 @@
}
if (switch_core_file_open(&tech_pvt->fh,
+ globals.read_codec.implementation,
tech_pvt->hold_file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Wed Mar 14 20:36:14 2007
@@ -1014,8 +1014,11 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh, char *file_path, unsigned int flags,
- switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
+ const switch_codec_implementation_t *codec_imp,
+ char *file_path,
+ unsigned int flags,
+ switch_memory_pool_t *pool)
{
char *ext;
switch_status_t status;
@@ -1049,6 +1052,12 @@
switch_set_flag(fh, SWITCH_FILE_FLAG_FREE_POOL);
}
+ if (rhs) {
+ fh->handler = switch_core_strdup(fh->memory_pool, rhs);
+ }
+
+ fh->codec_imp = codec_imp;
+
return fh->file_interface->file_open(fh, file_path);
}
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Wed Mar 14 20:36:14 2007
@@ -390,6 +390,7 @@
if (switch_core_file_open(fh,
+ read_codec->implementation,
file,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -628,6 +629,7 @@
if (switch_core_file_open(fh,
+ read_codec->implementation,
file,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -1155,6 +1157,7 @@
}
if (switch_core_file_open(fh,
+ read_codec->implementation,
file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -2854,6 +2857,7 @@
ringback.fhb.channels = read_codec->implementation->number_of_channels;
ringback.fhb.samplerate = read_codec->implementation->samples_per_second;
if (switch_core_file_open(&ringback.fhb,
+ read_codec->implementation,
ringback_data,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
1
0
Author: anthm
Date: Wed Mar 14 19:19:13 2007
New Revision: 4597
Modified:
freeswitch/trunk/src/mod/formats/mod_shout/interface.c
freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
freeswitch/trunk/src/mod/formats/mod_shout/mpglib.h
Log:
stick a fork in it.... needs testing and tweaks but can now read and write to icecast via shout:// and or .mp3 files the traditional way
Modified: freeswitch/trunk/src/mod/formats/mod_shout/interface.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/interface.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/interface.c Wed Mar 14 19:19:13 2007
@@ -13,7 +13,7 @@
}
-BOOL InitMP3(struct mpstr *mp, long outscale)
+BOOL InitMP3(struct mpstr *mp, long outscale, int samplerate)
{
/* quiet 4096 med 8192 */
@@ -26,7 +26,7 @@
mp->fr.single = 3; /* force mono */
mp->bsnum = 0;
mp->synth_bo = 1;
- mp->outsamplerate = 8000;
+ mp->outsamplerate = samplerate;
make_decode_tables_scale(mp, outscale);
@@ -190,7 +190,7 @@
if(osize < 4608) {
debug_printf("%d To less out space\n", __LINE__);
- return MP3_ERR;
+ return MP3_TOOSMALL;
}
if(in) {
Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c Wed Mar 14 19:19:13 2007
@@ -38,13 +38,14 @@
#include <curl/curl.h>
-#define OUTSCALE 4096
+#define OUTSCALE 8192
#define MP3_SCACHE 16384
#define MP3_DCACHE 8192
static const char modname[] = "mod_shout";
+
static char *supported_formats[SWITCH_MAX_CODECS] = {0};
struct shout_context {
@@ -52,32 +53,52 @@
lame_global_flags *gfp;
char *stream_url;
switch_mutex_t *audio_mutex;
- switch_mutex_t *mp3_mutex;
switch_buffer_t *audio_buffer;
- switch_buffer_t *mp3_buffer;
switch_memory_pool_t *memory_pool;
- //char encode_buf[MP3_SCACHE];
char decode_buf[MP3_DCACHE];
struct mpstr mp;
int err;
+ int mp3err;
int dlen;
+ switch_file_t *fd;
+ FILE *fp;
+ int samplerate;
};
typedef struct shout_context shout_context_t;
+
+static size_t decode_fd(shout_context_t *context, void *data, size_t bytes);
+
static inline void free_context(shout_context_t *context)
{
if (context) {
+ int sanity = 0;
+
+ if (context->fd) {
+ switch_file_close(context->fd);
+ context->fd = NULL;
+ }
+
+ if (context->fp) {
+ unsigned char mp3buffer[1024];
+ int len;
+
+ while ((len = lame_encode_flush(context->gfp, mp3buffer, sizeof(mp3buffer))) > 0) {
+ fwrite(mp3buffer, 1, len, context->fp);
+ }
+
+ lame_mp3_tags_fid(context->gfp, context->fp);
+ fclose(context->fp);
+ context->fp = NULL;
+ }
+
if (context->audio_buffer) {
switch_mutex_lock(context->audio_mutex);
switch_buffer_destroy(&context->audio_buffer);
switch_mutex_unlock(context->audio_mutex);
}
- if (context->mp3_buffer) {
- switch_buffer_destroy(&context->mp3_buffer);
- }
-
if (context->shout) {
shout_close(context->shout);
context->shout = NULL;
@@ -87,6 +108,22 @@
lame_close(context->gfp);
context->gfp = NULL;
}
+ if (context->stream_url) {
+ int err;
+
+ switch_mutex_lock(context->audio_mutex);
+ err = ++context->err;
+ switch_mutex_unlock(context->audio_mutex);
+
+ while(context->err == err) {
+ switch_yield(1000000);
+ if (++sanity > 10) {
+ break;
+ }
+ }
+
+ ExitMP3(&context->mp);
+ }
}
}
@@ -169,21 +206,119 @@
}
}
+static size_t decode_fd(shout_context_t *context, void *data, size_t bytes)
+{
+ int decode_status = 0;
+ int dlen = 0;
+ int x = 0;
+ char *in;
+ int inlen;
+ char *out;
+ int outlen;
+ int usedlen;
+ char inbuf[MP3_SCACHE];
+ int done = 0;
+
+ size_t lp;
+ size_t rb = 0;
+
+ while (switch_buffer_inuse(context->audio_buffer) < bytes) {
+ lp = sizeof(inbuf);
+ if ((switch_file_read(context->fd, inbuf, &lp) != SWITCH_STATUS_SUCCESS) || lp == 0) {
+ goto error;
+ }
+
+ inlen = (int) lp;
+ in = inbuf;
+
+ out = context->decode_buf;
+ outlen = (int) sizeof(context->decode_buf);
+ usedlen = 0;
+ x = 0;
+ if (inlen < bytes) {
+ done = 1;
+ }
+
+ do {
+ decode_status = decodeMP3(&context->mp, in, inlen, out, outlen, &dlen);
+
+ if (context->err) {
+ goto error;
+ }
+
+ if (!x) {
+ in = NULL;
+ inlen = 0;
+ x++;
+ }
+
+ if (decode_status == MP3_TOOSMALL) {
+ if (context->audio_buffer) {
+ switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
+ } else {
+ goto error;
+ }
+
+ out = context->decode_buf;
+ outlen = sizeof(context->decode_buf);
+ usedlen = 0;
+ continue;
+
+ }
+
+ if (decode_status == MP3_ERR) {
+ if (++context->mp3err >= 20) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
+ }
+ dlen = 0;
+ continue;
+ }
+
+ context->mp3err = 0;
+
+ usedlen += dlen;
+ out += dlen;
+ outlen -= dlen;
+ dlen = 0;
+
+
+ } while (decode_status != MP3_NEED_MORE);
+
+
+ if (context->audio_buffer) {
+ switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
+ } else {
+ goto error;
+ }
+
+ if (done) {
+ break;
+ }
+ }
+
+ if (switch_buffer_inuse(context->audio_buffer) >= bytes) {
+ rb = switch_buffer_read(context->audio_buffer, data, bytes);
+ return rb;
+ }
+
+ return 0;
+
+ error:
+ switch_mutex_lock(context->audio_mutex);
+ context->err++;
+ switch_mutex_unlock(context->audio_mutex);
+ return 0;
+
+}
-static int wtf = -1;
static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data)
{
register unsigned int realsize = (unsigned int)(size * nmemb);
shout_context_t *context = data;
- int rlen;
- char grr[1024];
- char *ass;
int decode_status = 0;
int dlen = 0;
- int offset = 0;
int x = 0;
-
char *in;
int inlen;
char *out;
@@ -200,37 +335,65 @@
do {
decode_status = decodeMP3(&context->mp, in, inlen, out, outlen, &dlen);
+ if (context->err) {
+ goto error;
+ }
+
if (!x) {
in = NULL;
inlen = 0;
x++;
}
- if (decode_status == MP3_ERR) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
- context->err++;
- return 0;
+ if (decode_status == MP3_TOOSMALL) {
+ switch_mutex_lock(context->audio_mutex);
+ if (context->audio_buffer) {
+ switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
+ } else {
+ goto error;
+ }
+ out = context->decode_buf;
+ outlen = sizeof(context->decode_buf);
+ usedlen = 0;
+ switch_mutex_unlock(context->audio_mutex);
+
+ } else if (decode_status == MP3_ERR) {
+
+ if (++context->mp3err >= 20) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
+ goto error;
+ }
+
+ ExitMP3(&context->mp);
+ InitMP3(&context->mp, OUTSCALE, context->samplerate);
+
+ return realsize;
}
-
+
+ context->mp3err = 0;
usedlen += dlen;
out += dlen;
outlen -= dlen;
dlen = 0;
} while (decode_status != MP3_NEED_MORE);
- printf("WRITE %d\n", usedlen);
+
switch_mutex_lock(context->audio_mutex);
- switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
+ if (context->audio_buffer) {
+ switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
+ } else {
+ goto error;
+ }
switch_mutex_unlock(context->audio_mutex);
- out = context->decode_buf;
- outlen = sizeof(context->decode_buf);
- printf("doh\n");
-
+ return realsize;
+ error:
+ switch_mutex_lock(context->audio_mutex);
+ context->err++;
+ switch_mutex_unlock(context->audio_mutex);
+ return 0;
-
- return realsize;
}
@@ -248,7 +411,10 @@
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "FreeSWITCH(mod_shout)/1.0");
curl_easy_perform(curl_handle);
curl_easy_cleanup(curl_handle);
-
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread Done\n");
+ switch_mutex_lock(context->audio_mutex);
+ context->err++;
+ switch_mutex_unlock(context->audio_mutex);
return NULL;
}
@@ -274,115 +440,130 @@
return SWITCH_STATUS_MEMERR;
}
- if (!(context->shout = shout_new())) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate shout_t\n");
- goto error;
- }
-
- if (!(context->gfp = lame_init())) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
- goto error;
- }
-
context->memory_pool = handle->memory_pool;
-
- lame_set_num_channels(context->gfp, handle->channels);
- lame_set_in_samplerate(context->gfp, handle->samplerate);
- lame_set_brate(context->gfp, 24);
- lame_set_mode(context->gfp, 3);
- lame_set_quality(context->gfp, 2); /* 2=high 5 = medium 7=low */
-
- lame_set_errorf(context->gfp, log_error);
- lame_set_debugf(context->gfp, log_debug);
- lame_set_msgf(context->gfp, log_msg);
- lame_set_bWriteVbrTag(context->gfp, 0);
- lame_mp3_tags_fid(context->gfp, NULL);
- lame_init_params(context->gfp);
- lame_print_config(context->gfp);
-
+ context->samplerate = handle->codec_imp ? handle->codec_imp->samples_per_second : 8000;
+
if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) {
if (switch_buffer_create_dynamic(&context->audio_buffer, MY_BLOCK_SIZE, MY_BUF_LEN, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
goto error;
}
- if (switch_buffer_create_dynamic(&context->mp3_buffer, MY_BLOCK_SIZE, MY_BUF_LEN, 0) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
- goto error;
- }
- switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->memory_pool);
- switch_mutex_init(&context->mp3_mutex, SWITCH_MUTEX_NESTED, context->memory_pool);
- InitMP3(&context->mp, OUTSCALE);
- context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
- launch_stream_thread(context);
- } else if (!switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
- username = switch_core_strdup(handle->memory_pool, path);
- if (!(password = strchr(username, ':'))) {
- err = "invalid url";
- goto error;
- }
- *password++ = '\0';
- if (!(host = strchr(password, '@'))) {
- err = "invalid url";
- goto error;
- }
- *host++ = '\0';
-
- if ((file = strchr(host, '/'))) {
- *file++ = '\0';
+ switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->memory_pool);
+ InitMP3(&context->mp, OUTSCALE, context->samplerate);
+ if (handle->handler) {
+ context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
+ launch_stream_thread(context);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL: %s\n", path);
+ if (switch_file_open(&context->fd, path, SWITCH_FOPEN_READ,
+ SWITCH_FPROT_UREAD|SWITCH_FPROT_UWRITE, handle->memory_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
+ goto error;
+ }
+ }
+ } else if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
+ if (!(context->gfp = lame_init())) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
goto error;
}
- if (shout_set_host(context->shout, host) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting hostname: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_set_protocol(context->shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting protocol: %s\n", shout_get_error(context->shout));
- goto error;
- }
+ lame_set_num_channels(context->gfp, handle->channels);
+ lame_set_in_samplerate(context->gfp, handle->samplerate);
+ lame_set_brate(context->gfp, 24);
+ lame_set_mode(context->gfp, 3);
+ lame_set_quality(context->gfp, 2); /* 2=high 5 = medium 7=low */
+
+ lame_set_errorf(context->gfp, log_error);
+ lame_set_debugf(context->gfp, log_debug);
+ lame_set_msgf(context->gfp, log_msg);
+
+ lame_init_params(context->gfp);
+ lame_print_config(context->gfp);
+
+ if (handle->handler) {
+ lame_set_bWriteVbrTag(context->gfp, 0);
+ lame_mp3_tags_fid(context->gfp, NULL);
+
+ username = switch_core_strdup(handle->memory_pool, path);
+ if (!(password = strchr(username, ':'))) {
+ err = "invalid url";
+ goto error;
+ }
+ *password++ = '\0';
+
+ if (!(host = strchr(password, '@'))) {
+ err = "invalid url";
+ goto error;
+ }
+ *host++ = '\0';
- if (shout_set_port(context->shout, 8000) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting port: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_set_password(context->shout, password) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting password: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_set_mount(context->shout, file) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting mount: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_set_user(context->shout, username) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_set_url(context->shout, "mod_shout") != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_set_audio_info(context->shout, "bitrate", "24000") != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_set_format(context->shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
- goto error;
- }
-
- if (shout_open(context->shout) != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening stream: %s\n", shout_get_error(context->shout));
- goto error;
+ if ((file = strchr(host, '/'))) {
+ *file++ = '\0';
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL: %s\n", path);
+ goto error;
+ }
+
+ if (!(context->shout = shout_new())) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate shout_t\n");
+ goto error;
+ }
+
+ if (shout_set_host(context->shout, host) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting hostname: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_protocol(context->shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting protocol: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_port(context->shout, 8000) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting port: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_password(context->shout, password) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting password: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_mount(context->shout, file) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting mount: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_user(context->shout, username) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_url(context->shout, "mod_shout") != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_audio_info(context->shout, "bitrate", "24000") != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_set_format(context->shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+
+ if (shout_open(context->shout) != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening stream: %s\n", shout_get_error(context->shout));
+ goto error;
+ }
+ } else {
+ /* lame being lame and all has FILE * coded into it's API for some functions so we gotta use it */
+ if (!(context->fp = fopen(path, "wb+"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
+ return SWITCH_STATUS_GENERR;
+ }
}
}
@@ -424,13 +605,19 @@
*len = 0;
- switch_mutex_lock(context->audio_mutex);
- if (context->audio_buffer) {
- rb = switch_buffer_read(context->audio_buffer, data, bytes);
+ if (context->fd) {
+ rb = decode_fd(context, data, bytes);
} else {
- context->err++;
+ switch_mutex_lock(context->audio_mutex);
+ if (context->audio_buffer) {
+ rb = switch_buffer_read(context->audio_buffer, data, bytes);
+ } else {
+ switch_mutex_lock(context->audio_mutex);
+ context->err++;
+ switch_mutex_unlock(context->audio_mutex);
+ }
+ switch_mutex_unlock(context->audio_mutex);
}
- switch_mutex_unlock(context->audio_mutex);
if (context->err) {
return SWITCH_STATUS_FALSE;
@@ -449,27 +636,33 @@
static switch_status_t shout_file_write(switch_file_handle_t *handle, void *data, size_t *len)
{
shout_context_t *context = handle->private_info;
-
-
unsigned char mp3buf[2048] = "";
long ret = 0;
int rlen;
int16_t *audio = data;
int nsamples = *len;
+
+ assert(context->gfp);
if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
return SWITCH_STATUS_FALSE;
}
- if (rlen) {
- ret = shout_send(context->shout, mp3buf, rlen);
- if (ret != SHOUTERR_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Send error: %s\n", shout_get_error(context->shout));
+ if (handle->handler) {
+ if (rlen) {
+ ret = shout_send(context->shout, mp3buf, rlen);
+ if (ret != SHOUTERR_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Send error: %s\n", shout_get_error(context->shout));
+ return SWITCH_STATUS_FALSE;
+ }
+ }
+ shout_sync(context->shout);
+ } else {
+ if (fwrite(mp3buf, 1, rlen, context->fp) < 0) {
return SWITCH_STATUS_FALSE;
}
}
- shout_sync(context->shout);
return SWITCH_STATUS_SUCCESS;
}
@@ -530,6 +723,7 @@
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
supported_formats[0] = "shout";
+ supported_formats[1] = "mp3";
shout_file_interface.extens = supported_formats;
curl_global_init(CURL_GLOBAL_ALL);
Modified: freeswitch/trunk/src/mod/formats/mod_shout/mpglib.h
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mpglib.h (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mpglib.h Wed Mar 14 19:19:13 2007
@@ -1,7 +1,7 @@
-#ifndef DEBUG_MP3
+#ifdef DEBUG_MP3
#define debug_printf(fmt,...) printf(fmt, ##__VA_ARGS__);
#else
-#define debug_printf;
+#define debug_printf(fmt,...)
#endif
struct buf {
@@ -47,10 +47,10 @@
#define MP3_ERR -1
#define MP3_OK 0
#define MP3_NEED_MORE 1
-
+#define MP3_TOOSMALL 2
void InitMP3Constants(void);
-BOOL InitMP3(struct mpstr *mp, long outscale);
+BOOL InitMP3(struct mpstr *mp, long outscale, int samplerate);
int decodeMP3(struct mpstr *mp,char *inmemory,int inmemsize,
char *outmemory,int outmemsize,int *done);
void ExitMP3(struct mpstr *mp);
1
0