Shaka Packager SDK
Public Member Functions | List of all members
shaka::media::SubsampleGenerator Class Reference

#include <subsample_generator.h>

Public Member Functions

 SubsampleGenerator (bool vp9_subsample_encryption)
 
virtual Status Initialize (FourCC protection_scheme, const StreamInfo &stream_info)
 
virtual Status GenerateSubsamples (const uint8_t *frame, size_t frame_size, std::vector< SubsampleEntry > *subsamples)
 
void InjectVpxParserForTesting (std::unique_ptr< VPxParser > vpx_parser)
 
void InjectVideoSliceHeaderParserForTesting (std::unique_ptr< VideoSliceHeaderParser > header_parser)
 
void InjectAV1ParserForTesting (std::unique_ptr< AV1Parser > av1_parser)
 

Detailed Description

Parsing and generating encryption subsamples from bitstreams. Note that the class can be used to generate subsamples from both audio and video bitstreams according to relevant specifications. For example, for video streams, the most notable specifications are Common Encryption v3 spec [1] and Apple SAMPLE AES spec [2]; for audio streams, they are full sample encrypted except for Apple SAMPLE AES spec, which usually contains leading clear bytes. [1] https://www.iso.org/standard/68042.html [2] https://apple.co/2Noi43q

Definition at line 34 of file subsample_generator.h.

Constructor & Destructor Documentation

◆ SubsampleGenerator()

shaka::media::SubsampleGenerator::SubsampleGenerator ( bool  vp9_subsample_encryption)
explicit
Parameters
vp9_subsample_encryptiondetermines if subsample encryption or full sample encryption is used for VP9. Only relevant for VP9 codec.

Definition at line 123 of file subsample_generator.cc.

Member Function Documentation

◆ GenerateSubsamples()

Status shaka::media::SubsampleGenerator::GenerateSubsamples ( const uint8_t *  frame,
size_t  frame_size,
std::vector< SubsampleEntry > *  subsamples 
)
virtual

Generates subsamples from the bitstream. Note that all frames should be processed by this function even if it is not encrypted as the next (encrypted) frame may be dependent on the previous clear frames.

Parameters
framepoints to the start of the frame.
frame_sizeis the size of the frame.
[out]subsampleswill contain the output subsamples on success. It will be empty if the frame should be full sample encrypted.
Returns
OK on success, an error status otherwise.

Definition at line 213 of file subsample_generator.cc.

◆ Initialize()

Status shaka::media::SubsampleGenerator::Initialize ( FourCC  protection_scheme,
const StreamInfo stream_info 
)
virtual

Initialize the generator.

Parameters
protection_schemeis the protection scheme to be used for the encryption. It is used to determine if the protected data should be block aligned.
stream_infocontains stream information.
Returns
OK on success, an error status otherwise.

Definition at line 128 of file subsample_generator.cc.


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