Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / modules / audio_processing / test / unpack.cc
index 0740143..f8a4bb1 100644 (file)
@@ -36,6 +36,7 @@ DEFINE_string(reverse_file, "reverse.pcm",
 DEFINE_string(delay_file, "delay.int32", "The name of the delay file.");
 DEFINE_string(drift_file, "drift.int32", "The name of the drift file.");
 DEFINE_string(level_file, "level.int32", "The name of the level file.");
+DEFINE_string(keypress_file, "keypress.bool", "The name of the keypress file.");
 DEFINE_string(settings_file, "settings.txt", "The name of the settings file.");
 DEFINE_bool(full, false,
             "Unpack the full set of files (normally not needed).");
@@ -105,6 +106,7 @@ int main(int argc, char* argv[]) {
   FILE* delay_file = NULL;
   FILE* drift_file = NULL;
   FILE* level_file = NULL;
+  FILE* keypress_file = NULL;
   if (FLAGS_full) {
     delay_file = fopen(FLAGS_delay_file.c_str(), "wb");
     if (delay_file == NULL) {
@@ -121,6 +123,11 @@ int main(int argc, char* argv[]) {
       printf("Unable to open %s\n", FLAGS_level_file.c_str());
       return 1;
     }
+    keypress_file = fopen(FLAGS_keypress_file.c_str(), "wb");
+    if (keypress_file == NULL) {
+      printf("Unable to open %s\n", FLAGS_keypress_file.c_str());
+      return 1;
+    }
   }
 
   Event event_msg;
@@ -188,6 +195,14 @@ int main(int argc, char* argv[]) {
             return 1;
           }
         }
+
+        if (msg.has_keypress()) {
+          bool keypress = msg.keypress();
+          if (fwrite(&keypress, sizeof(bool), 1, keypress_file) != 1) {
+            printf("Error when writing to %s\n", FLAGS_keypress_file.c_str());
+            return 1;
+          }
+        }
       }
     } else if (event_msg.type() == Event::INIT) {
       if (!event_msg.has_init()) {