Methods are virtual for mocking.
More...
#include <media_playlist.h>
|
enum class | MediaPlaylistStreamType {
kUnknown
, kAudio
, kVideo
, kVideoIFramesOnly
,
kSubtitle
} |
|
enum class | EncryptionMethod { kNone
, kAes128
, kSampleAes
, kSampleAesCenc
} |
|
|
| MediaPlaylist (const HlsParams &hls_params, const std::string &file_name, const std::string &name, const std::string &group_id) |
|
const std::string & | file_name () const |
|
const std::string & | name () const |
|
const std::string & | group_id () const |
|
MediaPlaylistStreamType | stream_type () const |
|
const std::string & | codec () const |
|
const std::string & | supplemental_codec () const |
|
const media::FourCC & | compatible_brand () const |
|
const std::list< std::unique_ptr< HlsEntry > > & | entries () const |
|
void | SetStreamTypeForTesting (MediaPlaylistStreamType stream_type) |
| For testing only.
|
|
void | SetCodecForTesting (const std::string &codec) |
| For testing only.
|
|
void | SetLanguageForTesting (const std::string &language) |
| For testing only.
|
|
void | SetForcedSubtitleForTesting (const bool forced_subtitle) |
| For testing only.
|
|
void | SetCharacteristicsForTesting (const std::vector< std::string > &characteristics) |
| For testing only.
|
|
void | AddEncryptionInfoForTesting (MediaPlaylist::EncryptionMethod method, const std::string &url, const std::string &key_id, const std::string &iv, const std::string &key_format, const std::string &key_format_versions) |
| For testing only.
|
|
virtual bool | SetMediaInfo (const MediaInfo &media_info) |
|
MediaInfo | GetMediaInfo () const |
|
virtual void | SetSampleDuration (int32_t sample_duration) |
|
virtual void | AddSegment (const std::string &file_name, int64_t start_time, int64_t duration, uint64_t start_byte_offset, uint64_t size) |
|
virtual void | AddKeyFrame (int64_t timestamp, uint64_t start_byte_offset, uint64_t size) |
|
virtual void | AddEncryptionInfo (EncryptionMethod method, const std::string &url, const std::string &key_id, const std::string &iv, const std::string &key_format, const std::string &key_format_versions) |
|
virtual void | AddPlacementOpportunity () |
|
virtual bool | WriteToFile (const std::filesystem::path &file_path) |
|
virtual uint64_t | MaxBitrate () const |
|
virtual uint64_t | AvgBitrate () const |
|
virtual double | GetLongestSegmentDuration () const |
|
virtual void | SetTargetDuration (int32_t target_duration) |
|
virtual int | GetNumChannels () const |
|
virtual int | GetEC3JocComplexity () const |
|
virtual bool | GetAC4ImsFlag () const |
|
virtual bool | GetAC4CbiFlag () const |
|
virtual bool | GetDisplayResolution (uint32_t *width, uint32_t *height) const |
|
virtual std::string | GetVideoRange () const |
|
virtual double | GetFrameRate () const |
|
const std::string & | language () const |
|
const std::vector< std::string > & | characteristics () const |
|
bool | forced_subtitle () const |
|
bool | is_dvs () const |
|
Methods are virtual for mocking.
Definition at line 49 of file media_playlist.h.
◆ MediaPlaylist()
shaka::hls::MediaPlaylist::MediaPlaylist |
( |
const HlsParams & |
hls_params, |
|
|
const std::string & |
file_name, |
|
|
const std::string & |
name, |
|
|
const std::string & |
group_id |
|
) |
| |
- Parameters
-
hls_params | contains HLS parameters. |
file_name | is the file name of this media playlist, relative to master playlist output path. |
name | is the name of this playlist. In other words this is the value of the NAME attribute for EXT-X-MEDIA. This is not necessarily the same as file_name. |
group_id | is the group ID for this playlist. This is the value of GROUP-ID attribute for EXT-X-MEDIA. |
Definition at line 333 of file media_playlist.cc.
◆ AddEncryptionInfo()
void shaka::hls::MediaPlaylist::AddEncryptionInfo |
( |
MediaPlaylist::EncryptionMethod |
method, |
|
|
const std::string & |
url, |
|
|
const std::string & |
key_id, |
|
|
const std::string & |
iv, |
|
|
const std::string & |
key_format, |
|
|
const std::string & |
key_format_versions |
|
) |
| |
|
virtual |
All segments added after calling this method must be decryptable with the key that can be fetched from |url|, until calling this again.
- Parameters
-
method | is the encryption method. |
url | specifies where the key is i.e. the value of the URI attribute. #param key_id is the default key ID for the encrypted segements. |
iv | is the initialization vector in human readable format, i.e. the value for IV attribute. This may be empty. |
key_format | is the key format, i.e. the KEYFORMAT value. This may be empty. |
key_format_versions | is the KEYFORMATVERIONS value. This may be empty. |
Definition at line 469 of file media_playlist.cc.
◆ AddKeyFrame()
void shaka::hls::MediaPlaylist::AddKeyFrame |
( |
int64_t |
timestamp, |
|
|
uint64_t |
start_byte_offset, |
|
|
uint64_t |
size |
|
) |
| |
|
virtual |
Keyframes must be added in order. It is also called before the containing segment being called.
- Parameters
-
timestamp | is the timestamp of the key frame in timescale of the media. |
start_byte_offset | is the offset of where the key frame starts. |
size | is size in bytes. |
Definition at line 454 of file media_playlist.cc.
◆ AddPlacementOpportunity()
void shaka::hls::MediaPlaylist::AddPlacementOpportunity |
( |
| ) |
|
|
virtual |
◆ AddSegment()
void shaka::hls::MediaPlaylist::AddSegment |
( |
const std::string & |
file_name, |
|
|
int64_t |
start_time, |
|
|
int64_t |
duration, |
|
|
uint64_t |
start_byte_offset, |
|
|
uint64_t |
size |
|
) |
| |
|
virtual |
Segments must be added in order.
- Parameters
-
file_name | is the file name of the segment. |
start_time | is in terms of the timescale of the media. |
duration | is in terms of the timescale of the media. |
start_byte_offset | is the offset of where the subsegment starts. This must be 0 if the whole segment is a subsegment. |
size | is size in bytes. |
Definition at line 426 of file media_playlist.cc.
◆ AvgBitrate()
uint64_t shaka::hls::MediaPlaylist::AvgBitrate |
( |
| ) |
const |
|
virtual |
Unlike MaxBitrate, AvgBitrate is always computed from the segment size and duration.
- Returns
- The average bitrate (in bits per second) of this MediaPlaylist.
Definition at line 520 of file media_playlist.cc.
◆ GetAC4CbiFlag()
bool shaka::hls::MediaPlaylist::GetAC4CbiFlag |
( |
| ) |
const |
|
virtual |
- Returns
- true if it's an AC-4 CBI stream, based on ETSI TS 103 190-2 Digital Audio Compression (AC-4) Standard; Part 2: Immersive and personalized audio 4.3.
Definition at line 551 of file media_playlist.cc.
◆ GetAC4ImsFlag()
bool shaka::hls::MediaPlaylist::GetAC4ImsFlag |
( |
| ) |
const |
|
virtual |
◆ GetDisplayResolution()
bool shaka::hls::MediaPlaylist::GetDisplayResolution |
( |
uint32_t * |
width, |
|
|
uint32_t * |
height |
|
) |
| const |
|
virtual |
- Returns
- true if |width| and |height| have been set with a valid resolution values.
Definition at line 555 of file media_playlist.cc.
◆ GetEC3JocComplexity()
int shaka::hls::MediaPlaylist::GetEC3JocComplexity |
( |
| ) |
const |
|
virtual |
- Returns
- Dolby Digital Plus JOC decoding complexity, ETSI TS 103 420 v1.2.1 Backwards-compatible object audio carriage using Enhanced AC-3 Standard C.3.2.3.
Definition at line 543 of file media_playlist.cc.
◆ GetFrameRate()
double shaka::hls::MediaPlaylist::GetFrameRate |
( |
| ) |
const |
|
virtual |
◆ GetLongestSegmentDuration()
double shaka::hls::MediaPlaylist::GetLongestSegmentDuration |
( |
| ) |
const |
|
virtual |
- Returns
- the longest segment’s duration. This will return 0 if no segments have been added.
Definition at line 524 of file media_playlist.cc.
◆ GetNumChannels()
int shaka::hls::MediaPlaylist::GetNumChannels |
( |
| ) |
const |
|
virtual |
- Returns
- number of channels for audio. 0 is returned for video.
Definition at line 539 of file media_playlist.cc.
◆ GetVideoRange()
std::string shaka::hls::MediaPlaylist::GetVideoRange |
( |
| ) |
const |
|
virtual |
◆ language()
const std::string& shaka::hls::MediaPlaylist::language |
( |
| ) |
const |
|
inline |
- Returns
- the language of the media, as an ISO language tag in its shortest form. May be an empty string for video.
Definition at line 237 of file media_playlist.h.
◆ MaxBitrate()
uint64_t shaka::hls::MediaPlaylist::MaxBitrate |
( |
| ) |
const |
|
virtual |
If bitrate is specified in MediaInfo then it will use that value. Otherwise, returns the max bitrate.
- Returns
- the max bitrate (in bits per second) of this MediaPlaylist.
Definition at line 514 of file media_playlist.cc.
◆ SetMediaInfo()
bool shaka::hls::MediaPlaylist::SetMediaInfo |
( |
const MediaInfo & |
media_info | ) |
|
|
virtual |
This must succeed before calling any other public methods.
- Parameters
-
media_info | is the info of the segments that are going to be added to this playlist. |
- Returns
- true on success, false otherwise.
Definition at line 382 of file media_playlist.cc.
◆ SetSampleDuration()
void shaka::hls::MediaPlaylist::SetSampleDuration |
( |
int32_t |
sample_duration | ) |
|
|
virtual |
Set the sample duration. Sample duration is used to generate frame rate. Sample duration is not available right away especially. This allows setting the sample duration after the Media Playlist has been initialized.
- Parameters
-
sample_duration | is the duration of a sample. |
Definition at line 421 of file media_playlist.cc.
◆ SetTargetDuration()
void shaka::hls::MediaPlaylist::SetTargetDuration |
( |
int32_t |
target_duration | ) |
|
|
virtual |
Set the target duration of this MediaPlaylist. In other words this is the value for EXT-X-TARGETDURATION. If this is not called before calling Write(), it will estimate the best target duration. The spec does not allow changing EXT-X-TARGETDURATION. However, this class has no control over the input source.
- Parameters
-
target_duration | is the target duration for this playlist. |
Definition at line 528 of file media_playlist.cc.
◆ WriteToFile()
bool shaka::hls::MediaPlaylist::WriteToFile |
( |
const std::filesystem::path & |
file_path | ) |
|
|
virtual |
Write the playlist to |file_path|. This does not close the file. If target duration is not set explicitly, this will try to find the target duration. Note that target duration cannot be changed. So calling this without explicitly setting the target duration and before adding any segments will end up setting the target duration to 0 and will always generate an invalid playlist.
- Parameters
-
file_path | is the output file path accepted by the File implementation. |
- Returns
- true on success, false otherwise.
Definition at line 490 of file media_playlist.cc.
The documentation for this class was generated from the following files: