Home / APIs / getid3_mp3::RecursiveFrameScanning() –

You appear to be a bot. Output may be restricted

Description

Usage

getid3_mp3::RecursiveFrameScanning( $offset, $nextframetestoffset, $ScanAsCBR );

Parameters

$offset
( mixed ) required –
$nextframetestoffset
( mixed ) required –
$ScanAsCBR
( mixed ) required –

Returns

void

Source

File name: wordpress/wp-includes/ID3/module.audio.mp3.php


Lines: 1 to 46 of 46

  public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) {
    $info = &$this->getid3->info;
    $firstframetestarray = array('error' => array(), 'warning'=> array(), 'avdataend' => $info['avdataend'], 'avdataoffset' => $info['avdataoffset']);
    $this->decodeMPEGaudioHeader($offset, $firstframetestarray, false);

    for ($i = 0; $i < GETID3_MP3_VALID_CHECK_FRAMES; $i++) {
      // check next GETID3_MP3_VALID_CHECK_FRAMES frames for validity, to make sure we haven't run across a false synch
      if (($nextframetestoffset + 4) >= $info['avdataend']) {
        // end of file
        return true;
      }

      $nextframetestarray = array('error' => array(), 'warning' => array(), 'avdataend' => $info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
      if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) {
        if ($ScanAsCBR) {
          // force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header
          if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) {
            return false;
          }
        }


        // next frame is OK, get ready to check the one after that
        if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) {
          $nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength'];
        } else {
          $this->error('Frame at offset ('.$offset.') is has an invalid frame length.');
          return false;
        }

      } elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) {

        // it's not the end of the file, but there's not enough data left for another frame, so assume it's garbage/padding and return OK
        return true;

      } else {

        // next frame is not valid, note the error and fail, so scanning can contiue for a valid frame sequence
        $this->warning('Frame at offset ('.$offset.') is valid, but the next one at ('.$nextframetestoffset.') is not.');

        return false;
      }
    }
    return true;
  }
 

 View on GitHub View on Trac

Published: 12th March 2017 | Last updated: 17th November 2017

Information

Function name: getid3_mp3::RecursiveFrameScanning
Class ref: getid3_mp3
Plugin ref: WordPress
Version: 5.0.3
Sourcefile: wp-includes/ID3/module.audio.mp3.php
File ref: wp-includes/ID3/module.audio.mp3.php
Deprecated?: No
API Letters: G,M,R

  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Files
  • Hooks
  • Classes
  • Sites
  • Sitemap
  • Blog
WooCommerce a2z WooCommerce a2z
WooCommerce

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2019. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins