ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
getid3_lib Class Reference

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g // More...

+ Collaboration diagram for getid3_lib:

Public Member Functions

 PrintHexBytes ($string, $hex=true, $spaces=true, $htmlsafe=true)
 SafeStripSlashes ($text)
 trunc ($floatnumber)
 CastAsInt ($floatnum)
 DecimalBinary2Float ($binarynumerator)
 NormalizeBinaryPoint ($binarypointnumber, $maxbits=52)
 Float2BinaryDecimal ($floatvalue)
 Float2String ($floatvalue, $bits)
 LittleEndian2Float ($byteword)
 BigEndian2Float ($byteword)
 BigEndian2Int ($byteword, $synchsafe=false, $signed=false)
 LittleEndian2Int ($byteword, $signed=false)
 BigEndian2Bin ($byteword)
 BigEndian2String ($number, $minbytes=1, $synchsafe=false, $signed=false)
 Dec2Bin ($number)
 Bin2Dec ($binstring, $signed=false)
 Bin2String ($binstring)
 LittleEndian2String ($number, $minbytes=1, $synchsafe=false)
 array_merge_clobber ($array1, $array2)
 array_merge_noclobber ($array1, $array2)
 fileextension ($filename, $numextensions=1)
 PlaytimeString ($playtimeseconds)
 image_type_to_mime_type ($imagetypeid)
 DateMac2Unix ($macdate)
 FixedPoint8_8 ($rawdata)
 FixedPoint16_16 ($rawdata)
 FixedPoint2_30 ($rawdata)
 CreateDeepArray ($ArrayPath, $Separator, $Value)
 array_max ($arraydata, $returnkey=false)
 array_min ($arraydata, $returnkey=false)
 md5_file ($file)
 sha1_file ($file)
 hash_data ($file, $offset, $end, $algorithm)
 iconv_fallback_int_utf8 ($charval)
 iconv_fallback_iso88591_utf8 ($string, $bom=false)
 iconv_fallback_iso88591_utf16be ($string, $bom=false)
 iconv_fallback_iso88591_utf16le ($string, $bom=false)
 iconv_fallback_iso88591_utf16 ($string)
 iconv_fallback_utf8_iso88591 ($string)
 iconv_fallback_utf8_utf16be ($string, $bom=false)
 iconv_fallback_utf8_utf16le ($string, $bom=false)
 iconv_fallback_utf8_utf16 ($string)
 iconv_fallback_utf16be_utf8 ($string)
 iconv_fallback_utf16le_utf8 ($string)
 iconv_fallback_utf16be_iso88591 ($string)
 iconv_fallback_utf16le_iso88591 ($string)
 iconv_fallback_utf16_iso88591 ($string)
 iconv_fallback_utf16_utf8 ($string)
 iconv_fallback ($in_charset, $out_charset, $string)
 MultiByteCharString2HTML ($string, $charset='ISO-8859-1')
 RGADnameLookup ($namecode)
 RGADoriginatorLookup ($originatorcode)
 RGADadjustmentLookup ($rawadjustment, $signbit)
 RGADgainString ($namecode, $originatorcode, $replaygain)
 RGADamplitude2dB ($amplitude)
 GetDataImageSize ($imgData)
 ImageTypesLookup ($imagetypeid)
 CopyTagsToComments (&$ThisFileInfo)
 EmbeddedLookup ($key, $begin, $end, $file, $name)
 IncludeDependency ($filename, $sourcefile, $DieOnFailure=false)

Detailed Description

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //

Definition at line 14 of file getid3.lib.php.

Member Function Documentation

getid3_lib::array_max (   $arraydata,
  $returnkey = false 
)

Definition at line 483 of file getid3.lib.php.

Referenced by getid3_mp3\getOnlyMPEGaudioInfoBruteForce().

{
$maxvalue = false;
$maxkey = false;
foreach ($arraydata as $key => $value) {
if (!is_array($value)) {
if ($value > $maxvalue) {
$maxvalue = $value;
$maxkey = $key;
}
}
}
return ($returnkey ? $maxkey : $maxvalue);
}

+ Here is the caller graph for this function:

getid3_lib::array_merge_clobber (   $array1,
  $array2 
)

Definition at line 358 of file getid3.lib.php.

Referenced by getid3_gzip\getid3_gzip(), getid3_tar\getid3_tar(), getid3_zip\getid3_zip(), and getid3_iso\ParseDirectoryRecord().

{
// written by kchireability*com
// taken from http://www.php.net/manual/en/function.array-merge-recursive.php
if (!is_array($array1) || !is_array($array2)) {
return false;
}
$newarray = $array1;
foreach ($array2 as $key => $val) {
if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
$newarray[$key] = getid3_lib::array_merge_clobber($newarray[$key], $val);
} else {
$newarray[$key] = $val;
}
}
return $newarray;
}

+ Here is the caller graph for this function:

getid3_lib::array_merge_noclobber (   $array1,
  $array2 
)

Definition at line 376 of file getid3.lib.php.

Referenced by getid3_asf\getid3_asf(), getid3_id3v2\getid3_id3v2(), and getid3_riff\getid3_riff().

{
if (!is_array($array1) || !is_array($array2)) {
return false;
}
$newarray = $array1;
foreach ($array2 as $key => $val) {
if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
$newarray[$key] = getid3_lib::array_merge_noclobber($newarray[$key], $val);
} elseif (!isset($newarray[$key])) {
$newarray[$key] = $val;
}
}
return $newarray;
}

+ Here is the caller graph for this function:

getid3_lib::array_min (   $arraydata,
  $returnkey = false 
)

Definition at line 497 of file getid3.lib.php.

{
$minvalue = false;
$minkey = false;
foreach ($arraydata as $key => $value) {
if (!is_array($value)) {
if ($value > $minvalue) {
$minvalue = $value;
$minkey = $key;
}
}
}
return ($returnkey ? $minkey : $minvalue);
}
getid3_lib::BigEndian2Bin (   $byteword)

Definition at line 271 of file getid3.lib.php.

Referenced by BigEndian2Float(), FixedPoint2_30(), getid3_flac\FLACparseSTREAMINFO(), getid3_aac\getAACADIFheaderFilepointer(), getid3_ac3\getid3_ac3(), getid3_id3v2\getid3_id3v2(), getid3_mpeg\getid3_mpeg(), and getid3_id3v2\ParseID3v2Frame().

{
$binvalue = '';
$bytewordlen = strlen($byteword);
for ($i = 0; $i < $bytewordlen; $i++) {
$binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT);
}
return $binvalue;
}

+ Here is the caller graph for this function:

getid3_lib::BigEndian2Float (   $byteword)

Definition at line 159 of file getid3.lib.php.

References BigEndian2Bin(), Bin2Dec(), and DecimalBinary2Float().

Referenced by getid3_riff\getid3_riff(), LittleEndian2Float(), getid3_id3v2\ParseID3v2Frame(), and AMFStream\readDouble().

