2 /////////////////////////////////////////////////////////////////
3 /// getID3() by James Heinrich <info@getid3.org> //
4 // available at http://getid3.sourceforge.net //
5 // or http://www.getid3.org //
6 // also https://github.com/JamesHeinrich/getID3 //
7 /////////////////////////////////////////////////////////////////
8 // See readme.txt for more details //
9 /////////////////////////////////////////////////////////////////
11 // module.audio.bink.php //
12 // module for analyzing Bink or Smacker audio-video files //
13 // dependencies: NONE //
15 /////////////////////////////////////////////////////////////////
18 class getid3_bink
extends getid3_handler
21 public function Analyze() {
22 $info = &$this->getid3
->info
;
24 $this->error('Bink / Smacker files not properly processed by this version of getID3() ['.$this->getid3
->version().']');
26 $this->fseek($info['avdataoffset']);
27 $fileTypeID = $this->fread(3);
28 switch ($fileTypeID) {
30 return $this->ParseBink();
34 return $this->ParseSmacker();
38 $this->error('Expecting "BIK" or "SMK" at offset '.$info['avdataoffset'].', found "'.getid3_lib
::PrintHexBytes($fileTypeID).'"');
47 public function ParseBink() {
48 $info = &$this->getid3
->info
;
49 $info['fileformat'] = 'bink';
50 $info['video']['dataformat'] = 'bink';
52 $fileData = 'BIK'.$this->fread(13);
54 $info['bink']['data_size'] = getid3_lib
::LittleEndian2Int(substr($fileData, 4, 4));
55 $info['bink']['frame_count'] = getid3_lib
::LittleEndian2Int(substr($fileData, 8, 2));
57 if (($info['avdataend'] - $info['avdataoffset']) != ($info['bink']['data_size'] +
8)) {
58 $this->error('Probably truncated file: expecting '.$info['bink']['data_size'].' bytes, found '.($info['avdataend'] - $info['avdataoffset']));
64 public function ParseSmacker() {
65 $info = &$this->getid3
->info
;
66 $info['fileformat'] = 'smacker';
67 $info['video']['dataformat'] = 'smacker';