********************************************************************
function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.74 2003/08/27 05:29:24 xiphmont Exp $
+ last mod: $Id: block.c,v 1.75 2003/09/02 04:39:26 xiphmont Exp $
Handle windowing, overlap-add, etc of the PCM vectors. This is made
more amusing by Vorbis' current two allowed block sizes.
int i;
codec_setup_info *ci=vi->codec_setup;
private_state *b=NULL;
- int hs=ci->halfrate_flag;
+ int hs;
+
+ if(ci==NULL) return 1;
+ hs=ci->halfrate_flag;
memset(v,0,sizeof(*v));
b=v->backend_state=_ogg_calloc(1,sizeof(*b));
b->residue[i]=_residue_P[ci->residue_type[i]]->
look(v,ci->residue_param[i]);
- return(0);
+ return 0;
}
/* arbitrary settings and spec-mandated numbers get filled in here */
int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){
private_state *b=NULL;
- _vds_shared_init(v,vi,1);
+ if(_vds_shared_init(v,vi,1))return 1;
b=v->backend_state;
b->psy_g_look=_vp_global_look(vi);
}
int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
- _vds_shared_init(v,vi,0);
+ if(_vds_shared_init(v,vi,0)) return 1;
vorbis_synthesis_restart(v);
- return(0);
+ return 0;
}
/* Unlike in analysis, the window is only partially applied for each
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.72 2003/09/02 01:06:08 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.73 2003/09/02 04:39:26 xiphmont Exp $
********************************************************************/
}
}
-static void _make_decode_ready(OggVorbis_File *vf){
- if(vf->ready_state!=STREAMSET)return;
+static int _make_decode_ready(OggVorbis_File *vf){
+ if(vf->ready_state!=STREAMSET)return OV_EFAULT;
if(vf->seekable){
- vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link);
+ if(vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link))
+ return OV_EBADLINK;
}else{
- vorbis_synthesis_init(&vf->vd,vf->vi);
+ if(vorbis_synthesis_init(&vf->vd,vf->vi))
+ return OV_EBADLINK;
}
vorbis_block_init(&vf->vd,&vf->vb);
vf->ready_state=INITSET;
vf->bittrack=0.f;
vf->samptrack=0.f;
- return;
+ return 0;
}
static int _open_seekable2(OggVorbis_File *vf){
}
}
- _make_decode_ready(vf);
+ {
+ int ret=_make_decode_ready(vf);
+ if(ret<0)return ret;
+ }
}
ogg_stream_pagein(&vf->os,&og);
}
int thisblock,lastblock=0;
int ret=ov_pcm_seek_page(vf,pos);
if(ret<0)return(ret);
- _make_decode_ready(vf);
+ if((ret=_make_decode_ready(vf)))return ret;
/* discard leading packets we don't need for the lapping of the
position we want; don't decode them */
ogg_stream_reset_serialno(&vf->os,vf->current_serialno);
vf->ready_state=STREAMSET;
- _make_decode_ready(vf);
+ ret=_make_decode_ready(vf);
+ if(ret)return ret;
lastblock=0;
}