{
// ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
// http://www.psc.edu/general/software/packages/ieee/ieee.html
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
$bitword = getid3_lib::BigEndian2Bin($byteword);
$signbit = $bitword{0};
switch (strlen($byteword) * 8) {
case 32:
$exponentbits = 8;
$fractionbits = 23;
break;
case 64:
$exponentbits = 11;
$fractionbits = 52;
break;
case 80:
// 80-bit Apple SANE format
// http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/
$exponentstring = substr($bitword, 1, 15);
$isnormalized = intval($bitword{16});
$fractionstring = substr($bitword, 17, 63);
$exponent = pow(2, getid3_lib::Bin2Dec($exponentstring) - 16383);
$fraction = $isnormalized + getid3_lib::DecimalBinary2Float($fractionstring);
$floatvalue = $exponent * $fraction;
if ($signbit == '1') {
$floatvalue *= -1;
}
return $floatvalue;
break;
default:
return false;
break;
}
$exponentstring = substr($bitword, 1, $exponentbits);
$fractionstring = substr($bitword, $exponentbits + 1, $fractionbits);
$exponent = getid3_lib::Bin2Dec($exponentstring);
$fraction = getid3_lib::Bin2Dec($fractionstring);
if (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction != 0)) {
// Not a Number
$floatvalue = false;
} elseif (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction == 0)) {
if ($signbit == '1') {
$floatvalue = '-infinity';
} else {
$floatvalue = '+infinity';
}
} elseif (($exponent == 0) && ($fraction == 0)) {
if ($signbit == '1') {
$floatvalue = -0;
} else {
$floatvalue = 0;
}
$floatvalue = ($signbit ? 0 : -0);
} elseif (($exponent == 0) && ($fraction != 0)) {
// These are 'unnormalized' values
$floatvalue = pow(2, (-1 * (pow(2, $exponentbits - 1) - 2))) * getid3_lib::DecimalBinary2Float($fractionstring);
if ($signbit == '1') {
$floatvalue *= -1;
}
} elseif ($exponent != 0) {
$floatvalue = pow(2, ($exponent - (pow(2, $exponentbits - 1) - 1))) * (1 + getid3_lib::DecimalBinary2Float($fractionstring));
if ($signbit == '1') {
$floatvalue *= -1;
}
}
return (float) $floatvalue;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::BigEndian2Int (   $byteword,
  $synchsafe = false,
  $signed = false 
)

Definition at line 234 of file getid3.lib.php.

References CastAsInt().

Referenced by getID3\analyze(), getid3_mp3\decodeMPEGaudioHeader(), getid3_matroska\EBML2Int(), getid3_riff\EitherEndian2Int(), FixedPoint16_16(), FixedPoint8_8(), getid3_flac\FLACparseAPPLICATION(), getid3_flac\FLACparseCUESHEET(), getid3_flac\FLACparseMETAdata(), getid3_flac\FLACparseSEEKTABLE(), getid3_flac\FLACparseSTREAMINFO(), getid3_au\getid3_au(), getid3_avr\getid3_avr(), getid3_flv\getid3_flv(), getid3_id3v2\getid3_id3v2(), getid3_lpac\getid3_lpac(), getid3_midi\getid3_midi(), getid3_mpeg\getid3_mpeg(), getid3_png\getid3_png(), getid3_quicktime\getid3_quicktime(), getid3_real\getid3_real(), getid3_riff\getid3_riff(), getid3_swf\getid3_swf(), getid3_szip\getid3_szip(), getid3_vqf\getid3_vqf(), iconv_fallback_utf16be_iso88591(), iconv_fallback_utf16be_utf8(), LittleEndian2Int(), getid3_mp3\MPEGaudioHeaderDecode(), MultiByteCharString2HTML(), getid3_id3v2\ParseID3v2Frame(), getid3_real\ParseOldRAheader(), getid3_quicktime\QuicktimeParseAtom(), getid3_quicktime\QuicktimeParseContainerAtom(), AMFStream\readByte(), and getid3_tiff\TIFFendian2Int().

{
$intvalue = 0;
$bytewordlen = strlen($byteword);
for ($i = 0; $i < $bytewordlen; $i++) {
if ($synchsafe) { // disregard MSB, effectively 7-bit bytes
$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7);
} else {
$intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i));
}
}
if ($signed && !$synchsafe) {
// synchsafe ints are not allowed to be signed
switch ($bytewordlen) {
case 1:
case 2:
case 3:
case 4:
$signmaskbit = 0x80 << (8 * ($bytewordlen - 1));
if ($intvalue & $signmaskbit) {
$intvalue = 0 - ($intvalue & ($signmaskbit - 1));
}
break;
default:
die('ERROR: Cannot have signed integers larger than 32-bits in getid3_lib::BigEndian2Int()');
break;
}
}
return getid3_lib::CastAsInt($intvalue);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::BigEndian2String (   $number,
  $minbytes = 1,
  $synchsafe = false,
  $signed = false 
)

Definition at line 281 of file getid3.lib.php.

Referenced by Float2String(), getid3_write_real\GenerateCONTchunk(), getid3_write_id3v2\GenerateID3v2FrameData(), getid3_write_id3v2\GenerateID3v2Tag(), getid3_write_real\GeneratePROPchunk(), getid3_write_real\GenerateRMFchunk(), and iconv_fallback_utf8_utf16be().

{
if ($number < 0) {
return false;
}
$maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF);
$intstring = '';
if ($signed) {
if ($minbytes > 4) {
die('ERROR: Cannot have signed integers larger than 32-bits in getid3_lib::BigEndian2String()');
}
$number = $number & (0x80 << (8 * ($minbytes - 1)));
}
while ($number != 0) {
$quotient = ($number / ($maskbyte + 1));
$intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring;
$number = floor($quotient);
}
return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT);
}

+ Here is the caller graph for this function:

getid3_lib::Bin2Dec (   $binstring,
  $signed = false 
)

Definition at line 316 of file getid3.lib.php.

References CastAsInt().

Referenced by BigEndian2Float(), Bin2String(), DecimalBinary2Float(), FixedPoint2_30(), getid3_flac\FLACparseSTREAMINFO(), Float2String(), getid3_aac\getAACADIFheaderFilepointer(), getid3_aac\getAACADTSheaderFilepointer(), getid3_mpeg\getid3_mpeg(), getid3_riff\getid3_riff(), getid3_swf\getid3_swf(), and getid3_id3v2\ParseID3v2Frame().

{
$signmult = 1;
if ($signed) {
if ($binstring{0} == '1') {
$signmult = -1;
}
$binstring = substr($binstring, 1);
}
$decvalue = 0;
for ($i = 0; $i < strlen($binstring); $i++) {
$decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i);
}
return getid3_lib::CastAsInt($decvalue * $signmult);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::Bin2String (   $binstring)

Definition at line 332 of file getid3.lib.php.

References Bin2Dec().

Referenced by getid3_aac\getAACADIFheaderFilepointer().

