| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chromecast/base/chromecast_switches.h" | 5 #include "chromecast/base/chromecast_switches.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 | 8 |
| 9 namespace switches { | 9 namespace switches { |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // How many frames need to be in the output buffer before output starts. | 57 // How many frames need to be in the output buffer before output starts. |
| 58 const char kAlsaOutputStartThreshold[] = "alsa-output-start-threshold"; | 58 const char kAlsaOutputStartThreshold[] = "alsa-output-start-threshold"; |
| 59 | 59 |
| 60 // Minimum number of available frames for scheduling a transfer. | 60 // Minimum number of available frames for scheduling a transfer. |
| 61 const char kAlsaOutputAvailMin[] = "alsa-output-avail-min"; | 61 const char kAlsaOutputAvailMin[] = "alsa-output-avail-min"; |
| 62 | 62 |
| 63 // Time in ms to wait before closing the PCM handle when no more mixer inputs | 63 // Time in ms to wait before closing the PCM handle when no more mixer inputs |
| 64 // remain. Assumed to be 0 if --accept-resource-provider is present. | 64 // remain. Assumed to be 0 if --accept-resource-provider is present. |
| 65 const char kAlsaCheckCloseTimeout[] = "alsa-check-close-timeout"; | 65 const char kAlsaCheckCloseTimeout[] = "alsa-check-close-timeout"; |
| 66 | 66 |
| 67 // Number of channels on the alsa output device that the stream mixer uses. | |
| 68 // Default is 2 channels. | |
| 69 const char kAlsaNumOutputChannels[] = "alsa-num-output-channels"; | |
| 70 | |
| 71 // Optional flag to set a fixed sample rate for the alsa device. | 67 // Optional flag to set a fixed sample rate for the alsa device. |
| 72 const char kAlsaFixedOutputSampleRate[] = "alsa-fixed-output-sample-rate"; | 68 const char kAlsaFixedOutputSampleRate[] = "alsa-fixed-output-sample-rate"; |
| 73 | 69 |
| 74 } // namespace switches | 70 } // namespace switches |
| 75 | 71 |
| 76 namespace chromecast { | 72 namespace chromecast { |
| 77 | 73 |
| 78 bool GetSwitchValueBoolean(const std::string& switch_string, | 74 bool GetSwitchValueBoolean(const std::string& switch_string, |
| 79 const bool default_value) { | 75 const bool default_value) { |
| 80 const base::CommandLine* command_line = | 76 const base::CommandLine* command_line = |
| 81 base::CommandLine::ForCurrentProcess(); | 77 base::CommandLine::ForCurrentProcess(); |
| 82 if (command_line->HasSwitch(switch_string)) { | 78 if (command_line->HasSwitch(switch_string)) { |
| 83 if (command_line->GetSwitchValueASCII(switch_string) != | 79 if (command_line->GetSwitchValueASCII(switch_string) != |
| 84 switches::kSwitchValueTrue && | 80 switches::kSwitchValueTrue && |
| 85 command_line->GetSwitchValueASCII(switch_string) != | 81 command_line->GetSwitchValueASCII(switch_string) != |
| 86 switches::kSwitchValueFalse && | 82 switches::kSwitchValueFalse && |
| 87 command_line->GetSwitchValueASCII(switch_string) != "") { | 83 command_line->GetSwitchValueASCII(switch_string) != "") { |
| 88 LOG(WARNING) << "Invalid switch value " << switch_string << "=" | 84 LOG(WARNING) << "Invalid switch value " << switch_string << "=" |
| 89 << command_line->GetSwitchValueASCII(switch_string) | 85 << command_line->GetSwitchValueASCII(switch_string) |
| 90 << "; assuming default value of " << default_value; | 86 << "; assuming default value of " << default_value; |
| 91 return default_value; | 87 return default_value; |
| 92 } | 88 } |
| 93 return command_line->GetSwitchValueASCII(switch_string) != | 89 return command_line->GetSwitchValueASCII(switch_string) != |
| 94 switches::kSwitchValueFalse; | 90 switches::kSwitchValueFalse; |
| 95 } | 91 } |
| 96 return default_value; | 92 return default_value; |
| 97 } | 93 } |
| 98 | 94 |
| 99 } // namespace chromecast | 95 } // namespace chromecast |
| OLD | NEW |