Rialto  0.1
Rialto media pipeline API
Public Member Functions | Protected Attributes | List of all members
firebolt::rialto::IMediaPipeline::MediaSegment Class Reference

A class that represents a media segment. More...

#include <IMediaPipeline.h>

Inheritance diagram for firebolt::rialto::IMediaPipeline::MediaSegment:
Inheritance graph
[legend]

Public Member Functions

 MediaSegment (int32_t sourceId=0, MediaSourceType type=MediaSourceType::UNKNOWN, int64_t timeStamp=0, int64_t duration=0)
 Default constructor. More...
 
virtual ~MediaSegment ()
 Virtual destructor.
 
virtual std::unique_ptr< MediaSegmentcopy () const
 Makes a shallow copy of the segment. More...
 
int32_t getId () const
 Return the source id. More...
 
MediaSourceType getType () const
 The source type for the data. More...
 
const uint8_t * getData () const
 Returns a pointer to the data. More...
 
uint32_t getDataLength () const
 Returns a the data length. More...
 
int64_t getTimeStamp () const
 Returns the time stamp. More...
 
void setTimeStamp (int64_t timeStamp)
 Sets the time stamp (value in nanoseconds).
 
int64_t getDuration () const
 Returns the duration. More...
 
const std::vector< uint8_t > & getExtraData () const
 Returns a pointer to the extra data. More...
 
bool isEncrypted () const
 Indicates that the data is encrypted. More...
 
const int32_t getMediaKeySessionId () const
 Returns the media key session id. Empty if unencrypted. More...
 
const std::vector< uint8_t > & getKeyId () const
 Returns the key id. Empty if unencrypted. More...
 
const std::vector< uint8_t > & getInitVector () const
 Returns the initialisation vector. Empty if unencrypted. More...
 
const std::vector< SubSamplePair > & getSubSamples () const
 Returns the sub samples. Empty if unencrypted. More...
 
const uint32_t getInitWithLast15 () const
 Returns the initWithLast15 value. More...
 
const SegmentAlignment getSegmentAlignment () const
 Returns the segment alignment. More...
 
const std::shared_ptr< CodecData > & getCodecData () const
 Gets the codec data. More...
 
const CipherModegetCipherMode () const
 Gets the cipher mode for common encryption. More...
 
const bool getEncryptionPattern (uint32_t &crypt, uint32_t &skip) const
 Gets the crypt & skip byte block for pattern encryption. More...
 
bool setData (uint32_t dataLength, const uint8_t *data)
 Sets the segment data. More...
 
bool setExtraData (const std::vector< uint8_t > &extraData)
 Sets the extra data. More...
 
void setSegmentAlignment (const SegmentAlignment &alignment)
 Sets the segment alignment. More...
 
void setCodecData (const std::shared_ptr< CodecData > &codecData)
 Sets new codec_data for the segment. More...
 
void setEncrypted (bool encrypted)
 Sets the encrypted flag. More...
 
void setMediaKeySessionId (int32_t mksId)
 Sets the media key session id. More...
 
void setKeyId (const std::vector< uint8_t > &keyId)
 Sets the key id. More...
 
void setInitVector (const std::vector< uint8_t > &initVector)
 Sets the encryption initialisation vector. More...
 
void addSubSample (size_t numClearBytes, size_t numEncryptedBytes)
 Adds a sub-sample pair to the sub samples. More...
 
void setInitWithLast15 (uint32_t initWithLast15)
 Sets initWithLast15 value. More...
 
void setCipherMode (CipherMode cipherMode)
 Sets the cipher mode for common encryption. More...
 
void setEncryptionPattern (uint32_t crypt, uint32_t skip)
 Sets the crypt & skip byte block for pattern encryption. More...
 
void copy (const MediaSegment &other)
 Copies the data from other to this.
 

Protected Attributes

int32_t m_sourceId
 The source id.
 
MediaSourceType m_type
 The source type.
 
const uint8_t * m_data
 The data.
 
uint32_t m_dataLength
 The data length.
 
int64_t m_timeStamp
 The time stamp.
 
int64_t m_duration
 The duration.
 
std::shared_ptr< CodecDatam_codecData
 Additional data for decoder.
 
std::vector< uint8_t > m_extraData
 The data.
 
bool m_encrypted
 Indicates the data is encrypted.
 
int32_t m_mediaKeySessionId
 Key session ID to use for decryption - only required for Netflix.
 
std::vector< uint8_t > m_keyId
 The encryption key id.
 
