7 #ifndef PACKAGER_MEDIA_CRYPTO_ENCRYPTION_HANDLER_H_
8 #define PACKAGER_MEDIA_CRYPTO_ENCRYPTION_HANDLER_H_
10 #include "packager/media/base/key_source.h"
11 #include "packager/media/base/media_handler.h"
17 class VideoSliceHeaderParser;
57 Status Process(std::unique_ptr<StreamData> stream_data)
override;
61 friend class EncryptionHandlerTest;
72 bool EncryptVpxFrame(
const std::vector<VPxFrameInfo>& vpx_frames,
76 void EncryptBytes(uint8_t* data,
size_t size);
79 void InjectVpxParserForTesting(std::unique_ptr<VPxParser> vpx_parser);
80 void InjectVideoSliceHeaderParserForTesting(
81 std::unique_ptr<VideoSliceHeaderParser> header_parser);
85 KeySource::TrackType track_type_ = KeySource::TRACK_TYPE_UNKNOWN;
86 std::unique_ptr<AesCryptor> encryptor_;
89 uint8_t nalu_length_size_ = 0;
90 Codec video_codec_ = kUnknownCodec;
92 int64_t remaining_clear_lead_ = 0;
94 uint64_t crypto_period_duration_ = 0;
96 int64_t prev_crypto_period_index_ = -1;
97 bool new_segment_ =
true;
100 uint8_t crypt_byte_block_ = 0;
102 uint8_t skip_byte_block_ = 0;
105 std::vector<uint8_t> key_id_;
107 std::unique_ptr<VPxParser> vpx_parser_;
109 std::unique_ptr<VideoSliceHeaderParser> header_parser_;
115 #endif // PACKAGER_MEDIA_CRYPTO_ENCRYPTION_HANDLER_H_