formats cleanup
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7384 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ab3b855841
commit
4156b6c88f
|
@ -56,6 +56,7 @@ struct local_stream_context {
|
|||
int line;
|
||||
struct local_stream_context *next;
|
||||
};
|
||||
|
||||
typedef struct local_stream_context local_stream_context_t;
|
||||
|
||||
struct local_stream_source {
|
||||
|
@ -74,6 +75,7 @@ struct local_stream_source {
|
|||
switch_memory_pool_t *pool;
|
||||
int shuffle;
|
||||
};
|
||||
|
||||
typedef struct local_stream_source local_stream_source_t;
|
||||
|
||||
static unsigned int S = 0;
|
||||
|
|
|
@ -69,8 +69,6 @@ static switch_status_t native_file_file_open(switch_file_handle_t *handle, const
|
|||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
handle->samples = 0;
|
||||
handle->samplerate = 8000;
|
||||
handle->channels = 1;
|
||||
|
@ -82,7 +80,6 @@ static switch_status_t native_file_file_open(switch_file_handle_t *handle, const
|
|||
handle->flags |= SWITCH_FILE_NATIVE;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File [%s] %dhz\n", path, handle->samplerate);
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -105,7 +102,6 @@ static switch_status_t native_file_file_seek(switch_file_handle_t *handle, unsig
|
|||
switch_file_seek(context->fd, whence, &samples);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t native_file_file_read(switch_file_handle_t *handle, void *data, size_t *len)
|
||||
|
@ -138,7 +134,6 @@ static switch_status_t native_file_file_get_string(switch_file_handle_t *handle,
|
|||
|
||||
static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
|
||||
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_native_file_load)
|
||||
{
|
||||
switch_file_interface_t *file_interface;
|
||||
|
|
|
@ -70,7 +70,6 @@ struct shout_context {
|
|||
|
||||
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)
|
||||
|
@ -128,7 +127,6 @@ static inline void free_context(shout_context_t * context)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void log_error(char const *fmt, va_list ap)
|
||||
{
|
||||
char *data = NULL;
|
||||
|
@ -287,7 +285,6 @@ static size_t decode_fd(shout_context_t * context, void *data, size_t bytes)
|
|||
|
||||
} while (decode_status != MP3_NEED_MORE);
|
||||
|
||||
|
||||
if (context->audio_buffer) {
|
||||
switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
|
||||
} else {
|
||||
|
@ -311,7 +308,6 @@ static size_t decode_fd(shout_context_t * context, void *data, size_t bytes)
|
|||
context->err++;
|
||||
switch_mutex_unlock(context->audio_mutex);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
#define error_check() if (context->err) goto error;
|
||||
|
@ -424,7 +420,6 @@ static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
|||
context->err++;
|
||||
switch_mutex_unlock(context->audio_mutex);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -804,7 +799,6 @@ static switch_status_t shout_file_write(switch_file_handle_t *handle, void *data
|
|||
int16_t *audio = data;
|
||||
int nsamples = *len;
|
||||
|
||||
|
||||
if (context->shout && !context->shout_init) {
|
||||
context->shout_init++;
|
||||
if (shout_open(context->shout) != SHOUTERR_SUCCESS) {
|
||||
|
@ -941,7 +935,6 @@ static switch_status_t shout_file_get_string(switch_file_handle_t *handle, switc
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
static switch_bool_t telecast_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
|
||||
{
|
||||
switch_buffer_t *buffer = (switch_buffer_t *) user_data;
|
||||
|
@ -993,7 +986,6 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
|
|||
char title_aft[128*3] = "";
|
||||
char *mp3, *m3u;
|
||||
|
||||
|
||||
/*
|
||||
0 uuid VARCHAR(255),
|
||||
1 created VARCHAR(255),
|
||||
|
@ -1011,8 +1003,6 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
|
|||
13 write_rate VARCHAR(255)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
holder->stream->write_function(holder->stream,
|
||||
"<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>",
|
||||
argv[1], argv[4], argv[5], argv[7], argv[8] ? argv[8] : "N/A", argv[9] ? argv[9] : "N/A", argv[10], argv[11]);
|
||||
|
@ -1031,7 +1021,6 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void do_telecast(switch_stream_handle_t *stream)
|
||||
{
|
||||
char *path_info = switch_event_get_header(stream->event, "http-path-info");
|
||||
|
@ -1047,7 +1036,6 @@ void do_telecast(switch_stream_handle_t *stream)
|
|||
char *ref = switch_event_get_header(stream->event, "http-referer");
|
||||
stream->write_function(stream,"Content-type: text/html\r\n\r\n<h2>Not Found!</h2>\n"
|
||||
"<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
|
||||
|
||||
} else {
|
||||
switch_media_bug_t *bug = NULL;
|
||||
switch_buffer_t *buffer;
|
||||
|
@ -1056,7 +1044,6 @@ void do_telecast(switch_stream_handle_t *stream)
|
|||
lame_global_flags *gfp = NULL;
|
||||
switch_codec_t *read_codec;
|
||||
|
||||
|
||||
if (!(gfp = lame_init())) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
|
||||
goto end;
|
||||
|
@ -1108,7 +1095,6 @@ void do_telecast(switch_stream_handle_t *stream)
|
|||
memset(buf, 0, bytes);
|
||||
}
|
||||
|
||||
|
||||
if ((rlen = lame_encode_buffer(gfp, (void *)buf, NULL, bytes / 2, mp3buf, sizeof(mp3buf))) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
|
||||
goto end;
|
||||
|
@ -1122,7 +1108,6 @@ void do_telecast(switch_stream_handle_t *stream)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
end:
|
||||
|
||||
switch_safe_free(uuid);
|
||||
|
@ -1142,10 +1127,8 @@ void do_telecast(switch_stream_handle_t *stream)
|
|||
|
||||
switch_core_session_rwunlock(tsession);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void do_broadcast(switch_stream_handle_t *stream)
|
||||
{
|
||||
char *path_info = switch_event_get_header(stream->event, "http-path-info");
|
||||
|
@ -1204,7 +1187,6 @@ void do_broadcast(switch_stream_handle_t *stream)
|
|||
"Content-Disposition: inline; filename=\"%s.mp3\"\r\n\r\n",
|
||||
path_info + 7);
|
||||
|
||||
|
||||
if (fh.interval) {
|
||||
interval = fh.interval * 1000;
|
||||
}
|
||||
|
@ -1233,11 +1215,8 @@ void do_broadcast(switch_stream_handle_t *stream)
|
|||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
while ((rlen = lame_encode_flush(gfp, mp3buf, sizeof(mp3buf))) > 0) {
|
||||
if (stream->raw_write_function(stream, mp3buf, rlen)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
|
||||
|
@ -1245,7 +1224,6 @@ void do_broadcast(switch_stream_handle_t *stream)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
end:
|
||||
|
||||
if (fh.channels) {
|
||||
|
@ -1257,11 +1235,9 @@ void do_broadcast(switch_stream_handle_t *stream)
|
|||
if (gfp) {
|
||||
lame_close(gfp);
|
||||
gfp = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void do_index(switch_stream_handle_t *stream)
|
||||
{
|
||||
switch_core_db_t *db = switch_core_db_handle();
|
||||
|
@ -1275,8 +1251,6 @@ void do_index(switch_stream_handle_t *stream)
|
|||
holder.stream = stream;
|
||||
|
||||
stream->write_function(stream, "Content-type: text/html\r\n\r\n");
|
||||
|
||||
|
||||
stream->write_function(stream,
|
||||
"<table align=center border=1 cellpadding=6 cellspacing=0>"
|
||||
"<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
|
||||
|
@ -1295,13 +1269,11 @@ void do_index(switch_stream_handle_t *stream)
|
|||
}
|
||||
|
||||
#define TELECAST_SYNTAX ""
|
||||
|
||||
SWITCH_STANDARD_API(telecast_api_function)
|
||||
{
|
||||
char *host = NULL, *port = NULL, *uri = NULL, *path_info = NULL;
|
||||
|
||||
|
||||
if (session) {
|
||||
if (session) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1369,8 +1341,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load)
|
|||
file_interface->file_set_string = shout_file_set_string;
|
||||
file_interface->file_get_string = shout_file_get_string;
|
||||
|
||||
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
//*module_interface = &shout_module_interface;
|
||||
|
||||
|
@ -1383,7 +1353,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown)
|
||||
{
|
||||
curl_global_cleanup();
|
||||
|
|
|
@ -71,7 +71,6 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
|
|||
}
|
||||
ext++;
|
||||
|
||||
|
||||
if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) {
|
||||
mode += SFM_READ;
|
||||
}
|
||||
|
@ -177,13 +176,11 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
|
|||
handle->seekable = context->sfinfo.seekable;
|
||||
handle->speed = 0;
|
||||
handle->private_info = context;
|
||||
|
||||
|
||||
end:
|
||||
|
||||
switch_safe_free(alt_path);
|
||||
switch_safe_free(ldup);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -210,7 +207,6 @@ static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned
|
|||
handle->pos = *cur_sample;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t sndfile_file_read(switch_file_handle_t *handle, void *data, size_t *len)
|
||||
|
@ -302,7 +298,6 @@ static switch_status_t setup_formats(void)
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "\nLibSndFile Version : %s Supported Formats\n", buffer);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "================================================================================\n");
|
||||
sf_command(NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof(int));
|
||||
|
@ -355,14 +350,11 @@ static switch_status_t setup_formats(void)
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
for (m = 0; m < exlen; m++) {
|
||||
supported_formats[len++] = extras[m];
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_NOTICE, "================================================================================\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue