ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
GetId3\Module\Audio\Dss Class Reference

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

+ Inheritance diagram for GetId3\Module\Audio\Dss:
+ Collaboration diagram for GetId3\Module\Audio\Dss:

Public Member Functions

 analyze ()
 
- Public Member Functions inherited from GetId3\Handler\BaseHandler
 __construct (GetId3Core $getid3, $call_module=null)
 
 analyze ()
 Analyze from file pointer. More...
 
 AnalyzeString (&$string)
 Analyze from string instead. More...
 
 saveAttachment (&$ThisFileInfoIndex, $filename, $offset, $length)
 

Static Protected Member Functions

static DSSdateStringToUnixDate ($datestring)
 

Additional Inherited Members

- Protected Member Functions inherited from GetId3\Handler\BaseHandler
 ftell ()
 
 fread ($bytes)
 
 fseek ($bytes, $whence=SEEK_SET)
 
 feof ()
 
 isDependencyFor ($module)
 
 error ($text)
 
 warning ($text)
 
- Protected Attributes inherited from GetId3\Handler\BaseHandler
 $getid3
 
 $data_string_flag = false
 
 $data_string = ''
 
 $data_string_position = 0
 
 $data_string_length = 0
 

Detailed Description

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

module for analyzing Digital Speech Standard (DSS) files

Author
James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g http://www.getid3.org

Definition at line 29 of file Dss.php.

Member Function Documentation

◆ analyze()

GetId3\Module\Audio\Dss::analyze ( )
Returns
boolean

Definition at line 35 of file Dss.php.

References $info, array, GetId3\Handler\BaseHandler\fread(), GetId3\Handler\BaseHandler\fseek(), and GetId3\Lib\Helper\PrintHexBytes().

36  {
37  $info = &$this->getid3->info;
38 
39  fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
40  $DSSheader = fread($this->getid3->fp, 1256);
41 
42  if (!preg_match('#^(\x02|\x03)dss#', $DSSheader)) {
43  $info['error'][] = 'Expecting "[02-03] 64 73 73" at offset '.$info['avdataoffset'].', found "'.Helper::PrintHexBytes(substr($DSSheader, 0, 4)).'"';
44 
45  return false;
46  }
47 
48  // some structure information taken from http://cpansearch.perl.org/src/RGIBSON/Audio-DSS-0.02/lib/Audio/DSS.pm
49 
50  // shortcut
51  $info['dss'] = array();
52  $thisfile_dss = &$info['dss'];
53 
54  $info['fileformat'] = 'dss';
55  $info['audio']['dataformat'] = 'dss';
56  $info['audio']['bitrate_mode'] = 'cbr';
57  //$thisfile_dss['encoding'] = 'ISO-8859-1';
58 
59  $thisfile_dss['version'] = ord(substr($DSSheader, 0, 1));
60  $thisfile_dss['date_create'] = self::DSSdateStringToUnixDate(substr($DSSheader, 38, 12));
61  $thisfile_dss['date_complete'] = self::DSSdateStringToUnixDate(substr($DSSheader, 50, 12));
62  //$thisfile_dss['length'] = intval(substr($DSSheader, 62, 6)); // I thought time was in seconds, it's actually HHMMSS
63  $thisfile_dss['length'] = intval((substr($DSSheader, 62, 2) * 3600) + (substr($DSSheader, 64, 2) * 60) + substr($DSSheader, 66, 2));
64  $thisfile_dss['priority'] = ord(substr($DSSheader, 793, 1));
65  $thisfile_dss['comments'] = trim(substr($DSSheader, 798, 100));
66 
67 
68  //$info['audio']['bits_per_sample'] = ?;
69  //$info['audio']['sample_rate'] = ?;
70  $info['audio']['channels'] = 1;
71 
72  $info['playtime_seconds'] = $thisfile_dss['length'];
73  $info['audio']['bitrate'] = ($info['filesize'] * 8) / $info['playtime_seconds'];
74 
75  return true;
76  }
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
Definition: Helper.php:36
fseek($bytes, $whence=SEEK_SET)
$info
Definition: example_052.php:80
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ DSSdateStringToUnixDate()

static GetId3\Module\Audio\Dss::DSSdateStringToUnixDate (   $datestring)
staticprotected
Parameters
type$datestring
Returns
type

Definition at line 83 of file Dss.php.

References $d, $h, and $y.

84  {
85  $y = substr($datestring, 0, 2);
86  $m = substr($datestring, 2, 2);
87  $d = substr($datestring, 4, 2);
88  $h = substr($datestring, 6, 2);
89  $i = substr($datestring, 8, 2);
90  $s = substr($datestring, 10, 2);
91  $y += (($y < 95) ? 2000 : 1900);
92 
93  return mktime($h, $i, $s, $m, $d, $y);
94  }
$h
for($col=0; $col< 50; $col++) $d
$y
Definition: example_007.php:83

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