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 
24 // The current gflags library does not provide a way to check whether a flag is
25 // set in command line. If a flag has a different value to its default value,
26 // the flag must have been set. It is possible that the flag is set to the same
27 // value as its default value though.
28 bool InformRetiredStringFlag(const char* flagname, const std::string& value) {
29  if (!value.empty())
30  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
31  return true;
32 }
33 
34 bool InformRetiredDefaultTrueFlag(const char* flagname, bool value) {
35  if (!value)
36  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
37  return true;
38 }
39 
40 bool InformRetiredDefaultDoubleFlag(const char* flagname, double value) {
41  if (value != 0)
42  fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname);
43  return true;
44 }
45 
46 DEFINE_validator(profile, &InformRetiredStringFlag);
47 DEFINE_validator(single_segment, &InformRetiredDefaultTrueFlag);
48 DEFINE_validator(webm_subsample_encryption, &InformRetiredDefaultTrueFlag);
49 DEFINE_validator(availability_time_offset, &InformRetiredDefaultDoubleFlag);