Skip to content
Snippets Groups Projects
Commit 8800bd6b authored by Mark Spencer's avatar Mark Spencer
Browse files

Merge rmarchev's vox fixes (bug #1812)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent a53d260d
No related branches found
No related tags found
No related merge requests found
......@@ -167,17 +167,36 @@ static char *vox_getcomment(struct ast_filestream *s)
static int vox_seek(struct ast_filestream *fs, long sample_offset, int whence)
{
return -1;
off_t offset=0,min,cur,max,distance;
min = 0;
cur = lseek(fs->fd, 0, SEEK_CUR);
max = lseek(fs->fd, 0, SEEK_END);
/* have to fudge to frame here, so not fully to sample */
distance = sample_offset/2;
if(whence == SEEK_SET)
offset = distance;
else if(whence == SEEK_CUR || whence == SEEK_FORCECUR)
offset = distance + cur;
else if(whence == SEEK_END)
offset = max - distance;
if (whence != SEEK_FORCECUR) {
offset = (offset > max)?max:offset;
offset = (offset < min)?min:offset;
}
return lseek(fs->fd, offset, SEEK_SET);
}
static int vox_trunc(struct ast_filestream *fs)
{
return -1;
return ftruncate(fs->fd, lseek(fs->fd,0,SEEK_CUR));
}
static long vox_tell(struct ast_filestream *fs)
{
return -1;
off_t offset;
offset = lseek(fs->fd, 0, SEEK_CUR);
return offset;
}
int load_module()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment