MPEGaudioHeaderValid example

static $MPEGaudioHeaderDecodeCache = array();
        if (isset($MPEGaudioHeaderDecodeCache[$head4_key])) {
            $MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4_key];
        } else {
            $MPEGheaderRawArray = self::MPEGaudioHeaderDecode($head4);
            $MPEGaudioHeaderDecodeCache[$head4_key] = $MPEGheaderRawArray;
        }

        static $MPEGaudioHeaderValidCache = array();
        if (!isset($MPEGaudioHeaderValidCache[$head4_key])) { // Not in cache             //$MPEGaudioHeaderValidCache[$head4_key] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true); // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1)             $MPEGaudioHeaderValidCache[$head4_key] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false);
        }

        // shortcut         if (!isset($info['mpeg']['audio'])) {
            $info['mpeg']['audio'] = array();
        }
        $thisfile_mpeg_audio = &$info['mpeg']['audio'];

        if ($MPEGaudioHeaderValidCache[$head4_key]) {
            $thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray;
        } else {
            
if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) {

                        $info['avdataoffset'] = $atom_structure['offset'] + 8;                       // $info['quicktime'][$atomname]['offset'] + 8;                         $OldAVDataEnd         = $info['avdataend'];
                        $info['avdataend']    = $atom_structure['offset'] + $atom_structure['size']; // $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size'];
                        $getid3_temp = new getID3();
                        $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize']$this->getid3->fp);
                        $getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
                        $getid3_temp->info['avdataend']    = $info['avdataend'];
                        $getid3_mp3 = new getid3_mp3($getid3_temp);
                        if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) {
                            $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
                            if (!empty($getid3_temp->info['warning'])) {
                                foreach ($getid3_temp->info['warning'] as $value) {
                                    $this->warning($value);
                                }
                            }
                            if (!empty($getid3_temp->info['mpeg'])) {
                                $info['mpeg'] = $getid3_temp->info['mpeg'];
                                if (isset($info['mpeg']['audio'])) {
                                    $info['audio']['dataformat']   = 'mp3';
                                    $info['audio']['codec']        = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3')));
                                    
Home | Imprint | This part of the site doesn't use cookies.