GetId3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //.
More...
GetId3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //.
module for analyzing AVR Audio files
- Author
- James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g http://www.getid3.org
Definition at line 29 of file Avr.php.
◆ analyze()
GetId3\Module\Audio\Avr::analyze |
( |
| ) |
|
Definition at line 31 of file Avr.php.
References $info, array, GetId3\Lib\Helper\BigEndian2Int(), GetId3\Handler\BaseHandler\fread(), GetId3\Handler\BaseHandler\fseek(), and GetId3\Lib\Helper\PrintHexBytes().
33 $info = &$this->getid3->info;
74 $info[
'fileformat'] =
'avr';
76 fseek($this->getid3->fp,
$info[
'avdataoffset'], SEEK_SET);
77 $AVRheader =
fread($this->getid3->fp, 128);
79 $info[
'avr'][
'raw'][
'magic'] = substr($AVRheader, 0, 4);
81 if (
$info[
'avr'][
'raw'][
'magic'] != $magic) {
83 unset(
$info[
'fileformat']);
88 $info[
'avdataoffset'] += 128;
90 $info[
'avr'][
'sample_name'] = rtrim(substr($AVRheader, 4, 8));
128 $info[
'avr'][
'sample_name_extra'] = rtrim(substr($AVRheader, 44, 20));
129 $info[
'avr'][
'comment'] = rtrim(substr($AVRheader, 64, 64));
131 $info[
'avr'][
'flags'][
'stereo'] = ((
$info[
'avr'][
'raw'][
'mono'] == 0) ?
false :
true);
132 $info[
'avr'][
'flags'][
'signed'] = ((
$info[
'avr'][
'raw'][
'signed'] == 0) ?
false :
true);
133 $info[
'avr'][
'flags'][
'loop'] = ((
$info[
'avr'][
'raw'][
'loop'] == 0) ?
false :
true);
136 if ((
$info[
'avr'][
'raw'][
'midi'] & 0xFF00) != 0xFF00) {
137 $info[
'avr'][
'midi_notes'][] = (
$info[
'avr'][
'raw'][
'midi'] & 0xFF00) >> 8;
139 if ((
$info[
'avr'][
'raw'][
'midi'] & 0x00FF) != 0x00FF) {
140 $info[
'avr'][
'midi_notes'][] = (
$info[
'avr'][
'raw'][
'midi'] & 0x00FF);
143 if ((
$info[
'avdataend'] -
$info[
'avdataoffset']) != (
$info[
'avr'][
'sample_length'] * ((
$info[
'avr'][
'bits_per_sample'] == 8) ? 1 : 2))) {
144 $info[
'warning'][] =
'Probable truncated file: expecting ' . (
$info[
'avr'][
'sample_length'] * ((
$info[
'avr'][
'bits_per_sample'] == 8) ? 1 : 2)) .
' bytes of audio data, found ' . (
$info[
'avdataend'] -
$info[
'avdataoffset']);
147 $info[
'audio'][
'dataformat'] =
'avr';
148 $info[
'audio'][
'lossless'] =
true;
149 $info[
'audio'][
'bitrate_mode'] =
'cbr';
150 $info[
'audio'][
'bits_per_sample'] =
$info[
'avr'][
'bits_per_sample'];
151 $info[
'audio'][
'sample_rate'] =
$info[
'avr'][
'sample_rate'];
152 $info[
'audio'][
'channels'] = (
$info[
'avr'][
'flags'][
'stereo'] ? 2 : 1);
153 $info[
'playtime_seconds'] = (
$info[
'avr'][
'sample_length'] /
$info[
'audio'][
'channels']) /
$info[
'avr'][
'sample_rate'];
154 $info[
'audio'][
'bitrate'] = (
$info[
'avr'][
'sample_length'] * ((
$info[
'avr'][
'bits_per_sample'] == 8) ? 8 : 16)) /
$info[
'playtime_seconds'];
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
fseek($bytes, $whence=SEEK_SET)
Create styles array
The data for the language used.
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)
The documentation for this class was generated from the following file:
- libs/composer/vendor/phansys/getid3/GetId3/Module/Audio/Avr.php