Helper: write recording only if needed

This commit is contained in:
Daniel Zaoui 2016-11-06 10:19:37 +02:00
parent ee1e8f77e1
commit 781f294654
1 changed files with 4 additions and 1 deletions

View File

@ -153,6 +153,7 @@ main(int argc, char *argv[])
const char *rec_file = NULL, *comp1 = NULL, *comp2 = NULL; const char *rec_file = NULL, *comp1 = NULL, *comp2 = NULL;
int ret = 0, args = 0; int ret = 0, args = 0;
unsigned short delay = 0; unsigned short delay = 0;
Eina_Bool write_file = EINA_FALSE;
Eina_Bool want_quit, clean = EINA_FALSE, list_get = EINA_FALSE, compare_files = EINA_FALSE; Eina_Bool want_quit, clean = EINA_FALSE, list_get = EINA_FALSE, compare_files = EINA_FALSE;
Ecore_Getopt_Value values[] = { Ecore_Getopt_Value values[] = {
ECORE_GETOPT_VALUE_USHORT(delay), ECORE_GETOPT_VALUE_USHORT(delay),
@ -228,6 +229,7 @@ main(int argc, char *argv[])
{ {
list->first_timestamp = evt_time_get(0, eina_list_data_get(list->variant_list)); list->first_timestamp = evt_time_get(0, eina_list_data_get(list->variant_list));
} }
write_file = EINA_TRUE;
} }
if (delay) if (delay)
@ -239,6 +241,7 @@ main(int argc, char *argv[])
list->first_timestamp = evt_time_get(0, eina_list_data_get(list->variant_list)); list->first_timestamp = evt_time_get(0, eina_list_data_get(list->variant_list));
} }
list->first_timestamp -= delay; list->first_timestamp -= delay;
write_file = EINA_TRUE;
} }
if (list_get) if (list_get)
@ -291,7 +294,7 @@ main(int argc, char *argv[])
} }
} }
if (rec_file) write_events(rec_file, list); if (rec_file && write_file) write_events(rec_file, list);
end: end:
ecore_shutdown(); ecore_shutdown();