Rename fixed_key to raw_key

Change-Id: I1ee9398387b54aa685a5bef5b8704849e62ebae3
This commit is contained in:
KongQun Yang 2017-10-17 16:03:08 -07:00
parent 7c38963c29
commit d66d307fc2
25 changed files with 227 additions and 191 deletions

View File

@ -57,7 +57,7 @@ Encryption / decryption options
Shaka Packager supports three different types of key providers: Shaka Packager supports three different types of key providers:
- Raw key (fixed key): keys are provided in command line - Raw key: keys are provided in command line
- Widevine: fetches keys from Widevine key server - Widevine: fetches keys from Widevine key server
- Playready: fetches keys from Playready key server - Playready: fetches keys from Playready key server
@ -67,8 +67,8 @@ Different key providers cannot be specified at the same time.
[--enable_widevine_encryption {Widevine Encryption Options}] \ [--enable_widevine_encryption {Widevine Encryption Options}] \
[--enable_widevine_decryption {Widevine Decryption Options}] \ [--enable_widevine_decryption {Widevine Decryption Options}] \
[--enable_fixed_key_encryption {Fixed Key Encryption Options}] \ [--enable_raw_key_encryption {Raw Key Encryption Options}] \
[--enable_fixed_key_decryption {Fixed Key Decryption Options}] \ [--enable_raw_key_decryption {Raw Key Decryption Options}] \
[--enable_playready_encryption {Playready Encryption Options}] [--enable_playready_encryption {Playready Encryption Options}]
.. include:: /options/general_encryption_options.rst .. include:: /options/general_encryption_options.rst

View File

@ -1,13 +1,13 @@
Raw key encryption options Raw key encryption options
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
--enable_fixed_key_encryption --enable_raw_key_encryption
Enable encryption with fixed key. Enable encryption with raw key (keys provided in command line)).
--enable_fixed_key_decryption --enable_raw_key_decryption
Enable decryption with fixed key. Enable decryption with raw key (keys provided in command line).
--keys <key_info_string[,key_info_string][,key_info_string]...> --keys <key_info_string[,key_info_string][,key_info_string]...>

View File

@ -9,7 +9,7 @@ Synopsis
:: ::
$ packager {stream_descriptor} [stream_descriptor] ... \ $ packager {stream_descriptor} [stream_descriptor] ... \
--enable_fixed_key_encryption \ --enable_raw_key_encryption \
--keys <key_info_string[,key_info_string][,key_info_string]...> \ --keys <key_info_string[,key_info_string][,key_info_string]...> \
[--pssh <concatenated PSSHs>] \ [--pssh <concatenated PSSHs>] \
[Other options, e.g. DASH options, HLS options] [Other options, e.g. DASH options, HLS options]
@ -35,7 +35,7 @@ Common PSSH (one key for all streams)::
in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4 \ in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4 \
in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4 \ in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4 \
in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4 \ in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4 \
--enable_fixed_key_encryption \ --enable_raw_key_encryption \
--keys label=:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392 \ --keys label=:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392 \
--mpd_output h264.mpd --mpd_output h264.mpd
@ -47,7 +47,7 @@ Common PSSH (different keys for different streams)::
in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \ in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \
in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \ in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \
in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \ in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \
--enable_fixed_key_encryption \ --enable_raw_key_encryption \
--keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \ --keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \
--mpd_output h264.mpd --mpd_output h264.mpd
@ -59,7 +59,7 @@ Widevine PSSH (different keys for different streams)::
in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \ in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \
in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \ in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \
in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \ in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \
--enable_fixed_key_encryption \ --enable_raw_key_encryption \
--keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \ --keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \
--pssh 000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964 \ --pssh 000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964 \
--mpd_output h264.mpd --mpd_output h264.mpd

View File

@ -1,89 +0,0 @@
// Copyright 2014 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
//
// Defines command line flags for fixed key encryption/decryption.
#include "packager/app/fixed_key_encryption_flags.h"
#include "packager/app/validate_flag.h"
DEFINE_bool(enable_fixed_key_encryption,
false,
"Enable encryption with fixed key.");
DEFINE_bool(enable_fixed_key_decryption,
false,
"Enable decryption with fixed key.");
DEFINE_hex_bytes(key_id, "", "Key id in hex string format.");
DEFINE_hex_bytes(key, "", "Key in hex string format.");
DEFINE_string(keys,
"",
"A list of key information in the form of label=<drm "
"label>:key_id=<32-digit key id in hex>:key=<32-digit key in "
"hex>,label=...");
DEFINE_hex_bytes(
iv,
"",
"IV in hex string format. If not specified, a random IV will be "
"generated. This flag should only be used for testing.");
DEFINE_hex_bytes(
pssh,
"",
"One or more PSSH boxes in hex string format. If not specified, "
"will generate a v1 common PSSH box as specified in "
"https://goo.gl/s8RIhr.");
namespace shaka {
bool ValidateFixedCryptoFlags() {
bool success = true;
const bool fixed_crypto =
FLAGS_enable_fixed_key_encryption || FLAGS_enable_fixed_key_decryption;
const char fixed_crypto_label[] = "--enable_fixed_key_encryption/decryption";
// --key_id and --key are associated with --enable_fixed_key_encryption and
// --enable_fixed_key_decryption.
if (FLAGS_keys.empty()) {
if (!ValidateFlag("key_id", FLAGS_key_id_bytes, fixed_crypto, false,
fixed_crypto_label)) {
success = false;
}
if (!ValidateFlag("key", FLAGS_key_bytes, fixed_crypto, false,
fixed_crypto_label)) {
success = false;
}
if (success && (!FLAGS_key_id_bytes.empty() || !FLAGS_key_bytes.empty())) {
PrintWarning(
"--key_id and --key are going to be deprecated. Please switch to "
"--keys as soon as possible.");
}
} else {
if (!FLAGS_key_id_bytes.empty() || !FLAGS_key_bytes.empty()) {
PrintError("--key_id or --key cannot be used together with --keys.");
success = false;
}
}
if (!ValidateFlag("iv", FLAGS_iv_bytes, FLAGS_enable_fixed_key_encryption,
true, "--enable_fixed_key_encryption")) {
success = false;
}
if (!FLAGS_iv_bytes.empty()) {
if (FLAGS_iv_bytes.size() != 8 && FLAGS_iv_bytes.size() != 16) {
PrintError(
"--iv should be either 8 bytes (16 hex digits) or 16 bytes (32 hex "
"digits).");
success = false;
}
}
// --pssh is associated with --enable_fix_key_encryption.
if (!ValidateFlag("pssh", FLAGS_pssh_bytes, FLAGS_enable_fixed_key_encryption,
true, "--enable_fixed_key_encryption")) {
success = false;
}
return success;
}
} // namespace shaka

