mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
simplify file interface for stream file interfaces, cleanup.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7042 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -85,7 +85,6 @@ static int do_rand(void)
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
|
||||
{
|
||||
local_stream_source_t *source = obj;
|
||||
@@ -151,7 +150,6 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (skip > 0) {
|
||||
@@ -180,7 +178,6 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing %s rate: %d\n", fname, source->rate);
|
||||
|
||||
while (RUNNING) {
|
||||
@@ -217,7 +214,6 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
||||
|
||||
switch_dir_close(source->dir_handle);
|
||||
source->dir_handle = NULL;
|
||||
|
||||
}
|
||||
|
||||
if (fd > -1) {
|
||||
@@ -262,8 +258,6 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
handle->samples = 0;
|
||||
handle->samplerate = source->rate;
|
||||
handle->channels = source->channels;
|
||||
@@ -318,11 +312,6 @@ static switch_status_t local_stream_file_close(switch_file_handle_t *handle)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t local_stream_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
|
||||
{
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
|
||||
{
|
||||
local_stream_context_t *context = handle->private_info;
|
||||
@@ -344,21 +333,6 @@ static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t local_stream_file_write(switch_file_handle_t *handle, void *data, size_t *len)
|
||||
{
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t local_stream_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string)
|
||||
{
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t local_stream_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col, const char **string)
|
||||
{
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
/* Registration */
|
||||
|
||||
static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
|
||||
@@ -372,7 +346,6 @@ static void launch_threads(void)
|
||||
switch_thread_t *thread;
|
||||
switch_threadattr_t *thd_attr = NULL;
|
||||
|
||||
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||
return;
|
||||
@@ -442,14 +415,11 @@ static void launch_threads(void)
|
||||
switch_threadattr_detach_set(thd_attr, 1);
|
||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||
switch_thread_create(&thread, thd_attr, read_stream_thread, source, source->pool);
|
||||
|
||||
}
|
||||
|
||||
switch_xml_free(xml);
|
||||
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_local_stream_load)
|
||||
{
|
||||
switch_file_interface_t *file_interface;
|
||||
@@ -462,10 +432,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_local_stream_load)
|
||||
file_interface->file_open = local_stream_file_open;
|
||||
file_interface->file_close = local_stream_file_close;
|
||||
file_interface->file_read = local_stream_file_read;
|
||||
file_interface->file_write = local_stream_file_write;
|
||||
file_interface->file_seek = local_stream_file_seek;
|
||||
file_interface->file_set_string = local_stream_file_set_string;
|
||||
file_interface->file_get_string = local_stream_file_get_string;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, pool);
|
||||
|
Reference in New Issue
Block a user