cocos2d/external/android-specific/tremolo/Tremolo/treminfo.c
int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
  int i;
  if(!ci)return(OV_EFAULT);

  /* codebooks */
  ci->books=oggpack_read(opb,8)+1;
  ci->book_param=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->book_param));
  if(!ci->book_param){
    ci->books=0;
    goto err_out;
  }
  for(i=0;i<ci->books;i++)
    if(vorbis_book_unpack(opb,ci->book_param+i))goto err_out;

  /* time backend settings, not actually used */
  i=oggpack_read(opb,6);
  for(;i>=0;i--)
    if(oggpack_read(opb,16)!=0)goto err_out;

  /* floor backend settings */
  ci->floors=oggpack_read(opb,6)+1;
  ci->floor_param=_ogg_calloc(ci->floors, sizeof(*ci->floor_param));
  ci->floor_type=_ogg_calloc(ci->floors, sizeof(*ci->floor_type));
  if(!ci->floor_param || !ci->floor_type){
    ci->floors=0;
    goto err_out;
  }
  for(i=0;i<ci->floors;i++){
    ci->floor_type[i]=(char)oggpack_read(opb,16);
    if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
    if(ci->floor_type[i])
      ci->floor_param[i]=floor1_info_unpack(vi,opb);
    else
      ci->floor_param[i]=floor0_info_unpack(vi,opb);
    if(!ci->floor_param[i])goto err_out;
  }

  /* residue backend settings */
  ci->residues=oggpack_read(opb,6)+1;
  ci->residue_param=_ogg_calloc(ci->residues, sizeof(*ci->residue_param));
  if (!ci->residue_param){
    ci->residues=0;
    goto err_out;
  }
  for(i=0;i<ci->residues;i++)
    if(res_unpack(ci->residue_param+i,vi,opb))goto err_out;

  /* map backend settings */
  ci->maps=oggpack_read(opb,6)+1;
  ci->map_param=_ogg_calloc(ci->maps, sizeof(*ci->map_param));
  if (!ci->map_param){
    ci->maps=0;
    goto err_out;
  }
  for(i=0;i<ci->maps;i++){
    if(oggpack_read(opb,16)!=0)goto err_out;
    if(mapping_info_unpack(ci->map_param+i,vi,opb))goto err_out;
  }

  /* mode settings */
  ci->modes=oggpack_read(opb,6)+1;
  ci->mode_param=
    (vorbis_info_mode *)_ogg_calloc(ci->modes, sizeof(*ci->mode_param));
  if (!ci->mode_param){
    ci->modes=0;
    goto err_out;
  }
  for(i=0;i<ci->modes;i++){
    ci->mode_param[i].blockflag=(unsigned char)oggpack_read(opb,1);
    if(oggpack_read(opb,16))goto err_out;
    if(oggpack_read(opb,16))goto err_out;
    ci->mode_param[i].mapping=(unsigned char)oggpack_read(opb,8);
    if(ci->mode_param[i].mapping>=ci->maps)goto err_out;
  }

  if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */

  return(0);
 err_out:
  vorbis_info_clear(vi);
  return(OV_EBADHEADER);
}
/* all of the real encoding details are here.  The modes, books,
   everything */
