summaryrefslogtreecommitdiff
path: root/lib/synthesis.c
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2002-02-28 04:12:48 +0000
committerMonty <xiphmont@xiph.org>2002-02-28 04:12:48 +0000
commitd8282fdb331ab1a46ed590797d335c83945365b8 (patch)
treecd931d3d3d922891b56af8726c3a579811490aaa /lib/synthesis.c
parent48e5deaf3c06fcc60dfc138f3a6ce8166bfc266a (diff)
downloadlibvorbis-git-d8282fdb331ab1a46ed590797d335c83945365b8.tar.gz
Single link files seeking fixes:
fix pcm exact seeking at very beginning (a rejected packet was being interpreted as a negative pcm offset) and very end of files (short final frames require processing from previous page's granulepos to get length of final frame correct) svn path=/trunk/vorbis/; revision=3115
Diffstat (limited to 'lib/synthesis.c')
-rw-r--r--lib/synthesis.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/lib/synthesis.c b/lib/synthesis.c
index 52cf51aa..6a032d32 100644
--- a/lib/synthesis.c
+++ b/lib/synthesis.c
@@ -11,7 +11,7 @@
********************************************************************
function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.25 2001/12/20 01:00:30 segher Exp $
+ last mod: $Id: synthesis.c,v 1.26 2002/02/28 04:12:48 xiphmont Exp $
********************************************************************/
@@ -73,6 +73,53 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
return(_mapping_P[type]->inverse(vb,b->mode[mode]));
}
+/* used to track pcm position without actually performing decode.
+ Useful for sequential 'fast forward' */
+int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
+ vorbis_dsp_state *vd=vb->vd;
+ backend_lookup_state *b=vd->backend_state;
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ oggpack_buffer *opb=&vb->opb;
+ int mode;
+
+ /* first things first. Make sure decode is ready */
+ _vorbis_block_ripcord(vb);
+ oggpack_readinit(opb,op->packet,op->bytes);
+
+ /* Check the packet type */
+ if(oggpack_read(opb,1)!=0){
+ /* Oops. This is not an audio data packet */
+ return(OV_ENOTAUDIO);
+ }
+
+ /* read our mode and pre/post windowsize */
+ mode=oggpack_read(opb,b->modebits);
+ if(mode==-1)return(OV_EBADPACKET);
+
+ vb->mode=mode;
+ vb->W=ci->mode_param[mode]->blockflag;
+ if(vb->W){
+ vb->lW=oggpack_read(opb,1);
+ vb->nW=oggpack_read(opb,1);
+ if(vb->nW==-1) return(OV_EBADPACKET);
+ }else{
+ vb->lW=0;
+ vb->nW=0;
+ }
+
+ /* more setup */
+ vb->granulepos=op->granulepos;
+ vb->sequence=op->packetno-3; /* first block is third packet */
+ vb->eofflag=op->e_o_s;
+
+ /* no pcm */
+ vb->pcmend=0;
+ vb->pcm=NULL;
+
+ return(0);
+}
+
long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
codec_setup_info *ci=vi->codec_setup;
oggpack_buffer opb;