Support adding delay to a specific shot in the scenario

It helps when a shot is not stable and need a few ms more to be ok.
master
Daniel Zaoui 5 years ago
parent c83ed3fabb
commit 7c10de63e3
  1. 44
      src/bin/exactness_helper.c

@ -123,10 +123,11 @@ static const Ecore_Getopt optdesc = {
"Helper for Exactness",
0,
{
ECORE_GETOPT_STORE_USHORT('d', "delay", "Delay the given recording by a given time (in seconds)."),
ECORE_GETOPT_STORE_USHORT('d', "delay", "Delay the given recording by a given time (in milliseconds)."),
ECORE_GETOPT_STORE_TRUE('c', "clean", "Clean the given recording from wrong events."),
ECORE_GETOPT_STORE_TRUE('l', "list", "List the events of the given recording."),
ECORE_GETOPT_STORE_TRUE('C', "compare", "Compare two given files (images files or objects eet files)."),
ECORE_GETOPT_STORE_USHORT('s', "shot", "Select a specific shot (1 = 1st shot...)."),
ECORE_GETOPT_LICENSE('L', "license"),
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
@ -152,7 +153,7 @@ main(int argc, char *argv[])
{
const char *rec_file = NULL, *comp1 = NULL, *comp2 = NULL;
int ret = 0, args = 0;
unsigned short delay = 0;
unsigned short delay = 0, shot = 0;
Eina_Bool write_file = EINA_FALSE;
Eina_Bool want_quit, clean = EINA_FALSE, list_get = EINA_FALSE, compare_files = EINA_FALSE;
Ecore_Getopt_Value values[] = {
@ -160,6 +161,7 @@ main(int argc, char *argv[])
ECORE_GETOPT_VALUE_BOOL(clean),
ECORE_GETOPT_VALUE_BOOL(list_get),
ECORE_GETOPT_VALUE_BOOL(compare_files),
ECORE_GETOPT_VALUE_USHORT(shot),
ECORE_GETOPT_VALUE_BOOL(want_quit),
ECORE_GETOPT_VALUE_BOOL(want_quit),
@ -183,13 +185,19 @@ main(int argc, char *argv[])
ret = 1;
goto end;
}
else if ((clean || delay || list_get) && args == argc)
else if ((clean || delay || shot || list_get) && args == argc)
{
fprintf(stderr, "Expected rec file as the last argument..\n");
ecore_getopt_help(stderr, &optdesc);
ret = 1;
goto end;
}
else if (shot && !delay)
{
fprintf(stderr, "shot option can only be used with delay option\n");
ret = 1;
goto end;
}
else if (compare_files && argc - args != 2)
{
fprintf(stderr, "Expected two files to compare as last arguments..\n");
@ -234,13 +242,33 @@ main(int argc, char *argv[])
if (delay)
{
delay *= 1000;
if (!list->first_timestamp)
if (!shot)
{
list->first_timestamp = evt_time_get(0, eina_list_data_get(list->variant_list));
if (!list->first_timestamp)
{
list->first_timestamp = evt_time_get(0, eina_list_data_get(list->variant_list));
}
list->first_timestamp -= delay;
}
else
{
Variant_st *v;
Eina_List *itr;
unsigned int cur_shot = 0;
EINA_LIST_FOREACH(list->variant_list, itr, v)
{
if (tsuite_event_mapping_type_get(v->t.type) == TSUITE_EVENT_TAKE_SHOT)
{
cur_shot++;
if (cur_shot == shot)
{
take_screenshot *t = v->data;
t->timestamp += delay;
break;
}
}
}
}
list->first_timestamp -= delay;
write_file = EINA_TRUE;
}

Loading…
Cancel
Save