std::vector< uint8_t > m_initVector
 The encryption key initialisation vector.
 
std::vector< SubSamplePairm_subSamples
 The sub-sample pairs.
 
uint32_t m_initWithLast15
 Whether decryption context needs to be initialized with last 15 bytes. Currently this only applies to PlayReady DRM.
 
SegmentAlignment m_alignment
 The alignment of media segment.
 
CipherMode m_cipherMode
 Cipher mode of the sample.
 
uint32_t m_crypt
 Crypt byte block value.
 
uint32_t m_skip
 Skip byte block value.
 
bool m_encryptionPatternSet
 Whether the encryption pattern has been set.
 

Detailed Description

A class that represents a media segment.

Constructor & Destructor Documentation

◆ MediaSegment()

firebolt::rialto::IMediaPipeline::MediaSegment::MediaSegment ( int32_t  sourceId = 0,
MediaSourceType  type = MediaSourceType::UNKNOWN,
int64_t  timeStamp = 0,
int64_t  duration = 0 
)
inline

Default constructor.

Parameters
[in]sourceId: The source id. Value should be set to the MediaSource.id returned after attachSource()
[in]type: The source type.
[in]timeStamp: The timestamp in nanoseconds.
[in]duration: The duration in nanoseconds.

Member Function Documentation

◆ addSubSample()

void firebolt::rialto::IMediaPipeline::MediaSegment::addSubSample ( size_t  numClearBytes,
size_t  numEncryptedBytes 
)
inline

Adds a sub-sample pair to the sub samples.

Parameters
[in]numClearBytes: The number of clear bytes.
[in]numEncryptedBytes: The number of encrypted bytes.

◆ copy()

virtual std::unique_ptr<MediaSegment> firebolt::rialto::IMediaPipeline::MediaSegment::copy ( ) const
inlinevirtual

Makes a shallow copy of the segment.

Return values
Shallowcopy of the segment

Reimplemented in firebolt::rialto::IMediaPipeline::MediaSegmentVideo, and firebolt::rialto::IMediaPipeline::MediaSegmentAudio.

◆ getCipherMode()

const CipherMode& firebolt::rialto::IMediaPipeline::MediaSegment::getCipherMode ( ) const
inline

Gets the cipher mode for common encryption.

Return values
ciphermode uses for this sample

◆ getCodecData()

const std::shared_ptr<CodecData>& firebolt::rialto::IMediaPipeline::MediaSegment::getCodecData ( ) const
inline

Gets the codec data.

Return values
thecodec data

◆ getData()

const uint8_t* firebolt::rialto::IMediaPipeline::MediaSegment::getData ( ) const
inline

Returns a pointer to the data.

Return values
thedata.

◆ getDataLength()

uint32_t firebolt::rialto::IMediaPipeline::MediaSegment::getDataLength ( ) const
inline

Returns a the data length.

Return values
thedata.

◆ getDuration()

int64_t firebolt::rialto::IMediaPipeline::MediaSegment::getDuration ( ) const
inline

Returns the duration.

Return values
theduration in nanoseconds.

◆ getEncryptionPattern()

const bool firebolt::rialto::IMediaPipeline::MediaSegment::getEncryptionPattern ( uint32_t &  crypt,
uint32_t &  skip 
) const
inline

Gets the crypt & skip byte block for pattern encryption.

Parameters
[out]crypt: Crypt byte block value
[out]skip: Skip byte block value
Return values
ifthe encryption pattern has been set

◆ getExtraData()

const std::vector<uint8_t>& firebolt::rialto::IMediaPipeline::MediaSegment::getExtraData ( ) const
inline

Returns a pointer to the extra data.

Return values
thedata.

◆ getId()

int32_t firebolt::rialto::IMediaPipeline::MediaSegment::getId ( ) const
inline

Return the source id.

Return values
thesource id.

◆ getInitVector()

const std::vector<uint8_t>& firebolt::rialto::IMediaPipeline::MediaSegment::getInitVector ( ) const
inline

Returns the initialisation vector. Empty if unencrypted.

Return values
theinitialisation vector.

◆ getInitWithLast15()

const uint32_t firebolt::rialto::IMediaPipeline::MediaSegment::getInitWithLast15 ( ) const
inline

Returns the initWithLast15 value.

Return values
theinitWithLast15 value.

◆ getKeyId()

const std::vector<uint8_t>& firebolt::rialto::IMediaPipeline::MediaSegment::getKeyId ( ) const
inline

Returns the key id. Empty if unencrypted.

Return values
thekey id.

◆ getMediaKeySessionId()

const int32_t firebolt::rialto::IMediaPipeline::MediaSegment::getMediaKeySessionId ( ) const
inline

Returns the media key session id. Empty if unencrypted.

Return values
themedia key session id.

◆ getSegmentAlignment()

const SegmentAlignment firebolt::rialto::IMediaPipeline::MediaSegment::getSegmentAlignment ( ) const
inline

Returns the segment alignment.

Return values
thesegment alignment

◆ getSubSamples()

const std::vector<SubSamplePair>& firebolt::rialto::IMediaPipeline::MediaSegment::getSubSamples ( ) const
inline

Returns the sub samples. Empty if unencrypted.

Return values
thesub samples.

◆ getTimeStamp()

int64_t firebolt::rialto::IMediaPipeline::MediaSegment::getTimeStamp ( ) const
inline

Returns the time stamp.

Return values
thetimestamp in nanoseconds.

◆ getType()

MediaSourceType firebolt::rialto::IMediaPipeline::MediaSegment::getType ( ) const
inline

The source type for the data.

Return values
thesource type.

◆ isEncrypted()

bool firebolt::rialto::IMediaPipeline::MediaSegment::isEncrypted ( ) const
inline

Indicates that the data is encrypted.

Return values
trueif the data is encrypted.

◆ setCipherMode()

void firebolt::rialto::IMediaPipeline::MediaSegment::setCipherMode ( CipherMode  cipherMode)
inline

Sets the cipher mode for common encryption.

Parameters
[in]cipherMode: Specifies cipher mode uses for this sample.

◆ setCodecData()

void firebolt::rialto::IMediaPipeline::MediaSegment::setCodecData ( const std::shared_ptr< CodecData > &  codecData)
inline

Sets new codec_data for the segment.

Note
Should only be called if the codec data changes
Parameters
[in]codecDataThe updated codec data for the source

◆ setData()

bool firebolt::rialto::IMediaPipeline::MediaSegment::setData ( uint32_t  dataLength,
const uint8_t *  data 
)
inline

Sets the segment data.

Warning
Note that the caller must guarantee that the buffer referenced by 'data' must remain valid until the corresponding call to haveData() has completed (at which point the data will have been copied out).
Note
This is for performance reasons to avoid multiple copies of AV data. A raw pointer is used for the same reason since most runtimes will expose a raw pointer to the data.
Return values
trueon success.

◆ setEncrypted()

void firebolt::rialto::IMediaPipeline::MediaSegment::setEncrypted ( bool  encrypted)
inline

Sets the encrypted flag.

Parameters
[in]encrypted: Set true to indicated encrypted data.

◆ setEncryptionPattern()

void firebolt::rialto::IMediaPipeline::MediaSegment::setEncryptionPattern ( uint32_t  crypt,
uint32_t  skip 
)
inline

Sets the crypt & skip byte block for pattern encryption.

Parameters
[in]crypt: Crypt byte block value
[in]skip: Skip byte block value

◆ setExtraData()

bool firebolt::rialto::IMediaPipeline::MediaSegment::setExtraData ( const std::vector< uint8_t > &  extraData)
inline

Sets the extra data.

Return values
trueon success.

◆ setInitVector()

void firebolt::rialto::IMediaPipeline::MediaSegment::setInitVector ( const std::vector< uint8_t > &  initVector)
inline

Sets the encryption initialisation vector.

Parameters
[in]initVector: The initialisation vector.

◆ setInitWithLast15()

void firebolt::rialto::IMediaPipeline::MediaSegment::setInitWithLast15 ( uint32_t  initWithLast15)
inline

Sets initWithLast15 value.

Parameters
[in]initWithLast15: initWithLast15 value

◆ setKeyId()

void firebolt::rialto::IMediaPipeline::MediaSegment::setKeyId ( const std::vector< uint8_t > &  keyId)
inline

Sets the key id.

Parameters
[in]keyId: The key id.

◆ setMediaKeySessionId()

void firebolt::rialto::IMediaPipeline::MediaSegment::setMediaKeySessionId ( int32_t  mksId)
inline

Sets the media key session id.

Parameters
[in]mksId: the media key session id.

◆ setSegmentAlignment()

void firebolt::rialto::IMediaPipeline::MediaSegment::setSegmentAlignment ( const SegmentAlignment alignment)
inline

Sets the segment alignment.

Parameters
[in]alignment: The new segment alignment

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