ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 //
6// also https://github.com/JamesHeinrich/getID3 //
8// See readme.txt for more details //
10// //
11// module.audio.bink.php //
12// module for analyzing Bink or Smacker audio-video files //
13// dependencies: NONE //
14// ///
16
17
19{
20
21 public function Analyze() {
22 $info = &$this->getid3->info;
23
24$this->error('Bink / Smacker files not properly processed by this version of getID3() ['.$this->getid3->version().']');
25
26 $this->fseek($info['avdataoffset']);
27 $fileTypeID = $this->fread(3);
28 switch ($fileTypeID) {
29 case 'BIK':
30 return $this->ParseBink();
31 break;
32
33 case 'SMK':
34 return $this->ParseSmacker();
35 break;
36
37 default:
38 $this->error('Expecting "BIK" or "SMK" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($fileTypeID).'"');
39 return false;
40 break;
41 }
42
43 return true;
44
45 }
46
47 public function ParseBink() {
48 $info = &$this->getid3->info;
49 $info['fileformat'] = 'bink';
50 $info['video']['dataformat'] = 'bink';
51
52 $fileData = 'BIK'.$this->fread(13);
53
54 $info['bink']['data_size'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4));
55 $info['bink']['frame_count'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 2));
56
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']));
59 }
60
61 return true;
62 }
63
64 public function ParseSmacker() {
65 $info = &$this->getid3->info;
66 $info['fileformat'] = 'smacker';
67 $info['video']['dataformat'] = 'smacker';
68
69 return true;
70 }
71
72}
An exception for terminatinating execution or to throw for unit testing.
getID3() by James Heinrich info@getid3.org //
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1711
fread($bytes)
Definition: getid3.php:1683
error($text)
Definition: getid3.php:1752
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
Definition: getid3.lib.php:18
static LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:292
$info
Definition: index.php:5