73 if (null !== $call_module) {
74 $this->dependency_to = $call_module;
81 abstract public function analyze();
89 $this->data_string_flag =
true;
90 $this->data_string = $string;
93 $saved_avdataoffset = $this->getid3->info[
'avdataoffset'];
94 $saved_avdataend = $this->getid3->info[
'avdataend'];
95 $saved_filesize = (isset($this->getid3->info[
'filesize']) ? $this->getid3->info[
'filesize'] : null);
97 $this->getid3->info[
'avdataoffset'] = 0;
98 $this->getid3->info[
'avdataend'] = $this->getid3->info[
'filesize'] = $this->data_string_length = strlen($string);
104 $this->getid3->info[
'avdataoffset'] = $saved_avdataoffset;
105 $this->getid3->info[
'avdataend'] = $saved_avdataend;
106 $this->getid3->info[
'filesize'] = $saved_filesize;
109 $this->data_string_flag =
false;
118 if ($this->data_string_flag) {
122 return ftell($this->getid3->fp);
132 if ($this->data_string_flag) {
133 $this->data_string_position += $bytes;
135 return substr($this->data_string,
136 $this->data_string_position - $bytes, $bytes);
139 return fread($this->getid3->fp, $bytes);
148 protected function fseek($bytes, $whence = SEEK_SET)
150 if ($this->data_string_flag) {
153 $this->data_string_position = $bytes;
157 $this->data_string_position += $bytes;
161 $this->data_string_position = $this->data_string_length + $bytes;
168 return fseek($this->getid3->fp, $bytes, $whence);
177 if ($this->data_string_flag) {
181 return feof($this->getid3->fp);
191 return $this->dependency_to == $module;
201 $this->getid3->info[
'error'][] =
$text;
213 return $this->getid3->warning(
$text);
230 throw new DefaultException(
'it extends beyond the ' . round(PHP_INT_MAX / 1073741824) .
'GB limit');
234 if ($this->getid3->option_save_attachments === self::ATTACHMENTS_NONE) {
235 unset($ThisFileInfoIndex);
239 else if ($this->getid3->option_save_attachments === self::ATTACHMENTS_INLINE) {
242 $this->
fseek($offset);
243 $ThisFileInfoIndex = $this->
fread($length);
244 if ($ThisFileInfoIndex ===
false || strlen($ThisFileInfoIndex) != $length) {
253 $dir = rtrim(str_replace(
array(
'/',
'\\'), DIRECTORY_SEPARATOR,
254 $this->getid3->option_save_attachments),
255 DIRECTORY_SEPARATOR);
256 if (!is_dir($dir) || !is_writable($dir)) {
257 throw new DefaultException(
'supplied path (' . $dir .
') does not exist, or is not writable');
259 $dest = $dir . DIRECTORY_SEPARATOR .
$filename;
262 if (($fp_dest = fopen($dest,
'wb')) ==
false) {
267 $this->
fseek($offset);
268 $buffersize = ($this->data_string_flag ? $length : $this->getid3->fread_buffer_size());
269 $bytesleft = $length;
270 while ($bytesleft > 0) {
271 if (($buffer = $this->
fread(min($buffersize, $bytesleft))) ===
false || ($byteswritten = fwrite($fp_dest,
272 $buffer)) ===
false) {
275 throw new DefaultException($buffer ===
false ?
'not enough data to read' :
'failed to write to destination file, may be not enough disk space');
277 $bytesleft -= $byteswritten;
281 $ThisFileInfoIndex = $dest;
285 unset($ThisFileInfoIndex);
286 $this->
warning(
'Failed to extract attachment ' .
$filename .
': ' . $e->getMessage());
GetId3() by James Heinrich info@getid3.org //.
__construct(GetId3Core $getid3, $call_module=null)
fseek($bytes, $whence=SEEK_SET)
GetId3() by James Heinrich info@getid3.org //.
analyze()
Analyze from file pointer.
Create styles array
The data for the language used.
AnalyzeString(&$string)
Analyze from string instead.
static intValueSupported($num)
null $hasINT64
saveAttachment(&$ThisFileInfoIndex, $filename, $offset, $length)