ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
module.audio-video.bink.php
Go to the documentation of this file.
1 <?php
4 // available at http://getid3.sourceforge.net //
5 // or http://www.getid3.org //
7 // See readme.txt for more details //
9 // //
10 // module.audio.bink.php //
11 // module for analyzing Bink or Smacker audio-video files //
12 // dependencies: NONE //
13 // ///
15 
16 
18 {
19 
20  function getid3_bink(&$fd, &$ThisFileInfo) {
21 
22 $ThisFileInfo['error'][] = 'Bink / Smacker files not properly processed by this version of getID3()';
23 
24  fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
25  $fileTypeID = fread($fd, 3);
26  switch ($fileTypeID) {
27  case 'BIK':
28  return $this->ParseBink($fd, $ThisFileInfo);
29  break;
30 
31  case 'SMK':
32  return $this->ParseSmacker($fd, $ThisFileInfo);
33  break;
34 
35  default:
36  $ThisFileInfo['error'][] = 'Expecting "BIK" or "SMK" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$fileTypeID.'"';
37  return false;
38  break;
39  }
40 
41  return true;
42 
43  }
44 
45  function ParseBink(&$fd, &$ThisFileInfo) {
46  $ThisFileInfo['fileformat'] = 'bink';
47  $ThisFileInfo['video']['dataformat'] = 'bink';
48 
49  $fileData = 'BIK'.fread($fd, 13);
50 
51  $ThisFileInfo['bink']['data_size'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4));
52  $ThisFileInfo['bink']['frame_count'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 2));
53 
54  if (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) != ($ThisFileInfo['bink']['data_size'] + 8)) {
55  $ThisFileInfo['error'][] = 'Probably truncated file: expecting '.$ThisFileInfo['bink']['data_size'].' bytes, found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']);
56  }
57 
58  return true;
59  }
60 
61  function ParseSmacker(&$fd, &$ThisFileInfo) {
62  $ThisFileInfo['fileformat'] = 'smacker';
63  $ThisFileInfo['video']['dataformat'] = 'smacker';
64 
65  return false;
66  }
67 
68 }
69 
70 ?>