Shaka Packager SDK
retired_flags.cc
1 // Copyright 2017 Google Inc. 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 retired / deprecated flags. These flags will be removed in later
8 // versions.
9 
10 #include "packager/app/retired_flags.h"
11 
12 #include <stdio.h>
13 
14 DEFINE_string(profile, "", "This flag is deprecated. Do not use.");
15 DEFINE_bool(single_segment, true, "This flag is deprecated. Do not use.");
16 DEFINE_bool(webm_subsample_encryption,
17  true,
18  "This flag is deprecated. Use vp9_subsample_encryption instead.");
19 DEFINE_double(availability_time_offset,
20  0,
21  "This flag is deprecated. Use suggested_presentation_delay "
22  "instead which can achieve similar effect.");
23 DEFINE_string(playready_key_id,
24  "",
25  "This flag is deprecated. Use --enable_raw_key_encryption with "
26  "--generate_playready_pssh to generate PlayReady PSSH.");
27 DEFINE_string(playready_key,
28  "",
29  "This flag is deprecated. Use --enable_raw_key_encryption with "
30  "--generate_playready_pssh to generate PlayReady PSSH.");
31 DEFINE_bool(mp4_use_decoding_timestamp_in_timeline,
32  false,
33  "This flag is deprecated. Do not use.");
34 DEFINE_int32(
35  num_subsegments_per_sidx,
36  0,
37  "This flag is deprecated. Use --generate_sidx_in_media_segments instead.");
38 DEFINE_bool(generate_widevine_pssh,
39  false,
40  "This flag is deprecated. Use --protection_systems instead.");
41 DEFINE_bool(generate_playready_pssh,
42  false,
43  "This flag is deprecated. Use --protection_systems instead.");
44 DEFINE_bool(generate_common_pssh,
45  false,
46  "This flag is deprecated. Use --protection_systems instead.");
47 
48 // The current gflags library does not provide a way to check whether a flag is
49 // set in command line. If a flag has a different value to its default value,
50 // the flag must have been set. It is possible that the flag is set to the same
51 // value as its default value though.
52 bool InformRetiredStringFlag(const char* flagname, const std::string& value) {
53  if (!value.empty())
54  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
55  return true;
56 }
57 
58 bool InformRetiredDefaultTrueFlag(const char* flagname, bool value) {
59  if (!value)
60  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
61  return true;
62 }
63 
64 bool InformRetiredDefaultFalseFlag(const char* flagname, bool value) {
65  if (value)
66  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
67  return true;
68 }
69 
70 bool InformRetiredDefaultDoubleFlag(const char* flagname, double value) {
71  if (value != 0)
72  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
73  return true;
74 }
75 
76 bool InformRetiredDefaultInt32Flag(const char* flagname, int32_t value) {
77  if (value != 0)
78  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
79  return true;
80 }
81 
82 bool InformRetiredPsshGenerationFlag(const char* flagname, bool value) {
83  if (value) {
84  fprintf(stderr,
85  "WARNING: %s is deprecated and ignored. Please switch to "
86  "--protection_systems.\n",
87  flagname);
88  }
89  return true;
90 }
91 
92 DEFINE_validator(profile, &InformRetiredStringFlag);
93 DEFINE_validator(single_segment, &InformRetiredDefaultTrueFlag);
94 DEFINE_validator(webm_subsample_encryption, &InformRetiredDefaultTrueFlag);
95 DEFINE_validator(availability_time_offset, &InformRetiredDefaultDoubleFlag);
96 DEFINE_validator(playready_key_id, &InformRetiredStringFlag);
97 DEFINE_validator(playready_key, &InformRetiredStringFlag);
98 DEFINE_validator(mp4_use_decoding_timestamp_in_timeline,
99  &InformRetiredDefaultFalseFlag);
100 DEFINE_validator(num_subsegments_per_sidx, &InformRetiredDefaultInt32Flag);
101 DEFINE_validator(generate_widevine_pssh, &InformRetiredPsshGenerationFlag);
102 DEFINE_validator(generate_playready_pssh, &InformRetiredPsshGenerationFlag);
103 DEFINE_validator(generate_common_pssh, &InformRetiredPsshGenerationFlag);