Parsed: 112286

  private static function EBML2Int($EBMLstring) {
    // http://matroska.org/specs/

    // Element ID coded with an UTF-8 like system:
    // 1xxx xxxx                                  - Class A IDs (2^7 -2 possible values) (base 0x8X)
    // 01xx xxxx  xxxx xxxx                       - Class B IDs (2^14-2 possible values) (base 0x4X 0xXX)
    // 001x xxxx  xxxx xxxx  xxxx xxxx            - Class C IDs (2^21-2 possible values) (base 0x2X 0xXX 0xXX)
    // 0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - Class D IDs (2^28-2 possible values) (base 0x1X 0xXX 0xXX 0xXX)
    // Values with all x at 0 and 1 are reserved (hence the -2).

    // Data size, in octets, is also coded with an UTF-8 like system :
    // 1xxx xxxx                                                                              - value 0 to  2^7-2
    // 01xx xxxx  xxxx xxxx                                                                   - value 0 to 2^14-2
    // 001x xxxx  xxxx xxxx  xxxx xxxx                                                        - value 0 to 2^21-2
    // 0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                             - value 0 to 2^28-2
    // 0000 1xxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                  - value 0 to 2^35-2
    // 0000 01xx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                       - value 0 to 2^42-2
    // 0000 001x  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx            - value 0 to 2^49-2
    // 0000 0001  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - value 0 to 2^56-2

    $first_byte_int = ord($EBMLstring[0]);
    if (0x80 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x7F);
    } elseif (0x40 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x3F);
    } elseif (0x20 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x1F);
    } elseif (0x10 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x0F);
    } elseif (0x08 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x07);
    } elseif (0x04 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x03);
    } elseif (0x02 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x01);
    } elseif (0x01 & $first_byte_int) {
      $EBMLstring[0] = chr($first_byte_int & 0x00);
    }

    return getid3_lib::BigEndian2Int($EBMLstring);
  }