setStringMode example

/** * @param string $BlockData * * @return bool */
    private function parseVORBIS_COMMENT($BlockData) {
        $info = &$this->getid3->info;

        $getid3_ogg = new getid3_ogg($this->getid3);
        if ($this->isDependencyFor('matroska')) {
            $getid3_ogg->setStringMode($this->data_string);
        }
        $getid3_ogg->ParseVorbisComments();
        if (isset($info['ogg'])) {
            unset($info['ogg']['comments_raw']);
            $info['flac']['VORBIS_COMMENT'] = $info['ogg'];
            unset($info['ogg']);
        }

        unset($getid3_ogg);

        return true;
    }

    abstract public function Analyze();

    /** * Analyze from string instead. * * @param string $string */
    public function AnalyzeString($string) {
        // Enter string mode         $this->setStringMode($string);

        // Save info         $saved_avdataoffset = $this->getid3->info['avdataoffset'];
        $saved_avdataend    = $this->getid3->info['avdataend'];
        $saved_filesize     = (isset($this->getid3->info['filesize']) ? $this->getid3->info['filesize'] : null); // may be not set if called as dependency without openfile() call
        // Reset some info         $this->getid3->info['avdataoffset'] = 0;
        $this->getid3->info['avdataend']    = $this->getid3->info['filesize'] = $this->data_string_length;

        // Analyze
$commentexploded = explode('=', $commentstring, 2);
                $ThisFileInfo_ogg_comments_raw[$i]['key']   = strtoupper($commentexploded[0]);
                $ThisFileInfo_ogg_comments_raw[$i]['value'] = (isset($commentexploded[1]) ? $commentexploded[1] : '');

                if ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'METADATA_BLOCK_PICTURE') {

                    // http://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE                     // The unencoded format is that of the FLAC picture block. The fields are stored in big endian order as in FLAC, picture data is stored according to the relevant standard.                     // http://flac.sourceforge.net/format.html#metadata_block_picture                     $flac = new getid3_flac($this->getid3);
                    $flac->setStringMode(base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']));
                    $flac->parsePICTURE();
                    $info['ogg']['comments']['picture'][] = $flac->getid3->info['flac']['PICTURE'][0];
                    unset($flac);

                } elseif ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'COVERART') {

                    $data = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']);
                    $this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure');
                    /** @todo use 'coverartmime' where available */
                    $imageinfo = getid3_lib::GetDataImageSize($data);
                    if ($imageinfo === false || !isset($imageinfo['mime'])) {
                        
Home | Imprint | This part of the site doesn't use cookies.