![]() |
TSDuck v3.46-4930
MPEG Transport Stream Toolkit
|
#include <tshlsPlayList.h>


Public Member Functions | |
| PlayList (Report *report) | |
| PlayList (ReporterBase *delegate) | |
| virtual | ~PlayList () override |
| bool | addAltPlayList (const AltPlayList &pl) |
| void | addCustomTag (const UString &tag) |
| bool | addPlayList (const MediaPlayList &pl) |
| bool | addSegment (const MediaSegment &seg) |
| const AltPlayList & | altPlayList (size_t index) const |
| size_t | altPlayListCount () const |
| bool | buildURL (MediaElement &media, const UString &uri, bool silent=false) const |
| void | clear () |
| void | clearCustomTags () |
| void | deleteAltPlayList (size_t index) |
| void | deletePlayList (size_t index) |
| Time | downloadUTC () const |
| bool | endList () const |
| bool | isMaster () const |
| bool | isMedia () const |
| bool | isPermissiveURL () |
| bool | isUpdatable () const |
| bool | isValid () const |
| bool | loadFile (const UString &filename, bool strict=false, PlayListType type=PlayListType::UNKNOWN) |
| bool | loadText (const UString &text, bool strict=false, PlayListType type=PlayListType::UNKNOWN) |
| bool | loadURL (const URL &url, bool strict=false, const WebRequestArgs &args=WebRequestArgs(), PlayListType type=PlayListType::UNKNOWN) |
| bool | loadURL (const UString &url, bool strict=false, const WebRequestArgs &args=WebRequestArgs(), PlayListType type=PlayListType::UNKNOWN) |
| size_t | mediaSequence () const |
| bool | muteReport (bool mute) |
| const UStringList & | originalLoadedContent () const |
| const MediaPlayList & | playList (size_t index) const |
| size_t | playListCount () const |
| bool | popFirstSegment (bool silent=false) |
| bool | popFirstSegment (MediaSegment &seg, bool silent=false) |
| bool | reload (bool strict=false, const WebRequestArgs &args=WebRequestArgs()) |
| bool | reloadText (const UString &text, bool strict=false) |
| virtual Report & | report () const override |
| void | reset (PlayListType type, const UString &filename, int version=3) |
| bool | saveFile (const UString &filename=UString()) const |
| const MediaSegment & | segment (size_t index) const |
| size_t | segmentCount () const |
| cn::seconds | segmentTargetDuration () const |
| size_t | selectAltPlayList (const UString &type=UString(), const UString &name=UString(), const UString &group_id=UString(), const UString &language=UString()) const |
| size_t | selectPlayList (const BitRate &min_bitrate, const BitRate &max_bitrate, size_t min_width, size_t max_width, size_t min_height, size_t max_height) const |
| size_t | selectPlayListHighestBitRate () const |
| size_t | selectPlayListHighestResolution () const |
| size_t | selectPlayListLowestBitRate () const |
| size_t | selectPlayListLowestResolution () const |
| void | setAutoSaveDirectory (const UString &dir) |
| bool | setEndList (bool end) |
| bool | setFile (const UString &filename, bool silent=false) |
| bool | setMediaSequence (size_t seq) |
| void | setPermissiveURL (bool permissive) |
| Report * | setReport (Report *report) |
| ReporterBase * | setReport (ReporterBase *delegate) |
| bool | setSegmentTargetDuration (cn::seconds duration) |
| bool | setType (PlayListType type, bool forced=false) |
| bool | setTypeMedia () |
| bool | setURL (const URL &url, bool silent=false) |
| bool | setURL (const UString &url, bool silent=false) |
| Time | terminationUTC () const |
| UString | textContent () const |
| virtual UString | toString () const override |
| PlayListType | type () const |
| UString | url () const |
| int | version () const |
Static Public Member Functions | |
| static int | SilentLevel (bool silent, int default_severity=Severity::Error) |
Playlist for HTTP Live Streaming (HLS).
|
inlineexplicit |
Constructor.
| [in] | report | Where to report errors. The report object must remain valid as long as this object exists or setReport() is used with another Report object. If report is null, log messages are discarded. |
|
inlineexplicit |
Constructor.
| [in] | delegate | Use the report of another ReporterBase. If delegate is null, log messages are discarded. |
|
overridevirtual |
Destructor.
| void ts::hls::PlayList::clear | ( | ) |
Clear the content of the playlist.
| void ts::hls::PlayList::reset | ( | PlayListType | type, |
| const UString & | filename, | ||
| int | version = 3 ) |
Reset the content of a playlist. Should be used before rebuilding a new playlist.
| [in] | type | Playlist type. |
| [in] | filename | File path where the playlist will be saved. This required to build relative paths for sub-playlists or media segments. |
| [in] | version | Playlist format version. The default is 3, the minimum level which is required for playlists which are supported here. |
| bool ts::hls::PlayList::loadURL | ( | const UString & | url, |
| bool | strict = false, | ||
| const WebRequestArgs & | args = WebRequestArgs(), | ||
| PlayListType | type = PlayListType::UNKNOWN ) |
Load the playlist from a URL.
| [in] | url | URL from which to load the playlist. |
| [in] | strict | If true, perform strict conformance checking. By default, relaxed as long as we can understand the content. |
| [in] | args | Web request arguments from command line. |
| [in] | type | Expected playlist type, unknown by default. |
| bool ts::hls::PlayList::loadURL | ( | const URL & | url, |
| bool | strict = false, | ||
| const WebRequestArgs & | args = WebRequestArgs(), | ||
| PlayListType | type = PlayListType::UNKNOWN ) |
Load the playlist from a URL.
| [in] | url | URL from which to load the playlist. |
| [in] | strict | If true, perform strict conformance checking. By default, relaxed as long as we can understand the content. |
| [in] | args | Web request arguments from command line. |
| [in] | type | Expected playlist type, unknown by default. |
| bool ts::hls::PlayList::loadFile | ( | const UString & | filename, |
| bool | strict = false, | ||
| PlayListType | type = PlayListType::UNKNOWN ) |
Load the playlist from a text file.
| [in] | filename | File from which to load the playlist. |
| [in] | strict | If true, perform strict conformance checking. By default, relaxed as long as we can understand the content. |
| [in] | type | Expected playlist type, unknown by default. |
| bool ts::hls::PlayList::loadText | ( | const UString & | text, |
| bool | strict = false, | ||
| PlayListType | type = PlayListType::UNKNOWN ) |
Load the playlist from its text content.
| [in] | text | Text of the playlist (multi-lines). |
| [in] | strict | If true, perform strict conformance checking. By default, relaxed as long as we can understand the content. |
| [in] | type | Expected playlist type, unknown by default. |
| bool ts::hls::PlayList::setURL | ( | const UString & | url, |
| bool | silent = false ) |
| bool ts::hls::PlayList::setURL | ( | const URL & | url, |
| bool | silent = false ) |
| bool ts::hls::PlayList::setFile | ( | const UString & | filename, |
| bool | silent = false ) |
Update the file name of the playlist.
| [in] | filename | File from which to load the playlist. |
| [in] | silent | When true, do not report an error message in case of error. |
| bool ts::hls::PlayList::reload | ( | bool | strict = false, |
| const WebRequestArgs & | args = WebRequestArgs() ) |
Reload a media playlist with updated content. Master playlists or media playlists for which endList() is true are never reloaded. Live playlists (media playlists for which endList() is false) are reloaded from the same URL. New segments are added. If a segment hole is found, all previous content is replaced.
| [in] | strict | If true, perform strict conformance checking. By default, relaxed as long as we can understand the content. |
| [in] | args | Web request arguments from command line. |
| bool ts::hls::PlayList::reloadText | ( | const UString & | text, |
| bool | strict = false ) |
Reload a media playlist with updated text content. Master playlists or media playlists for which endList() is true are never reloaded. New segments are added. If a segment hole is found, all previous content is replaced.
| [in] | text | Text of the playlist (multi-lines). |
| [in] | strict | If true, perform strict conformance checking. By default, relaxed as long as we can understand the content. |
|
inline |
Set a directory name where all loaded files or URL are automatically saved. This property is preserved when the playlist is cleared or reloaded.
| [in] | dir | A directory name. |
|
inline |
Check if the playlist has been successfully loaded.
Save the playlist to a text file.
| [in] | filename | File where to save the playlist. By default, use the same file from loadFile() or reset(). |
| UString ts::hls::PlayList::textContent | ( | ) | const |
Build the text content of the playlist.
|
inline |
Get the original loaded text content of the playlist. This can be different from the current content of the playlist if the object has been modified.
| bool ts::hls::PlayList::buildURL | ( | MediaElement & | media, |
| const UString & | uri, | ||
| bool | silent = false ) const |
Build an URL for a media segment or sub-playlist.
| [out] | media | A media element with all fields filled in. |
| [in] | uri | An URI, typically extracted from the playlist. |
| [in] | silent | When true, do not report an error message in case of error. |
|
inline |
Get the playlist type.
| bool ts::hls::PlayList::setType | ( | PlayListType | type, |
| bool | forced = false ) |
Set the playlist type.
| [in] | type | The playlist type. |
| [in] | forced | When true, unconditionally set the playlist type. When false (the default), check that the playlist type does not change in an inconsistent way. Allowed changes are UNKNOWN to anything and LIVE to VOD or EVENT. The latter case is a playlist which is known to be a media playlist but for which no EXT-X-PLAYLIST-TYPE tag was found so far. |
| bool ts::hls::PlayList::setTypeMedia | ( | ) |
Set the playlist type as media playlist. If the type is already known and already a media playlist, do nothing. If the type is unknown, set it as LIVE which is a media playlist type without EXT-X-PLAYLIST-TYPE tag and which can be later turned into a VOD or EVENT playlist.
|
inline |
Allow permissive URL resolution. By default, for security reasons, http: and https: playlist can only contain segments or media playlists with http: or https: URLs. If an http: or https: contains a segment file a file: URL, for instance, an error is generated. Use this method to relax this rule. This property is preserved when the playlist is cleared or reloaded.
| [in] | permissive | When true, the playlist allows permissive URL resolution. |
|
inline |
Check if the playlist allows permissive URL resolution.
|
inline |
Add a custom tag in the playlist.
| [in] | tag | A custom tag line to add in the playlist. If does not start with a '#', it will be automatically added. |
|
inline |
Clear all application-specific custom tags.
|
inline |
Check if the playlist can be updated (and must be reloaded later).
|
inline |
Check if the playlist is a media playlist (contains references to media segments).
|
inline |
Check if the playlist is a master playlist (contains references to media playlists).
|
inline |
Get the playlist version (EXT-X-VERSION).
|
inline |
Get the segment target duration (informative, in media playlist).
| bool ts::hls::PlayList::setSegmentTargetDuration | ( | cn::seconds | duration | ) |
Set the segment target duration in a media playlist.
| [in] | duration | The segment target duration in seconds. |
|
inline |
Get the sequence number of first segment (in media playlist).
| bool ts::hls::PlayList::setMediaSequence | ( | size_t | seq | ) |
Set the sequence number of first segment in a media playlist.
| [in] | seq | The sequence number of first segment. |
|
inline |
Get the end of list indicator (in media playlist).
| bool ts::hls::PlayList::setEndList | ( | bool | end | ) |
Set the end of list indicator in a media playlist.
| [in] | end | The end of list indicator. |
|
inline |
Get the number of media segments (in media playlist).
|
inline |
Get the number of media playlists (in master playlist).
|
inline |
Get the number of altenative rendition playlists (in master playlist).
| const MediaSegment & ts::hls::PlayList::segment | ( | size_t | index | ) | const |
Get a constant reference to a media segment (in media playlist).
| [in] | index | Index of the segment, from 0 to segmentCount(). |
| bool ts::hls::PlayList::popFirstSegment | ( | MediaSegment & | seg, |
| bool | silent = false ) |
Remove the first media segment (in media playlist).
| [out] | seg | Characteristics of the first segment. |
| [in] | silent | When true, do not report an error message in case of error. |
| bool ts::hls::PlayList::popFirstSegment | ( | bool | silent = false | ) |
Remove the first media segment and do not even return it (in media playlist).
| [in] | silent | When true, do not report an error message in case of error. |
| bool ts::hls::PlayList::addSegment | ( | const MediaSegment & | seg | ) |
Add a segment in a media playlist.
| [in] | seg | The new media segment to append. If the playlist's URI is a file name, the URI of the segment is transformed into a relative URI from the playlist's path. |
|
inline |
Get the download UTC time of the playlist.
|
inline |
Get the playout estimated termination UTC time of the playlist (in media playlist).
| const MediaPlayList & ts::hls::PlayList::playList | ( | size_t | index | ) | const |
Get a constant reference to a media playlist description (in master playlist).
| [in] | index | Index of the playlist, from 0 to playListCount()-1. |
| void ts::hls::PlayList::deletePlayList | ( | size_t | index | ) |
Delete a media playlist description from a master playlist.
| [in] | index | Index of the media playlist to delete, from 0 to playListCount()-1. |
| bool ts::hls::PlayList::addPlayList | ( | const MediaPlayList & | pl | ) |
Add a media playlist in a master playlist.
| [in] | pl | The new media playlist to append. If the master playlist's URI is a file name, the URI of the media playlist is transformed into a relative URI from the master playlist's path. |
| size_t ts::hls::PlayList::selectPlayList | ( | const BitRate & | min_bitrate, |
| const BitRate & | max_bitrate, | ||
| size_t | min_width, | ||
| size_t | max_width, | ||
| size_t | min_height, | ||
| size_t | max_height ) const |
Select the first media playlist with specific constraints.
| [in] | min_bitrate | Minimum bitrate. Zero means no minimum. |
| [in] | max_bitrate | Maximum bitrate. Zero means no maximum. |
| [in] | min_width | Minimum width. Zero means no minimum. |
| [in] | max_width | Maximum width. Zero means no maximum. |
| [in] | min_height | Minimum height. Zero means no minimum. |
| [in] | max_height | Maximum height. Zero means no maximum. |
| size_t ts::hls::PlayList::selectPlayListLowestBitRate | ( | ) | const |
Select the media playlist with the lowest bitrate.
| size_t ts::hls::PlayList::selectPlayListHighestBitRate | ( | ) | const |
Select the media playlist with the highest bitrate.
| size_t ts::hls::PlayList::selectPlayListLowestResolution | ( | ) | const |
Select the media playlist with the lowest resolution.
| size_t ts::hls::PlayList::selectPlayListHighestResolution | ( | ) | const |
Select the media playlist with the highest resolution.
| const AltPlayList & ts::hls::PlayList::altPlayList | ( | size_t | index | ) | const |
Get a constant reference to an alternative rendition playlist description (in master playlist).
| [in] | index | Index of the playlist, from 0 to altPlayListCount()-1. |
| void ts::hls::PlayList::deleteAltPlayList | ( | size_t | index | ) |
Delete an alternative rendition playlist description from a master playlist.
| [in] | index | Index of the alternative rendition playlist to delete, from 0 to altPlayListCount()-1. |
| bool ts::hls::PlayList::addAltPlayList | ( | const AltPlayList & | pl | ) |
Add an alternative rendition media playlist in a master playlist.
| [in] | pl | The new alternative rendition playlist to append. If the master playlist's URI is a file name, the URI of the media playlist is transformed into a relative URI from the master playlist's path. |
| size_t ts::hls::PlayList::selectAltPlayList | ( | const UString & | type = UString(), |
| const UString & | name = UString(), | ||
| const UString & | group_id = UString(), | ||
| const UString & | language = UString() ) const |
Select the first alternative rendition playlist with specific criteria.
| [in] | type | The type to match. Ignored if empty. |
| [in] | name | The name to match. Ignored if empty. |
| [in] | group_id | The group-id to match. Ignored if empty. |
| [in] | language | The language to match. Ignored if empty. |
|
overridevirtual |
Convert to a string object.
Implements ts::StringifyInterface.
|
overridevirtualinherited |
Access the Report which is associated with this object. Can be called from another thread only if the Report object is thread-safe.
Implements ts::ReporterInterface.
Associate this object with another Report to log errors.
| [in] | report | Where to report errors. The report object must remain valid as long as this object exists or setReport() is used with another Report object. If report is null, log messages are discarded. |
|
inherited |
Associate this object with another ReporterBase to log errors.
| [in] | delegate | Use the report of another ReporterBase. If delegate is null, the previous explicit Report is used.. |
|
inherited |
Temporarily mute the associated report.
| [in] | mute | It true, report() will return a null report (log messages are discarded), until muteReport() is invoked again with mute set to false. |
|
inlinestaticinherited |
Compute a log severity level from a "silent" parameter. Some subclass methods have a "silent" parameter to avoid reporting errors which may be insignificant, typically when closing a device after an error, in which case the close operation may produce other errors if the previous error left the device in an inconsistent state. While those errors should not be displayed as errors, we still display them at debug level.
| [in] | silent | If true, do not report errors, report debug messages instead. |
| [in] | default_severity | Default severity, in non-silent mode (error by default). |