|
|
|
@ -953,35 +953,69 @@ void _data_descriptors_shutdown(void) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Eet_Data_Descriptor * |
|
|
|
|
unit_desc_make(void) |
|
|
|
|
static Eet_Data_Descriptor * |
|
|
|
|
_unit_desc_make(void) |
|
|
|
|
{ |
|
|
|
|
Eet_Data_Descriptor_Class eddc; |
|
|
|
|
static Eet_Data_Descriptor *unit_d = NULL; |
|
|
|
|
_data_descriptors_init(); |
|
|
|
|
if (!unit_d) |
|
|
|
|
{ |
|
|
|
|
/* Exactness_Image */ |
|
|
|
|
Exactness_Image ex_img; |
|
|
|
|
Eet_Data_Descriptor *img_d; |
|
|
|
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Image); |
|
|
|
|
img_d = eet_data_descriptor_stream_new(&eddc); |
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(img_d, Exactness_Image, "w", w, EET_T_UINT); |
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(img_d, Exactness_Image, "h", h, EET_T_UINT); |
|
|
|
|
eet_data_descriptor_element_add(img_d, "pixels", EET_T_CHAR, EET_G_VAR_ARRAY, |
|
|
|
|
(char *)(&(ex_img.pixels)) - (char *)(&(ex_img)), |
|
|
|
|
(char *)(&(ex_img.pixels_count)) - (char *)(&(ex_img)), NULL, NULL); |
|
|
|
|
|
|
|
|
|
/* Exactness_Unit */ |
|
|
|
|
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Unit); |
|
|
|
|
unit_d = eet_data_descriptor_stream_new(&eddc); |
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_LIST(unit_d, Exactness_Unit, |
|
|
|
|
"events", events, _desc->_variant_descriptor); |
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_LIST(unit_d, Exactness_Unit, |
|
|
|
|
"imgs", imgs, img_d); |
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(unit_d, Exactness_Unit, |
|
|
|
|
"nb_shots", nb_shots, EET_T_UINT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return unit_d; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* END Event struct descriptors */ |
|
|
|
|
|
|
|
|
|
EAPI Exactness_Unit * |
|
|
|
|
unit_eet_read(const char *filename) |
|
|
|
|
{ |
|
|
|
|
int i; |
|
|
|
|
Exactness_Unit *unit = NULL; |
|
|
|
|
Eet_File *file = eet_open(filename, EET_FILE_MODE_READ); |
|
|
|
|
if (!file) |
|
|
|
|
{ |
|
|
|
|
fprintf(stderr, "Impossible to extract EET from %s\n", filename); |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
unit = eet_data_read(file, _unit_desc_make(), CACHE_FILE_ENTRY); |
|
|
|
|
for (i = 0; i < unit->nb_shots; i++) |
|
|
|
|
{ |
|
|
|
|
char entry[16]; |
|
|
|
|
Exactness_Image *ex_img = malloc(sizeof(*ex_img)); |
|
|
|
|
sprintf(entry, "images/%d", i + 1); |
|
|
|
|
ex_img->pixels = eet_data_image_read(file, entry, |
|
|
|
|
&ex_img->w, &ex_img->h, &ex_img->alpha, |
|
|
|
|
NULL, NULL, NULL); |
|
|
|
|
unit->imgs = eina_list_append(unit->imgs, ex_img); |
|
|
|
|
} |
|
|
|
|
eet_close(file); |
|
|
|
|
return unit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
EAPI Eina_Bool unit_eet_write(Exactness_Unit *unit, const char *filename) |
|
|
|
|
{ |
|
|
|
|
Eina_List *itr; |
|
|
|
|
Exactness_Image *ex_img; |
|
|
|
|
int i = 1; |
|
|
|
|
Eet_File *file = eet_open(filename, EET_FILE_MODE_WRITE); |
|
|
|
|
eet_data_write(file, _unit_desc_make(), CACHE_FILE_ENTRY, unit, EINA_TRUE); |
|
|
|
|
EINA_LIST_FOREACH(unit->imgs, itr, ex_img) |
|
|
|
|
{ |
|
|
|
|
char entry[16]; |
|
|
|
|
sprintf(entry, "images/%d", i++); |
|
|
|
|
eet_data_image_write(file, entry, |
|
|
|
|
ex_img->pixels, ex_img->w, ex_img->h, ex_img->alpha, |
|
|
|
|
0, 100, EET_IMAGE_LOSSLESS); |
|
|
|
|
} |
|
|
|
|
eet_close(file); |
|
|
|
|
return EINA_TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|