{
// return 'hi' for input of '0110100001101001'
$string = '';
$binstringreversed = strrev($binstring);
for ($i = 0; $i < strlen($binstringreversed); $i += 8) {
$string = chr(getid3_lib::Bin2Dec(strrev(substr($binstringreversed, $i, 8)))).$string;
}
return $string;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::CastAsInt (   $floatnum)

Definition at line 60 of file getid3.lib.php.

References trunc().

Referenced by BigEndian2Int(), Bin2Dec(), DateMac2Unix(), getid3_id3v2\getid3_id3v2(), getid3_mpc\getid3_mpc(), getid3_riff\getid3_riff(), and getid3_voc\getid3_voc().

{
// convert to float if not already
$floatnum = (float) $floatnum;
// convert a float to type int, only if possible
if (getid3_lib::trunc($floatnum) == $floatnum) {
// it's not floating point
if ($floatnum <= 1073741824) { // 2^30
// it's within int range
$floatnum = (int) $floatnum;
}
}
return $floatnum;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::CopyTagsToComments ( $ThisFileInfo)

Definition at line 1204 of file getid3.lib.php.

References MultiByteCharString2HTML().

{
// Copy all entries from ['tags'] into common ['comments']
if (!empty($ThisFileInfo['tags'])) {
foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) {
foreach ($tagarray as $tagname => $tagdata) {
foreach ($tagdata as $key => $value) {
if (!empty($value)) {
if (empty($ThisFileInfo['comments'][$tagname])) {
// fall through and append value
} elseif ($tagtype == 'id3v1') {
$newvaluelength = strlen(trim($value));
foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
$oldvaluelength = strlen(trim($existingvalue));
if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) {
// new value is identical but shorter-than (or equal-length to) one already in comments - skip
break 2;
}
}
} else {
$newvaluelength = strlen(trim($value));
foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
$oldvaluelength = strlen(trim($existingvalue));
if (($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
$ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
break 2;
}
}
}
if (empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
$ThisFileInfo['comments'][$tagname][] = trim($value);
}
}
}
}
}
// Copy to ['comments_html']
foreach ($ThisFileInfo['comments'] as $field => $values) {
foreach ($values as $index => $value) {
$ThisFileInfo['comments_html'][$field][$index] = str_replace('&#0;', '', getid3_lib::MultiByteCharString2HTML($value, $ThisFileInfo['encoding']));
}
}
}
}

+ Here is the call graph for this function:

getid3_lib::CreateDeepArray (   $ArrayPath,
  $Separator,
  $Value 
)

Definition at line 465 of file getid3.lib.php.

Referenced by getid3_gzip\getid3_gzip(), getid3_tar\getid3_tar(), getid3_zip\getid3_zip(), and getid3_iso\ParseDirectoryRecord().

{
// assigns $Value to a nested array path:
// $foo = getid3_lib::CreateDeepArray('/path/to/my', '/', 'file.txt')
// is the same as:
// $foo = array('path'=>array('to'=>'array('my'=>array('file.txt'))));
// or
// $foo['path']['to']['my'] = 'file.txt';
while ($ArrayPath && ($ArrayPath{0} == $Separator)) {
$ArrayPath = substr($ArrayPath, 1);
}
if (($pos = strpos($ArrayPath, $Separator)) !== false) {
$ReturnedArray[substr($ArrayPath, 0, $pos)] = getid3_lib::CreateDeepArray(substr($ArrayPath, $pos + 1), $Separator, $Value);
} else {
$ReturnedArray[$ArrayPath] = $Value;
}
return $ReturnedArray;
}

+ Here is the caller graph for this function:

getid3_lib::DateMac2Unix (   $macdate)

Definition at line 442 of file getid3.lib.php.

References CastAsInt().

Referenced by getid3_riff\getid3_riff(), and getid3_quicktime\QuicktimeParseAtom().

{
// Macintosh timestamp: seconds since 00:00h January 1, 1904
// UNIX timestamp: seconds since 00:00h January 1, 1970
return getid3_lib::CastAsInt($macdate - 2082844800);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::Dec2Bin (   $number)

Definition at line 302 of file getid3.lib.php.

Referenced by getid3_write_id3v2\GenerateID3v2FrameData(), getid3_riff\getid3_riff(), and getid3_id3v2\ParseID3v2Frame().

{
while ($number >= 256) {
$bytes[] = (($number / 256) - (floor($number / 256))) * 256;
$number = floor($number / 256);
}
$bytes[] = $number;
$binstring = '';
for ($i = 0; $i < count($bytes); $i++) {
$binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring;
}
return $binstring;
}

+ Here is the caller graph for this function:

getid3_lib::DecimalBinary2Float (   $binarynumerator)

Definition at line 76 of file getid3.lib.php.

References Bin2Dec().

Referenced by BigEndian2Float().

{
$numerator = getid3_lib::Bin2Dec($binarynumerator);
$denominator = getid3_lib::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator)));
return ($numerator / $denominator);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::EmbeddedLookup (   $key,
  $begin,
  $end,
  $file,
  $name 
)

Definition at line 1257 of file getid3.lib.php.

References $file.

Referenced by getid3_id3v2\FrameNameLongLookup(), getid3_id3v2\FrameNameShortLookup(), getid3_midi\GeneralMIDIinstrumentLookup(), getid3_midi\GeneralMIDIpercussionLookup(), getid3_id3v2\LanguageLookup(), getid3_id3v2\LookupCurrencyCountry(), getid3_id3v2\LookupCurrencyUnits(), getid3_riff\RIFFfourccLookup(), and getid3_riff\RIFFwFormatTagLookup().

{
// Cached
static $cache;
if (isset($cache[$file][$name])) {
return @$cache[$file][$name][$key];
}
// Init
$keylength = strlen($key);
$line_count = $end - $begin - 7;
// Open php file
$fp = fopen($file, 'r');
// Discard $begin lines
for ($i = 0; $i < ($begin + 3); $i++) {
fgets($fp, 1024);
}
// Loop thru line
while (0 < $line_count--) {
// Read line
$line = ltrim(fgets($fp, 1024), "\t ");
// METHOD A: only cache the matching key - less memory but slower on next lookup of not-previously-looked-up key
//$keycheck = substr($line, 0, $keylength);
//if ($key == $keycheck) {
// $cache[$file][$name][$keycheck] = substr($line, $keylength + 1);
// break;
//}
// METHOD B: cache all keys in this lookup - more memory but faster on next lookup of not-previously-looked-up key
//$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1));
@list($ThisKey, $ThisValue) = explode("\t", $line, 2);
$cache[$file][$name][$ThisKey] = trim($ThisValue);
}
// Close and return
fclose($fp);
return @$cache[$file][$name][$key];
}

+ Here is the caller graph for this function:

getid3_lib::fileextension (   $filename,
  $numextensions = 1 
)

Definition at line 392 of file getid3.lib.php.

References $filename.

Referenced by getid3_optimfrog\ParseOptimFROGheader45().

{
if (strstr($filename, '.')) {
$reversedfilename = strrev($filename);
$offset = 0;
for ($i = 0; $i < $numextensions; $i++) {
$offset = strpos($reversedfilename, '.', $offset + 1);
if ($offset === false) {
return '';
}
}
return strrev(substr($reversedfilename, 0, $offset));
}
return '';
}

+ Here is the caller graph for this function:

getid3_lib::FixedPoint16_16 (   $rawdata)

Definition at line 454 of file getid3.lib.php.

References BigEndian2Int().

Referenced by getid3_riff\getid3_riff(), and getid3_quicktime\QuicktimeParseAtom().

