module TSparser

Constants

DEFINITION_DESCRIPTOR_FILES
DEFINITION_FILES
LIBRARY_ROOT_PATH
MAIN_FILES

Public Instance Methods

open_ts(input) click to toggle source
# File lib/tsparser.rb, line 64
def open_ts(input)
  case input
  when String
    return TS.new(File.open(input, "rb"))
  when IO
    return TS.new(input)
  else
    raise "arugument should be TS file path(String) or IO"
  end
end
parse_epg(input) click to toggle source
# File lib/tsparser.rb, line 53
def parse_epg(input)
  epg = EPG.new
  section_stream = PSISectionReader.new(0x12, open_ts(input))
  while section_binary = section_stream.read
    next unless EventInformationSection.section_length_enough?(section_binary)        
    eis = EventInformationSection.new(section_binary)
    epg = epg + eis.to_epg
  end
  return epg
end