1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- if (!defined('GETID3_INCLUDEPATH')) {
- exit;
- }
- class getid3_hpk extends getid3_handler
- {
-
- public function Analyze() {
- $info = &$this->getid3->info;
- $info['fileformat'] = 'hpk';
- $this->fseek($info['avdataoffset']);
- $HPKheader = $this->fread(36);
- if (substr($HPKheader, 0, 4) == 'BPUL') {
- $info['hpk']['header']['signature'] = substr($HPKheader, 0, 4);
- $info['hpk']['header']['data_offset'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 4, 4));
- $info['hpk']['header']['fragments_per_file'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 8, 4));
-
- $info['hpk']['header']['fragments_residual_offset'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 16, 4));
- $info['hpk']['header']['fragments_residual_count'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 20, 4));
-
- $info['hpk']['header']['fragmented_filesystem_offset'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 28, 4));
- $info['hpk']['header']['fragmented_filesystem_length'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 32, 4));
- $info['hpk']['header']['filesystem_entries'] = $info['hpk']['header']['fragmented_filesystem_length'] / ($info['hpk']['header']['fragments_per_file'] * 8);
- $this->fseek($info['hpk']['header']['fragmented_filesystem_offset']);
- for ($i = 0; $i < $info['hpk']['header']['filesystem_entries']; $i++) {
- $offset = getid3_lib::LittleEndian2Int($this->fread(4));
- $length = getid3_lib::LittleEndian2Int($this->fread(4));
- $info['hpk']['filesystem'][$i] = array('offset' => $offset, 'length' => $length);
- }
- $this->error('HPK parsing incomplete (and mostly broken) in this version of getID3() ['.$this->getid3->version().']');
- } else {
- $this->error('Expecting "BPUL" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($HPKheader, 0, 4)).'"');
- return false;
- }
- return true;
- }
- }
|