{
return getid3_lib::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (getid3_lib::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::FixedPoint2_30 (   $rawdata)

Definition at line 459 of file getid3.lib.php.

References BigEndian2Bin(), and Bin2Dec().

Referenced by getid3_bmp\getid3_bmp(), and getid3_quicktime\QuicktimeParseAtom().

{
$binarystring = getid3_lib::BigEndian2Bin($rawdata);
return getid3_lib::Bin2Dec(substr($binarystring, 0, 2)) + (float) (getid3_lib::Bin2Dec(substr($binarystring, 2, 30)) / 1073741824);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::FixedPoint8_8 (   $rawdata)

Definition at line 449 of file getid3.lib.php.

References BigEndian2Int().

Referenced by getid3_quicktime\QuicktimeParseAtom().

{
return getid3_lib::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (getid3_lib::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::Float2BinaryDecimal (   $floatvalue)

Definition at line 107 of file getid3.lib.php.

References trunc().

Referenced by Float2String().

{
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
$maxbits = 128; // to how many bits of precision should the calculations be taken?
$intpart = getid3_lib::trunc($floatvalue);
$floatpart = abs($floatvalue - $intpart);
$pointbitstring = '';
while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) {
$floatpart *= 2;
$pointbitstring .= (string) getid3_lib::trunc($floatpart);
$floatpart -= getid3_lib::trunc($floatpart);
}
$binarypointnumber = decbin($intpart).'.'.$pointbitstring;
return $binarypointnumber;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::Float2String (   $floatvalue,
  $bits 
)

Definition at line 123 of file getid3.lib.php.

References BigEndian2String(), Bin2Dec(), Float2BinaryDecimal(), and NormalizeBinaryPoint().

Referenced by getid3_write_id3v2\GenerateID3v2FrameData().

{
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html
switch ($bits) {
case 32:
$exponentbits = 8;
$fractionbits = 23;
break;
case 64:
$exponentbits = 11;
$fractionbits = 52;
break;
default:
return false;
break;
}
if ($floatvalue >= 0) {
$signbit = '0';
} else {
$signbit = '1';
}
$normalizedbinary = getid3_lib::NormalizeBinaryPoint(getid3_lib::Float2BinaryDecimal($floatvalue), $fractionbits);
$biasedexponent = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent']; // (127 or 1023) +/- exponent
$exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT);
$fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT);
return getid3_lib::BigEndian2String(getid3_lib::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring), $bits % 8, false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::GetDataImageSize (   $imgData)

Definition at line 1170 of file getid3.lib.php.

Referenced by getid3_jpg\getid3_jpg(), getid3_id3v2\ParseID3v2Frame(), and getid3_ogg\ParseVorbisCommentsFilepointer().

{
$GetDataImageSize = false;
if ($tempfilename = tempnam('*', 'getID3')) {
if ($tmp = @fopen($tempfilename, 'wb')) {
fwrite($tmp, $imgData);
fclose($tmp);
$GetDataImageSize = @GetImageSize($tempfilename);
}
unlink($tempfilename);
}
return $GetDataImageSize;
}

+ Here is the caller graph for this function:

getid3_lib::hash_data (   $file,
  $offset,
  $end,
  $algorithm 
)

Definition at line 582 of file getid3.lib.php.

References $file, $result, $size, and GETID3_FREAD_BUFFER_SIZE.

Referenced by getID3\getHashdata().

{
switch ($algorithm) {
case 'md5':
$hash_function = 'md5_file';
$unix_call = 'md5sum';
$windows_call = 'md5sum.exe';
$hash_length = 32;
break;
case 'sha1':
$hash_function = 'sha1_file';
$unix_call = 'sha1sum';
$windows_call = 'sha1sum.exe';
$hash_length = 40;
break;
default:
die('Invalid algorithm ('.$algorithm.') in getid3_lib::hash_data()');
break;
}
$size = $end - $offset;
while (true) {
if (GETID3_OS_ISWINDOWS) {
// It seems that sha1sum.exe for Windows only works on physical files, does not accept piped data
// Fall back to create-temp-file method:
if ($algorithm == 'sha1') {
break;
}
$RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call);
foreach ($RequiredFiles as $required_file) {
if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
// helper apps not available - fall back to old method
break;
}
}
$commandline = GETID3_HELPERAPPSDIR.'head.exe -c '.$end.' "'.escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $file)).'" | ';
$commandline .= GETID3_HELPERAPPSDIR.'tail.exe -c '.$size.' | ';
$commandline .= GETID3_HELPERAPPSDIR.$windows_call;
} else {
$commandline = 'head -c'.$end.' '.escapeshellarg($file).' | ';
$commandline .= 'tail -c'.$size.' | ';
$commandline .= $unix_call;
}
if ((bool) ini_get('safe_mode')) {
$ThisFileInfo['warning'][] = 'PHP running in Safe Mode - backtick operator not available, using slower non-system-call '.$algorithm.' algorithm';
break;
}
return substr(`$commandline`, 0, $hash_length);
}
// try to create a temporary file in the system temp directory - invalid dirname should force to system temp dir
if (($data_filename = tempnam('*', 'getID3')) === false) {
// can't find anywhere to create a temp file, just die
return false;
}
// Init
$result = false;
// copy parts of file
if ($fp = @fopen($file, 'rb')) {
if ($fp_data = @fopen($data_filename, 'wb')) {
fseek($fp, $offset, SEEK_SET);
$byteslefttowrite = $end - $offset;
while (($byteslefttowrite > 0) && ($buffer = fread($fp, GETID3_FREAD_BUFFER_SIZE))) {
$byteswritten = fwrite($fp_data, $buffer, $byteslefttowrite);
$byteslefttowrite -= $byteswritten;
}
fclose($fp_data);
$result = getid3_lib::$hash_function($data_filename);
}
fclose($fp);
}
unlink($data_filename);
return $result;
}

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback (   $in_charset,
  $out_charset,
  $string 
)

Definition at line 951 of file getid3.lib.php.

Referenced by getID3\CharConvert(), getid3_writetags\FormatDataForAPE(), getid3_writetags\FormatDataForID3v1(), getid3_writetags\FormatDataForID3v2(), getid3_writetags\FormatDataForReal(), getid3_writetags\FormatDataForVorbisComment(), getid3_iso\ParseDirectoryRecord(), getid3_id3v2\ParseID3v2Frame(), getid3_iso\ParsePathTable(), getid3_asf\TrimConvert(), and getid3_asf\WMpictureTypeLookup().

{
if ($in_charset == $out_charset) {
return $string;
}
static $iconv_broken_or_unavailable = array();
if (is_null(@$iconv_broken_or_unavailable[$in_charset.'_'.$out_charset])) {
$GETID3_ICONV_TEST_STRING = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ';
// Check iconv()
if (function_exists('iconv')) {
if (@iconv($in_charset, 'ISO-8859-1', @iconv('ISO-8859-1', $in_charset, $GETID3_ICONV_TEST_STRING)) == $GETID3_ICONV_TEST_STRING) {
if (@iconv($out_charset, 'ISO-8859-1', @iconv('ISO-8859-1', $out_charset, $GETID3_ICONV_TEST_STRING)) == $GETID3_ICONV_TEST_STRING) {
// everything works, use iconv()
$iconv_broken_or_unavailable[$in_charset.'_'.$out_charset] = false;
} else {
// iconv() available, but broken. Use getID3()'s iconv_fallback() conversions instead
// known issue in PHP v4.1.x
$iconv_broken_or_unavailable[$in_charset.'_'.$out_charset] = true;
}
} else {
// iconv() available, but broken. Use getID3()'s iconv_fallback() conversions instead
// known issue in PHP v4.1.x
$iconv_broken_or_unavailable[$in_charset.'_'.$out_charset] = true;
}
} else {
// iconv() unavailable, use getID3()'s iconv_fallback() conversions
$iconv_broken_or_unavailable[$in_charset.'_'.$out_charset] = true;
}
}
if ($iconv_broken_or_unavailable[$in_charset.'_'.$out_charset]) {
static $ConversionFunctionList = array();
if (empty($ConversionFunctionList)) {
$ConversionFunctionList['ISO-8859-1']['UTF-8'] = 'iconv_fallback_iso88591_utf8';
$ConversionFunctionList['ISO-8859-1']['UTF-16'] = 'iconv_fallback_iso88591_utf16';
$ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be';
$ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le';
$ConversionFunctionList['UTF-8']['ISO-8859-1'] = 'iconv_fallback_utf8_iso88591';
$ConversionFunctionList['UTF-8']['UTF-16'] = 'iconv_fallback_utf8_utf16';
$ConversionFunctionList['UTF-8']['UTF-16BE'] = 'iconv_fallback_utf8_utf16be';
$ConversionFunctionList['UTF-8']['UTF-16LE'] = 'iconv_fallback_utf8_utf16le';
$ConversionFunctionList['UTF-16']['ISO-8859-1'] = 'iconv_fallback_utf16_iso88591';
$ConversionFunctionList['UTF-16']['UTF-8'] = 'iconv_fallback_utf16_utf8';
$ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591';
$ConversionFunctionList['UTF-16LE']['UTF-8'] = 'iconv_fallback_utf16le_utf8';
$ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591';
$ConversionFunctionList['UTF-16BE']['UTF-8'] = 'iconv_fallback_utf16be_utf8';
}
if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) {
$ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)];
return getid3_lib::$ConversionFunction($string);
}
die('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
}
if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) {
switch ($out_charset) {
case 'ISO-8859-1':
$converted_string = rtrim($converted_string, "\x00");
break;
}
return $converted_string;
}
// iconv() may sometimes fail with "illegal character in input string" error message
// and return an empty string, but returning the unconverted string is more useful
return $string;
}

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback_int_utf8 (   $charval)

