Package flumotion :: Package component :: Package consumers :: Package hlsstreamer :: Module hlsring :: Class HLSRing
[hide private]

Class HLSRing

source code

Playlister --+
             |
            HLSRing

I hold a ring with the fragments available in the playlist and update the playlist according to this.

Instance Methods [hide private]
 
__init__(self, mainPlaylist, streamPlaylist, streamBitrate=300000, title='', fragmentPrefix='fragment', newFragTolerance=0, window=5, maxExtraBuffers=None, keyInterval=0, keysURI=None) source code
 
_encryptFragment(self, fragment, secret, IV) source code
 
reset(self) source code
 
addFragment(self, fragment, sequenceNumber, duration)
Adds a fragment to the ring and updates the playlist.
source code
array
getFragment(self, fragmentName)
Returns a fragment of the playlist or raises an Exception if the fragment is not found
source code
str
getEncryptionKey(self, key)
Returns an encryption key from the keys dict or raises an Exception if the key is not found
source code

Inherited from Playlister: renderArgs, renderPlaylist, setAllowCache, setHostname

Class Variables [hide private]
  BLOCK_SIZE = 16
  PADDING = '0'
Method Details [hide private]

__init__(self, mainPlaylist, streamPlaylist, streamBitrate=300000, title='', fragmentPrefix='fragment', newFragTolerance=0, window=5, maxExtraBuffers=None, keyInterval=0, keysURI=None)
(Constructor)

source code 
Parameters:
  • mainPlaylist (str) - resource name of the main playlist
  • streamPlaylists - resource names of the playlists
  • streamBitrate (int) - Bitrate of the stream in bps
  • title (str) - description of the stream
  • fragmentPrefix (str) - fragment name prefix
  • newFragTolerance (float) - Tolerance to automatically add new fragments.
  • window (int) - maximum number of fragments to buffer
  • maxExtraBuffers (int) - maximum number of extra fragments to buffer
  • keyInterval (int @param keysURI URI used to retrieve the encription keys @type keysURI str) - number of fragments sharing the same encryption key. O if not using encryption
  • streamPlaylist (str)
Overrides: Playlister.__init__

addFragment(self, fragment, sequenceNumber, duration)

source code 

Adds a fragment to the ring and updates the playlist. If the ring is full, removes the oldest fragment.

Parameters:
  • fragment (array) - mpegts raw fragment
  • sequenceNumber (int) - sequence number relative to the stream's start
  • duration (int) - duration of the the segment in seconds
Returns:
the name used in the playlist for the fragment @rtype : str

getFragment(self, fragmentName)

source code 

Returns a fragment of the playlist or raises an Exception if the fragment is not found

Parameters:
  • fragmentName (str) - name of the fragment to retrieve
Returns: array
an mpegts raw fragment

getEncryptionKey(self, key)

source code 

Returns an encryption key from the keys dict or raises an Exception if the key is not found

Parameters:
  • key (str) - name of the key to retrieve
Returns: str
the encryption key