Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: webrtc/modules/audio_processing/test/conversational_speech/generator.cc

Issue 3005483002: Replace remaining gflags usages with rtc_base/flags (Closed)
Patch Set: Rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/conversational_speech/generator.cc
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/generator.cc b/webrtc/modules/audio_processing/test/conversational_speech/generator.cc
index c7f86dec1ea948be9e7e91386fa66c9f42e998c1..53f7217c2623714aa4d001f4d5858ebb9fac48a9 100644
--- a/webrtc/modules/audio_processing/test/conversational_speech/generator.cc
+++ b/webrtc/modules/audio_processing/test/conversational_speech/generator.cc
@@ -10,12 +10,12 @@
#include <iostream>
-#include "gflags/gflags.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/config.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/simulator.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/timing.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_factory.h"
+#include "webrtc/rtc_base/flags.h"
#include "webrtc/rtc_base/ptr_util.h"
#include "webrtc/test/testsupport/fileutils.h"
@@ -23,14 +23,6 @@ namespace webrtc {
namespace test {
namespace {
-// Adapting DirExists/FileExists interfaces to DEFINE_validator.
-auto dir_exists = [](const char* c, const std::string& dirpath) {
- return DirExists(dirpath);
-};
-auto file_exists = [](const char* c, const std::string& filepath) {
- return FileExists(filepath);
-};
-
const char kUsageDescription[] =
"Usage: conversational_speech_generator\n"
" -i <path/to/source/audiotracks>\n"
@@ -38,21 +30,30 @@ const char kUsageDescription[] =
" -o <output/path>\n"
"\n\n"
"Command-line tool to generate multiple-end audio tracks to simulate "
- "conversational speech with two or more participants.";
+ "conversational speech with two or more participants.\n";
DEFINE_string(i, "", "Directory containing the speech turn wav files");
-DEFINE_validator(i, dir_exists);
DEFINE_string(t, "", "Path to the timing text file");
-DEFINE_validator(t, file_exists);
DEFINE_string(o, "", "Output wav files destination path");
-DEFINE_validator(o, dir_exists);
+DEFINE_bool(help, false, "Prints this message");
} // namespace
int main(int argc, char* argv[]) {
- google::SetUsageMessage(kUsageDescription);
- google::ParseCommandLineFlags(&argc, &argv, true);
- conversational_speech::Config config(FLAGS_i, FLAGS_t, FLAGS_o);
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
+ FLAG_help || argc != 1) {
+ printf("%s", kUsageDescription);
+ if (FLAG_help) {
+ rtc::FlagList::Print(nullptr, false);
+ return 0;
+ }
+ return 1;
+ }
+ RTC_CHECK(DirExists(FLAG_i));
+ RTC_CHECK(FileExists(FLAG_t));
+ RTC_CHECK(DirExists(FLAG_o));
+
+ conversational_speech::Config config(FLAG_i, FLAG_t, FLAG_o);
// Load timing.
std::vector<conversational_speech::Turn> timing =

Powered by Google App Engine
This is Rietveld 408576698