/// <summary> /// Disposes of all resources /// </summary> public void Dispose() { os.clear(); vb.clear(); vd.clear(); vi.clear(); oy.clear(); }
// uses the local ogg_stream storage in vf; this is important for // non-streaming input sources int fetch_headers(Info vi, Comment vc, int[] serialno, Page og_ptr) { //System.err.println("fetch_headers"); 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) { Console.Error.WriteLine("Corrupt header in logical bitstream."); //goto bail_header; vi.clear(); vc.clear(); os.clear(); return -1; } if(vi.synthesis_headerin(vc, op)!=0) { Console.Error.WriteLine("Illegal header in logical bitstream."); //goto bail_header; vi.clear(); vc.clear(); os.clear(); return -1; } i++; } if(i<3) if(get_next_page(og_ptr, 1)<0) { Console.Error.WriteLine("Missing header in logical bitstream."); //goto bail_header; vi.clear(); vc.clear(); os.clear(); return -1; } } return 0; }
// uses the local ogg_stream storage in vf; this is important for // non-streaming input sources private int fetch_headers(Info vi, Comment vc, int[] serialno, Page og_ptr) { //System.err.println("fetch_headers"); 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) { throw new Exception("Corrupt header in logical bitstream."); //goto bail_header; vi.clear(); vc.clear(); os.clear(); return(-1); } if (vi.synthesis_headerin(vc, op) != 0) { throw new Exception("Illegal header in logical bitstream."); //goto bail_header; vi.clear(); vc.clear(); os.clear(); return(-1); } i++; } if (i < 3) { if (get_next_page(og_ptr, 1) < 0) { throw new Exception("Missing header in logical bitstream."); //goto bail_header; vi.clear(); vc.clear(); os.clear(); return(-1); } } } return(0); }