41 $info = &$this->getid3->info;
43 fseek($this->getid3->fp,
$info[
'avdataoffset'], SEEK_SET);
45 $ShortenHeader =
fread($this->getid3->fp, 8);
47 if (substr($ShortenHeader, 0, 4) != $magic) {
48 $info[
'error'][] =
'Expecting "'.Helper::PrintHexBytes($magic).
'" at offset '.
$info[
'avdataoffset'].
', found "'.
Helper::PrintHexBytes(substr($ShortenHeader, 0, 4)).
'"';
52 $info[
'fileformat'] =
'shn';
53 $info[
'audio'][
'dataformat'] =
'shn';
54 $info[
'audio'][
'lossless'] =
true;
55 $info[
'audio'][
'bitrate_mode'] =
'vbr';
59 fseek($this->getid3->fp,
$info[
'avdataend'] - 12, SEEK_SET);
60 $SeekTableSignatureTest =
fread($this->getid3->fp, 12);
61 $info[
'shn'][
'seektable'][
'present'] = (bool) (substr($SeekTableSignatureTest, 4, 8) ==
'SHNAMPSK');
62 if (
$info[
'shn'][
'seektable'][
'present']) {
64 $info[
'shn'][
'seektable'][
'offset'] =
$info[
'avdataend'] -
$info[
'shn'][
'seektable'][
'length'];
65 fseek($this->getid3->fp, $info[
'shn'][
'seektable'][
'offset'], SEEK_SET);
66 $SeekTableMagic =
fread($this->getid3->fp, 4);
68 if ($SeekTableMagic != $magic) {
70 $info[
'error'][] =
'Expecting "'.Helper::PrintHexBytes($magic).
'" at offset '.$info[
'shn'][
'seektable'][
'offset'].
', found "'.
Helper::PrintHexBytes($SeekTableMagic).
'"';
92 $SeekTableData =
fread($this->getid3->fp, $info[
'shn'][
'seektable'][
'length'] - 16);
93 $info[
'shn'][
'seektable'][
'entry_count'] = floor(strlen($SeekTableData) / 80);
137 if (preg_match(
'#(1|ON)#i', ini_get(
'safe_mode'))) {
138 $info[
'error'][] =
'PHP running in Safe Mode - backtick operator not available, cannot run shntool to analyze Shorten files';
145 $RequiredFiles =
array(
'shorten.exe',
'cygwin1.dll',
'head.exe');
146 foreach ($RequiredFiles as $required_file) {
154 $commandline = str_replace(
'/',
'\\', $commandline);
158 static $shorten_present;
159 if (!isset($shorten_present)) {
160 $shorten_present = file_exists(
'/usr/local/bin/shorten') || `which shorten`;
162 if (!$shorten_present) {
163 $info[
'error'][] =
'shorten binary was not found in path or /usr/local/bin';
167 $commandline = (file_exists(
'/usr/local/bin/shorten') ?
'/usr/local/bin/' :
'' ) .
'shorten -x '.escapeshellarg(
$info[
'filenamepath']).
' - | head -c 64';
177 $info[
'audio'][
'channels'] = $DecodedWAVFORMATEX[
'channels'];
178 $info[
'audio'][
'bits_per_sample'] = $DecodedWAVFORMATEX[
'bits_per_sample'];
179 $info[
'audio'][
'sample_rate'] = $DecodedWAVFORMATEX[
'sample_rate'];
181 if (substr(
$output, 20 + $fmt_size, 4) ==
'data') {
187 $info[
'error'][] =
'shorten failed to decode DATA chunk to expected location, cannot determine playtime';
193 $info[
'audio'][
'bitrate'] = ((
$info[
'avdataend'] -
$info[
'avdataoffset']) /
$info[
'playtime_seconds']) * 8;
197 $info[
'error'][] =
'shorten failed to decode file to WAV for parsing';
analyze()
type $shorten_present
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
GetId3() by James Heinrich info@getid3.org //.
GetId3() by James Heinrich info@getid3.org //.
static RIFFparseWAVEFORMATex($WaveFormatExData)
fseek($bytes, $whence=SEEK_SET)
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
static environmentIsWindows()
Create styles array
The data for the language used.
static LittleEndian2Int($byteword, $signed=false)
static getHelperAppsDir()