From: Anthony Minessale Date: Tue, 31 May 2011 15:40:34 +0000 (-0500) Subject: add append flag to mod_shout X-Git-Tag: v1.2-rc1~108^2~11^2~40^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0419c4e0f32e144ff741cc4181126e9adab64c90;p=thirdparty%2Ffreeswitch.git add append flag to mod_shout --- diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index a4134db943..4ac6790933 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -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)) { - 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())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n"); goto error; @@ -781,8 +778,13 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char } } 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 */ - 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); goto error; }