ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
getid3_nsv Class Reference

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g // More...

+ Inheritance diagram for getid3_nsv:
+ Collaboration diagram for getid3_nsv:

Public Member Functions

 getid3_nsv (&$fd, &$ThisFileInfo)
 
 getNSVsHeaderFilepointer (&$fd, &$ThisFileInfo, $fileoffset)
 
 getNSVfHeaderFilepointer (&$fd, &$ThisFileInfo, $fileoffset, $getTOCoffsets=false)
 
 NSVframerateLookup ($framerateindex)
 
 Analyze ()
 
 getNSVsHeaderFilepointer ($fileoffset)
 
 getNSVfHeaderFilepointer ($fileoffset, $getTOCoffsets=false)
 
- Public Member Functions inherited from getid3_handler
 __construct (getID3 $getid3, $call_module=null)
 
 Analyze ()
 
 AnalyzeString ($string)
 
 setStringMode ($string)
 
 saveAttachment ($name, $offset, $length, $image_mime=null)
 

Static Public Member Functions

static NSVframerateLookup ($framerateindex)
 

Additional Inherited Members

- Protected Member Functions inherited from getid3_handler
 ftell ()
 
 fread ($bytes)
 
 fseek ($bytes, $whence=SEEK_SET)
 
 feof ()
 
 isDependencyFor ($module)
 
 error ($text)
 
 warning ($text)
 
 notice ($text)
 
- Protected Attributes inherited from getid3_handler
 $getid3
 
 $data_string_flag = false
 
 $data_string = ''
 
 $data_string_position = 0
 
 $data_string_length = 0
 

Detailed Description

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //

Definition at line 17 of file module.audio-video.nsv.php.

Member Function Documentation

◆ Analyze()

getid3_nsv::Analyze ( )

Definition at line 21 of file module.audio-video.nsv.php.

References $info, getid3_handler\fread(), getid3_handler\fseek(), getNSVfHeaderFilepointer(), getNSVsHeaderFilepointer(), and getid3_lib\PrintHexBytes().

21  {
22  $info = &$this->getid3->info;
23 
24  $this->fseek($info['avdataoffset']);
25  $NSVheader = $this->fread(4);
26 
27  switch ($NSVheader) {
28  case 'NSVs':
29  if ($this->getNSVsHeaderFilepointer(0)) {
30  $info['fileformat'] = 'nsv';
31  $info['audio']['dataformat'] = 'nsv';
32  $info['video']['dataformat'] = 'nsv';
33  $info['audio']['lossless'] = false;
34  $info['video']['lossless'] = false;
35  }
36  break;
37 
38  case 'NSVf':
39  if ($this->getNSVfHeaderFilepointer(0)) {
40  $info['fileformat'] = 'nsv';
41  $info['audio']['dataformat'] = 'nsv';
42  $info['video']['dataformat'] = 'nsv';
43  $info['audio']['lossless'] = false;
44  $info['video']['lossless'] = false;
45  $this->getNSVsHeaderFilepointer($info['nsv']['NSVf']['header_length']);
46  }
47  break;
48 
49  default:
50  $info['error'][] = 'Expecting "NSVs" or "NSVf" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($NSVheader).'"';
51  return false;
52  break;
53  }
54 
55  if (!isset($info['nsv']['NSVf'])) {
56  $info['warning'][] = 'NSVf header not present - cannot calculate playtime or bitrate';
57  }
58 
59  return true;
60  }
getNSVsHeaderFilepointer(&$fd, &$ThisFileInfo, $fileoffset)
$info
Definition: example_052.php:80
fread($bytes)
Definition: getid3.php:1685
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
PrintHexBytes($string, $hex=true, $spaces=true, $htmlsafe=true)
Definition: getid3.lib.php:17
getNSVfHeaderFilepointer(&$fd, &$ThisFileInfo, $fileoffset, $getTOCoffsets=false)
+ Here is the call graph for this function:

◆ getid3_nsv()

getid3_nsv::getid3_nsv ( $fd,
$ThisFileInfo 
)

Definition at line 20 of file module.audio-video.nsv.php.

References getid3_handler\fread(), getid3_handler\fseek(), getNSVfHeaderFilepointer(), and getNSVsHeaderFilepointer().