View File

@ -8,12 +8,12 @@
#include <iostream> #include <iostream>
#include "packager/app/crypto_flags.h" #include "packager/app/crypto_flags.h"
#include "packager/app/fixed_key_encryption_flags.h"
#include "packager/app/hls_flags.h" #include "packager/app/hls_flags.h"
#include "packager/app/mpd_flags.h" #include "packager/app/mpd_flags.h"
#include "packager/app/muxer_flags.h" #include "packager/app/muxer_flags.h"
#include "packager/app/packager_util.h" #include "packager/app/packager_util.h"
#include "packager/app/playready_key_encryption_flags.h" #include "packager/app/playready_key_encryption_flags.h"
#include "packager/app/raw_key_encryption_flags.h"
#include "packager/app/stream_descriptor.h" #include "packager/app/stream_descriptor.h"
#include "packager/app/vlog_flags.h" #include "packager/app/vlog_flags.h"
#include "packager/app/widevine_encryption_flags.h" #include "packager/app/widevine_encryption_flags.h"
@ -232,14 +232,14 @@ base::Optional<PackagingParams> GetPackagingParams() {
encryption_params.key_provider = KeyProvider::kPlayready; encryption_params.key_provider = KeyProvider::kPlayready;
++num_key_providers; ++num_key_providers;
} }
if (FLAGS_enable_fixed_key_encryption) { if (FLAGS_enable_raw_key_encryption) {
encryption_params.key_provider = KeyProvider::kRawKey; encryption_params.key_provider = KeyProvider::kRawKey;
++num_key_providers; ++num_key_providers;
} }
if (num_key_providers > 1) { if (num_key_providers > 1) {
LOG(ERROR) << "Only one of --enable_widevine_encryption, " LOG(ERROR) << "Only one of --enable_widevine_encryption, "
"--enable_playready_encryption, " "--enable_playready_encryption, "
"--enable_fixed_key_encryption can be enabled."; "--enable_raw_key_encryption can be enabled.";
return base::nullopt; return base::nullopt;
} }
@ -296,13 +296,13 @@ base::Optional<PackagingParams> GetPackagingParams() {
decryption_params.key_provider = KeyProvider::kWidevine; decryption_params.key_provider = KeyProvider::kWidevine;
++num_key_providers; ++num_key_providers;
} }
if (FLAGS_enable_fixed_key_decryption) { if (FLAGS_enable_raw_key_decryption) {
decryption_params.key_provider = KeyProvider::kRawKey; decryption_params.key_provider = KeyProvider::kRawKey;
++num_key_providers; ++num_key_providers;
} }
if (num_key_providers > 1) { if (num_key_providers > 1) {
LOG(ERROR) << "Only one of --enable_widevine_decryption, " LOG(ERROR) << "Only one of --enable_widevine_decryption, "
"--enable_fixed_key_decryption can be enabled."; "--enable_raw_key_decryption can be enabled.";
return base::nullopt; return base::nullopt;
} }
switch (decryption_params.key_provider) { switch (decryption_params.key_provider) {
@ -384,7 +384,7 @@ int PackagerMain(int argc, char** argv) {
return kSuccess; return kSuccess;
} }
if (!ValidateWidevineCryptoFlags() || !ValidateFixedCryptoFlags() || if (!ValidateWidevineCryptoFlags() || !ValidateRawKeyCryptoFlags() ||
!ValidatePRCryptoFlags()) { !ValidatePRCryptoFlags()) {
return kArgumentValidationFailed; return kArgumentValidationFailed;
} }

View File

@ -10,10 +10,10 @@
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/string_split.h" #include "packager/base/strings/string_split.h"
#include "packager/file/file.h" #include "packager/file/file.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/media_handler.h" #include "packager/media/base/media_handler.h"
#include "packager/media/base/muxer_options.h" #include "packager/media/base/muxer_options.h"
#include "packager/media/base/playready_key_source.h" #include "packager/media/base/playready_key_source.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/base/request_signer.h" #include "packager/media/base/request_signer.h"
#include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_key_source.h"
#include "packager/media/chunking/chunking_handler.h" #include "packager/media/chunking/chunking_handler.h"
@ -85,7 +85,7 @@ std::unique_ptr<KeySource> CreateEncryptionKeySource(
break; break;
} }
case KeyProvider::kRawKey: { case KeyProvider::kRawKey: {
encryption_key_source = FixedKeySource::Create(encryption_params.raw_key); encryption_key_source = RawKeySource::Create(encryption_params.raw_key);
break; break;
} }
case KeyProvider::kPlayready: { case KeyProvider::kPlayready: {
@ -166,7 +166,7 @@ std::unique_ptr<KeySource> CreateDecryptionKeySource(
break; break;
} }
case KeyProvider::kRawKey: { case KeyProvider::kRawKey: {
decryption_key_source = FixedKeySource::Create(decryption_params.raw_key); decryption_key_source = RawKeySource::Create(decryption_params.raw_key);
break; break;
} }
case KeyProvider::kNone: case KeyProvider::kNone:

View File

@ -53,16 +53,16 @@ bool ValidatePRCryptoFlags() {
playready_enabled, true, playready_label)) { playready_enabled, true, playready_label)) {
success = false; success = false;
} }
bool use_fixed_key = !FLAGS_playready_key_id_bytes.empty() && bool use_raw_key = !FLAGS_playready_key_id_bytes.empty() &&
!FLAGS_playready_key_bytes.empty(); !FLAGS_playready_key_bytes.empty();
if (playready_enabled && !use_packaging && !use_fixed_key) { if (playready_enabled && !use_packaging && !use_raw_key) {
PrintError("combination of --playready_server_url and " PrintError("combination of --playready_server_url and "
"--program_identifier or --playready_key_id and playready_key are " "--program_identifier or --playready_key_id and playready_key are "
"required"); "required");
success = false; success = false;
} }
if (use_packaging && use_fixed_key) { if (use_packaging && use_raw_key) {
PrintError("combination of --playready_server_url, --program_identifier, " PrintError("combination of --playready_server_url, --program_identifier, "
"--playready_key_id, and playready_key is not valid"); "--playready_key_id, and playready_key is not valid");
success = false; success = false;

View File

@ -0,0 +1,111 @@
// Copyright 2014 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
//
// Defines command line flags for raw key encryption/decryption.
#include "packager/app/raw_key_encryption_flags.h"
#include "packager/app/validate_flag.h"
DEFINE_bool(enable_fixed_key_encryption,
false,
"Same as --enable_raw_key_encryption. Will be deprecated.");
DEFINE_bool(enable_fixed_key_decryption,
false,
"Same as --enable_raw_key_decryption. Will be deprecated.");
DEFINE_bool(enable_raw_key_encryption,
false,
"Enable encryption with raw key (key provided in command line).");
DEFINE_bool(enable_raw_key_decryption,
false,
"Enable decryption with raw key (key provided in command line).");
DEFINE_hex_bytes(
key_id,
"",
"Key id in hex string format. Will be deprecated. Use --keys.");
DEFINE_hex_bytes(key,
"",
"Key in hex string format. Will be deprecated. Use --keys.");
DEFINE_string(keys,
"",
"A list of key information in the form of label=<drm "
"label>:key_id=<32-digit key id in hex>:key=<32-digit key in "
"hex>,label=...");
DEFINE_hex_bytes(
iv,
"",
"IV in hex string format. If not specified, a random IV will be "
"generated. This flag should only be used for testing.");
DEFINE_hex_bytes(
pssh,
"",
"One or more PSSH boxes in hex string format. If not specified, "
"will generate a v1 common PSSH box as specified in "
"https://goo.gl/s8RIhr.");
namespace shaka {
bool ValidateRawKeyCryptoFlags() {
bool success = true;
if (FLAGS_enable_fixed_key_encryption)
FLAGS_enable_raw_key_encryption = true;
if (FLAGS_enable_fixed_key_decryption)
FLAGS_enable_raw_key_decryption = true;
if (FLAGS_enable_fixed_key_encryption || FLAGS_enable_fixed_key_decryption) {
PrintWarning(
"--enable_fixed_key_encryption and --enable_fixed_key_decryption are "
"going to be deprecated. Please switch to --enable_raw_key_encryption "
"and --enable_raw_key_decryption as soon as possible.");
}
const bool raw_key_crypto =
FLAGS_enable_raw_key_encryption || FLAGS_enable_raw_key_decryption;
const char raw_key_crypto_label[] = "--enable_raw_key_encryption/decryption";
// --key_id and --key are associated with --enable_raw_key_encryption and
// --enable_raw_key_decryption.
if (FLAGS_keys.empty()) {
if (!ValidateFlag("key_id", FLAGS_key_id_bytes, raw_key_crypto, false,
raw_key_crypto_label)) {
success = false;
}
if (!ValidateFlag("key", FLAGS_key_bytes, raw_key_crypto, false,
raw_key_crypto_label)) {
success = false;
}
if (success && (!FLAGS_key_id_bytes.empty() || !FLAGS_key_bytes.empty())) {
PrintWarning(
"--key_id and --key are going to be deprecated. Please switch to "
"--keys as soon as possible.");
}
} else {
if (!FLAGS_key_id_bytes.empty() || !FLAGS_key_bytes.empty()) {
PrintError("--key_id or --key cannot be used together with --keys.");
success = false;
}
}
if (!ValidateFlag("iv", FLAGS_iv_bytes, FLAGS_enable_raw_key_encryption, true,
"--enable_raw_key_encryption")) {
success = false;
}
if (!FLAGS_iv_bytes.empty()) {
if (FLAGS_iv_bytes.size() != 8 && FLAGS_iv_bytes.size() != 16) {
PrintError(
"--iv should be either 8 bytes (16 hex digits) or 16 bytes (32 hex "
"digits).");
success = false;
}
}
// --pssh is associated with --enable_raw_key_encryption.
if (!ValidateFlag("pssh", FLAGS_pssh_bytes, FLAGS_enable_raw_key_encryption,
true, "--enable_raw_key_encryption")) {
success = false;
}
return success;
}
} // namespace shaka

View File

@ -4,18 +4,17 @@
// license that can be found in the LICENSE file or at // license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd // https://developers.google.com/open-source/licenses/bsd
// //
// Defines command line flags for fixed key encryption. // Defines command line flags for raw key encryption.
#ifndef APP_FIXED_KEY_ENCRYPTION_FLAGS_H_ #ifndef PACKAGER_APP_RAW_KEY_ENCRYPTION_FLAGS_H_
#define APP_FIXED_KEY_ENCRYPTION_FLAGS_H_ #define PACKAGER_APP_RAW_KEY_ENCRYPTION_FLAGS_H_
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include "packager/app/gflags_hex_bytes.h" #include "packager/app/gflags_hex_bytes.h"
// TODO(kqyang): s/fixed/raw/. DECLARE_bool(enable_raw_key_encryption);
DECLARE_bool(enable_fixed_key_encryption); DECLARE_bool(enable_raw_key_decryption);
DECLARE_bool(enable_fixed_key_decryption);
DECLARE_hex_bytes(key_id); DECLARE_hex_bytes(key_id);
DECLARE_hex_bytes(key); DECLARE_hex_bytes(key);
DECLARE_string(keys); DECLARE_string(keys);
@ -24,10 +23,10 @@ DECLARE_hex_bytes(pssh);
namespace shaka { namespace shaka {
/// Validate fixed encryption/decryption flags. /// Validate raw encryption/decryption flags.
/// @return true on success, false otherwise. /// @return true on success, false otherwise.
bool ValidateFixedCryptoFlags(); bool ValidateRawKeyCryptoFlags();
} // namespace shaka } // namespace shaka
#endif // APP_FIXED_KEY_ENCRYPTION_FLAGS_H_ #endif // PACKAGER_APP_RAW_KEY_ENCRYPTION_FLAGS_H_

View File

@ -152,7 +152,7 @@ class PackagerAppTest(unittest.TestCase):
] ]
elif encryption: elif encryption:
flags += [ flags += [
'--enable_fixed_key_encryption', '--enable_raw_key_encryption',
'--keys=label=:key_id={0}:key={1}'.format(self.encryption_key_id, '--keys=label=:key_id={0}:key={1}'.format(self.encryption_key_id,
self.encryption_key), self.encryption_key),
'--clear_lead={0}'.format(clear_lead) '--clear_lead={0}'.format(clear_lead)
@ -167,7 +167,7 @@ class PackagerAppTest(unittest.TestCase):
if decryption: if decryption:
flags += [ flags += [
'--enable_fixed_key_decryption', '--enable_raw_key_decryption',
'--keys=label=:key_id={0}:key={1}'.format(self.encryption_key_id, '--keys=label=:key_id={0}:key={1}'.format(self.encryption_key_id,
self.encryption_key) self.encryption_key)
] ]
@ -571,13 +571,28 @@ class PackagerFunctionalTest(PackagerAppTest):
self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4') self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4')
self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4') self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4')
# Test deprecated flag --enable_fixed_key_encryption, which is still
# supported currently.
def testPackageWithEncryptionUsingFixedKey(self):
flags = self._GetFlags() + [
'--enable_fixed_key_encryption', '--key_id={0}'.format(
self.encryption_key_id), '--key={0}'.format(self.encryption_key),
'--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv)
]
self.assertPackageSuccess(self._GetStreams(['audio', 'video']), flags)
self._DiffGold(self.output[0], 'bear-640x360-a-cenc-golden.mp4')
self._DiffGold(self.output[1], 'bear-640x360-v-cenc-golden.mp4')
self._DiffGold(self.mpd_output, 'bear-640x360-av-cenc-golden.mpd')
self._VerifyDecryption(self.output[0], 'bear-640x360-a-golden.mp4')
self._VerifyDecryption(self.output[1], 'bear-640x360-v-golden.mp4')
def testPackageWithEncryptionMultiKeys(self): def testPackageWithEncryptionMultiKeys(self):
audio_key_id = '10111213141516171819202122232425' audio_key_id = '10111213141516171819202122232425'
audio_key = '11121314151617181920212223242526' audio_key = '11121314151617181920212223242526'
video_key_id = '20212223242526272829303132333435' video_key_id = '20212223242526272829303132333435'
video_key = '21222324252627282930313233343536' video_key = '21222324252627282930313233343536'
flags = self._GetFlags() + [ flags = self._GetFlags() + [
'--enable_fixed_key_encryption', '--enable_raw_key_encryption',
'--keys=label=AUDIO:key_id={0}:key={1},label=SD:key_id={2}:key={3}'. '--keys=label=AUDIO:key_id={0}:key={1},label=SD:key_id={2}:key={3}'.
format(audio_key_id, audio_key, video_key_id, video_key), format(audio_key_id, audio_key, video_key_id, video_key),
'--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv) '--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv)
@ -597,7 +612,7 @@ class PackagerFunctionalTest(PackagerAppTest):
video_key_id = '10111213141516171819202122232425' video_key_id = '10111213141516171819202122232425'
video_key = '11121314151617181920212223242526' video_key = '11121314151617181920212223242526'
flags = self._GetFlags() + [ flags = self._GetFlags() + [
'--enable_fixed_key_encryption', '--enable_raw_key_encryption',
'--keys=label=MyAudio:key_id={0}:key={1},label=:key_id={2}:key={3}'. '--keys=label=MyAudio:key_id={0}:key={1},label=:key_id={2}:key={3}'.
format(audio_key_id, audio_key, video_key_id, video_key), format(audio_key_id, audio_key, video_key_id, video_key),
'--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv) '--clear_lead={0}'.format(1), '--iv={0}'.format(self.encryption_iv)

View File

@ -16,8 +16,8 @@
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/stringprintf.h" #include "packager/base/strings/stringprintf.h"
#include "packager/hls/base/media_playlist.h" #include "packager/hls/base/media_playlist.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/protection_system_specific_info.h" #include "packager/media/base/protection_system_specific_info.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_key_source.h"
#include "packager/media/base/widevine_pssh_data.pb.h" #include "packager/media/base/widevine_pssh_data.pb.h"

View File

@ -13,8 +13,8 @@
#include "packager/base/files/file_path.h" #include "packager/base/files/file_path.h"
#include "packager/hls/base/mock_media_playlist.h" #include "packager/hls/base/mock_media_playlist.h"
#include "packager/hls/base/simple_hls_notifier.h" #include "packager/hls/base/simple_hls_notifier.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/protection_system_specific_info.h" #include "packager/media/base/protection_system_specific_info.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_key_source.h"
#include "packager/media/base/widevine_pssh_data.pb.h" #include "packager/media/base/widevine_pssh_data.pb.h"
@ -579,7 +579,7 @@ TEST_F(SimpleHlsNotifierTest, NotifyEncryptionUpdateWidevineNoKeyidsInPssh) {
widevine_system_id_, iv, pssh_box)); widevine_system_id_, iv, pssh_box));
} }
TEST_F(SimpleHlsNotifierTest, NotifyEncryptionUpdateFixedKey) { TEST_F(SimpleHlsNotifierTest, NotifyEncryptionUpdateIdentifyKey) {
// Pointer released by SimpleHlsNotifier. // Pointer released by SimpleHlsNotifier.
MockMediaPlaylist* mock_media_playlist = MockMediaPlaylist* mock_media_playlist =
new MockMediaPlaylist(kVodPlaylist, "playlist.m3u8", "", ""); new MockMediaPlaylist(kVodPlaylist, "playlist.m3u8", "", "");

View File

@ -10,7 +10,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "packager/base/macros.h" #include "packager/base/macros.h"
#include "packager/media/base/fixed_key_source.h" #include "packager/media/base/raw_key_source.h"
using ::testing::Return; using ::testing::Return;
using ::testing::SetArgPointee; using ::testing::SetArgPointee;
@ -51,7 +51,7 @@ const uint8_t kBuffer2[] = {0x05, 0x02};
// Expected decrypted buffer with the above kMockKey and kIv2. // Expected decrypted buffer with the above kMockKey and kIv2.
const uint8_t kExpectedDecryptedBuffer2[] = {0x20, 0x62}; const uint8_t kExpectedDecryptedBuffer2[] = {0x20, 0x62};
class MockKeySource : public FixedKeySource { class MockKeySource : public RawKeySource {
public: public:
MOCK_METHOD2(GetKey, MOCK_METHOD2(GetKey,
Status(const std::vector<uint8_t>& key_id, EncryptionKey* key)); Status(const std::vector<uint8_t>& key_id, EncryptionKey* key));

View File

@ -42,8 +42,6 @@
'decryptor_source.cc', 'decryptor_source.cc',
'decryptor_source.h', 'decryptor_source.h',
'encryption_config.h', 'encryption_config.h',
'fixed_key_source.cc',
'fixed_key_source.h',
'fourccs.h', 'fourccs.h',
'http_key_fetcher.cc', 'http_key_fetcher.cc',
'http_key_fetcher.h', 'http_key_fetcher.h',
@ -76,6 +74,8 @@
'protection_system_specific_info.cc', 'protection_system_specific_info.cc',
'protection_system_specific_info.h', 'protection_system_specific_info.h',
'range.h', 'range.h',
'raw_key_source.cc',
'raw_key_source.h',
'rcheck.h', 'rcheck.h',
'request_signer.cc', 'request_signer.cc',
'request_signer.h', 'request_signer.h',
@ -142,12 +142,12 @@
'closure_thread_unittest.cc', 'closure_thread_unittest.cc',
'container_names_unittest.cc', 'container_names_unittest.cc',
'decryptor_source_unittest.cc', 'decryptor_source_unittest.cc',
'fixed_key_source_unittest.cc',
'http_key_fetcher_unittest.cc', 'http_key_fetcher_unittest.cc',
'muxer_util_unittest.cc', 'muxer_util_unittest.cc',
'offset_byte_queue_unittest.cc', 'offset_byte_queue_unittest.cc',
'producer_consumer_queue_unittest.cc', 'producer_consumer_queue_unittest.cc',
'protection_system_specific_info_unittest.cc', 'protection_system_specific_info_unittest.cc',
'raw_key_source_unittest.cc',
'rsa_key_unittest.cc', 'rsa_key_unittest.cc',
'status_test_util_unittest.cc', 'status_test_util_unittest.cc',
'test/fake_prng.cc', # For rsa_key_unittest 'test/fake_prng.cc', # For rsa_key_unittest

View File

@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at // license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd // https://developers.google.com/open-source/licenses/bsd
#include "packager/media/base/fixed_key_source.h" #include "packager/media/base/raw_key_source.h"
#include <algorithm> #include <algorithm>
#include "packager/base/logging.h" #include "packager/base/logging.h"
@ -17,15 +17,15 @@ const char kEmptyDrmLabel[] = "";
namespace shaka { namespace shaka {
namespace media { namespace media {
FixedKeySource::~FixedKeySource() {} RawKeySource::~RawKeySource() {}
Status FixedKeySource::FetchKeys(EmeInitDataType init_data_type, Status RawKeySource::FetchKeys(EmeInitDataType init_data_type,
const std::vector<uint8_t>& init_data) { const std::vector<uint8_t>& init_data) {
// Do nothing for fixed key encryption/decryption. // Do nothing for raw key encryption/decryption.
return Status::OK; return Status::OK;
} }
Status FixedKeySource::GetKey(const std::string& stream_label, Status RawKeySource::GetKey(const std::string& stream_label,
EncryptionKey* key) { EncryptionKey* key) {
DCHECK(key); DCHECK(key);
// Try to find the key with label |stream_label|. If it is not available, // Try to find the key with label |stream_label|. If it is not available,
@ -42,7 +42,7 @@ Status FixedKeySource::GetKey(const std::string& stream_label,
return Status::OK; return Status::OK;
} }
Status FixedKeySource::GetKey(const std::vector<uint8_t>& key_id, Status RawKeySource::GetKey(const std::vector<uint8_t>& key_id,
EncryptionKey* key) { EncryptionKey* key) {
DCHECK(key); DCHECK(key);
for (const auto& pair : encryption_key_map_) { for (const auto& pair : encryption_key_map_) {
@ -56,7 +56,7 @@ Status FixedKeySource::GetKey(const std::vector<uint8_t>& key_id,
" was not found."); " was not found.");
} }
Status FixedKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index, Status RawKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index,
const std::string& stream_label, const std::string& stream_label,
EncryptionKey* key) { EncryptionKey* key) {
Status status = GetKey(stream_label, key); Status status = GetKey(stream_label, key);
@ -101,14 +101,14 @@ Status FixedKeySource::GetCryptoPeriodKey(uint32_t crypto_period_index,
return Status::OK; return Status::OK;
} }
std::unique_ptr<FixedKeySource> FixedKeySource::Create( std::unique_ptr<RawKeySource> RawKeySource::Create(
const RawKeyParams& raw_key) { const RawKeyParams& raw_key) {
std::vector<ProtectionSystemSpecificInfo> key_system_info; std::vector<ProtectionSystemSpecificInfo> key_system_info;
if (!raw_key.pssh.empty()) { if (!raw_key.pssh.empty()) {
if (!ProtectionSystemSpecificInfo::ParseBoxes( if (!ProtectionSystemSpecificInfo::ParseBoxes(
raw_key.pssh.data(), raw_key.pssh.size(), &key_system_info)) { raw_key.pssh.data(), raw_key.pssh.size(), &key_system_info)) {
LOG(ERROR) << "--pssh argument should be full PSSH boxes."; LOG(ERROR) << "--pssh argument should be full PSSH boxes.";
return std::unique_ptr<FixedKeySource>(); return std::unique_ptr<RawKeySource>();
} }
} else { } else {
// If there aren't any PSSH boxes given, create one with the common system // If there aren't any PSSH boxes given, create one with the common system
@ -131,13 +131,13 @@ std::unique_ptr<FixedKeySource> FixedKeySource::Create(
if (key_pair.key_id.size() != 16) { if (key_pair.key_id.size() != 16) {
LOG(ERROR) << "Invalid key ID size '" << key_pair.key_id.size() LOG(ERROR) << "Invalid key ID size '" << key_pair.key_id.size()
<< "', must be 16 bytes."; << "', must be 16 bytes.";
return std::unique_ptr<FixedKeySource>(); return std::unique_ptr<RawKeySource>();
} }
if (key_pair.key.size() != 16) { if (key_pair.key.size() != 16) {
// CENC only supports AES-128, i.e. 16 bytes. // CENC only supports AES-128, i.e. 16 bytes.
LOG(ERROR) << "Invalid key size '" << key_pair.key.size() LOG(ERROR) << "Invalid key size '" << key_pair.key.size()
<< "', must be 16 bytes."; << "', must be 16 bytes.";
return std::unique_ptr<FixedKeySource>(); return std::unique_ptr<RawKeySource>();
} }
std::unique_ptr<EncryptionKey> encryption_key(new EncryptionKey); std::unique_ptr<EncryptionKey> encryption_key(new EncryptionKey);
@ -148,12 +148,12 @@ std::unique_ptr<FixedKeySource> FixedKeySource::Create(
encryption_key_map[drm_label] = std::move(encryption_key); encryption_key_map[drm_label] = std::move(encryption_key);
} }
return std::unique_ptr<FixedKeySource>( return std::unique_ptr<RawKeySource>(
new FixedKeySource(std::move(encryption_key_map))); new RawKeySource(std::move(encryption_key_map)));
} }
FixedKeySource::FixedKeySource() {} RawKeySource::RawKeySource() {}
FixedKeySource::FixedKeySource(EncryptionKeyMap&& encryption_key_map) RawKeySource::RawKeySource(EncryptionKeyMap&& encryption_key_map)
: encryption_key_map_(std::move(encryption_key_map)) {} : encryption_key_map_(std::move(encryption_key_map)) {}
} // namespace media } // namespace media

View File

@ -4,8 +4,8 @@
// license that can be found in the LICENSE file or at // license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd // https://developers.google.com/open-source/licenses/bsd
#ifndef MEDIA_BASE_FIXED_KEY_SOURCE_H_ #ifndef PACKAGER_MEDIA_BASE_RAW_KEY_SOURCE_H_
#define MEDIA_BASE_FIXED_KEY_SOURCE_H_ #define PACKAGER_MEDIA_BASE_RAW_KEY_SOURCE_H_
#include <memory> #include <memory>
#include <string> #include <string>
@ -30,10 +30,10 @@ const uint8_t kFairplaySystemId[] = {0x29, 0x70, 0x1F, 0xE4, 0x3C, 0xC7,
0x4A, 0x34, 0x8C, 0x5B, 0xAE, 0x90, 0x4A, 0x34, 0x8C, 0x5B, 0xAE, 0x90,
0xC7, 0x43, 0x9A, 0x47}; 0xC7, 0x43, 0x9A, 0x47};
/// A key source that uses fixed keys for encryption. /// A key source that uses raw keys for encryption.
class FixedKeySource : public KeySource { class RawKeySource : public KeySource {
public: public:
~FixedKeySource() override; ~RawKeySource() override;
/// @name KeySource implementation overrides. /// @name KeySource implementation overrides.
/// @{ /// @{
@ -47,21 +47,21 @@ class FixedKeySource : public KeySource {
EncryptionKey* key) override; EncryptionKey* key) override;
/// @} /// @}
/// Creates a new FixedKeySource from the given data. Returns null /// Creates a new RawKeySource from the given data. Returns null
/// if the parameter is malformed. /// if the parameter is malformed.
/// @param raw_key contains parameters to setup the key source. /// @param raw_key contains parameters to setup the key source.
static std::unique_ptr<FixedKeySource> Create(const RawKeyParams& raw_key); static std::unique_ptr<RawKeySource> Create(const RawKeyParams& raw_key);
protected: protected:
// Allow default constructor for mock key sources. // Allow default constructor for mock key sources.
FixedKeySource(); RawKeySource();
private: private:
typedef std::map<std::string, std::unique_ptr<EncryptionKey>> typedef std::map<std::string, std::unique_ptr<EncryptionKey>>
EncryptionKeyMap; EncryptionKeyMap;
explicit FixedKeySource(EncryptionKeyMap&& encryption_key_map); explicit RawKeySource(EncryptionKeyMap&& encryption_key_map);
FixedKeySource(const FixedKeySource&) = delete; RawKeySource(const RawKeySource&) = delete;
FixedKeySource& operator=(const FixedKeySource&) = delete; RawKeySource& operator=(const RawKeySource&) = delete;
EncryptionKeyMap encryption_key_map_; EncryptionKeyMap encryption_key_map_;
}; };
@ -69,4 +69,4 @@ class FixedKeySource : public KeySource {
} // namespace media } // namespace media
} // namespace shaka } // namespace shaka
#endif // MEDIA_BASE_FIXED_KEY_SOURCE_H_ #endif // PACKAGER_MEDIA_BASE_RAW_KEY_SOURCE_H_

View File

@ -8,7 +8,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/media/base/fixed_key_source.h" #include "packager/media/base/raw_key_source.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
#define EXPECT_HEX_EQ(expected, actual) \ #define EXPECT_HEX_EQ(expected, actual) \
@ -59,7 +59,7 @@ std::vector<uint8_t> HexStringToVector(const std::string& str) {
} }
} // namespace } // namespace
TEST(FixedKeySourceTest, Success) { TEST(RawKeySourceTest, Success) {
RawKeyParams raw_key_params; RawKeyParams raw_key_params;
raw_key_params.key_map[kDrmLabel].key_id = HexStringToVector(kKeyIdHex); raw_key_params.key_map[kDrmLabel].key_id = HexStringToVector(kKeyIdHex);
raw_key_params.key_map[kDrmLabel].key = HexStringToVector(kKeyHex); raw_key_params.key_map[kDrmLabel].key = HexStringToVector(kKeyHex);
@ -68,8 +68,8 @@ TEST(FixedKeySourceTest, Success) {
raw_key_params.iv = HexStringToVector(kIvHex); raw_key_params.iv = HexStringToVector(kIvHex);
raw_key_params.pssh = raw_key_params.pssh =
HexStringToVector(std::string(kPsshBox1Hex) + kPsshBox2Hex); HexStringToVector(std::string(kPsshBox1Hex) + kPsshBox2Hex);
std::unique_ptr<FixedKeySource> key_source = std::unique_ptr<RawKeySource> key_source =
FixedKeySource::Create(raw_key_params); RawKeySource::Create(raw_key_params);
ASSERT_NE(nullptr, key_source); ASSERT_NE(nullptr, key_source);
EncryptionKey key_from_drm_label; EncryptionKey key_from_drm_label;
@ -102,7 +102,7 @@ TEST(FixedKeySourceTest, Success) {
key_from_drm_label.key_system_info[1].CreateBox()); key_from_drm_label.key_system_info[1].CreateBox());
} }
TEST(FixedKeySourceTest, EmptyPssh) { TEST(RawKeySourceTest, EmptyPssh) {
RawKeyParams raw_key_params; RawKeyParams raw_key_params;
raw_key_params.key_map[kDrmLabel].key_id = HexStringToVector(kKeyIdHex); raw_key_params.key_map[kDrmLabel].key_id = HexStringToVector(kKeyIdHex);
raw_key_params.key_map[kDrmLabel].key = HexStringToVector(kKeyHex); raw_key_params.key_map[kDrmLabel].key = HexStringToVector(kKeyHex);
@ -110,8 +110,8 @@ TEST(FixedKeySourceTest, EmptyPssh) {
HexStringToVector(kKeyId2Hex); HexStringToVector(kKeyId2Hex);
raw_key_params.key_map[kAnotherDrmLabel].key = HexStringToVector(kKey2Hex); raw_key_params.key_map[kAnotherDrmLabel].key = HexStringToVector(kKey2Hex);
raw_key_params.iv = HexStringToVector(kIvHex); raw_key_params.iv = HexStringToVector(kIvHex);
std::unique_ptr<FixedKeySource> key_source = std::unique_ptr<RawKeySource> key_source =
FixedKeySource::Create(raw_key_params); RawKeySource::Create(raw_key_params);
ASSERT_NE(nullptr, key_source); ASSERT_NE(nullptr, key_source);
EncryptionKey key; EncryptionKey key;
@ -123,7 +123,7 @@ TEST(FixedKeySourceTest, EmptyPssh) {
EXPECT_HEX_EQ(kDefaultPsshBoxHex, key.key_system_info[0].CreateBox()); EXPECT_HEX_EQ(kDefaultPsshBoxHex, key.key_system_info[0].CreateBox());
} }
TEST(FixedKeySourceTest, Failure) { TEST(RawKeySourceTest, Failure) {
// Invalid key id size. // Invalid key id size.
RawKeyParams raw_key_params; RawKeyParams raw_key_params;
raw_key_params.key_map[kEmptyDrmLabel].key_id = raw_key_params.key_map[kEmptyDrmLabel].key_id =
@ -131,14 +131,14 @@ TEST(FixedKeySourceTest, Failure) {
raw_key_params.key_map[kEmptyDrmLabel].key = HexStringToVector(kKeyHex); raw_key_params.key_map[kEmptyDrmLabel].key = HexStringToVector(kKeyHex);
raw_key_params.pssh = HexStringToVector(kPsshBox1Hex); raw_key_params.pssh = HexStringToVector(kPsshBox1Hex);
raw_key_params.iv = HexStringToVector(kIvHex); raw_key_params.iv = HexStringToVector(kIvHex);
std::unique_ptr<FixedKeySource> key_source = std::unique_ptr<RawKeySource> key_source =
FixedKeySource::Create(raw_key_params); RawKeySource::Create(raw_key_params);
EXPECT_EQ(nullptr, key_source); EXPECT_EQ(nullptr, key_source);
// Invalid pssh box. // Invalid pssh box.
raw_key_params.key_map[kEmptyDrmLabel].key_id = HexStringToVector(kKeyIdHex); raw_key_params.key_map[kEmptyDrmLabel].key_id = HexStringToVector(kKeyIdHex);
raw_key_params.pssh = HexStringToVector("000102030405"); raw_key_params.pssh = HexStringToVector("000102030405");
key_source = FixedKeySource::Create(raw_key_params); key_source = RawKeySource::Create(raw_key_params);
EXPECT_EQ(nullptr, key_source); EXPECT_EQ(nullptr, key_source);
} }

View File

@ -13,11 +13,11 @@
#include "packager/base/json/json_reader.h" #include "packager/base/json/json_reader.h"
#include "packager/base/json/json_writer.h" #include "packager/base/json/json_writer.h"
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/http_key_fetcher.h" #include "packager/media/base/http_key_fetcher.h"
#include "packager/media/base/network_util.h" #include "packager/media/base/network_util.h"
#include "packager/media/base/producer_consumer_queue.h" #include "packager/media/base/producer_consumer_queue.h"
#include "packager/media/base/protection_system_specific_info.h" #include "packager/media/base/protection_system_specific_info.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/base/rcheck.h" #include "packager/media/base/rcheck.h"
#include "packager/media/base/request_signer.h" #include "packager/media/base/request_signer.h"
#include "packager/media/base/widevine_pssh_data.pb.h" #include "packager/media/base/widevine_pssh_data.pb.h"

View File

@ -12,8 +12,8 @@
#include "packager/base/base64.h" #include "packager/base/base64.h"
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/stringprintf.h" #include "packager/base/strings/stringprintf.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/key_fetcher.h" #include "packager/media/base/key_fetcher.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/base/request_signer.h" #include "packager/media/base/request_signer.h"
#include "packager/media/base/widevine_key_source.h" #include "packager/media/base/widevine_key_source.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"

View File

@ -11,8 +11,8 @@
#include "packager/media/base/aes_decryptor.h" #include "packager/media/base/aes_decryptor.h"
#include "packager/media/base/aes_pattern_cryptor.h" #include "packager/media/base/aes_pattern_cryptor.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/media_handler_test_base.h" #include "packager/media/base/media_handler_test_base.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/codecs/video_slice_header_parser.h" #include "packager/media/codecs/video_slice_header_parser.h"
#include "packager/media/codecs/vpx_parser.h" #include "packager/media/codecs/vpx_parser.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
@ -54,7 +54,7 @@ const uint8_t kKeyRotationDefaultKeyId[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}; };
class MockKeySource : public FixedKeySource { class MockKeySource : public RawKeySource {
public: public:
MOCK_METHOD2(GetKey, MOCK_METHOD2(GetKey,
Status(const std::string& stream_label, EncryptionKey* key)); Status(const std::string& stream_label, EncryptionKey* key));

View File

@ -9,8 +9,8 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/media_handler_test_base.h" #include "packager/media/base/media_handler_test_base.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/test/test_data_util.h" #include "packager/media/test/test_data_util.h"
#include "packager/status_test_util.h" #include "packager/status_test_util.h"
@ -22,7 +22,7 @@ using ::testing::_;
using ::testing::Return; using ::testing::Return;
using ::testing::SetArgPointee; using ::testing::SetArgPointee;
class MockKeySource : public FixedKeySource { class MockKeySource : public RawKeySource {
public: public:
MOCK_METHOD2(GetKey, MOCK_METHOD2(GetKey,
Status(const std::vector<uint8_t>& key_id, EncryptionKey* key)); Status(const std::vector<uint8_t>& key_id, EncryptionKey* key));

View File

@ -9,8 +9,8 @@
#include "packager/base/bind.h" #include "packager/base/bind.h"
#include "packager/base/logging.h" #include "packager/base/logging.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/media_sample.h" #include "packager/media/base/media_sample.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/base/stream_info.h" #include "packager/media/base/stream_info.h"
#include "packager/media/base/video_stream_info.h" #include "packager/media/base/video_stream_info.h"
#include "packager/media/formats/mp4/mp4_media_parser.h" #include "packager/media/formats/mp4/mp4_media_parser.h"
@ -29,7 +29,7 @@ const char kKey[] =
"\xeb\xdd\x62\xf1\x68\x14\xd2\x7b\x68\xef\x12\x2a\xfc\xe4\xae\x3c"; "\xeb\xdd\x62\xf1\x68\x14\xd2\x7b\x68\xef\x12\x2a\xfc\xe4\xae\x3c";
const char kKeyId[] = "0123456789012345"; const char kKeyId[] = "0123456789012345";
class MockKeySource : public FixedKeySource { class MockKeySource : public RawKeySource {
public: public:
MOCK_METHOD2(FetchKeys, MOCK_METHOD2(FetchKeys,
Status(EmeInitDataType init_data_type, Status(EmeInitDataType init_data_type,

View File

@ -16,7 +16,7 @@
#include "packager/base/logging.h" #include "packager/base/logging.h"
#include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_number_conversions.h"
#include "packager/media/base/decrypt_config.h" #include "packager/media/base/decrypt_config.h"
#include "packager/media/base/fixed_key_source.h" #include "packager/media/base/raw_key_source.h"
#include "packager/media/base/timestamp.h" #include "packager/media/base/timestamp.h"
#include "packager/media/formats/webm/cluster_builder.h" #include "packager/media/formats/webm/cluster_builder.h"
#include "packager/media/formats/webm/webm_constants.h" #include "packager/media/formats/webm/webm_constants.h"
@ -177,7 +177,7 @@ const uint8_t kVP9Frame[] = {
0xe1, 0xe6, 0xef, 0xff, 0xfd, 0xf7, 0x4f, 0x0f, 0xe1, 0xe6, 0xef, 0xff, 0xfd, 0xf7, 0x4f, 0x0f,
}; };
class MockKeySource : public FixedKeySource { class MockKeySource : public RawKeySource {
public: public:
MOCK_METHOD2(GetKey, MOCK_METHOD2(GetKey,
Status(const std::vector<uint8_t>& key_id, EncryptionKey* key)); Status(const std::vector<uint8_t>& key_id, EncryptionKey* key));

View File

@ -12,8 +12,8 @@
#include "packager/base/bind_helpers.h" #include "packager/base/bind_helpers.h"
#include "packager/base/logging.h" #include "packager/base/logging.h"
#include "packager/media/base/audio_stream_info.h" #include "packager/media/base/audio_stream_info.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/media_sample.h" #include "packager/media/base/media_sample.h"
#include "packager/media/base/raw_key_source.h"
#include "packager/media/base/request_signer.h" #include "packager/media/base/request_signer.h"
#include "packager/media/base/stream_info.h" #include "packager/media/base/stream_info.h"
#include "packager/media/base/timestamp.h" #include "packager/media/base/timestamp.h"
@ -47,7 +47,7 @@ using ::testing::SetArgPointee;
namespace shaka { namespace shaka {
namespace media { namespace media {
class MockKeySource : public FixedKeySource { class MockKeySource : public RawKeySource {
public: public:
MockKeySource() {} MockKeySource() {}
~MockKeySource() override {} ~MockKeySource() override {}

View File

@ -58,8 +58,6 @@
'sources': [ 'sources': [
'app/crypto_flags.cc', 'app/crypto_flags.cc',
'app/crypto_flags.h', 'app/crypto_flags.h',
'app/fixed_key_encryption_flags.cc',
'app/fixed_key_encryption_flags.h',
'app/gflags_hex_bytes.cc', 'app/gflags_hex_bytes.cc',
'app/gflags_hex_bytes.h', 'app/gflags_hex_bytes.h',
'app/hls_flags.cc', 'app/hls_flags.cc',
@ -71,6 +69,8 @@
'app/packager_main.cc', 'app/packager_main.cc',
'app/playready_key_encryption_flags.cc', 'app/playready_key_encryption_flags.cc',
'app/playready_key_encryption_flags.h', 'app/playready_key_encryption_flags.h',
'app/raw_key_encryption_flags.cc',
'app/raw_key_encryption_flags.h',
'app/retired_flags.cc', 'app/retired_flags.cc',
'app/retired_flags.h', 'app/retired_flags.h',
'app/stream_descriptor.cc', 'app/stream_descriptor.cc',