else
evas_object_hide(e->img);
- plugin->generate_thumb(e);
+ e->plugin = plugin;
+ e->pdata = plugin->thumb_generate(e);
return EINA_TRUE;
}
if (e->finished_idler)
ecore_idler_del(e->finished_idler);
e->finished_idler = ecore_idler_add(_ethumb_finished_idler_cb, e);
+ e->plugin = NULL;
+ e->pdata = NULL;
}
EAPI Eina_Bool
ERR("thumbnail generation already in progress.");
return EINA_FALSE;
}
+ if (e->pdata)
+ {
+ e->plugin->thumb_cancel(e, e->pdata);
+ e->pdata = NULL;
+ e->plugin = NULL;
+ }
+
e->finished_cb = finished_cb;
e->cb_data = (void *)data;
e->cb_data_free = free_data;
}
r = _ethumb_plugin_generate(e);
+ fprintf(stderr, "ethumb generate: %i: %p\n", r, e->pdata);
if (r)
{
- ethumb_finished_callback_call(e, r);
return EINA_TRUE;
}
r->cb_data = NULL;
r->cb_data_free = NULL;
r->cb_result = 0;
+ r->plugin = NULL;
+ r->pdata = NULL;
return r;
}
int w, h;
};
+static Eina_Bool _frame_grab(void *data);
+static Eina_Bool _frame_grab_single(void *data);
+
static void
_resize_movie(struct _emotion_plugin *_plugin)
{
}
static void
+_frame_decode_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
+{
+ struct _emotion_plugin *_plugin = data;
+
+ if (_plugin->ef)
+ _frame_grab(data);
+ else
+ _frame_grab_single(data);
+}
+
+static void
_frame_resized_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
_resize_movie(data);
int r = 0;
evas_object_smart_callback_del(_plugin->video, "frame_resize",
_frame_resized_cb);
+ evas_object_smart_callback_del(_plugin->video, "frame_decode",
+ _frame_decode_cb);
emotion_object_play_set(_plugin->video, 0);
evas_object_del(_plugin->video);
if (_plugin->ef)
emotion_object_play_set(_plugin->video, 0);
evas_object_del(_plugin->video);
free(_plugin);
-
+
ethumb_finished_callback_call(e, 1);
return EINA_FALSE;
fprintf(stderr, "ERROR: could not open '%s'\n", thumb_path);
_finish_thumb_generation(_plugin, 0);
}
-
- ecore_timer_add(1.0 / ethumb_video_fps_get(e), _frame_grab, _plugin);
}
-static void
-_generate_thumb(Ethumb *e)
+static void *
+_thumb_generate(Ethumb *e)
{
Evas_Object *o;
int r;
struct _emotion_plugin *_plugin = calloc(sizeof(struct _emotion_plugin), 1);
o = emotion_object_add(ethumb_evas_get(e));
- r = emotion_object_init(o, "xine");
+ r = emotion_object_init(o, NULL);
if (!r)
{
fprintf(stderr, "ERROR: could not start emotion using gstreamer"
evas_object_del(o);
ethumb_finished_callback_call(e, 0);
free(_plugin);
- return;
+ return NULL;
}
_plugin->video = o;
_plugin->pcount = 1;
_resize_movie(_plugin);
+ evas_object_smart_callback_add(o, "frame_decode",
+ _frame_decode_cb, _plugin);
evas_object_smart_callback_add(o, "frame_resize",
_frame_resized_cb, _plugin);
evas_object_smart_callback_add(o, "decode_stop",
{
_generate_animated_thumb(_plugin);
}
- else
- {
- ecore_timer_add(0.1, _frame_grab_single, _plugin);
- }
_video_pos_set(_plugin);
emotion_object_play_set(o, 1);
evas_object_show(o);
+
+ return _plugin;
+}
+
+static void
+_thumb_cancel(Ethumb *e __UNUSED__, void *data)
+{
+ struct _emotion_plugin *_plugin = data;
+
+ if (_plugin->ef) eet_close(_plugin->ef);
+ evas_object_del(_plugin->video);
+ free(_plugin);
}
EAPI Ethumb_Plugin *
static Ethumb_Plugin plugin =
{
extensions,
- _generate_thumb,
+ _thumb_generate,
+ _thumb_cancel
};
_log_dom = eina_log_domain_register("ethumb_emotion", EINA_COLOR_GREEN);