Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.stream.core.Segment Class Reference

Public Member Functions

None __post_init__ (self)
 
None async_add_part (self, Part part, float duration)
 
bool complete (self)
 
int data_size (self)
 
int data_size_with_init (self)
 
bytes get_data (self)
 
str render_hls (self, int last_stream_id, bool render_parts, bool add_hint)
 

Public Attributes

 duration
 
 hls_num_parts_rendered
 
 hls_playlist_complete
 
 hls_playlist_parts
 
 hls_playlist_template
 

Static Public Attributes

 bool
 
 default_factory
 
 float
 
 int
 

Private Member Functions

str _render_hls_template (self, int last_stream_id, bool render_parts)
 

Detailed Description

Represent a segment.

Definition at line 85 of file core.py.

Member Function Documentation

◆ __post_init__()

None homeassistant.components.stream.core.Segment.__post_init__ (   self)
Run after init.

Definition at line 106 of file core.py.

◆ _render_hls_template()

str homeassistant.components.stream.core.Segment._render_hls_template (   self,
int  last_stream_id,
bool  render_parts 
)
private
Render the HLS playlist section for the Segment.

The Segment may still be in progress.
This method stores intermediate data in hls_playlist_parts,
hls_num_parts_rendered, and hls_playlist_complete to avoid redoing
work on subsequent calls.

Definition at line 145 of file core.py.

◆ async_add_part()

None homeassistant.components.stream.core.Segment.async_add_part (   self,
Part  part,
float  duration 
)
Add a part to the Segment.

Duration is non zero only for the last part.

Definition at line 127 of file core.py.

◆ complete()

bool homeassistant.components.stream.core.Segment.complete (   self)
Return whether the Segment is complete.

Definition at line 112 of file core.py.

◆ data_size()

int homeassistant.components.stream.core.Segment.data_size (   self)
Return the size of all part data without init in bytes.

Definition at line 122 of file core.py.

◆ data_size_with_init()

int homeassistant.components.stream.core.Segment.data_size_with_init (   self)
Return the size of all part data + init in bytes.

Definition at line 117 of file core.py.

◆ get_data()

bytes homeassistant.components.stream.core.Segment.get_data (   self)
Return reconstructed data for all parts as bytes, without init.

Definition at line 141 of file core.py.

◆ render_hls()

str homeassistant.components.stream.core.Segment.render_hls (   self,
int  last_stream_id,
bool  render_parts,
bool   add_hint 
)
Render the HLS playlist section for the Segment including a hint if requested.

Definition at line 200 of file core.py.

Member Data Documentation

◆ bool

homeassistant.components.stream.core.Segment.bool
static

Definition at line 104 of file core.py.

◆ default_factory

homeassistant.components.stream.core.Segment.default_factory
static

Definition at line 96 of file core.py.

◆ duration

homeassistant.components.stream.core.Segment.duration

Definition at line 137 of file core.py.

◆ float

homeassistant.components.stream.core.Segment.float
static

Definition at line 95 of file core.py.

◆ hls_num_parts_rendered

homeassistant.components.stream.core.Segment.hls_num_parts_rendered

Definition at line 195 of file core.py.

◆ hls_playlist_complete

homeassistant.components.stream.core.Segment.hls_playlist_complete

Definition at line 196 of file core.py.

◆ hls_playlist_parts

homeassistant.components.stream.core.Segment.hls_playlist_parts

Definition at line 194 of file core.py.

◆ hls_playlist_template

homeassistant.components.stream.core.Segment.hls_playlist_template

Definition at line 177 of file core.py.

◆ int

homeassistant.components.stream.core.Segment.int
static

Definition at line 102 of file core.py.


The documentation for this class was generated from the following file: