MPEGaudioHeaderBytesValid example

if (!$FoundAllChunksWeNeed) {
                                $WhereWeWere      = $this->ftell();
                                $AudioChunkHeader = $this->fread(12);
                                $AudioChunkStreamNum  =                              substr($AudioChunkHeader, 0, 2);
                                $AudioChunkStreamType =                              substr($AudioChunkHeader, 2, 2);
                                $AudioChunkSize       = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4));

                                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'];
                                                
Home | Imprint | This part of the site doesn't use cookies.