Class: M3u8::Scte35SegmentationDescriptor

Inherits:
Object
  • Object
show all
Defined in:
lib/m3u8/scte35_segmentation_descriptor.rb

Overview

Represents a segmentation_descriptor (tag 0x02) in SCTE-35

Constant Summary collapse

CUEI_IDENTIFIER =
0x43554549
DESCRIPTOR_TAG =
0x02

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Scte35SegmentationDescriptor

Returns a new instance of Scte35SegmentationDescriptor.



14
15
16
17
18
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 14

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#segment_numObject (readonly)

Returns the value of attribute segment_num.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segment_num
  @segment_num
end

#segmentation_durationObject (readonly)

Returns the value of attribute segmentation_duration.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segmentation_duration
  @segmentation_duration
end

#segmentation_event_cancel_indicatorObject (readonly)

Returns the value of attribute segmentation_event_cancel_indicator.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segmentation_event_cancel_indicator
  @segmentation_event_cancel_indicator
end

#segmentation_event_idObject (readonly)

Returns the value of attribute segmentation_event_id.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segmentation_event_id
  @segmentation_event_id
end

#segmentation_type_idObject (readonly)

Returns the value of attribute segmentation_type_id.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segmentation_type_id
  @segmentation_type_id
end

#segmentation_upidObject (readonly)

Returns the value of attribute segmentation_upid.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segmentation_upid
  @segmentation_upid
end

#segmentation_upid_typeObject (readonly)

Returns the value of attribute segmentation_upid_type.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segmentation_upid_type
  @segmentation_upid_type
end

#segments_expectedObject (readonly)

Returns the value of attribute segments_expected.



9
10
11
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 9

def segments_expected
  @segments_expected
end

Class Method Details

.parse_from(reader, _length) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/m3u8/scte35_segmentation_descriptor.rb', line 20

def self.parse_from(reader, _length)
  attrs = { segmentation_event_id: reader.read_bits(32) }
  attrs[:segmentation_event_cancel_indicator] = reader.read_flag
  reader.skip_bits(7) # reserved
  return new(**attrs) if attrs[:segmentation_event_cancel_indicator]

  parse_segmentation_detail(reader, attrs)
end