Shaka Packager SDK
playready_key_encryption_flags.cc
1 // Copyright 2017 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 //
7 // Defines command line flags for PlayReady encryption.
8 
9 #include <packager/app/playready_key_encryption_flags.h>
10 
11 #include <packager/app/validate_flag.h>
12 
13 ABSL_FLAG(bool,
14  enable_playready_encryption,
15  false,
16  "Enable encryption with PlayReady key.");
17 ABSL_FLAG(std::string,
18  playready_server_url,
19  "",
20  "PlayReady packaging server url.");
21 ABSL_FLAG(std::string,
22  program_identifier,
23  "",
24  "Program identifier for packaging request.");
25 
26 namespace shaka {
27 namespace {
28 const bool kFlagIsOptional = true;
29 }
30 
32  bool success = true;
33 
34  const char playready_label[] = "--enable_playready_encryption";
35  bool playready_enabled = absl::GetFlag(FLAGS_enable_playready_encryption);
36  if (!ValidateFlag("playready_server_url",
37  absl::GetFlag(FLAGS_playready_server_url),
38  playready_enabled, !kFlagIsOptional, playready_label)) {
39  success = false;
40  }
41  if (!ValidateFlag("program_identifier",
42  absl::GetFlag(FLAGS_program_identifier), playready_enabled,
43  !kFlagIsOptional, playready_label)) {
44  success = false;
45  }
46  return success;
47 }
48 
49 } // namespace shaka
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66
bool ValidateFlag(const char *flag_name, const FlagType &flag_value, bool condition, bool optional, const char *label)
Definition: validate_flag.h:37