Definition at line 669 of file getid3.lib.php.

Referenced by iconv_fallback_iso88591_utf8(), iconv_fallback_utf16be_utf8(), and iconv_fallback_utf16le_utf8().

{
if ($charval < 128) {
// 0bbbbbbb
$newcharstring = chr($charval);
} elseif ($charval < 2048) {
// 110bbbbb 10bbbbbb
$newcharstring = chr(($charval >> 6) | 0xC0);
$newcharstring .= chr(($charval & 0x3F) | 0x80);
} elseif ($charval < 65536) {
// 1110bbbb 10bbbbbb 10bbbbbb
$newcharstring = chr(($charval >> 12) | 0xE0);
$newcharstring .= chr(($charval >> 6) | 0xC0);
$newcharstring .= chr(($charval & 0x3F) | 0x80);
} else {
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
$newcharstring = chr(($charval >> 18) | 0xF0);
$newcharstring .= chr(($charval >> 12) | 0xC0);
$newcharstring .= chr(($charval >> 6) | 0xC0);
$newcharstring .= chr(($charval & 0x3F) | 0x80);
}
return $newcharstring;
}

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback_iso88591_utf16 (   $string)

Definition at line 734 of file getid3.lib.php.

References iconv_fallback_iso88591_utf16le().

{
}

+ Here is the call graph for this function:

getid3_lib::iconv_fallback_iso88591_utf16be (   $string,
  $bom = false 
)

Definition at line 710 of file getid3.lib.php.

{
$newcharstring = '';
if ($bom) {
$newcharstring .= "\xFE\xFF";
}
for ($i = 0; $i < strlen($string); $i++) {
$newcharstring .= "\x00".$string{$i};
}
return $newcharstring;
}
getid3_lib::iconv_fallback_iso88591_utf16le (   $string,
  $bom = false 
)

Definition at line 722 of file getid3.lib.php.

Referenced by iconv_fallback_iso88591_utf16().

{
$newcharstring = '';
if ($bom) {
$newcharstring .= "\xFF\xFE";
}
for ($i = 0; $i < strlen($string); $i++) {
$newcharstring .= $string{$i}."\x00";
}
return $newcharstring;
}

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback_iso88591_utf8 (   $string,
  $bom = false 
)

Definition at line 693 of file getid3.lib.php.

References iconv_fallback_int_utf8().

{
if (function_exists('utf8_encode')) {
return utf8_encode($string);
}
// utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
$newcharstring = '';
if ($bom) {
$newcharstring .= "\xEF\xBB\xBF";
}
for ($i = 0; $i < strlen($string); $i++) {
$charval = ord($string{$i});
$newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval);
}
return $newcharstring;
}

+ Here is the call graph for this function:

getid3_lib::iconv_fallback_utf16_iso88591 (   $string)

Definition at line 930 of file getid3.lib.php.

References iconv_fallback_utf16be_iso88591(), and iconv_fallback_utf16le_iso88591().

{
$bom = substr($string, 0, 2);
if ($bom == "\xFE\xFF") {
return getid3_lib::iconv_fallback_utf16be_iso88591(substr($string, 2));
} elseif ($bom == "\xFF\xFE") {
return getid3_lib::iconv_fallback_utf16le_iso88591(substr($string, 2));
}
return $string;
}

+ Here is the call graph for this function:

getid3_lib::iconv_fallback_utf16_utf8 (   $string)

Definition at line 941 of file getid3.lib.php.

References iconv_fallback_utf16be_utf8(), and iconv_fallback_utf16le_utf8().

{
$bom = substr($string, 0, 2);
if ($bom == "\xFE\xFF") {
return getid3_lib::iconv_fallback_utf16be_utf8(substr($string, 2));
} elseif ($bom == "\xFF\xFE") {
return getid3_lib::iconv_fallback_utf16le_utf8(substr($string, 2));
}
return $string;
}

+ Here is the call graph for this function:

getid3_lib::iconv_fallback_utf16be_iso88591 (   $string)

Definition at line 902 of file getid3.lib.php.

References BigEndian2Int().

Referenced by iconv_fallback_utf16_iso88591().

{
if (substr($string, 0, 2) == "\xFE\xFF") {
// strip BOM
$string = substr($string, 2);
}
$newcharstring = '';
for ($i = 0; $i < strlen($string); $i += 2) {
$charval = getid3_lib::BigEndian2Int(substr($string, $i, 2));
$newcharstring .= (($charval < 256) ? chr($charval) : '?');
}
return $newcharstring;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback_utf16be_utf8 (   $string)

Definition at line 874 of file getid3.lib.php.

References BigEndian2Int(), and iconv_fallback_int_utf8().

Referenced by iconv_fallback_utf16_utf8().

{
if (substr($string, 0, 2) == "\xFE\xFF") {
// strip BOM
$string = substr($string, 2);
}
$newcharstring = '';
for ($i = 0; $i < strlen($string); $i += 2) {
$charval = getid3_lib::BigEndian2Int(substr($string, $i, 2));
$newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval);
}
return $newcharstring;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback_utf16le_iso88591 (   $string)

Definition at line 916 of file getid3.lib.php.

References LittleEndian2Int().

Referenced by iconv_fallback_utf16_iso88591().

{
if (substr($string, 0, 2) == "\xFF\xFE") {
// strip BOM
$string = substr($string, 2);
}
$newcharstring = '';
for ($i = 0; $i < strlen($string); $i += 2) {
$charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2));
$newcharstring .= (($charval < 256) ? chr($charval) : '?');
}
return $newcharstring;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback_utf16le_utf8 (   $string)

Definition at line 888 of file getid3.lib.php.

References iconv_fallback_int_utf8(), and LittleEndian2Int().

Referenced by iconv_fallback_utf16_utf8().

{
if (substr($string, 0, 2) == "\xFF\xFE") {
// strip BOM
$string = substr($string, 2);
}
$newcharstring = '';
for ($i = 0; $i < strlen($string); $i += 2) {
$charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2));
$newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval);
}
return $newcharstring;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::iconv_fallback_utf8_iso88591 (   $string)

