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)
}
}
-
static void log_error(char const *fmt, va_list ap)
{
char *data = NULL;
} while (decode_status != MP3_NEED_MORE);
-
if (context->audio_buffer) {
switch_buffer_write(context->audio_buffer, context->decode_buf, usedlen);
} else {
context->err++;
switch_mutex_unlock(context->audio_mutex);
return 0;
-
}
#define error_check() if (context->err) goto error;
context->err++;
switch_mutex_unlock(context->audio_mutex);
return 0;
-
}
int16_t *audio = data;
int nsamples = *len;
-
if (context->shout && !context->shout_init) {
context->shout_init++;
if (shout_open(context->shout) != SHOUTERR_SUCCESS) {
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;
char title_aft[128*3] = "";
char *mp3, *m3u;
-
/*
0 uuid VARCHAR(255),
1 created VARCHAR(255),
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]);
return 0;
}
-
void do_telecast(switch_stream_handle_t *stream)
{
char *path_info = switch_event_get_header(stream->event, "http-path-info");
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;
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;
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;
}
}
-
end:
switch_safe_free(uuid);
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");
"Content-Disposition: inline; filename=\"%s.mp3\"\r\n\r\n",
path_info + 7);
-
if (fh.interval) {
interval = fh.interval * 1000;
}
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");
}
}
-
end:
if (fh.channels) {
if (gfp) {
lame_close(gfp);
gfp = NULL;
- }
-
+ }
}
-
void do_index(switch_stream_handle_t *stream)
{
switch_core_db_t *db = switch_core_db_handle();
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",
}
#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;
}
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;
return SWITCH_STATUS_SUCCESS;
}
-
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown)
{
curl_global_cleanup();
}
ext++;
-
if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) {
mode += SFM_READ;
}
handle->seekable = context->sfinfo.seekable;
handle->speed = 0;
handle->private_info = context;
-
end:
switch_safe_free(alt_path);
switch_safe_free(ldup);
-
return status;
}
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)
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));
}
*/
}
-
}
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;