ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Bink.php
Go to the documentation of this file.
1 <?php
2 
4 
7 
10 // available at http://getid3.sourceforge.net //
11 // or http://www.getid3.org //
13 // See readme.txt for more details //
15 // //
16 // module.audio.bink.php //
17 // module for analyzing Bink or Smacker audio-video files //
18 // dependencies: NONE //
19 // ///
21 
29 class Bink extends BaseHandler
30 {
31 
36  public function analyze()
37  {
38  $info = &$this->getid3->info;
39 
40  $info['error'][] = 'Bink / Smacker files not properly processed by this version of GetId3Core() [' . $this->getid3->version() . ']';
41 
42  fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
43  $fileTypeID = fread($this->getid3->fp, 3);
44  switch ($fileTypeID) {
45  case 'BIK':
46  return $this->ParseBink();
47  break;
48 
49  case 'SMK':
50  return $this->ParseSmacker();
51  break;
52 
53  default:
54  $info['error'][] = 'Expecting "BIK" or "SMK" at offset ' . $info['avdataoffset'] . ', found "' . Helper::PrintHexBytes($fileTypeID) . '"';
55 
56  return false;
57  break;
58  }
59 
60  return true;
61  }
62 
67  public function ParseBink()
68  {
69  $info = &$this->getid3->info;
70  $info['fileformat'] = 'bink';
71  $info['video']['dataformat'] = 'bink';
72 
73  $fileData = 'BIK' . fread($this->getid3->fp, 13);
74 
75  $info['bink']['data_size'] = Helper::LittleEndian2Int(substr($fileData,
76  4,
77  4));
78  $info['bink']['frame_count'] = Helper::LittleEndian2Int(substr($fileData,
79  8,
80  2));
81 
82  if (($info['avdataend'] - $info['avdataoffset']) != ($info['bink']['data_size'] + 8)) {
83  $info['error'][] = 'Probably truncated file: expecting ' . $info['bink']['data_size'] . ' bytes, found ' . ($info['avdataend'] - $info['avdataoffset']);
84  }
85 
86  return true;
87  }
88 
93  public function ParseSmacker()
94  {
95  $info = &$this->getid3->info;
96  $info['fileformat'] = 'smacker';
97  $info['video']['dataformat'] = 'smacker';
98 
99  return true;
100  }
101 }
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
Definition: Helper.php:36
GetId3() by James Heinrich info@getid3.org //.
Definition: BaseHandler.php:25
fseek($bytes, $whence=SEEK_SET)
$info
Definition: example_052.php:80
GetId3() by James Heinrich info@getid3.org //.
Definition: Bink.php:29
static LittleEndian2Int($byteword, $signed=false)
Definition: Helper.php:413