'Handle MPEG header in buffer on position offset
Return None on error, new offset or 0 if the new offset can\'t be scanned'

def ReadHeader(self, buffer, offset):

    if (buffer[offset:(offset + 3)] != '\x00\x00\x01'):
        return None
    id = ord(buffer[(offset + 3)])
    if (id == PADDING_PKT):
        return (((offset + (ord(buffer[(offset + 4)]) << 8)) + ord(buffer[(offset + 5)])) + 6)
    if (id == PACK_PKT):
        if ((ord(buffer[(offset + 4)]) & 240) == 32):
            self.type = 'MPEG-1    Video'
            self.get_time = self.ReadSCRMpeg1
            self.mpeg_version = 1
            return (offset + 12)
        elif ((ord(buffer[(offset + 4)]) & 192) == 64):
            self.type = 'MPEG-2    Video'
            self.get_time = self.ReadSCRMpeg2
            return ((offset + (ord(buffer[(offset + 13)]) & 7)) + 14)
        else:
            return 0
    if (192 <= id <= 223):
        for a in self.audio:
            if (a.id == id):
                break
        else:
            self.audio.append(core.AudioStream())
            self.audio[(-1)]._set('id', id)
        return 0
    if (224 <= id <= 239):
        for v in self.video:
            if (v.id == id):
                break
        else:
            self.video.append(core.VideoStream())
            self.video[(-1)]._set('id', id)
        return 0
    if (id == SEQ_HEAD):
        self.sequence_header_offset = offset
        return 0
    if (id in [PRIVATE_STREAM1, PRIVATE_STREAM2]):
        add = ord(buffer[(offset + 8)])
        if (buffer[((offset + 11) + add):((offset + 15) + add)].find('\x0bw') != (-1)):
            for a in self.audio:
                if (a.id == id):
                    break
            else:
                self.audio.append(core.AudioStream())
                self.audio[(-1)]._set('id', id)
                self.audio[(-1)].codec = 8192
        return 0
    if (id == SYS_PKT):
        return 0
    if (id == EXT_START):
        return 0
    return 0
