ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
getid3_ts Class Reference

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

+ Inheritance diagram for getid3_ts:
+ Collaboration diagram for getid3_ts:

Public Member Functions

 Analyze ()
 
 TSscramblingControlLookup ($raw)
 
- Public Member Functions inherited from getid3_handler
 __construct (getID3 $getid3, $call_module=null)
 
 Analyze ()
 
 AnalyzeString ($string)
 
 setStringMode ($string)
 
 saveAttachment ($name, $offset, $length, $image_mime=null)
 

Additional Inherited Members

- Protected Member Functions inherited from getid3_handler
 ftell ()
 
 fread ($bytes)
 
 fseek ($bytes, $whence=SEEK_SET)
 
 feof ()
 
 isDependencyFor ($module)
 
 error ($text)
 
 warning ($text)
 
 notice ($text)
 
- Protected Attributes inherited from getid3_handler
 $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 //

Definition at line 18 of file module.audio-video.ts.php.

Member Function Documentation

◆ Analyze()

getid3_ts::Analyze ( )

Definition at line 21 of file module.audio-video.ts.php.

References $info, getid3_lib\BigEndian2Int(), getid3_handler\error(), getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\PrintHexBytes(), and TSscramblingControlLookup().

21  {
22  $info = &$this->getid3->info;
23 
24  $this->fseek($info['avdataoffset']);
25  $TSheader = $this->fread(19);
26  $magic = "\x47";
27  if (substr($TSheader, 0, 1) != $magic) {
28  $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at '.$info['avdataoffset'].', found '.getid3_lib::PrintHexBytes(substr($TSheader, 0, 1)).' instead.');
29  return false;
30  }
31  $info['fileformat'] = 'ts';
32 
33  // http://en.wikipedia.org/wiki/.ts
34 
35  $offset = 0;
36  $info['ts']['packet']['sync'] = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 1)); $offset += 1;
37  $pid_flags_raw = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 2)); $offset += 2;
38  $SAC_raw = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 1)); $offset += 1;
39  $info['ts']['packet']['flags']['transport_error_indicator'] = (bool) ($pid_flags_raw & 0x8000); // Set by demodulator if can't correct errors in the stream, to tell the demultiplexer that the packet has an uncorrectable error
40  $info['ts']['packet']['flags']['payload_unit_start_indicator'] = (bool) ($pid_flags_raw & 0x4000); // 1 means start of PES data or PSI otherwise zero only.
41  $info['ts']['packet']['flags']['transport_high_priority'] = (bool) ($pid_flags_raw & 0x2000); // 1 means higher priority than other packets with the same PID.
42  $info['ts']['packet']['packet_id'] = ($pid_flags_raw & 0x1FFF) >> 0;
43 
44  $info['ts']['packet']['raw']['scrambling_control'] = ($SAC_raw & 0xC0) >> 6;
45  $info['ts']['packet']['flags']['adaption_field_exists'] = (bool) ($SAC_raw & 0x20);
46  $info['ts']['packet']['flags']['payload_exists'] = (bool) ($SAC_raw & 0x10);
47  $info['ts']['packet']['continuity_counter'] = ($SAC_raw & 0x0F) >> 0; // Incremented only when a payload is present
48  $info['ts']['packet']['scrambling_control'] = $this->TSscramblingControlLookup($info['ts']['packet']['raw']['scrambling_control']);
49 
50  if ($info['ts']['packet']['flags']['adaption_field_exists']) {
51  $AdaptionField_raw = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 2)); $offset += 2;
52  $info['ts']['packet']['adaption']['field_length'] = ($AdaptionField_raw & 0xFF00) >> 8; // Number of bytes in the adaptation field immediately following this byte
53  $info['ts']['packet']['adaption']['flags']['discontinuity'] = (bool) ($AdaptionField_raw & 0x0080); // Set to 1 if current TS packet is in a discontinuity state with respect to either the continuity counter or the program clock reference
54  $info['ts']['packet']['adaption']['flags']['random_access'] = (bool) ($AdaptionField_raw & 0x0040); // Set to 1 if the PES packet in this TS packet starts a video/audio sequence
55  $info['ts']['packet']['adaption']['flags']['high_priority'] = (bool) ($AdaptionField_raw & 0x0020); // 1 = higher priority
56  $info['ts']['packet']['adaption']['flags']['pcr'] = (bool) ($AdaptionField_raw & 0x0010); // 1 means adaptation field does contain a PCR field
57  $info['ts']['packet']['adaption']['flags']['opcr'] = (bool) ($AdaptionField_raw & 0x0008); // 1 means adaptation field does contain an OPCR field
58  $info['ts']['packet']['adaption']['flags']['splice_point'] = (bool) ($AdaptionField_raw & 0x0004); // 1 means presence of splice countdown field in adaptation field
59  $info['ts']['packet']['adaption']['flags']['private_data'] = (bool) ($AdaptionField_raw & 0x0002); // 1 means presence of private data bytes in adaptation field
60  $info['ts']['packet']['adaption']['flags']['extension'] = (bool) ($AdaptionField_raw & 0x0001); // 1 means presence of adaptation field extension
61  if ($info['ts']['packet']['adaption']['flags']['pcr']) {
62  $info['ts']['packet']['adaption']['raw']['pcr'] = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 6)); $offset += 6;
63  }
64  if ($info['ts']['packet']['adaption']['flags']['opcr']) {
65  $info['ts']['packet']['adaption']['raw']['opcr'] = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 6)); $offset += 6;
66  }
67  }
68 
69 $this->error('MPEG Transport Stream (.ts) parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
70 return false;
71 
72  }
error($text)
Definition: getid3.php:1752
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
Definition: getid3.lib.php:18
fread($bytes)
Definition: getid3.php:1683
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1711
$info
Definition: index.php:5
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: getid3.lib.php:263
TSscramblingControlLookup($raw)
+ Here is the call graph for this function:

◆ TSscramblingControlLookup()

getid3_ts::TSscramblingControlLookup (   $raw)

Definition at line 75 of file module.audio-video.ts.php.

References array.

Referenced by Analyze().

75  {
76  $TSscramblingControlLookup = array(0x00=>'not scrambled', 0x01=>'reserved', 0x02=>'scrambled, even key', 0x03=>'scrambled, odd key');
77  return (isset($TSscramblingControlLookup[$raw]) ? $TSscramblingControlLookup[$raw] : 'invalid');
78  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

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