cocos2d/external/android-specific/tremolo/Tremolo/treminfo.c
int vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
  oggpack_buffer opb;

  if(op){
    oggpack_readinit(&opb,op->packet);

    /* Which of the three types of header is this? */
    /* Also verify header-ness, vorbis */
    {
      char buffer[6];
      int packtype=oggpack_read(&opb,8);
      memset(buffer,0,6);
      _v_readstring(&opb,buffer,6);
      if(memcmp(buffer,"vorbis",6)){
	/* not a vorbis header */
	return(OV_ENOTVORBIS);
      }
      switch(packtype){
      case 0x01: /* least significant *bit* is read first */
	if(!op->b_o_s){
	  /* Not the initial packet */
	  return(OV_EBADHEADER);
	}
	if(vi->rate!=0){
	  /* previously initialized info header */
	  return(OV_EBADHEADER);
	}

	return(_vorbis_unpack_info(vi,&opb));

      case 0x03: /* least significant *bit* is read first */
	if(vi->rate==0){
	  /* um... we didn't get the initial header */
	  return(OV_EBADHEADER);
	}

	return(_vorbis_unpack_comment(vc,&opb));

      case 0x05: /* least significant *bit* is read first */
	if(vi->rate==0 || vc->vendor==NULL){
	  /* um... we didn;t get the initial header or comments yet */
	  return(OV_EBADHEADER);
	}

	return(_vorbis_unpack_books(vi,&opb));

      default:
	/* Not a valid vorbis header type */
	return(OV_EBADHEADER);
	break;
      }
    }
  }
  return(OV_EBADHEADER);
}
/* The Vorbis header is in three packets; the initial small packet in
   the first page that identifies basic parameters, a second packet
   with bitstream comments and a third packet that holds the
   codebook. */
The Vorbis header is in three packets; the initial small packet in
the first page that identifies basic parameters, a second packet
with bitstream comments and a third packet that holds the
codebook.
The Vorbis header is in three packets ; the initial small packet in the first page that identifies basic parameters a second packet with bitstream comments and a third packet that holds the codebook .
int vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
  oggpack_buffer opb;
  if(op){
    oggpack_readinit(&opb,op->packet);
    {
      char buffer[6];
      int packtype=oggpack_read(&opb,8);
      memset(buffer,0,6);
      _v_readstring(&opb,buffer,6);
      if(memcmp(buffer,"vorbis",6)){
	return(OV_ENOTVORBIS);
      }
      switch(packtype){
      case 0x01: 
	if(!op->b_o_s){
	  return(OV_EBADHEADER);
	}
	if(vi->rate!=0){
	  return(OV_EBADHEADER);
	}
	return(_vorbis_unpack_info(vi,&opb));
      case 0x03: 
	if(vi->rate==0){
	  return(OV_EBADHEADER);
	}
	return(_vorbis_unpack_comment(vc,&opb));
      case 0x05: 
	if(vi->rate==0 || vc->vendor==NULL){
	  return(OV_EBADHEADER);
	}
	return(_vorbis_unpack_books(vi,&opb));
      default:
	return(OV_EBADHEADER);
	break;
      }
    }
  }
  return(OV_EBADHEADER);
}
int vorbis_dsp_headerin ( vorbis_info * vi , vorbis_comment * vc , ogg_packet * op ) { oggpack_buffer opb ; if ( op ) { oggpack_readinit ( & opb , op -> packet ) ; { char buffer [ 6 ] ; int packtype = oggpack_read ( & opb , 8 ) ; memset ( buffer , 0 , 6 ) ; _v_readstring ( & opb , buffer , 6 ) ; if ( memcmp ( buffer , " " , 6 ) ) { return ( OV_ENOTVORBIS ) ; } switch ( packtype ) { case 0x01 : if ( ! op -> b_o_s ) { return ( OV_EBADHEADER ) ; } if ( vi -> rate != 0 ) { return ( OV_EBADHEADER ) ; } return ( _vorbis_unpack_info ( vi , & opb ) ) ; case 0x03 : if ( vi -> rate == 0 ) { return ( OV_EBADHEADER ) ; } return ( _vorbis_unpack_comment ( vc , & opb ) ) ; case 0x05 : if ( vi -> rate == 0 || vc -> vendor == NULL ) { return ( OV_EBADHEADER ) ; } return ( _vorbis_unpack_books ( vi , & opb ) ) ; default : return ( OV_EBADHEADER ) ; break ; } } } return ( OV_EBADHEADER ) ; }
The Vorbis header is in three packets; the initial small packet in
the first page that identifies basic parameters, a second packet
with bitstream comments and a third packet that holds the
codebook.
The Vorbis header is in three packets ; the initial small packet in the first page that identifies basic parameters a second packet with bitstream comments and a third packet that holds the codebook .
/* Which of the three types of header is this? */ /* Also verify header-ness, vorbis */ /* not a vorbis header */ /* least significant *bit* is read first */ /* Not the initial packet */ /* previously initialized info header */ /* least significant *bit* is read first */ /* um... we didn't get the initial header */ /* least significant *bit* is read first */ /* um... we didn;t get the initial header or comments yet */ /* Not a valid vorbis header type */