$thisfile_id3v2 ['majorversion'] = ord ( $header {3} );
$thisfile_id3v2 ['minorversion'] = ord ( $header {4} );
$thisfile_id3v2 ['footer'] = true;
$thisfile_id3v2 ['majorversion_footer'] = ord ( $footer {3} );
$thisfile_id3v2 ['minorversion_footer'] = ord ( $footer {4} );
$frame_offset = 0;
$frame_textencoding = ord ( substr ( $parsedFrame ['data'], $frame_offset ++, 1 ) );
$frame_terminatorpos = strpos ( $parsedFrame ['data'], $this->TextEncodingTerminatorLookup ( $frame_textencoding ), $frame_offset );
if (ord ( substr ( $parsedFrame ['data'], $frame_terminatorpos + strlen ( $this->TextEncodingTerminatorLookup ( $frame_textencoding ) ), 1 ) ) === 0) {
$frame_description = substr ( $parsedFrame ['data'], $frame_offset, $frame_terminatorpos - $frame_offset );
if (ord ( $frame_description ) === 0) {
// Text encoding $xx
// Information <text string(s) according to encoding>
$frame_offset = 0;
$frame_textencoding = ord ( substr ( $parsedFrame ['data'], $frame_offset ++, 1 ) );
if ($hex) {
$returnstring .= str_pad ( dechex ( ord ( $string {$i} ) ), 2, '0', STR_PAD_LEFT );
static function LittleEndian2Float($byteword) {
return getid3_lib::BigEndian2Float ( strrev ( $byteword ) );
}
static function BigEndian2Float($byteword) {
$bitword = getid3_lib::BigEndian2Bin ( $byteword );
if (! $bitword) {
return 0;
}
$signbit = $bitword {0};
$intvalue = 0;
$bytewordlen = strlen ( $byteword );
for ($i = 0; $i < strlen($string); $i++) {
$returnstring .= str_pad(dechex(ord(substr($string, $i, 1))), 2, '0', STR_PAD_LEFT).' ';
for ($i = 0; $i < strlen($string); $i++) {
if (ord(substr($string, $i, 1)) <= 31) {
case 'array':
$returnstring .= '<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="2">';
if (!function_exists('LittleEndian2Float')) {
function LittleEndian2Float($byteword) {
return BigEndian2Float(strrev($byteword));
}
if (!function_exists('BigEndian2Float')) {
function BigEndian2Float($byteword) {
$bitword = BigEndian2Bin($byteword);
$signbit = $bitword{0};
$intvalue = 0;
$bytewordlen = strlen($byteword);
// Contains of 100 indexes (one Byte length) for easier lookup in file. Approximately solves problem with moving inside file.
// Each Byte has a value according this formula:
for ($i = 0; $i < 100; $i++) {
$thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData{$i});
// may be different pattern due to padding
$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3};
if ($SyncPattern2 === $SyncPattern1) {
$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3};
$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['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
$notenumber = ord(substr($trackdata, $eventsoffset++, 1));
$velocity = ord(substr($trackdata, $eventsoffset++, 1));
$notenumber = ord(substr($trackdata, $eventsoffset++, 1));
$velocity = ord(substr($trackdata, $eventsoffset++, 1));
$controllernum = ord(substr($trackdata, $eventsoffset++, 1));
$newvalue = ord(substr($trackdata, $eventsoffset++, 1));
$newprogramnum = ord(substr($trackdata, $eventsoffset++, 1));
$channelnumber = ord(substr($trackdata, $eventsoffset++, 1));
// Object ID GUID 128 // GUID for header object - GETID3_ASF_Header_Object
// Object Size QWORD 64 // size of header object, including 30 bytes of Header Object header
// Number of Header Objects DWORD 32 // number of objects in header object
// Reserved1 BYTE 8 // hardcoded: 0x01
// Object ID GUID 128 // GUID for file properties object - GETID3_ASF_File_Properties_Object
// Object Size QWORD 64 // size of file properties object, including 104 bytes of File Properties Object header
// File ID GUID 128 // unique ID - identical to File ID in Data Object
// File Size QWORD 64 // entire file in bytes. Invalid if Broadcast Flag == 1
// Creation Date QWORD 64 // date & time of file creation. Maybe invalid if Broadcast Flag == 1
// Data Packets Count QWORD 64 // number of data packets in Data Object. Invalid if Broadcast Flag == 1
// Play Duration QWORD 64 // playtime, in 100-nanosecond units. Invalid if Broadcast Flag == 1
// Object ID GUID 128 // GUID for stream properties object - GETID3_ASF_Stream_Properties_Object
// Object Size QWORD 64 // size of stream properties object, including 78 bytes of Stream Properties Object header
// Error Correction Type GUID 128 // GETID3_ASF_Audio_Spread for audio-only streams, GETID3_ASF_No_Error_Correction for other stream types
// Time Offset QWORD 64 // 100-nanosecond units. typically zero. added to all timestamps of samples in the stream
$PCDflags = fread($this->getid3->fp, 1);
$PCDisVertical = ((ord($PCDflags) & 0x01) ? true : false);
if ($PCDisVertical) {
$info['pcd']['data'][$PCD_width - $x][$y] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
$info['pcd']['data'][$PCD_width - $x][$y + 1] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
} else {
$info['pcd']['data'][$y][$x] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
$info['pcd']['data'][$y + 1][$x] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
}
case 'gnre' : // GeNRE
case 'keyw' : // KEYWord
function QuicktimeColorNameLookup($colordepthid) {
// Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100
// Data is stored as records of:
// * 4 bytes record type
// * 2 bytes size of data field type:
// 0x0002 = char (size field *= 1-byte)
// 0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB
// 0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD
// 0x0005 = float (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together
//echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'<br>';
$record_type = getid3_lib::BigEndian2Int ( substr ( $atom_data, $offset, 4 ) );
//'?' => substr($data, 44, 4),
'PictureControlAdjust' => $PictureControlAdjust [ord ( substr ( $data, 48, 1 ) )],
$attr = unpack ( $unpack_header, substr ( $buf, 0, $start_length ) );
if (! $this->get_os_type ( ord ( $attr ['os'] ) )) {
$thisInfo ['filemtime'] = getid3_lib::LittleEndian2Int ( $attr ['mtime'] );
$thisInfo ['raw'] ['id1'] = ord ( $attr ['cmethod'] );
$thisInfo ['raw'] ['id2'] = ord ( $attr ['cmethod'] );
$thisInfo ['raw'] ['cmethod'] = ord ( $attr ['cmethod'] );
$thisInfo ['raw'] ['os'] = ord ( $attr ['os'] );
$thisInfo ['raw'] ['xflags'] = ord ( $attr ['xflags'] );
$thisInfo ['raw'] ['flags'] = ord ( $attr ['flags'] );
}
$si1 = ord ( substr ( $buff, $fpointer + $idx ++, 1 ) );
$si2 = ord ( substr ( $buff, $fpointer + $idx ++, 1 ) );
while ( true ) {
if (ord ( $buff [$fpointer] ) == 0) {
while ( true ) {
if (ord ( $buff [$fpointer] ) == 0) {
if (substr($ISOheader, 1, 5) == 'CD001') {
switch (ord($ISOheader{0})) {
function ParseDirectoryRecord($directorydata) {
fseek($this->getid3->fp, $directorydata['location_bytes'], SEEK_SET);
$DirectoryRecordData = fread($this->getid3->fp, 1);
while (ord($DirectoryRecordData{0}) > 33) {
$DirectoryRecordData .= fread($this->getid3->fp, ord($DirectoryRecordData{0}) - 1);
$ThisDirectoryRecord['raw']['length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 0, 1));
$ThisDirectoryRecord['raw']['extended_attribute_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 1, 1));
$ThisDirectoryRecord['raw']['offset_logical'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 2, 4));
$ThisDirectoryRecord['raw']['filesize'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 10, 4));
// WORD bfType;
// DWORD bfSize;
// WORD bfReserved1;
// WORD bfReserved2;
// DWORD bfOffBits;
// DWORD Size; /* Size of this structure in bytes */
// DWORD Width; /* Bitmap width in pixels */
// DWORD Height; /* Bitmap height in pixel */
// DWORD ImageDataSize; /* Size of bitmap data in bytes */
// DWORD XResolution; /* X resolution of display device */
// DWORD YResolution; /* Y resolution of display device */
// DWORD ColorsUsed; /* Number of color table indices used */
// DWORD ColorsImportant; /* Number of important color indices */
$info['wavpack']['blockheader']['minor_version'] = ord($wavpackheader{8});
$info['wavpack']['blockheader']['major_version'] = ord($wavpackheader{9});
$info['wavpack']['blockheader']['track_number'] = ord($wavpackheader{10}); // unused
$info['wavpack']['blockheader']['index_number'] = ord($wavpackheader{11}); // unused
$info['wavpack']['blockheader']['total_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 12, 4));
}
$metablock['id'] = ord($metablockheader{0});
}
$metablock['size'] = getid3_lib::LittleEndian2Int(substr($metablockheader, 1)) * 2; // size is stored in words
// The 'Time stamp' is set to zero if directly at the beginning of the sound
// or after the previous event. All events MUST be sorted in chronological order.
// The 'Time stamp' is set to zero if directly at the beginning of the sound
// or after the previous event. All events MUST be sorted in chronological order.
$this->errors [] = 'Out-of-order timestamp in ' . $frame_name . ' (' . $val ['timestamp'] . ') for Event Type (' . $val ['typeid'] . ')';
} else {
// Content type $xx
// Content descriptor <text string according to encoding> $00 (00)
// Language $xx xx xx
// Short content descrip. <text string according to encoding> $00 (00)
// The actual text <full text string according to encoding>
// MIME type <text string> $00
// Filename <text string according to encoding> $00 (00)
// Content description <text string according to encoding> $00 (00)
// Encapsulated object <binary data>
// Check that the segment marker is not a Restart marker - restart markers don't have size or data after them
if ((ord($data{1}) < 0xD0) || (ord($data{1}) > 0xD7))
$headerdata[] = array(
'SegType' => ord($data{1}),
'SegName' => $GLOBALS['JPEG_Segment_Names'][ord($data{1})],
'SegDataStart' => $segdatastart,
// Adobe PDF Schema
'pdf:Keywords',
$FrameSizeBitsPerValue = (ord ( substr ( $SWFfileData, 8, 1 ) ) & 0xF8) >> 3;
$FrameSizeDataLength = ceil ( (5 + (4 * $FrameSizeBitsPerValue)) / 8 );
$FrameSizeDataString = str_pad ( decbin ( ord ( substr ( $SWFfileData, 8, 1 ) ) & 0x07 ), 3, '0', STR_PAD_LEFT );
for($i = 1; $i < $FrameSizeDataLength; $i ++) {
$FrameSizeDataString .= str_pad ( decbin ( ord ( substr ( $SWFfileData, 8 + $i, 1 ) ) ), 8, '0', STR_PAD_LEFT );
}
list ( $X1, $X2, $Y1, $Y2 ) = explode ( "\n", wordwrap ( $FrameSizeDataString, $FrameSizeBitsPerValue, "\n", 1 ) );
$ParsedID3v1['comment'] = substr($id3v1tag, 97, 30); // can't remove nulls yet, track detection depends on them
$ParsedID3v1['genreid'] = ord(substr($id3v1tag, 127, 1));
if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) {
$ParsedID3v1['track'] = ord(substr($ParsedID3v1['comment'], 29, 1));
define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one.
define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced.
define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID.
define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc.
define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode.
define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order.
define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels.
define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base.
case EBML_ID_CONTENTENCODINGORDER:
// get length of integer
$first_byte_int = ord($this->EBMLbuffer[$actual_offset]);
$EBMLidList[EBML_ID_CONTENTENCODING] = 'ContentEncoding';
$EBMLidList[EBML_ID_CONTENTENCODINGORDER] = 'ContentEncodingOrder';
$EBMLidList[EBML_ID_EDITIONFLAGHIDDEN] = 'EditionFlagHidden';
$EBMLidList[EBML_ID_EDITIONFLAGORDERED] = 'EditionFlagOrdered';
$this->info['id3v2']['header'] = true;
$this->info['id3v2']['majorversion'] = ord($header{3});
$this->info['id3v2']['minorversion'] = ord($header{4});
$this->info['avdataoffset'] += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
'id3v1' => array('id3v1' , $this->encoding_id3v1),
'id3v2' => array('id3v2' , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8