MCPcopy Create free account
hub / github.com/bbc/audiowaveform / parseCommandLine

Method parseCommandLine

src/Options.cpp:133–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131//------------------------------------------------------------------------------
132
133bool Options::parseCommandLine(int argc, const char* const* argv)
134{
135 program_name_ = argv[0];
136
137 std::string input_filename;
138 std::string output_filename;
139
140 std::string input_format;
141 std::string output_format;
142
143 std::string amplitude_scale;
144 std::string samples_per_pixel;
145 std::string waveform_color;
146
147 desc_.add_options()(
148 "help",
149 "show help message"
150 )(
151 "version,v",
152 "show version information"
153 )(
154 "quiet,q",
155 "disable progress and information messages"
156 )(
157 "input-filename,i",
158 po::value<std::string>(&input_filename),
159 FileFormat::isSupported(FileFormat::Opus) ?
160 "input file name (.mp3, .wav, .flac, .ogg, .oga, .opus, .dat, .json)" :
161 "input file name (.mp3, .wav, .flac, .ogg, .oga, .dat, .json)"
162 )(
163 "output-filename,o",
164 po::value<std::string>(&output_filename),
165 "output file name (.wav, .dat, .png, .json)"
166 )(
167 "split-channels",
168 "output multi-channel waveform data or image files"
169 )(
170 "input-format",
171 po::value<std::string>(&input_format),
172 FileFormat::isSupported(FileFormat::Opus) ?
173 "input file format (mp3, wav, flac, ogg, raw, opus, dat, json)" :
174 "input file format (mp3, wav, flac, ogg, raw, dat, json)"
175 )(
176 "output-format",
177 po::value<std::string>(&output_format),
178 "output file format (wav, dat, png, json)"
179 )(
180 "zoom,z",
181 po::value<std::string>(&samples_per_pixel)->default_value("256"),
182 "zoom level (samples per pixel)"
183 )(
184 "pixels-per-second",
185 po::value<int>(&pixels_per_second_)->default_value(100),
186 "zoom level (pixels per second)"
187 )(
188 "bits,b",
189 po::value<int>(&bits_)->default_value(16),
190 "bits (8 or 16)"

Callers 2

TEST_FFunction · 0.80
mainFunction · 0.80

Calls 6

isSupportedFunction · 0.85
hasOptionValueFunction · 0.85
parseWaveformColorsFunction · 0.85
fromStringFunction · 0.85
runMethod · 0.45

Tested by 1

TEST_FFunction · 0.64