Class: TSparser::PSISectionReader
- Inherits:
-
Object
- Object
- TSparser::PSISectionReader
- Defined in:
- lib/psi_section_reader.rb
Instance Method Summary collapse
-
#initialize(pid, ts) ⇒ PSISectionReader
constructor
A new instance of PSISectionReader.
- #read ⇒ Object
Constructor Details
#initialize(pid, ts) ⇒ PSISectionReader
Returns a new instance of PSISectionReader.
5 6 7 |
# File 'lib/psi_section_reader.rb', line 5 def initialize(pid, ts) @ts = ts.filter(pid) end |
Instance Method Details
#read ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/psi_section_reader.rb', line 9 def read cont_packets = [] while packet = @ts.read if packet.payload_unit_start_indicator == 1 if @start_packet && continuity_check(@start_packet, *cont_packets, packet) binary = @start_packet.payload.from(@start_packet.payload.b(0) + 1) binary = binary.join(*cont_packets.map{|packet| packet.payload}) @start_packet = packet return binary else @start_packet = packet cont_packets = [] next end end cont_packets << packet end return nil end |