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 DEFINE_bool(generate_static_mpd,
48  false,
49  "This flag is deprecated. Use --generate_static_live_mpd instead.");
50 
51 // The current gflags library does not provide a way to check whether a flag is
52 // set in command line. If a flag has a different value to its default value,
53 // the flag must have been set. It is possible that the flag is set to the same
54 // value as its default value though.
55 bool InformRetiredStringFlag(const char* flagname, const std::string& value) {
56  if (!value.empty())
57  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
58  return true;
59 }
60 
61 bool InformRetiredDefaultTrueFlag(const char* flagname, bool value) {
62  if (!value)
63  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
64  return true;
65 }
66 
67 bool InformRetiredDefaultFalseFlag(const char* flagname, bool value) {
68  if (value)
69  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
70  return true;
71 }
72 
73 bool InformRetiredDefaultDoubleFlag(const char* flagname, double value) {
74  if (value != 0)
75  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
76  return true;
77 }
78 
79 bool InformRetiredDefaultInt32Flag(const char* flagname, int32_t value) {
80  if (value != 0)
81  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
82  return true;
83 }
84 
85 bool InformRetiredPsshGenerationFlag(const char* flagname, bool value) {
86  if (value) {
87  fprintf(stderr,
88  "WARNING: %s is deprecated and ignored. Please switch to "
89  "--protection_systems.\n",
90  flagname);
91  }
92  return true;
93 }
94 
95 bool InformRetiredGenerateStaticMpdFlag(const char* flagname, bool value) {
96  if (value) {
97  fprintf(stderr,
98  "WARNING: %s is deprecated and ignored. Please switch to "
99  "--generate_static_live_mpd.\n",
100  flagname);
101  }
102  return true;
103 }
104 
105 DEFINE_validator(profile, &InformRetiredStringFlag);
106 DEFINE_validator(single_segment, &InformRetiredDefaultTrueFlag);
107 DEFINE_validator(webm_subsample_encryption, &InformRetiredDefaultTrueFlag);
108 DEFINE_validator(availability_time_offset, &InformRetiredDefaultDoubleFlag);
109 DEFINE_validator(playready_key_id, &InformRetiredStringFlag);
110 DEFINE_validator(playready_key, &InformRetiredStringFlag);
111 DEFINE_validator(mp4_use_decoding_timestamp_in_timeline,
112  &InformRetiredDefaultFalseFlag);
113 DEFINE_validator(num_subsegments_per_sidx, &InformRetiredDefaultInt32Flag);
114 DEFINE_validator(generate_widevine_pssh, &InformRetiredPsshGenerationFlag);
115 DEFINE_validator(generate_playready_pssh, &InformRetiredPsshGenerationFlag);
116 DEFINE_validator(generate_common_pssh, &InformRetiredPsshGenerationFlag);
117 DEFINE_validator(generate_static_mpd, &InformRetiredGenerateStaticMpdFlag);