[Freeswitch-svn] [commit] r4600 - in freeswitch/trunk/src: . include mod/applications/mod_conference mod/endpoints/mod_portaudio mod/formats/mod_shout
Freeswitch SVN
brian at freeswitch.org
Wed Mar 14 21:58:41 EDT 2007
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");
More information about the Freeswitch-svn
mailing list