]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5242
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 29 Mar 2013 15:54:45 +0000 (10:54 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 29 Mar 2013 15:54:45 +0000 (10:54 -0500)
src/mod/formats/mod_shout/mod_shout.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
src/switch_ivr.c
src/switch_ivr_play_say.c

index b11718488fecf6fac3064ceeb1b2a2b73a4a8719..88ba993dea1e8fd1bb6be1d3f76e1b92d37a5246 100644 (file)
@@ -882,7 +882,7 @@ static switch_status_t shout_file_close(switch_file_handle_t *handle)
 static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
 {
        shout_context_t *context = handle->private_info;
-
+       
        if (handle->handler || switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
                return SWITCH_STATUS_FALSE;
        } else {
index 1fa7b4ad5c634d3ab728bd7bba139aae5e32c2aa..96d9917df1353bf9fd22c00680e886461045c2cc 100644 (file)
@@ -1217,7 +1217,7 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session,
        switch_status_t status;
        struct input_callback_state *cb_state = buf;
        switch_file_handle_t *fh = cb_state->extra;
-       struct js_session *jss = cb_state->session_state;
+       //struct js_session *jss = cb_state->session_state;
 
        if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
                return SWITCH_STATUS_FALSE;
@@ -1285,11 +1285,11 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session,
                        switch_core_file_seek(fh, &pos, 0, SEEK_SET);
                        return SWITCH_STATUS_SUCCESS;
                } else if (!strncasecmp(ret, "seek", 4)) {
-                       switch_codec_t *codec;
+                       //switch_codec_t *codec;
                        uint32_t samps = 0;
                        uint32_t pos = 0;
                        char *p;
-                       codec = switch_core_session_get_read_codec(jss->session);
+                       //codec = switch_core_session_get_read_codec(jss->session);
 
                        if ((p = strchr(ret, ':'))) {
                                p++;
@@ -1299,14 +1299,14 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session,
                                                step = 1000;
                                        }
                                        if (step > 0) {
-                                               samps = step * (codec->implementation->actual_samples_per_second / 1000);
+                                               samps = step * (fh->samplerate / 1000);
                                                switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
                                        } else {
-                                               samps = abs(step) * (codec->implementation->actual_samples_per_second / 1000);
+                                               samps = abs(step) * (fh->samplerate / 1000);
                                                switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
                                        }
                                } else {
-                                       samps = atoi(p) * (codec->implementation->actual_samples_per_second / 1000);
+                                       samps = atoi(p) * (fh->samplerate / 1000);
                                        switch_core_file_seek(fh, &pos, samps, SEEK_SET);
                                }
                        }
index 92440ce78f728d59c3af82be672d7376ac608ca2..5342d3e84673d67286a05ad7e2e56c0b25908c62 100644 (file)
@@ -3366,11 +3366,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
                        switch_core_file_seek(fhp, &pos, 0, SEEK_SET);
                        return SWITCH_STATUS_SUCCESS;
                } else if (!strncasecmp(cmd, "seek", 4)) {
-                       switch_codec_t *codec;
+                       //switch_codec_t *codec;
                        unsigned int samps = 0;
                        unsigned int pos = 0;
                        char *p;
-                       codec = switch_core_session_get_read_codec(session);
+                       //codec = switch_core_session_get_read_codec(session);
                        
                        if ((p = strchr(cmd, ':'))) {
                                p++;
@@ -3381,7 +3381,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
                                                step = 1000;
                                        }
 
-                                       samps = step * (codec->implementation->samples_per_second / 1000);
+                                       samps = step * (fhp->samplerate / 1000);
                                        target = (int32_t)fhp->pos + samps;
 
                                        if (target < 0) {
@@ -3392,7 +3392,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
                                        switch_core_file_seek(fhp, &pos, target, SEEK_SET);
 
                                } else {
-                                       samps = switch_atoui(p) * (codec->implementation->samples_per_second / 1000);
+                                       samps = switch_atoui(p) * (fhp->samplerate / 1000);
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", samps);
                                        switch_core_file_seek(fhp, &pos, samps, SEEK_SET);
                                }
index b20ce844768239d30e6f93e2d7458731cdd4a424..59dab6c904ff20ad7eeb9e18ca15ba24aafdd79d 100644 (file)
@@ -797,8 +797,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
        }
 
        if (read_impl.actual_samples_per_second) {
-               switch_channel_set_variable_printf(channel, "record_seconds", "%d", fh->samples_out / read_impl.actual_samples_per_second);
-               switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_out / (read_impl.actual_samples_per_second / 1000));
+               switch_channel_set_variable_printf(channel, "record_seconds", "%d", fh->samples_out / fh->samplerate);
+               switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_out / (fh->samplerate/ 1000));
 
        }
 
@@ -1693,8 +1693,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file);
 
                if (read_impl.samples_per_second) {
-                       switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / read_impl.samples_per_second);
-                       switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / (read_impl.samples_per_second / 1000));
+                       switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / fh->samplerate);
+                       switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / fh->samplerate);
                }
                switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_in);