summaryrefslogtreecommitdiff
path: root/src/lib/emotion
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-27 13:17:09 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-02-27 13:17:10 -0500
commit6326e18b3fb2a4757f8ffa22be5d55a75da23049 (patch)
tree31d586b52638aa0d0b1c759869a8e3368c9daf5d /src/lib/emotion
parent7924660d54500285d3844bfa384394c683825cd9 (diff)
efl.file: improve api a bit
Summary: the previous implementation/api had a number of issues: * "file" property contained both "file" and "key" values - also performed file loading operation * "load_error" property which was specific to image objects * no methods for controlling file loading/unloading this patch attempts the following changes: * split "file" property into "file" and "key" properties - also remove "key" from existing "mmap" property * remove "load_error" * directly return error codes from operations * add "load" and "unload" methods for directly controlling load state * add implicit file loading if file/mmap is set during construction * rewrite all efl.file implementations to move file loading into load() method * rewrite all usage of efl.file api based on these changes * add C extension functions to mimic previous behavior ref T7577 Reviewers: segfaultxavi, bu5hm4n, cedric Reviewed By: segfaultxavi Subscribers: vitor.sousa, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7577 Differential Revision: https://phab.enlightenment.org/D8018
Diffstat (limited to 'src/lib/emotion')
-rw-r--r--src/lib/emotion/efl_canvas_video.eo4
-rw-r--r--src/lib/emotion/emotion_smart.c41
2 files changed, 26 insertions, 19 deletions
diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo
index 0adbf3e..38a9894 100644
--- a/src/lib/emotion/efl_canvas_video.eo
+++ b/src/lib/emotion/efl_canvas_video.eo
@@ -53,7 +53,9 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group implements Efl.File, Efl.P
53 Efl.Object.constructor; 53 Efl.Object.constructor;
54 Efl.Gfx.Entity.position { set; } 54 Efl.Gfx.Entity.position { set; }
55 Efl.Gfx.Entity.size { set; } 55 Efl.Gfx.Entity.size { set; }
56 Efl.File.file { get; set; } 56 Efl.File.load;
57 Efl.File.file { set; }
58 Efl.File.loaded { get; }
57 Efl.Player.play { get; set; } 59 Efl.Player.play { get; set; }
58 Efl.Player.pos { get; set; } 60 Efl.Player.pos { get; set; }
59 Efl.Player.progress { get; } 61 Efl.Player.progress { get; }
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index ed5eb36..06c95bf 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -119,6 +119,7 @@ struct _Efl_Canvas_Video_Data
119 Eina_Bool remember_play : 1; 119 Eina_Bool remember_play : 1;
120 Eina_Bool seek : 1; 120 Eina_Bool seek : 1;
121 Eina_Bool seeking : 1; 121 Eina_Bool seeking : 1;
122 Eina_Bool loaded : 1;
122}; 123};
123 124
124struct _Emotion_Xattr_Data 125struct _Emotion_Xattr_Data
@@ -344,21 +345,34 @@ _efl_canvas_video_engine_set(Eo *obj, Efl_Canvas_Video_Data *pd, const char *eng
344EAPI Eina_Bool 345EAPI Eina_Bool
345emotion_object_file_set(Evas_Object *obj, const char *file) 346emotion_object_file_set(Evas_Object *obj, const char *file)
346{ 347{
347 return efl_file_set(obj, file, NULL); 348 return efl_file_simple_load(obj, file, NULL);
348} 349}
349 350
350EOLIAN static Eina_Bool 351EOLIAN static Eina_Error
351_efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, const char *file, const char *key EINA_UNUSED) 352_efl_canvas_video_efl_file_file_set(Eo *obj, Efl_Canvas_Video_Data *sd, const char *file)
352{ 353{
353 DBG("file=%s", file); 354 DBG("file=%s", file);
354 355
355 if (!eina_stringshare_replace(&sd->file, file)) return EINA_TRUE; 356 eina_stringshare_replace(&sd->file, file);
357 sd->loaded = 0;
358 return efl_file_set(efl_super(obj, MY_CLASS), file);
359}
356 360
361EOLIAN static Eina_Bool
362_efl_canvas_video_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
363{
364 return sd->open && sd->loaded;
365}
366
367EOLIAN static Eina_Error
368_efl_canvas_video_efl_file_load(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
369{
370 const char *file = sd->file;
357 if (!sd->engine_instance) _engine_init(obj, sd); 371 if (!sd->engine_instance) _engine_init(obj, sd);
358 if (!sd->engine_instance) 372 if (!sd->engine_instance)
359 { 373 {
360 WRN("No engine chosen. Please set an engine."); 374 WRN("No engine chosen. Please set an engine.");
361 return EINA_FALSE; 375 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
362 } 376 }
363 377
364 sd->video.w = 0; 378 sd->video.w = 0;
@@ -367,7 +381,6 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *
367 { 381 {
368 char *file2 = NULL; 382 char *file2 = NULL;
369 383
370 eina_stringshare_replace(&sd->file, file);
371 emotion_engine_instance_file_close(sd->engine_instance); 384 emotion_engine_instance_file_close(sd->engine_instance);
372 evas_object_image_data_set(sd->obj, NULL); 385 evas_object_image_data_set(sd->obj, NULL);
373 evas_object_image_size_set(sd->obj, 1, 1); 386 evas_object_image_size_set(sd->obj, 1, 1);
@@ -382,7 +395,7 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *
382 if (!emotion_engine_instance_file_open(sd->engine_instance, file2)) 395 if (!emotion_engine_instance_file_open(sd->engine_instance, file2))
383 { 396 {
384 WRN("Couldn't open file=%s", sd->file); 397 WRN("Couldn't open file=%s", sd->file);
385 return EINA_FALSE; 398 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
386 } 399 }
387 free(file2); 400 free(file2);
388 DBG("successfully opened file=%s", sd->file); 401 DBG("successfully opened file=%s", sd->file);
@@ -402,23 +415,15 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *
402 sd->anim = NULL; 415 sd->anim = NULL;
403 416
404 _xattr_data_cancel(sd->xattr); 417 _xattr_data_cancel(sd->xattr);
418 sd->loaded = 1;
405 419
406 return EINA_TRUE; 420 return 0;
407} 421}
408 422
409EAPI const char * 423EAPI const char *
410emotion_object_file_get(const Evas_Object *obj) 424emotion_object_file_get(const Evas_Object *obj)
411{ 425{
412 const char *file = NULL; 426 return efl_file_get(obj);
413 efl_file_get(obj, &file, NULL);
414 return file;
415}
416
417EOLIAN static void
418_efl_canvas_video_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, const char **file, const char **key)
419{
420 if (file) *file = sd->file;
421 if (key) *key = NULL;
422} 427}
423 428
424static void 429static void