MODAPP-305 FSCORE-401
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14199 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
109d05b0e2
commit
a99020173d
|
@ -902,8 +902,8 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in
|
|||
}
|
||||
|
||||
if (dtmf->digit == *cc->profile->rew_key) {
|
||||
int samps = 24000;
|
||||
switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
|
||||
int samps = -48000;
|
||||
switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
* Paul D. Tinsley <pdt at jackhammer.org>
|
||||
* John Wehle <john@feith.com>
|
||||
*
|
||||
*
|
||||
* switch_core_file.c -- Main Core Library (File I/O Functions)
|
||||
|
@ -335,12 +336,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh,
|
|||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence)
|
||||
{
|
||||
size_t bytes = 0;
|
||||
switch_status_t status;
|
||||
|
||||
switch_assert(fh != NULL);
|
||||
switch_assert(fh->file_interface != NULL);
|
||||
|
||||
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
||||
if (!switch_test_flag(fh, SWITCH_FILE_OPEN) || !switch_test_flag(fh, SWITCH_FILE_FLAG_READ)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -348,6 +350,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (fh->buffer) {
|
||||
bytes += switch_buffer_inuse(fh->buffer);
|
||||
switch_buffer_zero(fh->buffer);
|
||||
}
|
||||
|
||||
if (fh->pre_buffer) {
|
||||
bytes += switch_buffer_inuse(fh->pre_buffer);
|
||||
switch_buffer_zero(fh->pre_buffer);
|
||||
}
|
||||
|
||||
if (whence == SWITCH_SEEK_CUR) {
|
||||
samples -= bytes / sizeof(int16_t);
|
||||
}
|
||||
|
||||
switch_set_flag(fh, SWITCH_FILE_SEEK);
|
||||
status = fh->file_interface->file_seek(fh, cur_pos, samples, whence);
|
||||
if (samples) {
|
||||
|
|
Loading…
Reference in New Issue