Shaka Packager SDK
Classes | Typedefs | Enumerations | Functions | Variables
shaka Namespace Reference

All the methods that are virtual are virtual for mocking. More...

Classes

class  CallbackFile
 
class  File
 Define an abstract file interface. More...
 
struct  FileCloser
 
class  HttpFile
 
class  IoCache
 Declaration of class which implements a thread-safe circular buffer. More...
 
class  LocalFile
 Implement LocalFile which deals with local storage. More...
 
class  MemoryFile
 
struct  BufferCallbackParams
 Buffer callback params. More...
 
class  ThreadedIoFile
 Declaration of class which implements a thread-safe circular buffer. More...
 
class  UdpFile
 Implements UdpFile, which receives UDP unicast and multicast streams. More...
 
class  UdpOptions
 Options parsed from UDP url string of the form: udp://ip:port[?options]. More...
 
struct  HlsParams
 HLS related parameters. More...
 
struct  Cuepoint
 
struct  AdCueGeneratorParams
 Cuepoint generator related parameters. More...
 
struct  ChunkingParams
 Chunking (segmentation) related parameters. More...
 
struct  WidevineSigner
 Signer credential for Widevine license server. More...
 
struct  WidevineEncryptionParams
 Widevine encryption parameters. More...
 
struct  PlayReadyEncryptionParams
 
struct  RawKeyParams
 Raw key encryption/decryption parameters, i.e. with key parameters provided. More...
 
struct  EncryptionParams
 Encryption parameters. More...
 
struct  WidevineDecryptionParams
 Widevine decryption parameters. More...
 
struct  DecryptionParams
 Decryption parameters. More...
 
struct  Mp4OutputParams
 MP4 (ISO-BMFF) output related parameters. More...
 
class  AdaptationSet
 
class  BandwidthEstimator
 
struct  Element
 
struct  ContentProtectionElement
 
class  MockMpdBuilder
 
class  MockPeriod
 
class  MockAdaptationSet
 
class  MockRepresentation
 
class  MockMpdNotifier
 
class  MpdBuilder
 This class generates DASH MPDs (Media Presentation Descriptions). More...
 
class  MpdNotifier
 
struct  MpdOptions
 Defines Mpd Options. More...
 
class  Period
 
class  RepresentationStateChangeListener
 
class  Representation
 
struct  SegmentInfo
 
class  SimpleMpdNotifier
 
struct  MpdParams
 DASH MPD related parameters. More...
 
class  MpdNotifierFactory
 
class  MpdWriter
 
struct  TestParams
 Parameters used for testing. More...
 
struct  PackagingParams
 Packaging parameters. More...
 
struct  StreamDescriptor
 Defines a single input/output stream. More...
 
class  Packager
 
class  Status
 

Typedefs

typedef MediaInfo::AudioInfo AudioInfo
 
typedef MediaInfo::VideoInfo VideoInfo
 

Enumerations

enum class  HttpMethod { kGet , kPost , kPut }
 
enum class  HlsPlaylistType { kVod , kEvent , kLive }
 
enum class  KeyProvider { kNone , kRawKey , kWidevine , kPlayReady }
 
enum class  ProtectionSystem : uint16_t {
  kNone = 0 , kCommon = (1 << 0) , kWidevine = (1 << 1) , kPlayReady = (1 << 2) ,
  kFairPlay = (1 << 3) , kMarlin = (1 << 4)
}
 
enum  ContentType { kContentTypeUnknown , kContentTypeVideo , kContentTypeAudio , kContentTypeText }
 
enum class  DashProfile { kUnknown , kOnDemand , kLive }
 
enum class  MpdType { kStatic , kDynamic }
 

Functions

bool ValidateHexString (const char *flagname, const std::string &value, std::vector< uint8_t > *value_bytes)
 
bool ValidatePRCryptoFlags ()
 
bool ValidateRawKeyCryptoFlags ()
 
base::Optional< StreamDescriptorParseStreamDescriptor (const std::string &descriptor_string)
 
void PrintError (const std::string &error_message)
 
void PrintWarning (const std::string &warning_message)
 
template<class FlagType >
bool ValidateFlag (const char *flag_name, const FlagType &flag_value, bool condition, bool optional, const char *label)
 
bool ValidateWidevineCryptoFlags ()
 
bool TempFilePath (const std::string &temp_dir, std::string *temp_file_path)
 
std::string LanguageToShortestForm (const std::string &language)
 
std::string LanguageToISO_639_2 (const std::string &language)
 
ProtectionSystem operator| (ProtectionSystem a, ProtectionSystem b)
 