20  {
21 
22  fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
23  $NSVheader = fread($fd, 4);
24 
25  switch ($NSVheader) {
26  case 'NSVs':
27  if ($this->getNSVsHeaderFilepointer($fd, $ThisFileInfo, 0)) {
28  $ThisFileInfo['fileformat'] = 'nsv';
29  $ThisFileInfo['audio']['dataformat'] = 'nsv';
30  $ThisFileInfo['video']['dataformat'] = 'nsv';
31  $ThisFileInfo['audio']['lossless'] = false;
32  $ThisFileInfo['video']['lossless'] = false;
33  }
34  break;
35 
36  case 'NSVf':
37  if ($this->getNSVfHeaderFilepointer($fd, $ThisFileInfo, 0)) {
38  $ThisFileInfo['fileformat'] = 'nsv';
39  $ThisFileInfo['audio']['dataformat'] = 'nsv';
40  $ThisFileInfo['video']['dataformat'] = 'nsv';
41  $ThisFileInfo['audio']['lossless'] = false;
42  $ThisFileInfo['video']['lossless'] = false;
43  $this->getNSVsHeaderFilepointer($fd, $ThisFileInfo, $ThisFileInfo['nsv']['NSVf']['header_length']);
44  }
45  break;
46 
47  default:
48  $ThisFileInfo['error'][] = 'Expecting "NSVs" or "NSVf" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$NSVheader.'"';
49  return false;
50  break;
51  }
52 
53  if (!isset($ThisFileInfo['nsv']['NSVf'])) {
54  $ThisFileInfo['warning'][] = 'NSVf header not present - cannot calculate playtime or bitrate';
55  }
56 
57  return true;
58  }
getNSVsHeaderFilepointer(&$fd, &$ThisFileInfo, $fileoffset)
fread($bytes)
Definition: getid3.php:1685
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
getNSVfHeaderFilepointer(&$fd, &$ThisFileInfo, $fileoffset, $getTOCoffsets=false)
+ Here is the call graph for this function:

◆ getNSVfHeaderFilepointer() [1/2]

getid3_nsv::getNSVfHeaderFilepointer ( $fd,
$ThisFileInfo,
  $fileoffset,
  $getTOCoffsets = false 
)

Definition at line 132 of file module.audio-video.nsv.php.

References getid3_handler\fread(), getid3_handler\fseek(), and getid3_lib\LittleEndian2Int().

Referenced by Analyze(), and getid3_nsv().

