summaryrefslogtreecommitdiff
path: root/lib/synthesis.c
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2001-05-27 06:44:07 +0000
committerMonty <xiphmont@xiph.org>2001-05-27 06:44:07 +0000
commit939a038b6faf62b95d599e72564498c71db4b2af (patch)
treef89c69453cd40460ba7ec76b8c12ce92e31f383f /lib/synthesis.c
parentd734a5096d793cb30e4c1f45519f193bf968b249 (diff)
downloadlibvorbis-git-939a038b6faf62b95d599e72564498c71db4b2af.tar.gz
Floor 1
Res 1 Vorbisfile fixes/opts now all on mainline svn path=/trunk/vorbis/; revision=1458
Diffstat (limited to 'lib/synthesis.c')
-rw-r--r--lib/synthesis.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/synthesis.c b/lib/synthesis.c
index 19b60c01..eb314b89 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.21 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: synthesis.c,v 1.22 2001/05/27 06:44:01 xiphmont Exp $
********************************************************************/
@@ -72,4 +72,32 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
return(_mapping_P[type]->inverse(vb,b->mode[mode]));
}
+long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
+ codec_setup_info *ci=vi->codec_setup;
+ oggpack_buffer opb;
+ int type,mode,i;
+
+ 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);
+ }
+
+ {
+ int modebits=0;
+ int v=ci->modes;
+ while(v>1){
+ modebits++;
+ v>>=1;
+ }
+
+ /* read our mode and pre/post windowsize */
+ mode=oggpack_read(&opb,modebits);
+ }
+ if(mode==-1)return(OV_EBADPACKET);
+ return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
+}
+