Definition at line 739 of file getid3.lib.php.

{
if (function_exists('utf8_decode')) {
return utf8_decode($string);
}
// utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
$newcharstring = '';
$offset = 0;
$stringlength = strlen($string);
while ($offset < $stringlength) {
if ((ord($string{$offset}) | 0x07) == 0xF7) {
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
((ord($string{($offset + 1)}) & 0x3F) << 12) &
((ord($string{($offset + 2)}) & 0x3F) << 6) &
(ord($string{($offset + 3)}) & 0x3F);
$offset += 4;
} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
// 1110bbbb 10bbbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
((ord($string{($offset + 1)}) & 0x3F) << 6) &
(ord($string{($offset + 2)}) & 0x3F);
$offset += 3;
} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
// 110bbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
(ord($string{($offset + 1)}) & 0x3F);
$offset += 2;
} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
// 0bbbbbbb
$charval = ord($string{$offset});
$offset += 1;
} else {
// error? throw some kind of warning here?
$charval = false;
$offset += 1;
}
if ($charval !== false) {
$newcharstring .= (($charval < 256) ? chr($charval) : '?');
}
}
return $newcharstring;
}
getid3_lib::iconv_fallback_utf8_utf16 (   $string)

Definition at line 869 of file getid3.lib.php.

References iconv_fallback_utf8_utf16le().

{
}

+ Here is the call graph for this function:

getid3_lib::iconv_fallback_utf8_utf16be (   $string,
  $bom = false 
)

Definition at line 783 of file getid3.lib.php.

References BigEndian2String().

{
$newcharstring = '';
if ($bom) {
$newcharstring .= "\xFE\xFF";
}
$offset = 0;
$stringlength = strlen($string);
while ($offset < $stringlength) {
if ((ord($string{$offset}) | 0x07) == 0xF7) {
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
((ord($string{($offset + 1)}) & 0x3F) << 12) &
((ord($string{($offset + 2)}) & 0x3F) << 6) &
(ord($string{($offset + 3)}) & 0x3F);
$offset += 4;
} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
// 1110bbbb 10bbbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
((ord($string{($offset + 1)}) & 0x3F) << 6) &
(ord($string{($offset + 2)}) & 0x3F);
$offset += 3;
} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
// 110bbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
(ord($string{($offset + 1)}) & 0x3F);
$offset += 2;
} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
// 0bbbbbbb
$charval = ord($string{$offset});
$offset += 1;
} else {
// error? throw some kind of warning here?
$charval = false;
$offset += 1;
}
if ($charval !== false) {
$newcharstring .= (($charval < 65536) ? getid3_lib::BigEndian2String($charval, 2) : "\x00".'?');
}
}
return $newcharstring;
}

+ Here is the call graph for this function:

getid3_lib::iconv_fallback_utf8_utf16le (   $string,
  $bom = false 
)

Definition at line 826 of file getid3.lib.php.

References LittleEndian2String().

Referenced by iconv_fallback_utf8_utf16().

{
$newcharstring = '';
if ($bom) {
$newcharstring .= "\xFF\xFE";
}
$offset = 0;
$stringlength = strlen($string);
while ($offset < $stringlength) {
if ((ord($string{$offset}) | 0x07) == 0xF7) {
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
((ord($string{($offset + 1)}) & 0x3F) << 12) &
((ord($string{($offset + 2)}) & 0x3F) << 6) &
(ord($string{($offset + 3)}) & 0x3F);
$offset += 4;
} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
// 1110bbbb 10bbbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
((ord($string{($offset + 1)}) & 0x3F) << 6) &
(ord($string{($offset + 2)}) & 0x3F);
$offset += 3;
} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
// 110bbbbb 10bbbbbb
$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
(ord($string{($offset + 1)}) & 0x3F);
$offset += 2;
} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
// 0bbbbbbb
$charval = ord($string{$offset});
$offset += 1;
} else {
// error? maybe throw some warning here?
$charval = false;
$offset += 1;
}
if ($charval !== false) {
$newcharstring .= (($charval < 65536) ? getid3_lib::LittleEndian2String($charval, 2) : '?'."\x00");
}
}
return $newcharstring;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::image_type_to_mime_type (   $imagetypeid)

Definition at line 419 of file getid3.lib.php.

Referenced by getid3_ogg\ParseVorbisCommentsFilepointer().

{
// only available in PHP v4.3.0+
static $image_type_to_mime_type = array();
if (empty($image_type_to_mime_type)) {
$image_type_to_mime_type[1] = 'image/gif'; // GIF
$image_type_to_mime_type[2] = 'image/jpeg'; // JPEG
$image_type_to_mime_type[3] = 'image/png'; // PNG
$image_type_to_mime_type[4] = 'application/x-shockwave-flash'; // Flash
$image_type_to_mime_type[5] = 'image/psd'; // PSD
$image_type_to_mime_type[6] = 'image/bmp'; // BMP
$image_type_to_mime_type[7] = 'image/tiff'; // TIFF: little-endian (Intel)
$image_type_to_mime_type[8] = 'image/tiff'; // TIFF: big-endian (Motorola)
//$image_type_to_mime_type[9] = 'image/jpc'; // JPC
//$image_type_to_mime_type[10] = 'image/jp2'; // JPC
//$image_type_to_mime_type[11] = 'image/jpx'; // JPC
//$image_type_to_mime_type[12] = 'image/jb2'; // JPC
$image_type_to_mime_type[13] = 'application/x-shockwave-flash'; // Shockwave
$image_type_to_mime_type[14] = 'image/iff'; // IFF
}
return (isset($image_type_to_mime_type[$imagetypeid]) ? $image_type_to_mime_type[$imagetypeid] : 'application/octet-stream');
}

+ Here is the caller graph for this function:

getid3_lib::ImageTypesLookup (   $imagetypeid)

Definition at line 1183 of file getid3.lib.php.

{
static $ImageTypesLookup = array();
if (empty($ImageTypesLookup)) {
$ImageTypesLookup[1] = 'gif';
$ImageTypesLookup[2] = 'jpeg';
$ImageTypesLookup[3] = 'png';
$ImageTypesLookup[4] = 'swf';
$ImageTypesLookup[5] = 'psd';
$ImageTypesLookup[6] = 'bmp';
$ImageTypesLookup[7] = 'tiff (little-endian)';
$ImageTypesLookup[8] = 'tiff (big-endian)';
$ImageTypesLookup[9] = 'jpc';
$ImageTypesLookup[10] = 'jp2';
$ImageTypesLookup[11] = 'jpx';
$ImageTypesLookup[12] = 'jb2';
$ImageTypesLookup[13] = 'swc';
$ImageTypesLookup[14] = 'iff';
}
return (isset($ImageTypesLookup[$imagetypeid]) ? $ImageTypesLookup[$imagetypeid] : '');
}
getid3_lib::IncludeDependency (   $filename,
  $sourcefile,
  $DieOnFailure = false 
)

Definition at line 1301 of file getid3.lib.php.

References $filename.

Referenced by getID3\analyze(), getid3_lyrics3\getid3_lyrics3(), getid3_riff\getid3_riff(), getid3_shorten\getid3_shorten(), getid3_wavpack\getid3_wavpack(), getid3_riff\ParseRIFF(), and getid3_writetags\WriteTags().

