Class: TSparser::Descriptor

Inherits:
Object
  • Object
show all
Defined in:
lib/definition/descriptor.rb

Constant Summary collapse

DescriptorTable =

ARIB STD-B10 Table5-3

{
  0x4D => TSparser::ShortEventDescriptor,
  0x4E => TSparser::ExtendedEventDescriptor,
  0x50 => TSparser::ComponentDescriptor,
  0x54 => TSparser::ContentDescriptor,
  0xC1 => TSparser::DigitalCopyControlDescriptor,
  0xC4 => TSparser::AudioComponentDescriptor,
  0xC7 => TSparser::DataContentDescriptor,
  0xCB => TSparser::CAContractInformationDescriptor, # Defined in ARIB STD-B25
  0xD6 => TSparser::EventGroupDescriptor
}

Class Method Summary collapse

Class Method Details

.new(binary) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/definition/descriptor.rb', line 19

def self.new(binary)
  now_point               = binary.bit_pointer / 8
  descriptor_tag          = binary.b(now_point + 0)
  descriptor_length       = binary.b(now_point + 1)
  descriptor_whole_binary = binary.read_bit_as_binary(descriptor_length * 8 + 16)
  return DescriptorTable[descriptor_tag].new(descriptor_whole_binary)
end