ProtectionSystemoperator|= (ProtectionSystem &a, ProtectionSystem b)
 
ProtectionSystem operator& (ProtectionSystem a, ProtectionSystem b)
 
ProtectionSystemoperator&= (ProtectionSystem &a, ProtectionSystem b)
 
ProtectionSystem operator~ (ProtectionSystem a)
 
bool has_flag (ProtectionSystem value, ProtectionSystem flag)
 
bool WriteMpdToFile (const std::string &output_path, MpdBuilder *mpd_builder)
 
ContentType GetContentType (const MediaInfo &media_info)
 
std::string Uint8VectorToBase64 (const std::vector< uint8_t > &input)
 Converts uint8 vector into base64 encoded string.
 
bool HasVODOnlyFields (const MediaInfo &media_info)
 
bool HasLiveOnlyFields (const MediaInfo &media_info)
 
void RemoveDuplicateAttributes (ContentProtectionElement *content_protection_element)
 
std::string GetLanguage (const MediaInfo &media_info)
 
std::string GetCodecs (const MediaInfo &media_info)
 
std::string GetBaseCodec (const MediaInfo &media_info)
 
std::string GetAdaptationSetKey (const MediaInfo &media_info, bool ignore_codec)
 
std::string SecondsToXmlDuration (double seconds)
 
bool GetDurationAttribute (xmlNodePtr node, float *duration)
 
bool MoreThanOneTrue (bool b1, bool b2, bool b3)
 
bool AtLeastOneTrue (bool b1, bool b2, bool b3)
 
bool OnlyOneTrue (bool b1, bool b2, bool b3)
 
bool HexToUUID (const std::string &data, std::string *uuid_format)
 
void UpdateContentProtectionPsshHelper (const std::string &drm_uuid, const std::string &pssh, std::list< ContentProtectionElement > *content_protection_elements)
 
void AddContentProtectionElements (const MediaInfo &media_info, Representation *parent)
 
void AddContentProtectionElements (const MediaInfo &media_info, AdaptationSet *parent)
 
bool XmlEqual (const std::string &xml1, const xml::XmlNode &xml2)
 
std::ostream & operator<< (std::ostream &os, const Status &x)
 

Variables

const char * kCallbackFilePrefix = "callback://"
 
const char * kLocalFilePrefix = "file://"
 
const char * kMemoryFilePrefix = "memory://"
 
const char * kUdpFilePrefix = "udp://"
 
const char * kHttpFilePrefix = "http://"
 
const char * kHttpsFilePrefix = "https://"
 
const int64_t kWholeFile = -1
 
const char kAdditionalFileMode [] = "b"
 
const char kEncryptedMp4Scheme [] = "urn:mpeg:dash:mp4protection:2011"
 
const char kPsshElementName [] = "cenc:pssh"
 
const char kMsproElementName [] = "mspr:pro"
 

Detailed Description

All the methods that are virtual are virtual for mocking.

All the methods that are virtual are virtual for mocking. NOTE: Inclusion of this module will cause xmlInitParser and xmlCleanupParser to be called at static initialization / deinitialization time.

This file contains helper functions and enums for MpdNotifier implementations.

Enumeration Type Documentation

◆ HlsPlaylistType

Defines the EXT-X-PLAYLIST-TYPE in the HLS specification. For HlsPlaylistType of kLive, EXT-X-PLAYLIST-TYPE tag is omitted.

Definition at line 16 of file hls_params.h.

◆ KeyProvider

enum shaka::KeyProvider
strong

Encryption key providers. These provide keys to decrypt the content if the source content is encrypted, or used to encrypt the content.

Definition at line 21 of file crypto_params.h.

◆ ProtectionSystem

enum shaka::ProtectionSystem : uint16_t
strong

Protection systems that handle decryption during playback. This affects the protection info that is stored in the content. Multiple protection systems can be combined using OR.

Enumerator
kCommon 

The common key system from EME: https://goo.gl/s8RIhr.

Definition at line 31 of file crypto_params.h.

Function Documentation

◆ AddContentProtectionElements() [1/2]

void shaka::AddContentProtectionElements ( const MediaInfo &  media_info,
AdaptationSet parent 
)

Adds <ContentProtection> elements specified by media_info to representation.

Parameters
media_infomay or may not have protected_content field.
representationis the parent element that owns the ContentProtection elements.

Definition at line 478 of file mpd_utils.cc.

◆ AddContentProtectionElements() [2/2]

void shaka::AddContentProtectionElements ( const MediaInfo &  media_info,
Representation parent 
)