{
global $GETID3_ERRORARRAY;
if (file_exists($filename)) {
if (@include_once($filename)) {
return true;
} else {
$diemessage = basename($sourcefile).' depends on '.$filename.', which has errors';
}
} else {
$diemessage = basename($sourcefile).' depends on '.$filename.', which is missing';
}
if ($DieOnFailure) {
die($diemessage);
} else {
$GETID3_ERRORARRAY[] = $diemessage;
}
return false;
}

+ Here is the caller graph for this function:

getid3_lib::LittleEndian2Float (   $byteword)

Definition at line 154 of file getid3.lib.php.

References BigEndian2Float().

Referenced by getid3_mp3\decodeMPEGaudioHeader(), and getid3_riff\getid3_riff().

{
return getid3_lib::BigEndian2Float(strrev($byteword));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::LittleEndian2Int (   $byteword,
  $signed = false 
)

Definition at line 266 of file getid3.lib.php.

References BigEndian2Int().

Referenced by getid3_riff\EitherEndian2Int(), getid3_ac3\getid3_ac3(), getid3_apetag\getid3_apetag(), getid3_asf\getid3_asf(), getid3_bmp\getid3_bmp(), getid3_bonk\getid3_bonk(), getid3_exe\getid3_exe(), getid3_gif\getid3_gif(), getid3_gzip\getid3_gzip(), getid3_la\getid3_la(), getid3_monkey\getid3_monkey(), getid3_mpc\getid3_mpc(), getid3_ogg\getid3_ogg(), getid3_riff\getid3_riff(), getid3_rkau\getid3_rkau(), getid3_shorten\getid3_shorten(), getid3_svg\getid3_svg(), getid3_swf\getid3_swf(), getid3_tta\getid3_tta(), getid3_voc\getid3_voc(), getid3_wavpack\getid3_wavpack(), getid3_nsv\getNSVfHeaderFilepointer(), getid3_nsv\getNSVsHeaderFilepointer(), getid3_bonk\HandleBonkTags(), iconv_fallback_utf16le_iso88591(), iconv_fallback_utf16le_utf8(), MultiByteCharString2HTML(), getid3_apetag\parseAPEheaderFooter(), getid3_bink\ParseBink(), getid3_iso\ParseDirectoryRecord(), getid3_ogg\ParseOggPageHeader(), getid3_optimfrog\ParseOptimFROGheader42(), getid3_optimfrog\ParseOptimFROGheader45(), getid3_iso\ParsePathTable(), getid3_iso\ParsePrimaryVolumeDescriptor(), getid3_riff\ParseRIFF(), getid3_iso\ParseSupplementaryVolumeDescriptor(), getid3_ogg\ParseVorbisCommentsFilepointer(), getid3_riff\RIFFparseWAVEFORMATex(), getid3_riff\RIFFparseWavPackHeader(), getid3_tiff\TIFFendian2Int(), getid3_zip\ZIPparseCentralDirectory(), getid3_zip\ZIPparseEndOfCentralDirectory(), and getid3_zip\ZIPparseLocalFileHeader().

{
return getid3_lib::BigEndian2Int(strrev($byteword), false, $signed);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::LittleEndian2String (   $number,
  $minbytes = 1,
  $synchsafe = false 
)

Definition at line 343 of file getid3.lib.php.

Referenced by getid3_write_apetag\GenerateAPEtag(), getid3_write_apetag\GenerateAPEtagHeaderFooter(), iconv_fallback_utf8_utf16le(), and getid3_riff\ParseRIFFdata().

{
$intstring = '';
while ($number > 0) {
if ($synchsafe) {
$intstring = $intstring.chr($number & 127);
$number >>= 7;
} else {
$intstring = $intstring.chr($number & 255);
$number >>= 8;
}
}
return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT);
}

+ Here is the caller graph for this function:

getid3_lib::md5_file (   $file)

Definition at line 512 of file getid3.lib.php.

References $file.

Referenced by getID3\getHashdata().

{
// md5_file() exists in PHP 4.2.0+.
if (function_exists('md5_file')) {
return md5_file($file);
}
if (GETID3_OS_ISWINDOWS) {
$RequiredFiles = array('cygwin1.dll', 'md5sum.exe');
foreach ($RequiredFiles as $required_file) {
if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
die(implode(' and ', $RequiredFiles).' are required in '.GETID3_HELPERAPPSDIR.' for getid3_lib::md5_file() to function under Windows in PHP < v4.2.0');
}
}
$commandline = GETID3_HELPERAPPSDIR.'md5sum.exe "'.str_replace('/', DIRECTORY_SEPARATOR, $file).'"';
if (ereg("^[\\]?([0-9a-f]{32})", strtolower(`$commandline`), $r)) {
return $r[1];
}
} else {
// The following works under UNIX only
$file = str_replace('`', '\\`', $file);
if (ereg("^([0-9a-f]{32})[ \t\n\r]", `md5sum "$file"`, $r)) {
return $r[1];
}
}
return false;
}

+ Here is the caller graph for this function:

getid3_lib::MultiByteCharString2HTML (   $string,
  $charset = 'ISO-8859-1' 
)

Definition at line 1023 of file getid3.lib.php.

References BigEndian2Int(), and LittleEndian2Int().

Referenced by CopyTagsToComments(), and getID3\HandleAllTags().

{
$HTMLstring = '';
switch ($charset) {
case 'ISO-8859-1':
case 'ISO8859-1':
case 'ISO-8859-15':
case 'ISO8859-15':
case 'cp866':
case 'ibm866':
case '866':
case 'cp1251':
case 'Windows-1251':
case 'win-1251':
case '1251':
case 'cp1252':
case 'Windows-1252':
case '1252':
case 'KOI8-R':
case 'koi8-ru':
case 'koi8r':
case 'BIG5':
case '950':
case 'GB2312':
case '936':
case 'BIG5-HKSCS':
case 'Shift_JIS':
case 'SJIS':
case '932':
case 'EUC-JP':
case 'EUCJP':
$HTMLstring = htmlentities($string, ENT_COMPAT, $charset);
break;
case 'UTF-8':
$strlen = strlen($string);
for ($i = 0; $i < $strlen; $i++) {
$char_ord_val = ord($string{$i});
$charval = 0;
if ($char_ord_val < 0x80) {
$charval = $char_ord_val;
} elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F) {
$charval = (($char_ord_val & 0x07) << 18);
$charval += ((ord($string{++$i}) & 0x3F) << 12);
$charval += ((ord($string{++$i}) & 0x3F) << 6);
$charval += (ord($string{++$i}) & 0x3F);
} elseif ((($char_ord_val & 0xE0) >> 5) == 0x07) {
$charval = (($char_ord_val & 0x0F) << 12);
$charval += ((ord($string{++$i}) & 0x3F) << 6);
$charval += (ord($string{++$i}) & 0x3F);
} elseif ((($char_ord_val & 0xC0) >> 6) == 0x03) {
$charval = (($char_ord_val & 0x1F) << 6);
$charval += (ord($string{++$i}) & 0x3F);
}
if (($charval >= 32) && ($charval <= 127)) {
$HTMLstring .= chr($charval);
} else {
$HTMLstring .= '&#'.$charval.';';
}
}
break;
case 'UTF-16LE':
for ($i = 0; $i < strlen($string); $i += 2) {
$charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2));
if (($charval >= 32) && ($charval <= 127)) {
$HTMLstring .= chr($charval);
} else {
$HTMLstring .= '&#'.$charval.';';
}
}
break;
case 'UTF-16BE':
for ($i = 0; $i < strlen($string); $i += 2) {
$charval = getid3_lib::BigEndian2Int(substr($string, $i, 2));
if (($charval >= 32) && ($charval <= 127)) {
$HTMLstring .= chr($charval);
} else {
$HTMLstring .= '&#'.$charval.';';
}
}
break;
default:
$HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()';
break;
}
return $HTMLstring;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

