csvorbis.VorbisFile.open_seekable C# (CSharp) Method

open_seekable() private method

private open_seekable ( ) : int
return int
        int open_seekable()
        {
            Info initial_i=new Info();
            Comment initial_c=new Comment();
            int serialno;
            long end;
            int ret;
            int dataoffset;
            Page og=new Page();
            // is this even vorbis...?
            int[] foo=new int[1];
            ret=fetch_headers(initial_i, initial_c, foo, null);
            serialno=foo[0];
            dataoffset=(int)offset; //!!
            os.clear();
            if(ret==-1)return(-1);
            // we can seek, so set out learning all about this file
            skable=true;
            //(callbacks.seek_func)(datasource, 0, SEEK_END);
            fseek(datasource, 0, SEEK_END);
            //offset=end=(callbacks.tell_func)(datasource);
            offset=ftell(datasource);
            end=offset;
            // We get the offset for the last page of the physical bitstream.
            // Most OggVorbis files will contain a single logical bitstream
            end=get_prev_page(og);
            // moer than one logical bitstream?
            if(og.serialno()!=serialno)
            {
                // Chained bitstream. Bisect-search each logical bitstream
                // section.  Do so based on serial number only
                if(bisect_forward_serialno(0,0,end+1,serialno,0)<0)
                {
                    clear();
                    return OV_EREAD;
                }
            }
            else
            {
                // Only one logical bitstream
                if(bisect_forward_serialno(0,end,end+1,serialno,0)<0)
                {
                    clear();
                    return OV_EREAD;
                }
            }
            prefetch_all_headers(initial_i, initial_c, dataoffset);
            return(raw_seek(0));
        }