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"
12 #include "packager/media/base/stream_info.h"
18 class VideoSliceHeaderParser;
58 Status Process(std::unique_ptr<StreamData> stream_data)
override;
62 friend class EncryptionHandlerTest;
73 bool EncryptVpxFrame(
const std::vector<VPxFrameInfo>& vpx_frames,
77 void EncryptBytes(uint8_t* data,
size_t size);
80 void InjectVpxParserForTesting(std::unique_ptr<VPxParser> vpx_parser);
81 void InjectVideoSliceHeaderParserForTesting(
82 std::unique_ptr<VideoSliceHeaderParser> header_parser);
86 KeySource::TrackType track_type_ = KeySource::TRACK_TYPE_UNKNOWN;
87 std::unique_ptr<AesCryptor> encryptor_;
90 uint8_t nalu_length_size_ = 0;
91 Codec video_codec_ = kUnknownCodec;
93 int64_t remaining_clear_lead_ = 0;
95 uint64_t crypto_period_duration_ = 0;
97 int64_t prev_crypto_period_index_ = -1;
98 bool new_segment_ =
true;
101 uint8_t crypt_byte_block_ = 0;
103 uint8_t skip_byte_block_ = 0;
106 std::vector<uint8_t> key_id_;
108 std::unique_ptr<VPxParser> vpx_parser_;
110 std::unique_ptr<VideoSliceHeaderParser> header_parser_;
116 #endif // PACKAGER_MEDIA_CRYPTO_ENCRYPTION_HANDLER_H_