Shaka Packager Library (Continued)¶
-
struct
shaka::
PackagingParams
¶ Packaging parameters.
Public Members
-
std::string
temp_dir
¶ Specify temporary directory for intermediate temporary files.
-
Mp4OutputParams
mp4_output_params
¶ MP4 (ISO-BMFF) output related parameters.
-
ChunkingParams
chunking_params
¶ Chunking (segmentation) related parameters.
-
bool
output_media_info
= false¶ Manifest generation related parameters. Right now only one of
output_media_info
,mpd_params
andhls_params
should be set. Create a human readable format of MediaInfo. The output file name will be the name specified by output flag, suffixed with.media_info
.
-
EncryptionParams
encryption_params
¶ Encryption and Decryption Parameters.
-
BufferCallbackParams
buffer_callback_params
¶ Buffer callback params.
-
std::string
-
struct
shaka::
StreamDescriptor
¶ Defines a single input/output stream.
Public Members
-
std::string
input
¶ Input/source media file path or network stream URL. Required.
-
std::string
stream_selector
¶ Stream selector, can be
audio
,video
,text
or a zero based stream index. Required.
-
std::string
output
¶ Specifies output file path or init segment path (if segment template is specified). Can be empty for self initialization media segments.
-
std::string
segment_template
¶ Specifies segment template. Can be empty.
-
std::string
output_format
¶ Optional value which specifies output container format, e.g. “mp4”. If not specified, will detect from output / segment template name.
-
bool
skip_encryption
= false¶ If set to true, the stream will not be encrypted. This is useful, e.g. to encrypt only video streams.
-
uint32_t
trick_play_factor
= 0¶ If set to a non-zero value, will generate a trick play / trick mode stream with frames sampled from the key frames in the original stream.
trick_play_factor
defines the sampling rate.
-
uint32_t
bandwidth
= 0¶ Optional user-specified content bit rate for the stream, in bits/sec. If specified, this value is propagated to the
$Bandwidth$
template parameter for segment names. If not specified, its value may be estimated.
-
std::string
language
¶ Optional value which contains a user-specified language tag. If specified, this value overrides any language metadata in the input stream.
-
std::string
hls_name
¶ Required for audio when outputting HLS. It defines the name of the output stream, which is not necessarily the same as output. This is used as the
NAME
attribute for EXT-X-MEDIA.
-
std::string
hls_group_id
¶ Required for audio when outputting HLS. It defines the group ID for the output stream. This is used as the GROUP-ID attribute for EXT-X-MEDIA.
-
std::string
hls_playlist_name
¶ Required for HLS output. It defines the name of the playlist for the stream. Usually ends with
.m3u8
.
-
std::string
-
struct
shaka::
Mp4OutputParams
¶ MP4 (ISO-BMFF) output related parameters.
Public Members
-
bool
use_decoding_timestamp_in_timeline
= false¶ Set the flag use_decoding_timestamp_in_timeline, which if set to true, use decoding timestamp instead of presentation timestamp in media timeline, which is needed to workaround a Chromium bug that decoding timestamp is used in buffered range, https://crbug.com/398130.
Public Static Attributes
-
constexpr int
kNoSidxBoxInSegment
= -1¶ Set the number of subsegments in each SIDX box. If 0, a single SIDX box is used per segment. If -1, no SIDX box is used. Otherwise, the Muxer will pack N subsegments in the root SIDX of the segment, with segment_duration/N/subsegment_duration fragments per subsegment. This flag is ingored for DASH MPD with on-demand profile.
-
bool
-
struct
shaka::
ChunkingParams
¶ Chunking (segmentation) related parameters.
Public Members
-
double
segment_duration_in_seconds
= 0¶ Segment duration in seconds.
-
double
subsegment_duration_in_seconds
= 0¶ Subsegment duration in seconds. Should not be larger than the segment duration.
-
bool
segment_sap_aligned
= true¶ Force segments to begin with stream access points. Actual segment duration may not be exactly what is specified by segment_duration.
-
bool
subsegment_sap_aligned
= true¶ Force subsegments to begin with stream access points. Actual subsegment duration may not be exactly what is specified by subsegment_duration. Setting to subsegment_sap_aligned to true but segment_sap_aligned to false is not allowed.
-
double
-
struct
shaka::
MpdParams
¶ DASH MPD related parameters.
Public Members
-
std::string
mpd_output
¶ MPD output file path.
-
std::vector<std::string>
base_urls
¶ BaseURLs for the MPD. The values will be added as <BaseURL> element(s) under the <MPD> element.
-
double
min_buffer_time
= 2.0¶ Set MPD attribute, which specifies, in seconds, a common duration used in the definition of the MPD representation data rate. A client can be assured of having enough data for continous playout providing playout begins at min_buffer_time after the first bit is received.
-
bool
generate_static_live_mpd
= false¶ Generate static MPD for live profile. Note that this flag has no effect for on-demand profile, in which case static MPD is always used.
-
double
time_shift_buffer_depth
= 0¶ Set MPD attribute, which is the guaranteed duration of the time shifting buffer for ‘dynamic’ media presentations, in seconds.
-
double
minimum_update_period
= 0¶ Set MPD attribute, which indicates to the player how often to refresh the MPD in seconds. For dynamic MPD only.
-
std::string
default_language
¶ The tracks tagged with this language will have <Role ... value=”main” /> in the manifest. This allows the player to choose the correct default language for the content.
-
bool
generate_dash_if_iop_compliant_mpd
= true¶ Try to generate DASH-IF IOP compliant MPD.
Public Static Attributes
-
constexpr double
kSuggestedPresentationDelayNotSet
= 0¶ Set MPD attribute. For ‘dynamic’ media presentations, it specifies a delay, in seconds, to be added to the media presentation time. The attribute is not set if the value is 0; the client is expected to choose a suitable value in this case.
-
std::string
-
struct
shaka::
HlsParams
¶ HLS related parameters.
Public Members
-
HlsPlaylistType
playlist_type
= HlsPlaylistType::kVod¶ HLS playlist type. See HLS specification for details.
-
std::string
master_playlist_output
¶ HLS master playlist output path.
-
std::string
base_url
¶ The base URL for the Media Playlists and media files listed in the playlists. This is the prefix for the files.
-
double
time_shift_buffer_depth
= 0¶ Defines the live window, or the guaranteed duration of the time shifting buffer for ‘live’ playlists.
-
HlsPlaylistType
-
enum
shaka::
HlsPlaylistType
¶ Defines the EXT-X-PLAYLIST-TYPE in the HLS specification. For HlsPlaylistType of kLive, EXT-X-PLAYLIST-TYPE tag is omitted.
Values:
-
kVod
¶
-
kEvent
¶
-
kLive
¶
-
-
enum
shaka::
KeyProvider
¶ Encryption / decryption key providers.
Values:
-
kNone
= 0¶
-
kWidevine
= 1¶
-
kPlayready
= 2¶
-
kRawKey
= 3¶
-
-
struct
shaka::
WidevineSigner
¶ Signer credential for Widevine license server.
Public Members
-
std::string
signer_name
¶ Name of the signer / content provider.
-
SigningKeyType
signing_key_type
= SigningKeyType::kNone¶ Specifies the signing key type, which determines whether AES or RSA key are used to authenticate the signer. A type of ‘kNone’ is invalid.
-
std::vector<uint8_t>
key
¶ AES signing key.
-
std::vector<uint8_t>
iv
¶ AES signing IV.
-
std::string
key
¶ RSA signing private key.
-
std::string
-
struct
shaka::
WidevineEncryptionParams
¶ Widevine encryption parameters.
Public Members
-
std::string
key_server_url
¶ Widevine license / key server URL.
-
bool
include_common_pssh
= false¶ Generates and includes an additional v1 PSSH box for the common system ID. See: https://goo.gl/s8RIhr.
-
std::vector<uint8_t>
content_id
¶ Content identifier.
-
std::string
policy
¶ The name of a stored policy, which specifies DRM content rights.
-
WidevineSigner
signer
¶ Signer credential for Widevine license / key server.
-
std::vector<uint8_t>
group_id
¶ Group identifier, if present licenses will belong to this group.
-
std::string
-
struct
shaka::
PlayreadyEncryptionParams
¶ Playready encryption parameters. Two different modes of playready key acquisition is supported: (1) Fetch from a key server.
key_server_url
andprogram_identifier
are required. The presence of other parameters may be necessary depends on server configuration. (2) Provide the raw key directly. Bothkey_id
andkey
are required. We are planning to merge this mode withRawKeyEncryptionParams
.Public Members
-
std::string
key_server_url
¶ Playready license / key server URL.
-
std::string
program_identifier
¶ Playready program identifier.
-
std::string
ca_file
¶ Absolute path to the Certificate Authority file for the server cert in PEM format.
-
std::string
client_cert_file
¶ Absolute path to client certificate file.
-
std::string
client_cert_private_key_file
¶ Absolute path to the private key file.
-
std::string
client_cert_private_key_password
¶ Password to the private key file.
-
std::vector<uint8_t>
key_id
¶ Provides a raw Playready KeyId.
-
std::vector<uint8_t>
key
¶ Provides a raw Playready Key.
-
std::string
-
struct
shaka::
RawKeyEncryptionParams
¶ Raw key encryption parameters, i.e. with key parameters provided.
Public Members
-
std::vector<uint8_t>
iv
¶ An optional initialization vector. If not provided, a random
iv
will be generated. Note that this parameter should only be used during testing.
-
std::vector<uint8_t>
pssh
¶ Inject a custom
pssh
or multiple concatenatedpsshs
. If not provided, a common system pssh will be generated.
-
std::vector<uint8_t>
-
struct
shaka::RawKeyEncryptionParams::
KeyPair
¶
-
struct
shaka::
EncryptionParams
¶ Encryption parameters.
Public Members
-
KeyProvider
key_provider
= KeyProvider::kNone¶ Specifies the key provider, which determines which key provider is used and which encryption params is valid. ‘kNone’ means not to encrypt the streams.
-
double
clear_lead_in_seconds
= 0¶ Clear lead duration in seconds.
-
bool
vp9_subsample_encryption
= true¶ Enable/disable subsample encryption for VP9.
-
std::function<std::string(const EncryptedStreamAttributes &stream_attributes)>
stream_label_func
¶ Stream label function assigns a stream label to the stream to be encrypted. Stream label is used to associate KeyPair with streams. Streams with the same stream label always uses the same keyPair; Streams with different stream label could use the same or different KeyPairs. A default stream label function will be generated if not set.
Public Static Attributes
-
constexpr uint32_t
kProtectionSchemeCenc
= 0x63656E63¶ The protection scheme: “cenc”, “cens”, “cbc1”, “cbcs”.
-
constexpr double
kNoKeyRotation
= 0¶ Crypto period duration in seconds. A positive value means key rotation is enabled, the key provider must support key rotation in this case.
-
struct
EncryptedStreamAttributes
¶ Encrypted stream information that is used to determine stream label.
-
KeyProvider
-
struct
shaka::
WidevineDecryptionParams
¶ Widevine decryption parameters.
Public Members
-
std::string
key_server_url
¶ Widevine license / key server URL.
-
WidevineSigner
signer
¶ Signer credential for Widevine license / key server.
-
std::string
-
struct
shaka::
RawKeyDecryptionParams
¶ Raw key decryption parameters, i.e. with key parameters provided.
-
struct
shaka::RawKeyDecryptionParams::
KeyPair
¶
-
struct
shaka::
DecryptionParams
¶ Decryption parameters.
Public Members
-
KeyProvider
key_provider
= KeyProvider::kNone¶ Specifies the key provider, which determines which key provider is used and which encryption params is valid. ‘kNone’ means not to decrypt the streams.
-
KeyProvider
-
class
shaka::
Status
¶ Public Functions
-
Status
()¶ Creates a “successful” status.
-
Status
(error::Code error_code, const std::string &error_message)¶ Create a status with the specified code, and error message. If “error_code == error::OK”, error_message is ignored and a Status object identical to Status::OK is constructed.
-
void
SetError
(error::Code error_code, const std::string &error_message)¶ Store the specified error in this Status object. If “error_code == error::OK”, error_message is ignored and a Status object identical to Status::OK is constructed.
-
void
Update
(const Status &new_status)¶ If “ok()”, stores “new_status” into *this. If ”!ok()”, preserves the current “error_code()/error_message()”,
Convenient way of keeping track of the first error encountered. Instead of: if (overall_status.ok()) overall_status = new_status Use: overall_status.Update(new_status);
-
void
Clear
()¶ Clear this status object to contain the OK code and no error message.
-
bool
Matches
(const Status &x) const¶ - Return
- true iff this has the same error_code as “x”, i.e., the two Status objects are identical except possibly for the error message.
-
std::string
ToString
() const¶ - Return
- A combination of the error code name and message.
-
-
enum
shaka::error::
Code
¶ Error codes for the packager APIs.
Values:
-
OK
¶
-
UNKNOWN
¶
-
CANCELLED
¶
-
INVALID_ARGUMENT
¶
-
UNIMPLEMENTED
¶
-
FILE_FAILURE
¶
-
END_OF_STREAM
¶
-
HTTP_FAILURE
¶
-
PARSER_FAILURE
¶
-
ENCRYPTION_FAILURE
¶
-
CHUNKING_ERROR
¶
-
MUXER_FAILURE
¶
-
FRAGMENT_FINALIZED
¶
-
SERVER_ERROR
¶
-
INTERNAL_ERROR
¶
-
STOPPED
¶
-
TIME_OUT
¶
-
NOT_FOUND
¶
-
ALREADY_EXISTS
¶
-
TRICK_PLAY_ERROR
¶
-