Class: Ariblib::EventInformationTable
- Inherits:
-
ProgramSpecificInformation
- Object
- ProgramSpecificInformation
- Ariblib::EventInformationTable
- Defined in:
- lib/ariblib/EventInformationTable.rb
Overview
番組表テーブル
Defined Under Namespace
Classes: SelfWeeklyMultiEventSchedule, SelfWeeklyMultiSchedule
Instance Attribute Summary collapse
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
Attributes inherited from ProgramSpecificInformation
Instance Method Summary collapse
-
#initialize ⇒ EventInformationTable
constructor
A new instance of EventInformationTable.
- #parse_buf ⇒ Object
- #time_to_datetime(t) ⇒ Object
Methods inherited from ProgramSpecificInformation
#arib_to_utf8, #descriptor, #init_buf, #set, #set_buf
Constructor Details
#initialize ⇒ EventInformationTable
Returns a new instance of EventInformationTable.
107 108 109 110 |
# File 'lib/ariblib/EventInformationTable.rb', line 107 def initialize super @schedule=SelfWeeklyMultiSchedule.new end |
Instance Attribute Details
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
111 112 113 |
# File 'lib/ariblib/EventInformationTable.rb', line 111 def schedule @schedule end |
Instance Method Details
#parse_buf ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/ariblib/EventInformationTable.rb', line 112 def parse_buf ret=[] bs=BitStream.new(@buf) #event_information_section(){ table_id =bs.getc #8 uimsbf #staff_table if table_id == 0x72 tmp =bs.gets section_length =tmp & 0x0fff #section_syntax_indicator =bs.read 1 #bslbf #reserved_future_use =bs.read 1 #bslbf #reserved =bs.read 2 #bslbf #section_length =bs.read 12 # < 4096 -3 service_id =bs.gets #16 uimsbf tmp =bs.getc #reserved =bs.read 2 #bslbf #version_number =bs.read 5 #uimsbf #current_next_indicator =bs.read 1 #bslbf section_number =bs.getc #8 uimsbf last_section_number =bs.getc #8 uimsbf transport_stream_id =bs.gets #16 uimsbf original_network_id =bs.gets #16 uimsbf segment_last_section_number =bs.getc #8 uimsbf last_table_id =bs.getc #8 uimsbf uid=(original_network_id<<(16+16))|(transport_stream_id<<(16))|service_id tid =( table_id<<8)| section_number last_tid=(last_table_id<<8)|last_section_number len=(section_length+3-4)*8 while bs.pos < len event_id =bs.gets #16 #uimsbf start_mdj =bs.gets #16 #bslbf start_time =bs.get3 #24 #bslbf duration =bs.get3 #24 #uimsbf tmp =bs.gets #running_status =bs.read 3 #uimsbf #free_CA_mode =bs.read 1 #bslbf #descriptors_loop_length =bs.read 12 #uimsbf desc = descriptor(bs,tmp & 0x0fff) start=Date.jd(start_mdj+2400001).to_datetime + time_to_datetime(start_time) fin =start+time_to_datetime(duration) @contents << [uid,tid,event_id,start,fin,desc] #ret << ' %04x|%s|%s' % [event_id,start.strftime('%Y%m%d%H%M'),fin.strftime('%Y%m%d%H%M')] end cCRC_32 =bs.read 32 #rpchof #@schedule.check(uid,tid,last_tid,segment_last_section_number,ret) #tmp= [table_id,transport_stream_id,original_network_id,service_id,section_number,last_section_number,segment_last_section_number,last_table_id,ret.size] #ret.unshift("tid=%02x,tpid=%04x,nid=%04x,serid=%04x,secnum=%02x,lastsec=%02x,seglast=%02x,ltid=%02x,n=%d" % tmp) #@debug||=Hash.new(){|k,v|k[v]={}} #tmp=@debug[uid][tid] #@debug[uid][tid] = ret #@debug[uid]=@debug[uid].sort_by{|k,v| k}.to_h unless tmp nil end |
#time_to_datetime(t) ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/ariblib/EventInformationTable.rb', line 168 def time_to_datetime(t) sec =(t & 0x0000000f) t>>=4 sec+=(t & 0x0000000f)*10 t>>=4 sec+=(t & 0x0000000f)*60 t>>=4 sec+=(t & 0x0000000f)*600 t>>=4 sec+=(t & 0x0000000f)*3600 t>>=4 sec+=(t & 0x0000000f)*36000 Rational(sec,24*60*60) end |