本文整理匯總了PHP中getid3_lib::BigEndian2Float方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::BigEndian2Float方法的具體用法?PHP getid3_lib::BigEndian2Float怎麽用?PHP getid3_lib::BigEndian2Float使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類getid3_lib
的用法示例。
在下文中一共展示了getid3_lib::BigEndian2Float方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getid3_riff
//.........這裏部分代碼省略.........
// hardcoded data for CD-audio
$thisfile_audio['sample_rate'] = 44100;
$thisfile_audio['channels'] = 2;
$thisfile_audio['bits_per_sample'] = 16;
$thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample'];
$thisfile_audio['bitrate_mode'] = 'cbr';
}
break;
case 'AIFF':
case 'AIFC':
$thisfile_audio['bitrate_mode'] = 'cbr';
$thisfile_audio_dataformat = 'aiff';
$thisfile_audio['lossless'] = true;
$ThisFileInfo['mime_type'] = 'audio/x-aiff';
if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) {
$thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8;
$thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size'];
if ($thisfile_avdataend > $ThisFileInfo['filesize']) {
if ($thisfile_avdataend == $ThisFileInfo['filesize'] + 1 && $ThisFileInfo['filesize'] % 2 == 1) {
// structures rounded to 2-byte boundary, but dumb encoders
// forget to pad end of file to make this actually work
} else {
$ThisFileInfo['warning'][] = 'Probable truncated AIFF file: expecting ' . $thisfile_riff[$RIFFsubtype]['SSND'][0]['size'] . ' bytes of audio data, only ' . ($ThisFileInfo['filesize'] - $thisfile_avdataoffset) . ' bytes found';
}
$thisfile_avdataend = $ThisFileInfo['filesize'];
}
}
if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) {
// shortcut
$thisfile_riff_RIFFsubtype_COMM_0_data =& $thisfile_riff[$RIFFsubtype]['COMM'][0]['data'];
$thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true);
$thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false);
$thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true);
$thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10));
if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) {
$thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4);
$CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false);
$thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize);
switch ($thisfile_riff_audio['codec_name']) {
case 'NONE':
$thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)';
$thisfile_audio['lossless'] = true;
break;
case '':
switch ($thisfile_riff_audio['codec_fourcc']) {
// http://developer.apple.com/qa/snd/snd07.html
case 'sowt':
$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
$thisfile_audio['lossless'] = true;
break;
case 'twos':
$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM';
$thisfile_audio['lossless'] = true;
break;
default:
break;
}
break;
default:
$thisfile_audio['codec'] = $thisfile_riff_audio['codec_name'];
$thisfile_audio['lossless'] = false;
break;
}
}
$thisfile_audio['channels'] = $thisfile_riff_audio['channels'];
if ($thisfile_riff_audio['bits_per_sample'] > 0) {
示例2: Analyze
//.........這裏部分代碼省略.........
$thisfile_audio['bits_per_sample'] = 16;
$thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample'];
$thisfile_audio['bitrate_mode'] = 'cbr';
}
break;
// http://en.wikipedia.org/wiki/AIFF
// http://en.wikipedia.org/wiki/AIFF
case 'AIFF':
case 'AIFC':
$info['fileformat'] = 'aiff';
$info['mime_type'] = 'audio/x-aiff';
$thisfile_audio['bitrate_mode'] = 'cbr';
$thisfile_audio_dataformat = 'aiff';
$thisfile_audio['lossless'] = true;
if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) {
$info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8;
$info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size'];
if ($info['avdataend'] > $info['filesize']) {
if ($info['avdataend'] == $info['filesize'] + 1 && $info['filesize'] % 2 == 1) {
// structures rounded to 2-byte boundary, but dumb encoders
// forget to pad end of file to make this actually work
} else {
$info['warning'][] = 'Probable truncated AIFF file: expecting ' . $thisfile_riff[$RIFFsubtype]['SSND'][0]['size'] . ' bytes of audio data, only ' . ($info['filesize'] - $info['avdataoffset']) . ' bytes found';
}
$info['avdataend'] = $info['filesize'];
}
}
if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) {
// shortcut
$thisfile_riff_RIFFsubtype_COMM_0_data =& $thisfile_riff[$RIFFsubtype]['COMM'][0]['data'];
$thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true);
$thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false);
$thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true);
$thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10));
if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) {
$thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4);
$CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false);
$thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize);
switch ($thisfile_riff_audio['codec_name']) {
case 'NONE':
$thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)';
$thisfile_audio['lossless'] = true;
break;
case '':
switch ($thisfile_riff_audio['codec_fourcc']) {
// http://developer.apple.com/qa/snd/snd07.html
case 'sowt':
$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
$thisfile_audio['lossless'] = true;
break;
case 'twos':
$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM';
$thisfile_audio['lossless'] = true;
break;
default:
break;
}
break;
default:
$thisfile_audio['codec'] = $thisfile_riff_audio['codec_name'];
$thisfile_audio['lossless'] = false;
break;
}
}
$thisfile_audio['channels'] = $thisfile_riff_audio['channels'];
if ($thisfile_riff_audio['bits_per_sample'] > 0) {
示例3: LittleEndian2Float
static function LittleEndian2Float($byteword)
{
return getid3_lib::BigEndian2Float(strrev($byteword));
}
示例4: parseEBML
private function parseEBML(&$info)
{
// http://www.matroska.org/technical/specs/index.html#EBMLBasics
$this->current_offset = $info['avdataoffset'];
while ($this->getEBMLelement($top_element, $info['avdataend'])) {
switch ($top_element['id']) {
case EBML_ID_EBML:
$info['matroska']['header']['offset'] = $top_element['offset'];
$info['matroska']['header']['length'] = $top_element['length'];
while ($this->getEBMLelement($element_data, $top_element['end'], true)) {
switch ($element_data['id']) {
case EBML_ID_EBMLVERSION:
case EBML_ID_EBMLREADVERSION:
case EBML_ID_EBMLMAXIDLENGTH:
case EBML_ID_EBMLMAXSIZELENGTH:
case EBML_ID_DOCTYPEVERSION:
case EBML_ID_DOCTYPEREADVERSION:
$element_data['data'] = getid3_lib::BigEndian2Int($element_data['data']);
break;
case EBML_ID_DOCTYPE:
$element_data['data'] = getid3_lib::trimNullByte($element_data['data']);
$info['matroska']['doctype'] = $element_data['data'];
$info['fileformat'] = $element_data['data'];
break;
default:
$this->unhandledElement('header', __LINE__, $element_data);
break;
}
unset($element_data['offset'], $element_data['end']);
$info['matroska']['header']['elements'][] = $element_data;
}
break;
case EBML_ID_SEGMENT:
$info['matroska']['segment'][0]['offset'] = $top_element['offset'];
$info['matroska']['segment'][0]['length'] = $top_element['length'];
while ($this->getEBMLelement($element_data, $top_element['end'])) {
if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) {
// collect clusters only if required
$info['matroska']['segments'][] = $element_data;
}
switch ($element_data['id']) {
case EBML_ID_SEEKHEAD:
// Contains the position of other level 1 elements.
while ($this->getEBMLelement($seek_entry, $element_data['end'])) {
switch ($seek_entry['id']) {
case EBML_ID_SEEK:
// Contains a single seek entry to an EBML element
while ($this->getEBMLelement($sub_seek_entry, $seek_entry['end'], true)) {
switch ($sub_seek_entry['id']) {
case EBML_ID_SEEKID:
$seek_entry['target_id'] = self::EBML2Int($sub_seek_entry['data']);
$seek_entry['target_name'] = self::EBMLidName($seek_entry['target_id']);
break;
case EBML_ID_SEEKPOSITION:
$seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($sub_seek_entry['data']);
break;
default:
$this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry);
}
break;
}
if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) {
// collect clusters only if required
$info['matroska']['seek'][] = $seek_entry;
}
break;
default:
$this->unhandledElement('seekhead', __LINE__, $seek_entry);
break;
}
}
break;
case EBML_ID_TRACKS:
// A top-level block of information with many tracks described.
$info['matroska']['tracks'] = $element_data;
while ($this->getEBMLelement($track_entry, $element_data['end'])) {
switch ($track_entry['id']) {
case EBML_ID_TRACKENTRY:
//subelements: Describes a track with all elements.
while ($this->getEBMLelement($subelement, $track_entry['end'], array(EBML_ID_VIDEO, EBML_ID_AUDIO, EBML_ID_CONTENTENCODINGS, EBML_ID_CODECPRIVATE))) {
switch ($subelement['id']) {
case EBML_ID_TRACKNUMBER:
case EBML_ID_TRACKUID:
case EBML_ID_TRACKTYPE:
case EBML_ID_MINCACHE:
case EBML_ID_MAXCACHE:
case EBML_ID_MAXBLOCKADDITIONID:
case EBML_ID_DEFAULTDURATION:
// nanoseconds per frame
$track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
break;
case EBML_ID_TRACKTIMECODESCALE:
$track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']);
break;
case EBML_ID_CODECID:
case EBML_ID_LANGUAGE:
case EBML_ID_NAME:
case EBML_ID_CODECNAME:
$track_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
break;
//.........這裏部分代碼省略.........
示例5: ParseID3v2Frame
//.........這裏部分代碼省略.........
$parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
} elseif ($id3v2_majorversion >= 3 && $parsedFrame['frame_name'] == 'PRIV') {
// 4.27 PRIV Private frame (ID3v2.3+ only)
// The tag may contain more than one 'PRIV' frame
// but only with different contents
// <Header for 'Private frame', ID: 'PRIV'>
// Owner identifier <text string> $00
// The private data <binary data>
$frame_offset = 0;
$frame_terminatorpos = @strpos($parsedFrame['data'], "", $frame_offset);
$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
if (ord($frame_ownerid) === 0) {
$frame_ownerid = '';
}
$frame_offset = $frame_terminatorpos + strlen("");
$parsedFrame['ownerid'] = $frame_ownerid;
$parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
} elseif ($id3v2_majorversion >= 4 && $parsedFrame['frame_name'] == 'SIGN') {
// 4.28 SIGN Signature frame (ID3v2.4+ only)
// There may be more than one 'signature frame' in a tag,
// but no two may be identical
// <Header for 'Signature frame', ID: 'SIGN'>
// Group symbol $xx
// Signature <binary data>
$frame_offset = 0;
$parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
$parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
} elseif ($id3v2_majorversion >= 4 && $parsedFrame['frame_name'] == 'SEEK') {
// 4.29 SEEK Seek frame (ID3v2.4+ only)
// There may only be one 'seek frame' in a tag
// <Header for 'Seek frame', ID: 'SEEK'>
// Minimum offset to next tag $xx xx xx xx
$frame_offset = 0;
$parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
} elseif ($id3v2_majorversion >= 4 && $parsedFrame['frame_name'] == 'ASPI') {
// 4.30 ASPI Audio seek point index (ID3v2.4+ only)
// There may only be one 'audio seek point index' frame in a tag
// <Header for 'Seek Point Index', ID: 'ASPI'>
// Indexed data start (S) $xx xx xx xx
// Indexed data length (L) $xx xx xx xx
// Number of index points (N) $xx xx
// Bits per index point (b) $xx
// Then for every index point the following data is included:
// Fraction at index (Fi) $xx (xx)
$frame_offset = 0;
$parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
$frame_offset += 4;
$parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
$frame_offset += 4;
$parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
$frame_offset += 2;
$parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
$frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8);
for ($i = 0; $i < $frame_indexpoints; $i++) {
$parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint));
$frame_offset += $frame_bytesperpoint;
}
unset($parsedFrame['data']);
} elseif ($id3v2_majorversion >= 3 && $parsedFrame['frame_name'] == 'RGAD') {
// Replay Gain Adjustment
// http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
// There may only be one 'RGAD' frame in a tag
// <Header for 'Replay Gain Adjustment', ID: 'RGAD'>
// Peak Amplitude $xx $xx $xx $xx
// Radio Replay Gain Adjustment %aaabbbcd %dddddddd
// Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd
// a - name code
// b - originator code
// c - sign bit
// d - replay gain adjustment
$frame_offset = 0;
$parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4));
$frame_offset += 4;
$rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
$frame_offset += 2;
$rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
$frame_offset += 2;
$parsedFrame['raw']['track']['name'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3));
$parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3));
$parsedFrame['raw']['track']['signbit'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1));
$parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9));
$parsedFrame['raw']['album']['name'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3));
$parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3));
$parsedFrame['raw']['album']['signbit'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1));
$parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9));
$parsedFrame['track']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']);
$parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']);
$parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']);
$parsedFrame['album']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']);
$parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']);
$parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']);
$ThisFileInfo['replay_gain']['track']['peak'] = $parsedFrame['peakamplitude'];
$ThisFileInfo['replay_gain']['track']['originator'] = $parsedFrame['track']['originator'];
$ThisFileInfo['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment'];
$ThisFileInfo['replay_gain']['album']['originator'] = $parsedFrame['album']['originator'];
$ThisFileInfo['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment'];
unset($parsedFrame['data']);
}
return true;
}
示例6: Analyze
//.........這裏部分代碼省略.........
// information about all tracks in segment
$info['matroska']['tracks'] = $element_data;
while ($offset < $element_end) {
$this->EnsureBufferHasEnoughData($EBMLdata, $offset, $EBMLdata_offset);
$track_entry = array();
$track_entry['offset'] = $offset;
$track_entry['id'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$track_entry['id_name'] = $this->EBMLidName($track_entry['id']);
$track_entry['length'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$track_entry_endoffset = $offset + $track_entry['length'];
// $track_entry['offset'] is not the same as $offset, even though they were set equal a few lines up: $offset has been automagically incremented by readEMLint()
switch ($track_entry['id']) {
case EBML_ID_TRACKENTRY:
//subelements: Describes a track with all elements.
while ($offset < $track_entry_endoffset) {
$this->EnsureBufferHasEnoughData($EBMLdata, $offset, $EBMLdata_offset);
$subelement_offset = $offset;
$subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$subelement_idname = $this->EBMLidName($subelement_id);
$subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$subelement_end = $offset + $subelement_length;
switch ($subelement_id) {
case EBML_ID_TRACKNUMBER:
case EBML_ID_TRACKUID:
case EBML_ID_TRACKTYPE:
case EBML_ID_MINCACHE:
case EBML_ID_MAXCACHE:
case EBML_ID_MAXBLOCKADDITIONID:
case EBML_ID_DEFAULTDURATION:
// nanoseconds per frame
$track_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_TRACKTIMECODESCALE:
$track_entry[$subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_CODECID:
case EBML_ID_LANGUAGE:
case EBML_ID_NAME:
case EBML_ID_CODECNAME:
case EBML_ID_CODECPRIVATE:
$track_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "");
break;
// thought maybe it was a nice wFormatTag entry, but it's not :(
//case EBML_ID_CODECPRIVATE:
//$track_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "\x00");
//if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
// $track_entry[$subelement_idname.'_decoded'] = getid3_riff::RIFFparseWAVEFORMATex($track_entry[$subelement_idname]);
// if (isset($track_entry[$subelement_idname.'_decoded']['raw']['wFormatTag'])) {
// }
//} else {
// $this->warnings[] = 'failed to include "module.audio-video.riff.php" for parsing codec private data';
//}
//break;
// thought maybe it was a nice wFormatTag entry, but it's not :(
//case EBML_ID_CODECPRIVATE:
//$track_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "\x00");
//if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
// $track_entry[$subelement_idname.'_decoded'] = getid3_riff::RIFFparseWAVEFORMATex($track_entry[$subelement_idname]);
// if (isset($track_entry[$subelement_idname.'_decoded']['raw']['wFormatTag'])) {
// }
//} else {
// $this->warnings[] = 'failed to include "module.audio-video.riff.php" for parsing codec private data';
//}
//break;
case EBML_ID_FLAGENABLED:
case EBML_ID_FLAGDEFAULT:
示例7: readDouble
function readDouble()
{
return getid3_lib::BigEndian2Float($this->read(8));
}
示例8: ParseID3v2Frame
//.........這裏部分代碼省略.........
// Indexed data start (S) $xx xx xx xx
// Indexed data length (L) $xx xx xx xx
// Number of index points (N) $xx xx
// Bits per index point (b) $xx
// Then for every index point the following data is included:
// Fraction at index (Fi) $xx (xx)
$frame_offset = 0;
$parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
$frame_offset += 4;
$parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
$frame_offset += 4;
$parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
$frame_offset += 2;
$parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
$frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8);
for ($i = 0; $i < $parsedFrame['indexpoints']; $i++) {
$parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint));
$frame_offset += $frame_bytesperpoint;
}
unset($parsedFrame['data']);
} elseif ($id3v2_majorversion >= 3 && $parsedFrame['frame_name'] == 'RGAD') {
// Replay Gain Adjustment
// http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
// There may only be one 'RGAD' frame in a tag
// <Header for 'Replay Gain Adjustment', ID: 'RGAD'>
// Peak Amplitude $xx $xx $xx $xx
// Radio Replay Gain Adjustment %aaabbbcd %dddddddd
// Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd
// a - name code
// b - originator code
// c - sign bit
// d - replay gain adjustment
$frame_offset = 0;
$parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4));
$frame_offset += 4;
$rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
$frame_offset += 2;
$rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
$frame_offset += 2;
$parsedFrame['raw']['track']['name'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3));
$parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3));
$parsedFrame['raw']['track']['signbit'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1));
$parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9));
$parsedFrame['raw']['album']['name'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3));
$parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3));
$parsedFrame['raw']['album']['signbit'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1));
$parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9));
$parsedFrame['track']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']);
$parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']);
$parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']);
$parsedFrame['album']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']);
$parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']);
$parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']);
$info['replay_gain']['track']['peak'] = $parsedFrame['peakamplitude'];
$info['replay_gain']['track']['originator'] = $parsedFrame['track']['originator'];
$info['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment'];
$info['replay_gain']['album']['originator'] = $parsedFrame['album']['originator'];
$info['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment'];
unset($parsedFrame['data']);
} elseif ($id3v2_majorversion >= 3 && $parsedFrame['frame_name'] == 'CHAP') {
// CHAP Chapters frame (ID3v2.3+ only)
// http://id3.org/id3v2-chapters-1.0
// <ID3v2.3 or ID3v2.4 frame header, ID: "CHAP"> (10 bytes)
// Element ID <text string> $00
// Start time $xx xx xx xx
// End time $xx xx xx xx
示例9: getid3_matroska
//.........這裏部分代碼省略.........
case EBML_ID_TRACKS:
// information about all tracks in segment
$ThisFileInfo['matroska']['tracks'] = $element_data;
while ($offset < $element_end) {
$this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset);
$track_entry = array();
$track_entry['offset'] = $offset;
$track_entry['id'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$track_entry['id_name'] = $this->EBMLidName($track_entry['id']);
$track_entry['length'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$track_entry_endoffset = $offset + $track_entry['length'];
switch ($track_entry['id']) {
case EBML_ID_TRACKENTRY:
//subelements: Describes a track with all elements.
while ($offset < $track_entry_endoffset) {
$this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset);
$subelement_offset = $offset;
$subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$subelement_idname = $this->EBMLidName($subelement_id);
$subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$subelement_end = $offset + $subelement_length;
switch ($subelement_id) {
case EBML_ID_TRACKNUMBER:
case EBML_ID_TRACKUID:
case EBML_ID_TRACKTYPE:
case EBML_ID_MINCACHE:
case EBML_ID_MAXCACHE:
case EBML_ID_MAXBLOCKADDITIONID:
case EBML_ID_DEFAULTDURATION:
// nanoseconds per frame
$track_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_TRACKTIMECODESCALE:
$track_entry[$subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_CODECID:
case EBML_ID_LANGUAGE:
case EBML_ID_NAME:
case EBML_ID_CODECPRIVATE:
$track_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "");
break;
case EBML_ID_FLAGENABLED:
case EBML_ID_FLAGDEFAULT:
case EBML_ID_FLAGFORCED:
case EBML_ID_FLAGLACING:
case EBML_ID_CODECDECODEALL:
$track_entry[$subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_VIDEO:
while ($offset < $subelement_end) {
$this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset);
$sub_subelement_offset = $offset;
$sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$sub_subelement_idname = $this->EBMLidName($sub_subelement_id);
$sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$sub_subelement_end = $offset + $sub_subelement_length;
switch ($sub_subelement_id) {
case EBML_ID_PIXELWIDTH:
case EBML_ID_PIXELHEIGHT:
case EBML_ID_STEREOMODE:
case EBML_ID_PIXELCROPBOTTOM:
case EBML_ID_PIXELCROPTOP:
case EBML_ID_PIXELCROPLEFT:
case EBML_ID_PIXELCROPRIGHT:
case EBML_ID_DISPLAYWIDTH:
case EBML_ID_DISPLAYHEIGHT:
示例10: getid3_matroska
//.........這裏部分代碼省略.........
break;
case EBML_ID_TRACKS: // information about all tracks in segment
$ThisFileInfo['matroska']['tracks'] = $element_data;
while ($offset < $element_end) {
$this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset);
$track_entry = array();
$track_entry['offset'] = $offset;
$track_entry['id'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$track_entry['id_name'] = $this->EBMLidName($track_entry['id']);
$track_entry['length'] = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$track_entry_endoffset = $offset + $track_entry['length'];
switch ($track_entry['id']) {
case EBML_ID_TRACKENTRY: //subelements: Describes a track with all elements.
while ($offset < $track_entry_endoffset) {
$this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset);
$subelement_offset = $offset;
$subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$subelement_idname = $this->EBMLidName($subelement_id);
$subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$subelement_end = $offset + $subelement_length;
switch ($subelement_id) {
case EBML_ID_TRACKNUMBER:
case EBML_ID_TRACKUID:
case EBML_ID_TRACKTYPE:
case EBML_ID_MINCACHE:
case EBML_ID_MAXCACHE:
case EBML_ID_MAXBLOCKADDITIONID:
case EBML_ID_DEFAULTDURATION: // nanoseconds per frame
$track_entry[$subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_TRACKTIMECODESCALE:
$track_entry[$subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_CODECID:
case EBML_ID_LANGUAGE:
case EBML_ID_NAME:
case EBML_ID_CODECNAME:
case EBML_ID_CODECPRIVATE:
$track_entry[$subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length), "\x00");
break;
case EBML_ID_FLAGENABLED:
case EBML_ID_FLAGDEFAULT:
case EBML_ID_FLAGFORCED:
case EBML_ID_FLAGLACING:
case EBML_ID_CODECDECODEALL:
$track_entry[$subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $subelement_length));
break;
case EBML_ID_VIDEO:
while ($offset < $subelement_end) {
$this->EnsureBufferHasEnoughData($fd, $EBMLdata, $offset, $EBMLdata_offset);
$sub_subelement_offset = $offset;
$sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$sub_subelement_idname = $this->EBMLidName($sub_subelement_id);
$sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
$sub_subelement_end = $offset + $sub_subelement_length;
switch ($sub_subelement_id) {
case EBML_ID_PIXELWIDTH:
case EBML_ID_PIXELHEIGHT:
case EBML_ID_STEREOMODE:
case EBML_ID_PIXELCROPBOTTOM:
case EBML_ID_PIXELCROPTOP: