| 48 | }; |
| 49 | |
| 50 | static CommandLine |
| 51 | ParseCommandLine(int argc, char **argv) |
| 52 | { |
| 53 | CommandLine c; |
| 54 | |
| 55 | OptionParser option_parser(option_defs, argc, argv); |
| 56 | while (auto o = option_parser.Next()) { |
| 57 | switch (Option(o.index)) { |
| 58 | case OPTION_CONFIG: |
| 59 | c.config_path = o.value; |
| 60 | break; |
| 61 | |
| 62 | case OPTION_VERBOSE: |
| 63 | c.verbose = true; |
| 64 | break; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | auto args = option_parser.GetRemaining(); |
| 69 | if (args.size() != 2) |
| 70 | throw std::runtime_error("Usage: run_convert IN_FORMAT OUT_FORMAT <IN >OUT"); |
| 71 | |
| 72 | c.in_audio_format = ParseAudioFormat(args[0], false); |
| 73 | c.out_audio_format = c.in_audio_format.WithMask(ParseAudioFormat(args[1], false)); |
| 74 | return c; |
| 75 | } |
| 76 | |
| 77 | class GlobalInit { |
| 78 | const ConfigData config; |
no test coverage detected