1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-03-05 02:02:01 +00:00

add append flag to mod_shout

This commit is contained in:
Anthony Minessale 2011-05-31 10:40:34 -05:00
parent 37064511e4
commit 0419c4e0f3

@ -655,9 +655,6 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
} }
} else if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { } else if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Appending to MP3 not supported.\n");
}
if (!(context->gfp = lame_init())) { if (!(context->gfp = lame_init())) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
goto error; goto error;
@ -781,8 +778,13 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
} }
} else { } else {
const char *mask = "wb+";
if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) {
mask = "ab+";
}
/* lame being lame and all has FILE * coded into it's API for some functions so we gotta use it */ /* 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+"))) { if (!(context->fp = fopen(path, mask))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
goto error; goto error;
} }