getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //
More...
◆ Analyze()
Definition at line 21 of file module.audio-video.nsv.php.
References $info, getid3_handler\error(), getid3_handler\fread(), getid3_handler\fseek(), getNSVfHeaderFilepointer(), getNSVsHeaderFilepointer(), getid3_lib\PrintHexBytes(), and getid3_handler\warning().
22 $info = &$this->getid3->info;
25 $NSVheader = $this->
fread(4);
30 $info[
'fileformat'] =
'nsv';
31 $info[
'audio'][
'dataformat'] =
'nsv';
32 $info[
'video'][
'dataformat'] =
'nsv';
33 $info[
'audio'][
'lossless'] =
false;
34 $info[
'video'][
'lossless'] =
false;
40 $info[
'fileformat'] =
'nsv';
41 $info[
'audio'][
'dataformat'] =
'nsv';
42 $info[
'video'][
'dataformat'] =
'nsv';
43 $info[
'audio'][
'lossless'] =
false;
44 $info[
'video'][
'lossless'] =
false;
55 if (!isset(
$info[
'nsv'][
'NSVf'])) {
56 $this->
warning(
'NSVf header not present - cannot calculate playtime or bitrate');
getNSVfHeaderFilepointer($fileoffset, $getTOCoffsets=false)
getNSVsHeaderFilepointer($fileoffset)
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
fseek($bytes, $whence=SEEK_SET)
◆ getNSVfHeaderFilepointer()
getid3_nsv::getNSVfHeaderFilepointer |
( |
|
$fileoffset, |
|
|
|
$getTOCoffsets = false |
|
) |
| |
Definition at line 135 of file module.audio-video.nsv.php.
References $info, $key, getid3_handler\error(), getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\LittleEndian2Int(), and getid3_handler\warning().
Referenced by Analyze().
136 $info = &$this->getid3->info;
137 $this->
fseek($fileoffset);
138 $NSVfheader = $this->
fread(28);
141 $info[
'nsv'][
'NSVf'][
'identifier'] = substr($NSVfheader, $offset, 4);
144 if (
$info[
'nsv'][
'NSVf'][
'identifier'] !=
'NSVf') {
145 $this->
error(
'expected "NSVf" at offset ('.$fileoffset.
'), found "'.
$info[
'nsv'][
'NSVf'][
'identifier'].
'" instead');
146 unset(
$info[
'nsv'][
'NSVf']);
150 $info[
'nsv'][
'NSVs'][
'offset'] = $fileoffset;
157 if (
$info[
'nsv'][
'NSVf'][
'file_size'] >
$info[
'avdataend']) {
158 $this->
warning(
'truncated file - NSVf header indicates '.
$info[
'nsv'][
'NSVf'][
'file_size'].
' bytes, file actually '.
$info[
'avdataend'].
' bytes');
170 if (
$info[
'nsv'][
'NSVf'][
'playtime_ms'] == 0) {
171 $this->
error(
'Corrupt NSV file: NSVf.playtime_ms == zero');
175 $NSVfheader .= $this->
fread(
$info[
'nsv'][
'NSVf'][
'meta_size'] + (4 *
$info[
'nsv'][
'NSVf'][
'TOC_entries_1']) + (4 *
$info[
'nsv'][
'NSVf'][
'TOC_entries_2']));
176 $NSVfheaderlength = strlen($NSVfheader);
177 $info[
'nsv'][
'NSVf'][
'metadata'] = substr($NSVfheader, $offset,
$info[
'nsv'][
'NSVf'][
'meta_size']);
178 $offset +=
$info[
'nsv'][
'NSVf'][
'meta_size'];
180 if ($getTOCoffsets) {
182 while ($TOCcounter <
$info[
'nsv'][
'NSVf'][
'TOC_entries_1']) {
183 if ($TOCcounter <
$info[
'nsv'][
'NSVf'][
'TOC_entries_1']) {
191 if (trim(
$info[
'nsv'][
'NSVf'][
'metadata']) !=
'') {
192 $info[
'nsv'][
'NSVf'][
'metadata'] = str_replace(
'`',
"\x01",
$info[
'nsv'][
'NSVf'][
'metadata']);
193 $CommentPairArray = explode(
"\x01".
' ',
$info[
'nsv'][
'NSVf'][
'metadata']);
194 foreach ($CommentPairArray as $CommentPair) {
195 if (strstr($CommentPair,
'='.
"\x01")) {
196 list(
$key, $value) = explode(
'='.
"\x01", $CommentPair, 2);
197 $info[
'nsv'][
'comments'][strtolower(
$key)][] = trim(str_replace(
"\x01",
'', $value));
202 $info[
'playtime_seconds'] =
$info[
'nsv'][
'NSVf'][
'playtime_ms'] / 1000;
203 $info[
'bitrate'] = (
$info[
'nsv'][
'NSVf'][
'file_size'] * 8) /
$info[
'playtime_seconds'];
static LittleEndian2Int($byteword, $signed=false)
fseek($bytes, $whence=SEEK_SET)
◆ getNSVsHeaderFilepointer()
getid3_nsv::getNSVsHeaderFilepointer |
( |
|
$fileoffset | ) |
|
Definition at line 62 of file module.audio-video.nsv.php.
References $info, getid3_handler\error(), getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\LittleEndian2Int(), and NSVframerateLookup().
Referenced by Analyze().
63 $info = &$this->getid3->info;
64 $this->
fseek($fileoffset);
65 $NSVsheader = $this->
fread(28);
68 $info[
'nsv'][
'NSVs'][
'identifier'] = substr($NSVsheader, $offset, 4);
71 if (
$info[
'nsv'][
'NSVs'][
'identifier'] !=
'NSVs') {
72 $this->
error(
'expected "NSVs" at offset ('.$fileoffset.
'), found "'.
$info[
'nsv'][
'NSVs'][
'identifier'].
'" instead');
73 unset(
$info[
'nsv'][
'NSVs']);
77 $info[
'nsv'][
'NSVs'][
'offset'] = $fileoffset;
79 $info[
'nsv'][
'NSVs'][
'video_codec'] = substr($NSVsheader, $offset, 4);
81 $info[
'nsv'][
'NSVs'][
'audio_codec'] = substr($NSVsheader, $offset, 4);
105 switch (
$info[
'nsv'][
'NSVs'][
'audio_codec']) {
114 $info[
'audio'][
'sample_rate'] =
$info[
'nsv'][
'NSVs'][
'sample_rate'];
125 $info[
'video'][
'resolution_x'] =
$info[
'nsv'][
'NSVs'][
'resolution_x'];
126 $info[
'video'][
'resolution_y'] =
$info[
'nsv'][
'NSVs'][
'resolution_y'];
128 $info[
'video'][
'frame_rate'] =
$info[
'nsv'][
'NSVs'][
'frame_rate'];
129 $info[
'video'][
'bits_per_sample'] = 24;
130 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
static NSVframerateLookup($framerateindex)
static LittleEndian2Int($byteword, $signed=false)
fseek($bytes, $whence=SEEK_SET)
◆ NSVframerateLookup()
static getid3_nsv::NSVframerateLookup |
( |
|
$framerateindex | ) |
|
|
static |
Definition at line 209 of file module.audio-video.nsv.php.
Referenced by getNSVsHeaderFilepointer().
210 if ($framerateindex <= 127) {
211 return (
float) $framerateindex;
213 static $NSVframerateLookup = array();
214 if (empty($NSVframerateLookup)) {
215 $NSVframerateLookup[129] = (float) 29.970;
216 $NSVframerateLookup[131] = (float) 23.976;
217 $NSVframerateLookup[133] = (float) 14.985;
218 $NSVframerateLookup[197] = (float) 59.940;
219 $NSVframerateLookup[199] = (float) 47.952;
221 return (isset($NSVframerateLookup[$framerateindex]) ? $NSVframerateLookup[$framerateindex] :
false);
The documentation for this class was generated from the following file: