ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
getid3_au Class Reference

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g // More...

+ Collaboration diagram for getid3_au:

Public Member Functions

 getid3_au (&$fd, &$ThisFileInfo)
 
 AUdataFormatNameLookup ($id)
 
 AUdataFormatBitsPerSampleLookup ($id)
 
 AUdataFormatUsedBitsPerSampleLookup ($id)
 

Detailed Description

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //

Definition at line 17 of file module.audio.au.php.

Member Function Documentation

◆ AUdataFormatBitsPerSampleLookup()

getid3_au::AUdataFormatBitsPerSampleLookup (   $id)

Definition at line 104 of file module.audio.au.php.

Referenced by getid3_au().

104  {
105  static $AUdataFormatBitsPerSampleLookup = array(
106  1 => 8,
107  2 => 8,
108  3 => 16,
109  4 => 24,
110  5 => 32,
111  6 => 32,
112  7 => 64,
113 
114  11 => 8,
115  12 => 16,
116  13 => 24,
117  14 => 32,
118 
119  18 => 16,
120  19 => 16,
121  20 => 16,
122 
123  23 => 16,
124 
125  25 => 16,
126  26 => 16,
127  27 => 8
128  );
129  return (isset($AUdataFormatBitsPerSampleLookup[$id]) ? $AUdataFormatBitsPerSampleLookup[$id] : false);
130  }
+ Here is the caller graph for this function:

◆ AUdataFormatNameLookup()

getid3_au::AUdataFormatNameLookup (   $id)

Definition at line 70 of file module.audio.au.php.

Referenced by getid3_au().

70  {
71  static $AUdataFormatNameLookup = array(
72  0 => 'unspecified format',
73  1 => '8-bit mu-law',
74  2 => '8-bit linear',
75  3 => '16-bit linear',
76  4 => '24-bit linear',
77  5 => '32-bit linear',
78  6 => 'floating-point',
79  7 => 'double-precision float',
80  8 => 'fragmented sampled data',
81  9 => 'SUN_FORMAT_NESTED',
82  10 => 'DSP program',
83  11 => '8-bit fixed-point',
84  12 => '16-bit fixed-point',
85  13 => '24-bit fixed-point',
86  14 => '32-bit fixed-point',
87 
88  16 => 'non-audio display data',
89  17 => 'SND_FORMAT_MULAW_SQUELCH',
90  18 => '16-bit linear with emphasis',
91  19 => '16-bit linear with compression',
92  20 => '16-bit linear with emphasis + compression',
93  21 => 'Music Kit DSP commands',
94  22 => 'SND_FORMAT_DSP_COMMANDS_SAMPLES',
95  23 => 'CCITT g.721 4-bit ADPCM',
96  24 => 'CCITT g.722 ADPCM',
97  25 => 'CCITT g.723 3-bit ADPCM',
98  26 => 'CCITT g.723 5-bit ADPCM',
99  27 => 'A-Law 8-bit'
100  );
101  return (isset($AUdataFormatNameLookup[$id]) ? $AUdataFormatNameLookup[$id] : false);
102  }
+ Here is the caller graph for this function:

◆ AUdataFormatUsedBitsPerSampleLookup()

getid3_au::AUdataFormatUsedBitsPerSampleLookup (   $id)

Definition at line 132 of file module.audio.au.php.

Referenced by getid3_au().

132  {
133  static $AUdataFormatUsedBitsPerSampleLookup = array(
134  1 => 8,
135  2 => 8,
136  3 => 16,
137  4 => 24,
138  5 => 32,
139  6 => 32,
140  7 => 64,
141 
142  11 => 8,
143  12 => 16,
144  13 => 24,
145  14 => 32,
146 
147  18 => 16,
148  19 => 16,
149  20 => 16,
150 
151  23 => 4,
152 
153  25 => 3,
154  26 => 5,
155  27 => 8,
156  );
157  return (isset($AUdataFormatUsedBitsPerSampleLookup[$id]) ? $AUdataFormatUsedBitsPerSampleLookup[$id] : false);
158  }
+ Here is the caller graph for this function:

◆ getid3_au()

getid3_au::getid3_au ( $fd,
$ThisFileInfo 
)

Definition at line 20 of file module.audio.au.php.

References AUdataFormatBitsPerSampleLookup(), AUdataFormatNameLookup(), AUdataFormatUsedBitsPerSampleLookup(), and getid3_lib\BigEndian2Int().

20  {
21 
22  fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
23  $AUheader = fread($fd, 8);
24 
25  if (substr($AUheader, 0, 4) != '.snd') {
26  $ThisFileInfo['error'][] = 'Expecting ".snd" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($AUheader, 0, 4).'"';
27  return false;
28  }
29 
30  // shortcut
31  $ThisFileInfo['au'] = array();
32  $thisfile_au = &$ThisFileInfo['au'];
33 
34  $ThisFileInfo['fileformat'] = 'au';
35  $ThisFileInfo['audio']['dataformat'] = 'au';
36  $ThisFileInfo['audio']['bitrate_mode'] = 'cbr';
37  $thisfile_au['encoding'] = 'ISO-8859-1';
38 
39  $thisfile_au['header_length'] = getid3_lib::BigEndian2Int(substr($AUheader, 4, 4));
40  $AUheader .= fread($fd, $thisfile_au['header_length'] - 8);
41  $ThisFileInfo['avdataoffset'] += $thisfile_au['header_length'];
42 
43  $thisfile_au['data_size'] = getid3_lib::BigEndian2Int(substr($AUheader, 8, 4));
44  $thisfile_au['data_format_id'] = getid3_lib::BigEndian2Int(substr($AUheader, 12, 4));
45  $thisfile_au['sample_rate'] = getid3_lib::BigEndian2Int(substr($AUheader, 16, 4));
46  $thisfile_au['channels'] = getid3_lib::BigEndian2Int(substr($AUheader, 20, 4));
47  $thisfile_au['comments']['comment'][] = trim(substr($AUheader, 24));
48 
49  $thisfile_au['data_format'] = $this->AUdataFormatNameLookup($thisfile_au['data_format_id']);
50  $thisfile_au['used_bits_per_sample'] = $this->AUdataFormatUsedBitsPerSampleLookup($thisfile_au['data_format_id']);
51  if ($thisfile_au['bits_per_sample'] = $this->AUdataFormatBitsPerSampleLookup($thisfile_au['data_format_id'])) {
52  $ThisFileInfo['audio']['bits_per_sample'] = $thisfile_au['bits_per_sample'];
53  } else {
54  unset($thisfile_au['bits_per_sample']);
55  }
56 
57  $ThisFileInfo['audio']['sample_rate'] = $thisfile_au['sample_rate'];
58  $ThisFileInfo['audio']['channels'] = $thisfile_au['channels'];
59 
60  if (($ThisFileInfo['avdataoffset'] + $thisfile_au['data_size']) > $ThisFileInfo['avdataend']) {
61  $ThisFileInfo['warning'][] = 'Possible truncated file - expecting "'.$thisfile_au['data_size'].'" bytes of audio data, only found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']).' bytes"';
62  }
63 
64  $ThisFileInfo['playtime_seconds'] = $thisfile_au['data_size'] / ($thisfile_au['sample_rate'] * $thisfile_au['channels'] * ($thisfile_au['used_bits_per_sample'] / 8));
65  $ThisFileInfo['audio']['bitrate'] = ($thisfile_au['data_size'] * 8) / $ThisFileInfo['playtime_seconds'];
66 
67  return true;
68  }
AUdataFormatBitsPerSampleLookup($id)
AUdataFormatNameLookup($id)
BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: getid3.lib.php:234
AUdataFormatUsedBitsPerSampleLookup($id)
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: