Shaka Packager SDK
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
shaka::AdaptationSet Class Reference

#include <adaptation_set.h>

Inheritance diagram for shaka::AdaptationSet:
shaka::MockAdaptationSet

Public Types

enum  Role {
  kRoleCaption, kRoleSubtitle, kRoleMain, kRoleAlternate,
  kRoleSupplementary, kRoleCommentary, kRoleDub
}
 

Public Member Functions

virtual RepresentationAddRepresentation (const MediaInfo &media_info)
 
virtual RepresentationCopyRepresentation (const Representation &representation)
 
virtual void AddContentProtectionElement (const ContentProtectionElement &element)
 
virtual void UpdateContentProtectionPssh (const std::string &drm_uuid, const std::string &pssh)
 
virtual void AddRole (Role role)
 
xml::scoped_xml_ptr< xmlNode > GetXml ()
 
virtual void ForceSetSegmentAlignment (bool segment_alignment)
 
virtual void AddAdaptationSetSwitching (const AdaptationSet *adaptation_set)
 
bool has_id () const
 
uint32_t id () const
 
void set_id (uint32_t id)
 
void OnNewSegmentForRepresentation (uint32_t representation_id, uint64_t start_time, uint64_t duration)
 
void OnSetFrameRateForRepresentation (uint32_t representation_id, uint32_t frame_duration, uint32_t timescale)
 
virtual void AddTrickPlayReference (const AdaptationSet *adaptation_set)
 
const std::list< Representation * > GetRepresentations () const
 
bool IsVideo () const
 

Protected Member Functions

 AdaptationSet (const std::string &language, const MpdOptions &mpd_options, uint32_t *representation_counter)
 

Friends

class Period
 
class AdaptationSetTest
 

Detailed Description

AdaptationSet class provides methods to add Representations and <ContentProtection> elements to the AdaptationSet element.

Definition at line 37 of file adaptation_set.h.

Constructor & Destructor Documentation

◆ AdaptationSet()

shaka::AdaptationSet::AdaptationSet ( const std::string &  language,
const MpdOptions mpd_options,
uint32_t *  representation_counter 
)
protected
Parameters
languageis the language of this AdaptationSet. Mainly relevant for audio.
mpd_optionsis the options for this MPD.
mpd_typeis the type of this MPD.
representation_counteris a Counter for assigning ID numbers to Representation. It can not be NULL.

Definition at line 169 of file adaptation_set.cc.

Member Function Documentation

◆ AddAdaptationSetSwitching()

void shaka::AdaptationSet::AddAdaptationSetSwitching ( const AdaptationSet adaptation_set)
virtual

Adds the adaptation set this adaptation set can switch to.

Parameters
adaptation_setpoints to the switchable adaptation set.

Definition at line 346 of file adaptation_set.cc.

◆ AddContentProtectionElement()

void shaka::AdaptationSet::AddContentProtectionElement ( const ContentProtectionElement element)
virtual

Add a ContenProtection element to the adaptation set. AdaptationSet does not add <ContentProtection> elements automatically to itself even if media_info.protected_content is populated. This is because some MPDs should have the elements at AdaptationSet level and some at Representation level.

Parameters
elementcontains the ContentProtection element contents. If element has {value, schemeIdUri} set and has {“value”, “schemeIdUri”} as key for additional_attributes, then the former is used.

Definition at line 216 of file adaptation_set.cc.

◆ AddRepresentation()

Representation * shaka::AdaptationSet::AddRepresentation ( const MediaInfo &  media_info)
virtual

Create a Representation instance using media_info.

Parameters
media_infois a MediaInfo object used to initialize the returned Representation instance. It may contain only one of VideoInfo, AudioInfo, or TextInfo, i.e. VideoInfo XOR AudioInfo XOR TextInfo.
Returns
On success, returns a pointer to Representation. Otherwise returns NULL. The returned pointer is owned by the AdaptationSet instance.

Definition at line 182 of file adaptation_set.cc.

◆ AddRole()

void shaka::AdaptationSet::AddRole ( Role  role)
virtual

Set the Role element for this AdaptationSet. The Role element's is schemeIdUri='urn:mpeg:dash:role:2011'. See ISO/IEC 23009-1:2012 section 5.8.5.5.

Parameters
roleof this AdaptationSet.

Definition at line 228 of file adaptation_set.cc.

◆ AddTrickPlayReference()

