Recorder: support exu

master
Daniel Zaoui 5 years ago
parent e71334118b
commit d589c93764
  1. 44
      src/bin/recorder.c
  2. 1
      src/lib/tsuite_file_data.c

@ -25,15 +25,8 @@
#define SHOT_KEY_STR "F2"
#define SAVE_KEY_STR "F3"
<<<<<<< HEAD
#include <canvas/evas_canvas.eo.h>
#include "exactness_canvas.eo.h"
static const char *_rec_filename = NULL;
=======
static Evas *(*_evas_new)(void) = NULL;
static const char *_out_filename = NULL;
>>>>>>> 0cce6b6... SqR
static const char *_test_name = NULL;
static int _verbose = 0;
@ -102,6 +95,25 @@ _is_hook_duplicate(const Variant_st *v, Tsuite_Event_Type ev_type, const void *i
return EINA_FALSE;
}
static void
_output_write()
{
if (!strcmp(_out_filename + strlen(_out_filename) - 4,".exu"))
{
Exactness_Unit unit;
unit.imgs = NULL;
unit.events = _events_list->variant_list;
Eet_Data_Descriptor *unit_edd = unit_desc_make();
Eet_File *file = eet_open(_out_filename, EET_FILE_MODE_WRITE);
eet_data_write(file, unit_edd, CACHE_FILE_ENTRY, &unit, EINA_TRUE);
eet_close(file);
}
else if (!strcmp(_out_filename + strlen(_out_filename) - 4,".rec"))
{
write_events(_out_filename, _events_list);
}
}
/* Adding variant to list, this list is later written to EET file */
#define ADD_TO_LIST(EVT_TYPE, INFO) \
do { /* This macro will add event to EET data list */ \
@ -208,7 +220,7 @@ _event_key_cb(void *data, const Efl_Event *event)
if (!strcmp(key, SAVE_KEY_STR))
{
if (_events_list)
write_events(_rec_filename, _events_list);
_output_write();
_printf(2, "Save events: %s timestamp=<%u>\n", __func__, timestamp);
return;
}
@ -349,7 +361,7 @@ _print_usage(const char *progn, FILE *outf)
{
fprintf(outf, "Usage: %s [options] [program]\n", progn);
fprintf(outf, "Options:\n"
" -t file.rec Name of the filename where to store the test\n"
" -t file.rec|exu Name of the filename where to store the test\n"
" -v Verbose mode\n"
" -h Print this message and exit\n"
"\n");
@ -389,7 +401,7 @@ int main(int argc, char **argv)
break;
case 't':
{
_rec_filename = eina_stringshare_add(optarg);
_out_filename = eina_stringshare_add(optarg);
break;
}
case 'v':
@ -415,24 +427,24 @@ int main(int argc, char **argv)
fprintf(stderr, "no program specified\nUse -h for more information\n");
goto end;
}
if (!_rec_filename)
if (!_out_filename)
{
fprintf(stderr, "no test file specified\n");
goto end;
}
else
{
char *slash = strrchr(_rec_filename, '/');
char *slash = strrchr(_out_filename, '/');
if (slash) _test_name = strdup(slash + 1);
else _test_name = strdup(_rec_filename);
else _test_name = strdup(_out_filename);
char *dot = strrchr(_test_name, '.');
if (dot) *dot = '\0';
if (slash)
{
*slash = '\0';
if (!_mkdir(_rec_filename))
if (!_mkdir(_out_filename))
{
fprintf(stderr, "Can't create %s\n", _rec_filename);
fprintf(stderr, "Can't create %s\n", _out_filename);
goto end;
}
*slash = '/';
@ -471,7 +483,7 @@ int main(int argc, char **argv)
ecore_evas_callback_new_set(_my_evas_new);
_prg_invoke(_prg_full_path_guess(argv[0]), argc - optind, argv);
write_events(_rec_filename, _events_list);
_output_write();
free_events(_events_list, EINA_TRUE);
_events_list = NULL;

@ -238,6 +238,7 @@ read_events(const char *filename, Timer_Data *td)
unsigned int tm = evt_time_get(0, v);
if (tm) evt_time_set(tm - vr_list->first_timestamp, v);
}
vr_list->first_timestamp = 0;
#ifdef DEBUG_TSUITE
print_events(vr_list);
#endif

Loading…
Cancel
Save