getid3_lib::NormalizeBinaryPoint (   $binarypointnumber,
  $maxbits = 52 
)

Definition at line 83 of file getid3.lib.php.

Referenced by Float2String().

{
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
if (strpos($binarypointnumber, '.') === false) {
$binarypointnumber = '0.'.$binarypointnumber;
} elseif ($binarypointnumber{0} == '.') {
$binarypointnumber = '0'.$binarypointnumber;
}
$exponent = 0;
while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
if (substr($binarypointnumber, 1, 1) == '.') {
$exponent--;
$binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3);
} else {
$pointpos = strpos($binarypointnumber, '.');
$exponent += ($pointpos - 1);
$binarypointnumber = str_replace('.', '', $binarypointnumber);
$binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1);
}
}
$binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT);
return array('normalized'=>$binarypointnumber, 'exponent'=>(int) $exponent);
}

+ Here is the caller graph for this function:

getid3_lib::PlaytimeString (   $playtimeseconds)

Definition at line 408 of file getid3.lib.php.

Referenced by getID3\ChannelsBitratePlaytimeCalculations().

{
$contentseconds = round((($playtimeseconds / 60) - floor($playtimeseconds / 60)) * 60);
$contentminutes = floor($playtimeseconds / 60);
if ($contentseconds >= 60) {
$contentseconds -= 60;
$contentminutes++;
}
return intval($contentminutes).':'.str_pad($contentseconds, 2, 0, STR_PAD_LEFT);
}

+ Here is the caller graph for this function:

getid3_lib::PrintHexBytes (   $string,
  $hex = true,
  $spaces = true,
  $htmlsafe = true 
)

Definition at line 17 of file getid3.lib.php.

Referenced by getid3_mp3\FreeFormatFrameLength(), getid3_la\getid3_la(), getid3_wavpack\getid3_wavpack(), and getid3_optimfrog\ParseOptimFROGheader45().

{
$returnstring = '';
for ($i = 0; $i < strlen($string); $i++) {
if ($hex) {
$returnstring .= str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT);
} else {
$returnstring .= ' '.(ereg("[\x20-\x7E]", $string{$i}) ? $string{$i} : '');
}
if ($spaces) {
$returnstring .= ' ';
}
}
if ($htmlsafe) {
$returnstring = htmlentities($returnstring);
}
return $returnstring;
}

+ Here is the caller graph for this function:

getid3_lib::RGADadjustmentLookup (   $rawadjustment,
  $signbit 
)

Definition at line 1141 of file getid3.lib.php.

Referenced by getid3_mp3\decodeMPEGaudioHeader(), getid3_riff\getid3_riff(), and getid3_id3v2\ParseID3v2Frame().

{
$adjustment = $rawadjustment / 10;
if ($signbit == 1) {
$adjustment *= -1;
}
return (float) $adjustment;
}

+ Here is the caller graph for this function:

getid3_lib::RGADamplitude2dB (   $amplitude)

Definition at line 1165 of file getid3.lib.php.

Referenced by getid3_ac3\AC3heavyCompression(), getID3\CalculateReplayGain(), and getid3_mp3\decodeMPEGaudioHeader().

{
return 20 * log10($amplitude);
}

+ Here is the caller graph for this function:

getid3_lib::RGADgainString (   $namecode,
  $originatorcode,
  $replaygain 
)

Definition at line 1150 of file getid3.lib.php.

Referenced by getid3_write_id3v2\GenerateID3v2FrameData().

{
if ($replaygain < 0) {
$signbit = '1';
} else {
$signbit = '0';
}
$storedreplaygain = intval(round($replaygain * 10));
$gainstring = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT);
$gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT);
$gainstring .= $signbit;
$gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT);
return $gainstring;
}

+ Here is the caller graph for this function:

getid3_lib::RGADnameLookup (   $namecode)

Definition at line 1116 of file getid3.lib.php.

Referenced by getid3_mp3\decodeMPEGaudioHeader(), getid3_riff\getid3_riff(), and getid3_id3v2\ParseID3v2Frame().

{
static $RGADname = array();
if (empty($RGADname)) {
$RGADname[0] = 'not set';
$RGADname[1] = 'Track Gain Adjustment';
$RGADname[2] = 'Album Gain Adjustment';
}
return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : '');
}

+ Here is the caller graph for this function:

getid3_lib::RGADoriginatorLookup (   $originatorcode)

Definition at line 1128 of file getid3.lib.php.

Referenced by getid3_mp3\decodeMPEGaudioHeader(), getid3_riff\getid3_riff(), and getid3_id3v2\ParseID3v2Frame().

{
static $RGADoriginator = array();
if (empty($RGADoriginator)) {
$RGADoriginator[0] = 'unspecified';
$RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer';
$RGADoriginator[2] = 'set by user';
$RGADoriginator[3] = 'determined automatically';
}
return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : '');
}

+ Here is the caller graph for this function:

getid3_lib::SafeStripSlashes (   $text)

Definition at line 35 of file getid3.lib.php.

{
if (get_magic_quotes_gpc()) {
return stripslashes($text);
}
return $text;
}
getid3_lib::sha1_file (   $file)

Definition at line 545 of file getid3.lib.php.

References $file.

Referenced by getID3\getHashdata().

{
// sha1_file() exists in PHP 4.3.0+.
if (function_exists('sha1_file')) {
return sha1_file($file);
}
$file = str_replace('`', '\\`', $file);
if (GETID3_OS_ISWINDOWS) {
$RequiredFiles = array('cygwin1.dll', 'sha1sum.exe');
foreach ($RequiredFiles as $required_file) {
if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
die(implode(' and ', $RequiredFiles).' are required in '.GETID3_HELPERAPPSDIR.' for getid3_lib::sha1_file() to function under Windows in PHP < v4.3.0');
}
}
$commandline = GETID3_HELPERAPPSDIR.'sha1sum.exe "'.str_replace('/', DIRECTORY_SEPARATOR, $file).'"';
if (ereg("^sha1=([0-9a-f]{40})", strtolower(`$commandline`), $r)) {
return $r[1];
}
} else {
$commandline = 'sha1sum '.escapeshellarg($file).'';
if (ereg("^([0-9a-f]{40})[ \t\n\r]", strtolower(`$commandline`), $r)) {
return $r[1];
}
}
return false;
}

+ Here is the caller graph for this function:

getid3_lib::trunc (   $floatnumber)

Definition at line 43 of file getid3.lib.php.

Referenced by CastAsInt(), Float2BinaryDecimal(), and getid3_voc\getid3_voc().

{
// truncates a floating-point number at the decimal point
// returns int (if possible, otherwise float)
if ($floatnumber >= 1) {
$truncatednumber = floor($floatnumber);
} elseif ($floatnumber <= -1) {
$truncatednumber = ceil($floatnumber);
} else {
$truncatednumber = 0;
}
if ($truncatednumber <= 1073741824) { // 2^30
$truncatednumber = (int) $truncatednumber;
}
return $truncatednumber;
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: