2 /////////////////////////////////////////////////////////////////
3 /// getID3() by James Heinrich <info@getid3.org> //
4 // available at https://github.com/JamesHeinrich/getID3 //
5 // or https://www.getid3.org //
6 // or http://getid3.sourceforge.net //
7 // see readme.txt for more details //
8 /////////////////////////////////////////////////////////////////
10 // module.audio.bink.php //
11 // module for analyzing Bink or Smacker audio-video files //
12 // dependencies: NONE //
14 /////////////////////////////////////////////////////////////////
16 if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers
20 class getid3_bink
extends getid3_handler
25 public function Analyze() {
26 $info = &$this->getid3
->info
;
28 $this->error('Bink / Smacker files not properly processed by this version of getID3() ['.$this->getid3
->version().']');
30 $this->fseek($info['avdataoffset']);
31 $fileTypeID = $this->fread(3);
32 switch ($fileTypeID) {
34 return $this->ParseBink();
37 return $this->ParseSmacker();
40 $this->error('Expecting "BIK" or "SMK" at offset '.$info['avdataoffset'].', found "'.getid3_lib
::PrintHexBytes($fileTypeID).'"');
48 public function ParseBink() {
49 $info = &$this->getid3
->info
;
50 $info['fileformat'] = 'bink';
51 $info['video']['dataformat'] = 'bink';
53 $fileData = 'BIK'.$this->fread(13);
55 $info['bink']['data_size'] = getid3_lib
::LittleEndian2Int(substr($fileData, 4, 4));
56 $info['bink']['frame_count'] = getid3_lib
::LittleEndian2Int(substr($fileData, 8, 2));
58 if (($info['avdataend'] - $info['avdataoffset']) != ($info['bink']['data_size'] +
8)) {
59 $this->error('Probably truncated file: expecting '.$info['bink']['data_size'].' bytes, found '.($info['avdataend'] - $info['avdataoffset']));
68 public function ParseSmacker() {
69 $info = &$this->getid3
->info
;
70 $info['fileformat'] = 'smacker';
71 $info['video']['dataformat'] = 'smacker';