getid3_mp3::MPEGaudioHeaderDecode() –

You appear to be a bot. Output may be restricted

Description

Usage

$array|false = getid3_mp3::MPEGaudioHeaderDecode( $Header4Bytes );

Parameters

$Header4Bytes
( string ) required

Returns

array|false

Source

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

1 to 37 of 37
  public static function MPEGaudioHeaderDecode($Header4Bytes) {
    // AAAA AAAA  AAAB BCCD  EEEE FFGH  IIJJ KLMM
    // A - Frame sync (all bits set)
    // B - MPEG Audio version ID
    // C - Layer description
    // D - Protection bit
    // E - Bitrate index
    // F - Sampling rate frequency index
    // G - Padding bit
    // H - Private bit
    // I - Channel Mode
    // J - Mode extension (Only if Joint stereo)
    // K - Copyright
    // L - Original
    // M - Emphasis

    if (strlen($Header4Bytes) != 4) {
      return false;
    }

    $MPEGrawHeader = array();
    $MPEGrawHeader['synch']         = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4;
    $MPEGrawHeader['version']       = (ord($Header4Bytes[1]) & 0x18) >> 3; //    BB
    $MPEGrawHeader['layer']         = (ord($Header4Bytes[1]) & 0x06) >> 1; //      CC
    $MPEGrawHeader['protection']    = (ord($Header4Bytes[1]) & 0x01);      //        D
    $MPEGrawHeader['bitrate']       = (ord($Header4Bytes[2]) & 0xF0) >> 4; // EEEE
    $MPEGrawHeader['sample_rate']   = (ord($Header4Bytes[2]) & 0x0C) >> 2; //     FF
    $MPEGrawHeader['padding']       = (ord($Header4Bytes[2]) & 0x02) >> 1; //       G
    $MPEGrawHeader['private']       = (ord($Header4Bytes[2]) & 0x01);      //        H
    $MPEGrawHeader['channelmode']   = (ord($Header4Bytes[3]) & 0xC0) >> 6; // II
    $MPEGrawHeader['modeextension'] = (ord($Header4Bytes[3]) & 0x30) >> 4; //   JJ
    $MPEGrawHeader['copyright']     = (ord($Header4Bytes[3]) & 0x08) >> 3; //     K
    $MPEGrawHeader['original']      = (ord($Header4Bytes[3]) & 0x04) >> 2; //      L
    $MPEGrawHeader['emphasis']      = (ord($Header4Bytes[3]) & 0x03);      //       MM

    return $MPEGrawHeader;
  }
 

 View on GitHub View on Trac