Adds <ContentProtection> elements specified by media_info to adaptation_set. Note that this will add the elements as direct chlidren of AdaptationSet.

Parameters
media_infomay or may not have protected_content field.
adaptation_setis the parent element that owns the ContentProtection elements.

Definition at line 473 of file mpd_utils.cc.

◆ GetContentType()

ContentType shaka::GetContentType ( const MediaInfo &  media_info)

Determines the content type of |media_info|.

Parameters
media_infois the information about the media.
Returns
content type of the media_info.

Definition at line 32 of file mpd_notifier_util.cc.

◆ HexToUUID()

bool shaka::HexToUUID ( const std::string &  data,
std::string *  uuid_format 
)

Converts hex data to UUID format. Hex data must be size 16.

Parameters
datainput hex data.
uuid_formatis the UUID format of the input.

Definition at line 232 of file mpd_utils.cc.

◆ LanguageToISO_639_2()

std::string shaka::LanguageToISO_639_2 ( const std::string &  language)

Convert a language tag to a 3-letter ISO-639-2 code, as required by the ISO BMFF spec. The input is assumed to be a valid ISO-639-2 or ISO-639-1 language code. Regions and variants are not supported.

Definition at line 117 of file language_utils.cc.

◆ LanguageToShortestForm()

std::string shaka::LanguageToShortestForm ( const std::string &  language)

Convert a language tag to its shortest form, as required by RFC 5646 indicated in the MPD and HLS specs. Assumes the input is a valid ISO-639-2 or ISO-639-1 language tag, or an empty string. Regions and variants are preserved in the conversion.

Definition at line 89 of file language_utils.cc.

◆ ParseStreamDescriptor()

base::Optional< StreamDescriptor > shaka::ParseStreamDescriptor ( const std::string &  descriptor_string)

Parses a descriptor string, and inserts into sorted list of stream descriptors.

Parameters
descriptor_stringcontains comma separate name-value pairs describing the stream.
descriptor_listis a pointer to the sorted descriptor list into which the new descriptor should be inserted.
Returns
true if successful, false otherwise. May print error messages.

Definition at line 98 of file stream_descriptor.cc.

◆ PrintError()

void shaka::PrintError ( const std::string &  error_message)

Format and print error message.

Parameters
error_messagespecifies the error message.

Definition at line 15 of file validate_flag.cc.

◆ PrintWarning()

void shaka::PrintWarning ( const std::string &  warning_message)

Format and print warning message.

Parameters
warning_messagespecifies the warning message.

Definition at line 19 of file validate_flag.cc.

◆ TempFilePath()

bool shaka::TempFilePath ( const std::string &  temp_dir,
std::string *  temp_file_path 
)

Create a temp file name in directory temp_dir. Generate the temp file in os specific temporary directory if temp_dir is empty.

Parameters
temp_dirspecifies the directory where the file should go.
temp_file_pathis the result temp file path on success.
Returns
true on success, false otherwise.

Definition at line 38 of file file_util.cc.

◆ ValidateFlag()

template<class FlagType >
bool shaka::ValidateFlag ( const char *  flag_name,
const FlagType &  flag_value,
bool  condition,
bool  optional,
const char *  label 
)

Validate a flag against the given condition.

Parameters
flag_nameis the name of the flag.
flag_valueis the value of the flag.
condition,optionaldetermines how the flag should be validated. If condition is true and optional is false, then this flag is required
labelspecifies the label associated with the condition. It is used to generate the error message on validation failure.
Returns
true on success, false otherwise.

Definition at line 37 of file validate_flag.h.

◆ ValidatePRCryptoFlags()

bool shaka::ValidatePRCryptoFlags ( )

Validate PlayReady encryption flags.

Returns
true on success, false otherwise.

Definition at line 25 of file playready_key_encryption_flags.cc.

◆ ValidateRawKeyCryptoFlags()

bool shaka::ValidateRawKeyCryptoFlags ( )

Validate raw encryption/decryption flags.

Returns
true on success, false otherwise.

Definition at line 51 of file raw_key_encryption_flags.cc.

◆ ValidateWidevineCryptoFlags()

bool shaka::ValidateWidevineCryptoFlags ( )

Validate widevine encryption/decryption flags.

Returns
true on success, false otherwise.

Definition at line 71 of file widevine_encryption_flags.cc.

◆ WriteMpdToFile()

bool shaka::WriteMpdToFile ( const std::string &  output_path,
MpdBuilder mpd_builder 
)

Outputs MPD to output_path.

Parameters
output_pathis the path to the MPD output location.
mpd_builderis the MPD builder instance.

Definition at line 16 of file mpd_notifier_util.cc.