diff options
author | Monty <xiphmont@xiph.org> | 2000-10-31 00:10:37 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2000-10-31 00:10:37 +0000 |
commit | 52e056a6d232ad295f53252b16a4ec9e707810dd (patch) | |
tree | f925a43c2d8fad2963ba9f2e1258d4abe9e7d7a6 | |
parent | 908382dc7ebfb9933a9c5ea6c860911662979db3 (diff) | |
download | libvorbis-git-52e056a6d232ad295f53252b16a4ec9e707810dd.tar.gz |
Sample level editing stuff happily implemented/tested.
Monty
svn path=/branches/branch_beta3/vorbis/; revision=849
-rw-r--r-- | include/vorbis/codec.h | 4 | ||||
-rw-r--r-- | lib/block.c | 27 | ||||
-rw-r--r-- | lib/info.c | 4 |
3 files changed, 25 insertions, 10 deletions
diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h index 81aafcc2..5b8e8637 100644 --- a/include/vorbis/codec.h +++ b/include/vorbis/codec.h @@ -12,7 +12,7 @@ ******************************************************************** function: libvorbis codec headers - last mod: $Id: codec.h,v 1.32.2.1 2000/10/14 03:14:06 xiphmont Exp $ + last mod: $Id: codec.h,v 1.32.2.2 2000/10/31 00:10:36 xiphmont Exp $ ********************************************************************/ @@ -218,7 +218,7 @@ typedef struct vorbis_block{ int pcmend; int mode; - int eofflag; + int eofflag; ogg_int64_t granulepos; ogg_int64_t sequence; vorbis_dsp_state *vd; /* For read-only access of configuration */ diff --git a/lib/block.c b/lib/block.c index fe49609a..6739a8cf 100644 --- a/lib/block.c +++ b/lib/block.c @@ -12,7 +12,7 @@ ******************************************************************** function: PCM data vector blocking, windowing and dis/reassembly - last mod: $Id: block.c,v 1.39.2.1 2000/10/14 03:14:06 xiphmont Exp $ + last mod: $Id: block.c,v 1.39.2.2 2000/10/31 00:10:37 xiphmont Exp $ Handle windowing, overlap-add, etc of the PCM vectors. This is made more amusing by Vorbis' current two allowed block sizes. @@ -682,15 +682,30 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ it reads the last two marked pages in proper sequence */ if(v->granulepos==-1) - v->granulepos=vb->granulepos; + if(vb->granulepos==-1){ + v->granulepos=0; + }else{ + v->granulepos=vb->granulepos; + } else{ v->granulepos+=(centerW-v->centerW); if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){ - if(v->granulepos>vb->granulepos && vb->eofflag){ - /* partial last frame. Strip the padding off */ - centerW-=(v->granulepos-vb->granulepos); + + if(v->granulepos>vb->granulepos){ + long extra=v->granulepos-vb->granulepos; + + if(vb->eofflag){ + /* partial last frame. Strip the extra samples off */ + centerW-=extra; + }else if(vb->sequence == 1){ + /* partial first frame. Discard extra leading samples */ + v->pcm_returned+=extra; + if(v->pcm_returned>centerW)v->pcm_returned=centerW; + + } + }/* else{ Shouldn't happen *unless* the bitstream is out of - spec. Either way, believe the bitstream } */ + spec. Either way, believe the bitstream } */ v->granulepos=vb->granulepos; } } @@ -12,7 +12,7 @@ ******************************************************************** function: maintain the info structure, info <-> header packets - last mod: $Id: info.c,v 1.31.2.1 2000/10/14 03:14:06 xiphmont Exp $ + last mod: $Id: info.c,v 1.31.2.2 2000/10/31 00:10:37 xiphmont Exp $ ********************************************************************/ @@ -406,7 +406,7 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){ } static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ - char temp[]="Xiphophorus libVorbis I 20000508"; + char temp[]="Xiphophorus libVorbis I 20001031"; /* preamble */ oggpack_write(opb,0x03,8); |