132  {
133  fseek($fd, $fileoffset, SEEK_SET);
134  $NSVfheader = fread($fd, 28);
135  $offset = 0;
136 
137  $ThisFileInfo['nsv']['NSVf']['identifier'] = substr($NSVfheader, $offset, 4);
138  $offset += 4;
139 
140  if ($ThisFileInfo['nsv']['NSVf']['identifier'] != 'NSVf') {
141  $ThisFileInfo['error'][] = 'expected "NSVf" at offset ('.$fileoffset.'), found "'.$ThisFileInfo['nsv']['NSVf']['identifier'].'" instead';
142  unset($ThisFileInfo['nsv']['NSVf']);
143  return false;
144  }
145 
146  $ThisFileInfo['nsv']['NSVs']['offset'] = $fileoffset;
147 
148  $ThisFileInfo['nsv']['NSVf']['header_length'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
149  $offset += 4;
150  $ThisFileInfo['nsv']['NSVf']['file_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
151  $offset += 4;
152 
153  if ($ThisFileInfo['nsv']['NSVf']['file_size'] > $ThisFileInfo['avdataend']) {
154  $ThisFileInfo['warning'][] = 'truncated file - NSVf header indicates '.$ThisFileInfo['nsv']['NSVf']['file_size'].' bytes, file actually '.$ThisFileInfo['avdataend'].' bytes';
155  }
156 
157  $ThisFileInfo['nsv']['NSVf']['playtime_ms'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
158  $offset += 4;
159  $ThisFileInfo['nsv']['NSVf']['meta_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
160  $offset += 4;
161  $ThisFileInfo['nsv']['NSVf']['TOC_entries_1'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
162  $offset += 4;
163  $ThisFileInfo['nsv']['NSVf']['TOC_entries_2'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
164  $offset += 4;
165 
166  if ($ThisFileInfo['nsv']['NSVf']['playtime_ms'] == 0) {
167  $ThisFileInfo['error'][] = 'Corrupt NSV file: NSVf.playtime_ms == zero';
168  return false;
169  }
170 
171  $NSVfheader .= fread($fd, $ThisFileInfo['nsv']['NSVf']['meta_size'] + (4 * $ThisFileInfo['nsv']['NSVf']['TOC_entries_1']) + (4 * $ThisFileInfo['nsv']['NSVf']['TOC_entries_2']));
172  $NSVfheaderlength = strlen($NSVfheader);
173  $ThisFileInfo['nsv']['NSVf']['metadata'] = substr($NSVfheader, $offset, $ThisFileInfo['nsv']['NSVf']['meta_size']);
174  $offset += $ThisFileInfo['nsv']['NSVf']['meta_size'];
175 
176  if ($getTOCoffsets) {
177  $TOCcounter = 0;
178  while ($TOCcounter < $ThisFileInfo['nsv']['NSVf']['TOC_entries_1']) {
179  if ($TOCcounter < $ThisFileInfo['nsv']['NSVf']['TOC_entries_1']) {
180  $ThisFileInfo['nsv']['NSVf']['TOC_1'][$TOCcounter] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
181  $offset += 4;
182  $TOCcounter++;
183  }
184  }
185  }
186 
187  if (trim($ThisFileInfo['nsv']['NSVf']['metadata']) != '') {
188  $ThisFileInfo['nsv']['NSVf']['metadata'] = str_replace('`', "\x01", $ThisFileInfo['nsv']['NSVf']['metadata']);
189  $CommentPairArray = explode("\x01".' ', $ThisFileInfo['nsv']['NSVf']['metadata']);
190  foreach ($CommentPairArray as $CommentPair) {
191  if (strstr($CommentPair, '='."\x01")) {
192  list($key, $value) = explode('='."\x01", $CommentPair, 2);
193  $ThisFileInfo['nsv']['comments'][strtolower($key)][] = trim(str_replace("\x01", '', $value));
194  }
195  }
196  }
197 
198  $ThisFileInfo['playtime_seconds'] = $ThisFileInfo['nsv']['NSVf']['playtime_ms'] / 1000;
199  $ThisFileInfo['bitrate'] = ($ThisFileInfo['nsv']['NSVf']['file_size'] * 8) / $ThisFileInfo['playtime_seconds'];
200 
201  return true;
202  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
fread($bytes)
Definition: getid3.php:1685
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNSVfHeaderFilepointer() [2/2]

getid3_nsv::getNSVfHeaderFilepointer (   $fileoffset,
  $getTOCoffsets = false 
)

Definition at line 135 of file module.audio-video.nsv.php.

References $info, getid3_handler\fread(), getid3_handler\fseek(), and getid3_lib\LittleEndian2Int().

135  {
136  $info = &$this->getid3->info;
137  $this->fseek($fileoffset);
138  $NSVfheader = $this->fread(28);
139  $offset = 0;
140 
141  $info['nsv']['NSVf']['identifier'] = substr($NSVfheader, $offset, 4);
142  $offset += 4;
143 
144  if ($info['nsv']['NSVf']['identifier'] != 'NSVf') {
145  $info['error'][] = 'expected "NSVf" at offset ('.$fileoffset.'), found "'.$info['nsv']['NSVf']['identifier'].'" instead';
146  unset($info['nsv']['NSVf']);
147  return false;
148  }
149 
150  $info['nsv']['NSVs']['offset'] = $fileoffset;
151 
152  $info['nsv']['NSVf']['header_length'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
153  $offset += 4;
154  $info['nsv']['NSVf']['file_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
155  $offset += 4;
156 
157  if ($info['nsv']['NSVf']['file_size'] > $info['avdataend']) {
158  $info['warning'][] = 'truncated file - NSVf header indicates '.$info['nsv']['NSVf']['file_size'].' bytes, file actually '.$info['avdataend'].' bytes';
159  }
160 
161  $info['nsv']['NSVf']['playtime_ms'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
162  $offset += 4;
163  $info['nsv']['NSVf']['meta_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
164  $offset += 4;
165  $info['nsv']['NSVf']['TOC_entries_1'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
166  $offset += 4;
167  $info['nsv']['NSVf']['TOC_entries_2'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
168  $offset += 4;
169 
170  if ($info['nsv']['NSVf']['playtime_ms'] == 0) {
171  $info['error'][] = 'Corrupt NSV file: NSVf.playtime_ms == zero';
172  return false;
173  }
174 
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'];
179 
180  if ($getTOCoffsets) {
181  $TOCcounter = 0;
182  while ($TOCcounter < $info['nsv']['NSVf']['TOC_entries_1']) {
183  if ($TOCcounter < $info['nsv']['NSVf']['TOC_entries_1']) {
184  $info['nsv']['NSVf']['TOC_1'][$TOCcounter] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
185  $offset += 4;
186  $TOCcounter++;
187  }
188  }
189  }
190 
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));
198  }
199  }
200  }
201 
202  $info['playtime_seconds'] = $info['nsv']['NSVf']['playtime_ms'] / 1000;
203  $info['bitrate'] = ($info['nsv']['NSVf']['file_size'] * 8) / $info['playtime_seconds'];
204 
205  return true;
206  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
$info
Definition: example_052.php:80
fread($bytes)
Definition: getid3.php:1685
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:

◆ getNSVsHeaderFilepointer() [1/2]

getid3_nsv::getNSVsHeaderFilepointer ( $fd,
$ThisFileInfo,
  $fileoffset 
)

Definition at line 60 of file module.audio-video.nsv.php.

References getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\LittleEndian2Int(), and NSVframerateLookup().

Referenced by Analyze(), and getid3_nsv().

60  {
61  fseek($fd, $fileoffset, SEEK_SET);
62  $NSVsheader = fread($fd, 28);
63  $offset = 0;
64 
65  $ThisFileInfo['nsv']['NSVs']['identifier'] = substr($NSVsheader, $offset, 4);
66  $offset += 4;
67 
68  if ($ThisFileInfo['nsv']['NSVs']['identifier'] != 'NSVs') {
69  $ThisFileInfo['error'][] = 'expected "NSVs" at offset ('.$fileoffset.'), found "'.$ThisFileInfo['nsv']['NSVs']['identifier'].'" instead';
70  unset($ThisFileInfo['nsv']['NSVs']);
71  return false;
72  }
73 
74  $ThisFileInfo['nsv']['NSVs']['offset'] = $fileoffset;
75 
76  $ThisFileInfo['nsv']['NSVs']['video_codec'] = substr($NSVsheader, $offset, 4);
77  $offset += 4;
78  $ThisFileInfo['nsv']['NSVs']['audio_codec'] = substr($NSVsheader, $offset, 4);
79  $offset += 4;
80  $ThisFileInfo['nsv']['NSVs']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
81  $offset += 2;
82  $ThisFileInfo['nsv']['NSVs']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
83  $offset += 2;
84 
85  $ThisFileInfo['nsv']['NSVs']['framerate_index'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
86  $offset += 1;
87  //$ThisFileInfo['nsv']['NSVs']['unknown1b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
88  $offset += 1;
89  //$ThisFileInfo['nsv']['NSVs']['unknown1c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
90  $offset += 1;
91  //$ThisFileInfo['nsv']['NSVs']['unknown1d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
92  $offset += 1;
93  //$ThisFileInfo['nsv']['NSVs']['unknown2a'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
94  $offset += 1;
95  //$ThisFileInfo['nsv']['NSVs']['unknown2b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
96  $offset += 1;
97  //$ThisFileInfo['nsv']['NSVs']['unknown2c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
98  $offset += 1;
99  //$ThisFileInfo['nsv']['NSVs']['unknown2d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
100  $offset += 1;
101 
102  switch ($ThisFileInfo['nsv']['NSVs']['audio_codec']) {
103  case 'PCM ':
104  $ThisFileInfo['nsv']['NSVs']['bits_channel'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
105  $offset += 1;
106  $ThisFileInfo['nsv']['NSVs']['channels'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
107  $offset += 1;
108  $ThisFileInfo['nsv']['NSVs']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
109  $offset += 2;
110 
111  $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['nsv']['NSVs']['sample_rate'];
112  break;
113 
114  case 'MP3 ':
115  case 'NONE':
116  default:
117  //$ThisFileInfo['nsv']['NSVs']['unknown3'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 4));
118  $offset += 4;
119  break;
120  }
121 
122  $ThisFileInfo['video']['resolution_x'] = $ThisFileInfo['nsv']['NSVs']['resolution_x'];
123  $ThisFileInfo['video']['resolution_y'] = $ThisFileInfo['nsv']['NSVs']['resolution_y'];
124  $ThisFileInfo['nsv']['NSVs']['frame_rate'] = $this->NSVframerateLookup($ThisFileInfo['nsv']['NSVs']['framerate_index']);
125  $ThisFileInfo['video']['frame_rate'] = $ThisFileInfo['nsv']['NSVs']['frame_rate'];
126  $ThisFileInfo['video']['bits_per_sample'] = 24;
127  $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1;
128 
129  return true;
130  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
fread($bytes)
Definition: getid3.php:1685
NSVframerateLookup($framerateindex)
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNSVsHeaderFilepointer() [2/2]

getid3_nsv::getNSVsHeaderFilepointer (   $fileoffset)

Definition at line 62 of file module.audio-video.nsv.php.

References $info, getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\LittleEndian2Int(), and NSVframerateLookup().

62  {
63  $info = &$this->getid3->info;
64  $this->fseek($fileoffset);
65  $NSVsheader = $this->fread(28);
66  $offset = 0;
67 
68  $info['nsv']['NSVs']['identifier'] = substr($NSVsheader, $offset, 4);
69  $offset += 4;
70 
71  if ($info['nsv']['NSVs']['identifier'] != 'NSVs') {
72  $info['error'][] = 'expected "NSVs" at offset ('.$fileoffset.'), found "'.$info['nsv']['NSVs']['identifier'].'" instead';
73  unset($info['nsv']['NSVs']);
74  return false;
75  }
76 
77  $info['nsv']['NSVs']['offset'] = $fileoffset;
78 
79  $info['nsv']['NSVs']['video_codec'] = substr($NSVsheader, $offset, 4);
80  $offset += 4;
81  $info['nsv']['NSVs']['audio_codec'] = substr($NSVsheader, $offset, 4);
82  $offset += 4;
83  $info['nsv']['NSVs']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
84  $offset += 2;
85  $info['nsv']['NSVs']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
86  $offset += 2;
87 
88  $info['nsv']['NSVs']['framerate_index'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
89  $offset += 1;
90  //$info['nsv']['NSVs']['unknown1b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
91  $offset += 1;
92  //$info['nsv']['NSVs']['unknown1c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
93  $offset += 1;
94  //$info['nsv']['NSVs']['unknown1d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
95  $offset += 1;
96  //$info['nsv']['NSVs']['unknown2a'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
97  $offset += 1;
98  //$info['nsv']['NSVs']['unknown2b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
99  $offset += 1;
100  //$info['nsv']['NSVs']['unknown2c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
101  $offset += 1;
102  //$info['nsv']['NSVs']['unknown2d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
103  $offset += 1;
104 
105  switch ($info['nsv']['NSVs']['audio_codec']) {
106  case 'PCM ':
107  $info['nsv']['NSVs']['bits_channel'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
108  $offset += 1;
109  $info['nsv']['NSVs']['channels'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
110  $offset += 1;
111  $info['nsv']['NSVs']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
112  $offset += 2;
113 
114  $info['audio']['sample_rate'] = $info['nsv']['NSVs']['sample_rate'];
115  break;
116 
117  case 'MP3 ':
118  case 'NONE':
119  default:
120  //$info['nsv']['NSVs']['unknown3'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 4));
121  $offset += 4;
122  break;
123  }
124 
125  $info['video']['resolution_x'] = $info['nsv']['NSVs']['resolution_x'];
126  $info['video']['resolution_y'] = $info['nsv']['NSVs']['resolution_y'];
127  $info['nsv']['NSVs']['frame_rate'] = $this->NSVframerateLookup($info['nsv']['NSVs']['framerate_index']);
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;
131 
132  return true;
133  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
$info
Definition: example_052.php:80
fread($bytes)
Definition: getid3.php:1685
NSVframerateLookup($framerateindex)
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:

◆ NSVframerateLookup() [1/2]

getid3_nsv::NSVframerateLookup (   $framerateindex)

Definition at line 205 of file module.audio-video.nsv.php.

Referenced by getNSVsHeaderFilepointer().

205  {
206  if ($framerateindex <= 127) {
207  return (float) $framerateindex;
208  }
209 
210  static $NSVframerateLookup = array();
211  if (empty($NSVframerateLookup)) {
212  $NSVframerateLookup[129] = (float) 29.970;
213  $NSVframerateLookup[131] = (float) 23.976;
214  $NSVframerateLookup[133] = (float) 14.985;
215  $NSVframerateLookup[197] = (float) 59.940;
216  $NSVframerateLookup[199] = (float) 47.952;
217  }
218  return (isset($NSVframerateLookup[$framerateindex]) ? $NSVframerateLookup[$framerateindex] : false);
219  }
+ Here is the caller graph for this function:

◆ NSVframerateLookup() [2/2]

static getid3_nsv::NSVframerateLookup (   $framerateindex)
static

Definition at line 209 of file module.audio-video.nsv.php.

209  {
210  if ($framerateindex <= 127) {
211  return (float) $framerateindex;
212  }
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;
220  }
221  return (isset($NSVframerateLookup[$framerateindex]) ? $NSVframerateLookup[$framerateindex] : false);
222  }

The documentation for this class was generated from the following file: