[xiph-cvs] cvs commit: vorbis/lib vorbisfile.c
Monty
xiphmont at xiph.org
Sun May 27 01:16:01 PDT 2001
xiphmont 01/05/27 01:16:01
Modified: lib vorbisfile.c
Log:
One last vorbisfile opt uncommented, fixed and tested.
Monty
Revision Changes Path
1.46 +12 -13 vorbis/lib/vorbisfile.c
Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisfile.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- vorbisfile.c 2001/05/27 06:44:01 1.45
+++ vorbisfile.c 2001/05/27 08:16:00 1.46
@@ -11,7 +11,7 @@
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.45 2001/05/27 06:44:01 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.46 2001/05/27 08:16:00 xiphmont Exp $
********************************************************************/
@@ -25,6 +25,7 @@
#include "vorbis/vorbisfile.h"
#include "os.h"
+#include "codec_internal.h"
#include "misc.h"
/* A 'chained bitstream' is a Vorbis bitstream that contains more than
@@ -1085,7 +1086,7 @@
}
}
if(ret<0)goto seek_error;
- if(op.granulepos!=-1 && !op.e_o_s){
+ if(op.granulepos!=-1){
vf->pcm_offset=op.granulepos+total;
break;
}else
@@ -1112,13 +1113,14 @@
returns zero on success, nonzero on failure */
int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
- int thisblock,lastblock=0,blockacc=0;
+ int thisblock,lastblock=0;
int ret=ov_pcm_seek_page(vf,pos);
+ codec_setup_info *ci=vf->vi->codec_setup;
if(ret<0)return(ret);
/* discard leading packets we don't need for the lapping of the
position we want; don't decode them */
-#if 0
+
while(1){
ogg_packet op;
ogg_page og;
@@ -1126,12 +1128,13 @@
int ret=ogg_stream_packetpeek(&vf->os,&op);
if(ret>0){
thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
+ if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2;
- if(blockacc+
- ((lastblock+thisblock)>>2)+
- (thisblock>>1)+vf->pcm_offset>pos)break;
+ if(vf->pcm_offset+((thisblock+ci->blocksizes[1])>>2)>=pos)break;
ogg_stream_packetout(&vf->os,NULL);
+
+
/* end of logical stream case is hard, especially with exact
length positioning. */
@@ -1141,11 +1144,10 @@
vf->pcm_offset=op.granulepos;
for(i=0;i<vf->current_link;i++)
vf->pcm_offset+=vf->pcmlengths[i];
- blockacc=0;
- }else
- if(lastblock)blockacc+=(lastblock+thisblock)>>2;
+ }
lastblock=thisblock;
+
}else{
if(ret<0 && ret!=OV_HOLE)break;
@@ -1170,9 +1172,6 @@
ogg_stream_pagein(&vf->os,&og);
}
}
-
- if(lastblock)vf->pcm_offset+=blockacc;
-#endif
/* discard samples until we reach the desired position. Crossing a
logical bitstream boundary with abandon is OK. */
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list