37 $info = &$this->getid3->info;
42 $info[
'fileformat'] =
'vqf';
43 $info[
'audio'][
'dataformat'] =
'vqf';
44 $info[
'audio'][
'bitrate_mode'] =
'cbr';
45 $info[
'audio'][
'lossless'] =
false;
49 $thisfile_vqf = &
$info[
'vqf'];
50 $thisfile_vqf_raw = &$thisfile_vqf[
'raw'];
52 fseek($this->getid3->fp,
$info[
'avdataoffset'], SEEK_SET);
53 $VQFheaderData =
fread($this->getid3->fp, 16);
56 $thisfile_vqf_raw[
'header_tag'] = substr($VQFheaderData, $offset, 4);
58 if ($thisfile_vqf_raw[
'header_tag'] != $magic) {
59 $info[
'error'][] =
'Expecting "'.Helper::PrintHexBytes($magic).
'" at offset '.
$info[
'avdataoffset'].
', found "'.
Helper::PrintHexBytes($thisfile_vqf_raw[
'header_tag']).
'"';
61 unset(
$info[
'fileformat']);
66 $thisfile_vqf_raw[
'version'] = substr($VQFheaderData, $offset, 8);
71 while (
ftell($this->getid3->fp) <
$info[
'avdataend']) {
73 $ChunkBaseOffset =
ftell($this->getid3->fp);
75 $ChunkData =
fread($this->getid3->fp, 8);
76 $ChunkName = substr($ChunkData, $chunkoffset, 4);
77 if ($ChunkName ==
'DATA') {
78 $info[
'avdataoffset'] = $ChunkBaseOffset;
84 if ($ChunkSize > (
$info[
'avdataend'] -
ftell($this->getid3->fp))) {
85 $info[
'error'][] =
'Invalid chunk size ('.$ChunkSize.
') for chunk "'.$ChunkName.
'" at offset '.$ChunkBaseOffset;
89 $ChunkData .=
fread($this->getid3->fp, $ChunkSize);
95 $thisfile_vqf[
'COMM'] =
array();
96 $thisfile_vqf_COMM = &$thisfile_vqf[
'COMM'];
107 $info[
'audio'][
'channels'] = $thisfile_vqf_COMM[
'channel_mode'] + 1;
109 $info[
'audio'][
'bitrate'] = $thisfile_vqf_COMM[
'bitrate'] * 1000;
110 $info[
'audio'][
'encoder_options'] =
'CBR' . ceil(
$info[
'audio'][
'bitrate']/1000);
112 if (
$info[
'audio'][
'bitrate'] == 0) {
113 $info[
'error'][] =
'Corrupt VQF file: bitrate_audio == zero';
133 $info[
'warning'][] =
'Unhandled chunk type "'.$ChunkName.
'" at offset '.$ChunkBaseOffset;
138 $info[
'playtime_seconds'] = ((
$info[
'avdataend'] -
$info[
'avdataoffset']) * 8) /
$info[
'audio'][
'bitrate'];
140 if (isset($thisfile_vqf[
'DSIZ']) && (($thisfile_vqf[
'DSIZ'] != (
$info[
'avdataend'] -
$info[
'avdataoffset'] - strlen(
'DATA'))))) {
141 switch ($thisfile_vqf[
'DSIZ']) {
144 $info[
'warning'][] =
'Invalid DSIZ value "'.$thisfile_vqf[
'DSIZ'].
'". This is known to happen with VQF files encoded by Ahead Nero, and seems to be its way of saying this is TwinVQF v'.($thisfile_vqf[
'DSIZ'] + 1).
'.0';
145 $info[
'audio'][
'encoder'] =
'Ahead Nero';
149 $info[
'warning'][] =
'Probable corrupted file - should be '.$thisfile_vqf[
'DSIZ'].
' bytes, actually '.(
$info[
'avdataend'] -
$info[
'avdataoffset'] - strlen(
'DATA'));
165 static $VQFchannelFrequencyLookup =
array(
171 return (isset($VQFchannelFrequencyLookup[$frequencyid]) ? $VQFchannelFrequencyLookup[$frequencyid] : $frequencyid * 1000);
182 static $VQFcommentNiceNameLookup =
array(
185 '(c) ' =>
'copyright',
186 'FILE' =>
'filename',
191 return (isset($VQFcommentNiceNameLookup[$shortname]) ? $VQFcommentNiceNameLookup[$shortname] : $shortname);
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
GetId3() by James Heinrich info@getid3.org //.
VQFchannelFrequencyLookup($frequencyid)
array $VQFchannelFrequencyLookup
fseek($bytes, $whence=SEEK_SET)
GetId3() by James Heinrich info@getid3.org //.
Create styles array
The data for the language used.
VQFcommentNiceNameLookup($shortname)
array $VQFcommentNiceNameLookup
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)