'Raises ogg.error, IOError'

def __init__(self, fileobj):

    page = OggPage(fileobj)
    while (not page.packets[0].startswith('\x01vorbis')):
        page = OggPage(fileobj)
    if (not page.first):
        raise OggVorbisHeaderError("page    has    ID    header,    but    doesn't    start    a    stream")
    (self.channels, self.sample_rate, max_bitrate, nominal_bitrate, min_bitrate) = struct.unpack('<B4i', page.packets[0][11:28])
    self.serial = page.serial
    max_bitrate = max(0, max_bitrate)
    min_bitrate = max(0, min_bitrate)
    nominal_bitrate = max(0, nominal_bitrate)
    if (nominal_bitrate == 0):
        self.bitrate = ((max_bitrate + min_bitrate) // 2)
    elif (max_bitrate and (max_bitrate < nominal_bitrate)):
        self.bitrate = max_bitrate
    elif (min_bitrate > nominal_bitrate):
        self.bitrate = min_bitrate
    else:
        self.bitrate = nominal_bitrate
