getOnlyMPEGaudioInfo example


    public $mp3_valid_check_frames = 50;

    /** * @return bool */
    public function Analyze() {
        $info = &$this->getid3->info;

        $initialOffset = $info['avdataoffset'];

        if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) {
            if ($this->allow_bruteforce) {
                $this->error('Rescanning file in BruteForce mode');
                $this->getOnlyMPEGaudioInfoBruteForce();
            }
        }


        if (isset($info['mpeg']['audio']['bitrate_mode'])) {
            $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
        }

        
if ($AudioChunkStreamType == 'wb') {
                                    $FirstFourBytes = substr($AudioChunkHeader, 8, 4);
                                    if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) {
                                        // MP3                                         if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) {
                                            $getid3_temp = new getID3();
                                            $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize']$this->getid3->fp);
                                            $getid3_temp->info['avdataoffset'] = $this->ftell() - 4;
                                            $getid3_temp->info['avdataend']    = $this->ftell() + $AudioChunkSize;
                                            $getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__);
                                            $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
                                            if (isset($getid3_temp->info['mpeg']['audio'])) {
                                                $info['mpeg']['audio']         = $getid3_temp->info['mpeg']['audio'];
                                                $info['audio']                 = $getid3_temp->info['audio'];
                                                $info['audio']['dataformat']   = 'mp'.$info['mpeg']['audio']['layer'];
                                                $info['audio']['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
                                                $info['audio']['channels']     = $info['mpeg']['audio']['channels'];
                                                $info['audio']['bitrate']      = $info['mpeg']['audio']['bitrate'];
                                                $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
                                                //$info['bitrate'] = $info['audio']['bitrate'];                                             }
                                            unset($getid3_temp$getid3_mp3);
                                        }
$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')));
                                    $info['audio']['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
                                    
Home | Imprint | This part of the site doesn't use cookies.