parseMETAdata example

$this->fseek($info['avdataoffset']);
        $StreamMarker = $this->fread(4);
        if ($StreamMarker != self::syncword) {
            return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"');
        }
        $info['fileformat']            = 'flac';
        $info['audio']['dataformat']   = 'flac';
        $info['audio']['bitrate_mode'] = 'vbr';
        $info['audio']['lossless']     = true;

        // parse flac container         return $this->parseMETAdata();
    }

    /** * @return bool */
    public function parseMETAdata() {
        $info = &$this->getid3->info;
        do {
            $BlockOffset   = $this->ftell();
            $BlockHeader   = $this->fread(4);
            $LBFBT         = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1));  // LBFBT = LastBlockFlag + BlockType
switch ($info['audio']['dataformat']) {
            case 'vorbis':
                $filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
                $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1));
                $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] =                              substr($filedata, 1, 6); // hard-coded to 'vorbis'
                $this->ParseVorbisComments();
                break;

            case 'flac':
                $flac = new getid3_flac($this->getid3);
                if (!$flac->parseMETAdata()) {
                    $this->error('Failed to parse FLAC headers');
                    return false;
                }
                unset($flac);
                break;

            case 'speex':
                $this->fseek($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length'], SEEK_CUR);
                $this->ParseVorbisComments();
                break;

            
Home | Imprint | This part of the site doesn't use cookies.