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 /////////////////////////////////////////////////////////////////
17 class getid3_bink
extends getid3_handler
22 public function Analyze() {
23 $info = &$this->getid3
->info
;
25 $this->error('Bink / Smacker files not properly processed by this version of getID3() ['.$this->getid3
->version().']');
27 $this->fseek($info['avdataoffset']);
28 $fileTypeID = $this->fread(3);
29 switch ($fileTypeID) {
31 return $this->ParseBink();
35 return $this->ParseSmacker();
39 $this->error('Expecting "BIK" or "SMK" at offset '.$info['avdataoffset'].', found "'.getid3_lib
::PrintHexBytes($fileTypeID).'"');
51 public function ParseBink() {
52 $info = &$this->getid3
->info
;
53 $info['fileformat'] = 'bink';
54 $info['video']['dataformat'] = 'bink';
56 $fileData = 'BIK'.$this->fread(13);
58 $info['bink']['data_size'] = getid3_lib
::LittleEndian2Int(substr($fileData, 4, 4));
59 $info['bink']['frame_count'] = getid3_lib
::LittleEndian2Int(substr($fileData, 8, 2));
61 if (($info['avdataend'] - $info['avdataoffset']) != ($info['bink']['data_size'] +
8)) {
62 $this->error('Probably truncated file: expecting '.$info['bink']['data_size'].' bytes, found '.($info['avdataend'] - $info['avdataoffset']));
71 public function ParseSmacker() {
72 $info = &$this->getid3
->info
;
73 $info['fileformat'] = 'smacker';
74 $info['video']['dataformat'] = 'smacker';