void shaka::AdaptationSet::AddTrickPlayReference ( const AdaptationSet adaptation_set)
virtual

Add the adaptation set this trick play adaptation set belongs to.

Parameters
adaptation_setpoints to the reference (or main) adapation set.

Definition at line 374 of file adaptation_set.cc.

◆ CopyRepresentation()

Representation * shaka::AdaptationSet::CopyRepresentation ( const Representation representation)
virtual

Copy a Representation instance from representation in another AdaptationSet. One use case is to duplicate Representation in different periods.

Parameters
representationis an existing Representation to be cloned from.
Returns
On success, returns a pointer to Representation. Otherwise returns NULL. The returned pointer is owned by the AdaptationSet instance.

Definition at line 201 of file adaptation_set.cc.

◆ ForceSetSegmentAlignment()

void shaka::AdaptationSet::ForceSetSegmentAlignment ( bool  segment_alignment)
virtual

Forces the (sub)segmentAlignment field to be set to segment_alignment. Use this if you are certain that the (sub)segments are alinged/unaligned for the AdaptationSet.

Parameters
segment_alignmentis the value used for (sub)segmentAlignment attribute.

Definition at line 340 of file adaptation_set.cc.

◆ GetXml()

xml::scoped_xml_ptr< xmlNode > shaka::AdaptationSet::GetXml ( )

Makes a copy of AdaptationSet xml element with its child Representation and ContentProtection elements.

Returns
On success returns a non-NULL scoped_xml_ptr. Otherwise returns a NULL scoped_xml_ptr.

Definition at line 238 of file adaptation_set.cc.

◆ has_id()

bool shaka::AdaptationSet::has_id ( ) const
inline
Returns
true if id is set, false otherwise.

Definition at line 121 of file adaptation_set.h.

◆ IsVideo()

bool shaka::AdaptationSet::IsVideo ( ) const
Returns
true if it is a video AdaptationSet.

Definition at line 386 of file adaptation_set.cc.

◆ OnNewSegmentForRepresentation()

void shaka::AdaptationSet::OnNewSegmentForRepresentation ( uint32_t  representation_id,
uint64_t  start_time,
uint64_t  duration 
)

Notifies the AdaptationSet instance that a new (sub)segment was added to the Representation with representation_id. This must be called every time a (sub)segment is added to a Representation in this AdaptationSet. If a Representation is constructed using AddRepresentation() this is called automatically whenever Representation::AddNewSegment() is is called.

Parameters
representation_idis the id of the Representation with a new segment.
start_timeis the start time of the new segment.
durationis the duration of the new segment.

Definition at line 357 of file adaptation_set.cc.

◆ OnSetFrameRateForRepresentation()

void shaka::AdaptationSet::OnSetFrameRateForRepresentation ( uint32_t  representation_id,
uint32_t  frame_duration,
uint32_t  timescale 
)

Notifies the AdaptationSet instance that the sample duration for the Representation was set. The frame duration for a video Representation might not be specified when a Representation is created (by calling AddRepresentation()). This should be used to notify this instance that the frame rate for a Represenatation has been set. This method is called automatically when Represenatation::SetSampleDuration() is called if the Represenatation instance was created using AddRepresentation().

Parameters
representation_idis the id of the Representation. is the duration of a frame in the Representation.
timescaleis the timescale of the Representation.

Definition at line 368 of file adaptation_set.cc.

◆ set_id()

void shaka::AdaptationSet::set_id ( uint32_t  id)
inline

Set AdaptationSet.

Parameters
idis the new ID to be set.

Definition at line 128 of file adaptation_set.h.

◆ UpdateContentProtectionPssh()

void shaka::AdaptationSet::UpdateContentProtectionPssh ( const std::string &  drm_uuid,
const std::string &  pssh 
)
virtual

Update the 'cenc:pssh' element for drm_uuid ContentProtection element. If the element does not exist, this will add one.

Parameters
drm_uuidis the UUID of the DRM for encryption.
psshis the content of <cenc:pssh> element. Note that DASH IF IOP mentions that this should be base64 encoded string of the whole pssh box.
Attention
This might get removed once DASH IF IOP specification makes a a clear guideline on how to handle key rotation. Also to get this working with shaka-player, this method DOES NOT update the PSSH element. Instead, it removes the element regardless of the content of pssh.

Definition at line 222 of file adaptation_set.cc.


The documentation for this class was generated from the following files: