[Asterisk-cvs] asterisk/formats format_vox.c,1.14,1.15
markster at lists.digium.com
markster at lists.digium.com
Wed Jun 9 15:52:07 CDT 2004
Update of /usr/cvsroot/asterisk/formats
In directory mongoose.digium.com:/tmp/cvs-serv17677/formats
Modified Files:
format_vox.c
Log Message:
Merge rmarchev's vox fixes (bug #1812)
Index: format_vox.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_vox.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- format_vox.c 9 Jun 2004 01:45:08 -0000 1.14
+++ format_vox.c 9 Jun 2004 20:55:20 -0000 1.15
@@ -167,17 +167,36 @@
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()
More information about the svn-commits
mailing list