int fetch_headers ( Info vi , Comment vc , int [ ] serialno , Page og_ptr ) { Page og = new Page ( ) ; Packet op = new Packet ( ) ; int ret ; if ( og_ptr == null ) { ret = get_next_page ( og , CHUNKSIZE ) ; if ( ret == OV_EREAD ) return OV_EREAD ; if ( ret < 0 ) return OV_ENOTVORBIS ; og_ptr = og ; } if ( serialno != null ) serialno [ 0 ] = og_ptr . serialno ( ) ; os . init ( og_ptr . serialno ( ) ) ; // extract the initial header from the first page and verify that the // Ogg bitstream is in fact Vorbis data vi . init ( ) ; vc . init ( ) ; int i = 0 ; while ( i < 3 ) { os . pagein ( og_ptr ) ; while ( i < 3 ) { int result = os . packetout ( op ) ; if ( result == 0 ) break ; if ( result == - 1 ) { vi . clear ( ) ; vc . clear ( ) ; os . clear ( ) ; return - 1 ; } if ( vi . synthesis_headerin ( vc , op ) != 0 ) { vi . clear ( ) ; vc . clear ( ) ; os . clear ( ) ; return - 1 ; } i ++ ; } if ( i < 3 ) if ( get_next_page ( og_ptr , 1 ) < 0 ) { vi . clear ( ) ; vc . clear ( ) ; os . clear ( ) ; return - 1 ; } } return 0 ; }
non - streaming input sources