all of the real encoding details are here.  The modes, books,
everything
all of the real encoding details are here . The modes books everything
int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
  int i;
  if(!ci)return(OV_EFAULT);
  ci->books=oggpack_read(opb,8)+1;
  ci->book_param=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->book_param));
  if(!ci->book_param){
    ci->books=0;
    goto err_out;
  }
  for(i=0;i<ci->books;i++)
    if(vorbis_book_unpack(opb,ci->book_param+i))goto err_out;
  i=oggpack_read(opb,6);
  for(;i>=0;i--)
    if(oggpack_read(opb,16)!=0)goto err_out;
  ci->floors=oggpack_read(opb,6)+1;
  ci->floor_param=_ogg_calloc(ci->floors, sizeof(*ci->floor_param));
  ci->floor_type=_ogg_calloc(ci->floors, sizeof(*ci->floor_type));
  if(!ci->floor_param || !ci->floor_type){
    ci->floors=0;
    goto err_out;
  }
  for(i=0;i<ci->floors;i++){
    ci->floor_type[i]=(char)oggpack_read(opb,16);
    if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
    if(ci->floor_type[i])
      ci->floor_param[i]=floor1_info_unpack(vi,opb);
    else
      ci->floor_param[i]=floor0_info_unpack(vi,opb);
    if(!ci->floor_param[i])goto err_out;
  }
  ci->residues=oggpack_read(opb,6)+1;
  ci->residue_param=_ogg_calloc(ci->residues, sizeof(*ci->residue_param));
  if (!ci->residue_param){
    ci->residues=0;
    goto err_out;
  }
  for(i=0;i<ci->residues;i++)
    if(res_unpack(ci->residue_param+i,vi,opb))goto err_out;
  ci->maps=oggpack_read(opb,6)+1;
  ci->map_param=_ogg_calloc(ci->maps, sizeof(*ci->map_param));
  if (!ci->map_param){
    ci->maps=0;
    goto err_out;
  }
  for(i=0;i<ci->maps;i++){
    if(oggpack_read(opb,16)!=0)goto err_out;
    if(mapping_info_unpack(ci->map_param+i,vi,opb))goto err_out;
  }
  ci->modes=oggpack_read(opb,6)+1;
  ci->mode_param=
    (vorbis_info_mode *)_ogg_calloc(ci->modes, sizeof(*ci->mode_param));
  if (!ci->mode_param){
    ci->modes=0;
    goto err_out;
  }
  for(i=0;i<ci->modes;i++){
    ci->mode_param[i].blockflag=(unsigned char)oggpack_read(opb,1);
    if(oggpack_read(opb,16))goto err_out;
    if(oggpack_read(opb,16))goto err_out;
    ci->mode_param[i].mapping=(unsigned char)oggpack_read(opb,8);
    if(ci->mode_param[i].mapping>=ci->maps)goto err_out;
  }
  if(oggpack_read(opb,1)!=1)goto err_out; 
  return(0);
 err_out:
  vorbis_info_clear(vi);
  return(OV_EBADHEADER);
}
int _vorbis_unpack_books ( vorbis_info * vi , oggpack_buffer * opb ) { codec_setup_info * ci = ( codec_setup_info * ) vi -> codec_setup ; int i ; if ( ! ci ) return ( OV_EFAULT ) ; ci -> books = oggpack_read ( opb , 8 ) + 1 ; ci -> book_param = ( codebook * ) _ogg_calloc ( ci -> books , sizeof ( * ci -> book_param ) ) ; if ( ! ci -> book_param ) { ci -> books = 0 ; goto err_out ; } for ( i = 0 ; i < ci -> books ; i ++ ) if ( vorbis_book_unpack ( opb , ci -> book_param + i ) ) goto err_out ; i = oggpack_read ( opb , 6 ) ; for ( ; i >= 0 ; i -- ) if ( oggpack_read ( opb , 16 ) != 0 ) goto err_out ; ci -> floors = oggpack_read ( opb , 6 ) + 1 ; ci -> floor_param = _ogg_calloc ( ci -> floors , sizeof ( * ci -> floor_param ) ) ; ci -> floor_type = _ogg_calloc ( ci -> floors , sizeof ( * ci -> floor_type ) ) ; if ( ! ci -> floor_param || ! ci -> floor_type ) { ci -> floors = 0 ; goto err_out ; } for ( i = 0 ; i < ci -> floors ; i ++ ) { ci -> floor_type [ i ] = ( char ) oggpack_read ( opb , 16 ) ; if ( ci -> floor_type [ i ] < 0 || ci -> floor_type [ i ] >= VI_FLOORB ) goto err_out ; if ( ci -> floor_type [ i ] ) ci -> floor_param [ i ] = floor1_info_unpack ( vi , opb ) ; else ci -> floor_param [ i ] = floor0_info_unpack ( vi , opb ) ; if ( ! ci -> floor_param [ i ] ) goto err_out ; } ci -> residues = oggpack_read ( opb , 6 ) + 1 ; ci -> residue_param = _ogg_calloc ( ci -> residues , sizeof ( * ci -> residue_param ) ) ; if ( ! ci -> residue_param ) { ci -> residues = 0 ; goto err_out ; } for ( i = 0 ; i < ci -> residues ; i ++ ) if ( res_unpack ( ci -> residue_param + i , vi , opb ) ) goto err_out ; ci -> maps = oggpack_read ( opb , 6 ) + 1 ; ci -> map_param = _ogg_calloc ( ci -> maps , sizeof ( * ci -> map_param ) ) ; if ( ! ci -> map_param ) { ci -> maps = 0 ; goto err_out ; } for ( i = 0 ; i < ci -> maps ; i ++ ) { if ( oggpack_read ( opb , 16 ) != 0 ) goto err_out ; if ( mapping_info_unpack ( ci -> map_param + i , vi , opb ) ) goto err_out ; } ci -> modes = oggpack_read ( opb , 6 ) + 1 ; ci -> mode_param = ( vorbis_info_mode * ) _ogg_calloc ( ci -> modes , sizeof ( * ci -> mode_param ) ) ; if ( ! ci -> mode_param ) { ci -> modes = 0 ; goto err_out ; } for ( i = 0 ; i < ci -> modes ; i ++ ) { ci -> mode_param [ i ] . blockflag = ( unsigned char ) oggpack_read ( opb , 1 ) ; if ( oggpack_read ( opb , 16 ) ) goto err_out ; if ( oggpack_read ( opb , 16 ) ) goto err_out ; ci -> mode_param [ i ] . mapping = ( unsigned char ) oggpack_read ( opb , 8 ) ; if ( ci -> mode_param [ i ] . mapping >= ci -> maps ) goto err_out ; } if ( oggpack_read ( opb , 1 ) != 1 ) goto err_out ; return ( 0 ) ; err_out : vorbis_info_clear ( vi ) ; return ( OV_EBADHEADER ) ; }
all of the real encoding details are here.
all of the real encoding details are here .
/* codebooks */ /* time backend settings, not actually used */ /* floor backend settings */ /* residue backend settings */ /* map backend settings */ /* mode settings */ /* top level EOP check */