summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h5
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c67
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c20
-rw-r--r--src/modules/ecore_imf/meson.build5
-rw-r--r--src/modules/ecore_wl2/engines/dmabuf/ecore_wl2_surface_module_dmabuf.c1
-rw-r--r--src/modules/eeze/meson.build1
-rw-r--r--src/modules/eeze/sensor/tizen/meson.build8
-rw-r--r--src/modules/eeze/sensor/tizen/tizen.c1383
-rw-r--r--src/modules/eina/mp/chained_pool/eina_chained_mempool.c74
-rw-r--r--src/modules/eina/mp/one_big/eina_one_big.c3
-rw-r--r--src/modules/eina/mp/pass_through/eina_pass_through.c1
-rw-r--r--src/modules/emotion/gstreamer/emotion_alloc.c90
-rw-r--r--src/modules/emotion/gstreamer/emotion_convert.c251
-rw-r--r--src/modules/emotion/gstreamer/emotion_fakeeos.c70
-rw-r--r--src/modules/emotion/gstreamer/emotion_gstreamer.c2018
-rw-r--r--src/modules/emotion/gstreamer/emotion_gstreamer.h352
-rw-r--r--src/modules/emotion/gstreamer/emotion_sink.c1461
-rw-r--r--src/modules/emotion/gstreamer/meson.build18
-rw-r--r--src/modules/emotion/meson.build1
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h4
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c96
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_shader.c7
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x7
-rw-r--r--src/modules/evas/engines/gl_common/shader/fragment.glsl8
-rw-r--r--src/modules/evas/engines/gl_drm/evas_engine.c4
-rw-r--r--src/modules/evas/engines/gl_drm/evas_outbuf.c2
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c11
-rw-r--r--src/modules/evas/engines/gl_generic/filters/gl_engine_filter.h1
-rw-r--r--src/modules/evas/engines/gl_generic/filters/gl_filter_inverse_color.c53
-rw-r--r--src/modules/evas/engines/gl_generic/meson.build1
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c8
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c13
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_engine_filter.h1
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_filter_inverse_color.c57
-rw-r--r--src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h8
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.c2
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_wl_main.c2
-rw-r--r--src/modules/evas/image_loaders/meson.build23
-rw-r--r--src/modules/evas/image_savers/meson.build23
-rw-r--r--src/modules/evas/meson.build4
-rw-r--r--src/modules/evas/model_loaders/meson.build17
-rw-r--r--src/modules/evas/model_savers/meson.build17
-rw-r--r--src/modules/evas/vg_loaders/json/evas_vg_load_json.c30
-rw-r--r--src/modules/evas/vg_loaders/meson.build27
-rw-r--r--src/modules/evas/vg_savers/eet/evas_vg_save_eet.c2
-rw-r--r--src/modules/evas/vg_savers/meson.build18
46 files changed, 466 insertions, 5809 deletions
diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h
index dd82f50..a6aad24 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_engine.h
@@ -1,3 +1,6 @@
1#ifndef _ECORE_EVAS_EXTN_ENGINE_H_
2#define _ECORE_EVAS_EXTN_ENGINE_H_
3
1#ifdef HAVE_CONFIG_H 4#ifdef HAVE_CONFIG_H
2# include <config.h> 5# include <config.h>
3#endif 6#endif
@@ -222,3 +225,5 @@ struct _Ipc_Data_Ev_Key_Down
222 unsigned int timestamp; 225 unsigned int timestamp;
223 Evas_Event_Flags event_flags; 226 Evas_Event_Flags event_flags;
224}; 227};
228
229#endif /*_ECORE_EVAS_EXTN_ENGINE_H_*/
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 02884e5..c14bdbc 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -313,7 +313,7 @@ static void
313_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h) 313_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
314{ 314{
315 Ecore_Evas_Engine_Wl_Data *wdata; 315 Ecore_Evas_Engine_Wl_Data *wdata;
316 int ow, oh, ew, eh; 316 int ow, oh, ew, eh, fw, fh;
317 int diff = 0; 317 int diff = 0;
318 318
319 LOGFN(__FILE__, __LINE__, __FUNCTION__); 319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -326,6 +326,8 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
326 ee->req.w = w; 326 ee->req.w = w;
327 ee->req.h = h; 327 ee->req.h = h;
328 328
329 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
330
329 /* TODO: wayland client can resize the ecore_evas directly. 331 /* TODO: wayland client can resize the ecore_evas directly.
330 * In the future, we will remove ee->req value in wayland backend */ 332 * In the future, we will remove ee->req value in wayland backend */
331 ew = ee->w; 333 ew = ee->w;
@@ -335,55 +337,52 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
335 337
336 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min) 338 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
337 { 339 {
338 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w, ee->prop.min.h); 340 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
339 wdata->win->pending.min = 0; 341 wdata->win->pending.min = 0;
340 } 342 }
341 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max) 343 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
342 { 344 {
343 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w, ee->prop.max.h); 345 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
344 wdata->win->pending.max = 0; 346 wdata->win->pending.max = 0;
345 } 347 }
346 348
347 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min) 349 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
348 { 350 {
349 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h); 351 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
350 wdata->win->pending.min = 0; 352 wdata->win->pending.min = 0;
351 } 353 }
352 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max) 354 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max)
353 { 355 {
354 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w, ee->prop.max.h); 356 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
355 wdata->win->pending.max = 0; 357 wdata->win->pending.max = 0;
356 } 358 }
357 359
358 if (!ee->prop.fullscreen) 360 if (!ee->prop.fullscreen)
359 { 361 {
360 int fw = 0, fh = 0;
361 int maxw = 0, maxh = 0; 362 int maxw = 0, maxh = 0;
362 int minw = 0, minh = 0; 363 int minw = 0, minh = 0;
363 364
364 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
365
366 if (ECORE_EVAS_PORTRAIT(ee)) 365 if (ECORE_EVAS_PORTRAIT(ee))
367 { 366 {
368 if (ee->prop.min.w > 0) 367 if (ee->prop.min.w > 0)
369 minw = (ee->prop.min.w - fw); 368 minw = (ee->prop.min.w);
370 if (ee->prop.min.h > 0) 369 if (ee->prop.min.h > 0)
371 minh = (ee->prop.min.h - fh); 370 minh = (ee->prop.min.h);
372 if (ee->prop.max.w > 0) 371 if (ee->prop.max.w > 0)
373 maxw = (ee->prop.max.w + fw); 372 maxw = (ee->prop.max.w);
374 if (ee->prop.max.h > 0) 373 if (ee->prop.max.h > 0)
375 maxh = (ee->prop.max.h + fh); 374 maxh = (ee->prop.max.h);
376 } 375 }
377 else 376 else
378 { 377 {
379 if (ee->prop.min.w > 0) 378 if (ee->prop.min.w > 0)
380 minw = (ee->prop.min.w - fh); 379 minw = (ee->prop.min.w);
381 if (ee->prop.min.h > 0) 380 if (ee->prop.min.h > 0)
382 minh = (ee->prop.min.h - fw); 381 minh = (ee->prop.min.h);
383 if (ee->prop.max.w > 0) 382 if (ee->prop.max.w > 0)
384 maxw = (ee->prop.max.w + fh); 383 maxw = (ee->prop.max.w);
385 if (ee->prop.max.h > 0) 384 if (ee->prop.max.h > 0)
386 maxh = (ee->prop.max.h + fw); 385 maxh = (ee->prop.max.h);
387 } 386 }
388 387
389 if ((maxw > 0) && (w > maxw)) 388 if ((maxw > 0) && (w > maxw))
@@ -401,13 +400,13 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
401 /* calc new size using base size & step size */ 400 /* calc new size using base size & step size */
402 if (ee->prop.step.w > 1) 401 if (ee->prop.step.w > 1)
403 { 402 {
404 int bw = ee->prop.base.w ?: minw; 403 int bw = ee->prop.base.w;
405 w = (bw + (((w - bw) / ee->prop.step.w) * ee->prop.step.w)); 404 w = (bw + (((w - bw) / ee->prop.step.w) * ee->prop.step.w));
406 } 405 }
407 406
408 if (ee->prop.step.h > 1) 407 if (ee->prop.step.h > 1)
409 { 408 {
410 int bh = ee->prop.base.h ?: minh; 409 int bh = ee->prop.base.h;
411 h = (bh + (((h - bh) / ee->prop.step.h) * ee->prop.step.h)); 410 h = (bh + (((h - bh) / ee->prop.step.h) * ee->prop.step.h));
412 } 411 }
413 412
@@ -1671,6 +1670,7 @@ _ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const char *n, const char *
1671static void 1670static void
1672_ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h) 1671_ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
1673{ 1672{
1673 int fw, fh;
1674 Ecore_Evas_Engine_Wl_Data *wdata; 1674 Ecore_Evas_Engine_Wl_Data *wdata;
1675 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1675 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1676 1676
@@ -1682,14 +1682,15 @@ _ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
1682 ee->prop.min.w = w; 1682 ee->prop.min.w = w;
1683 ee->prop.min.h = h; 1683 ee->prop.min.h = h;
1684 wdata = ee->engine.data; 1684 wdata = ee->engine.data;
1685 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
1685 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel) 1686 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel)
1686 { 1687 {
1687 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, w, h); 1688 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, w + fw, h + fh);
1688 wdata->win->pending.min = 0; 1689 wdata->win->pending.min = 0;
1689 } 1690 }
1690 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel) 1691 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel)
1691 { 1692 {
1692 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, w, h); 1693 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, w + fw, h + fh);
1693 wdata->win->pending.min = 0; 1694 wdata->win->pending.min = 0;
1694 } 1695 }
1695 else 1696 else
@@ -1700,6 +1701,7 @@ _ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
1700static void 1701static void
1701_ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h) 1702_ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h)
1702{ 1703{
1704 int fw, fh;
1703 Ecore_Evas_Engine_Wl_Data *wdata; 1705 Ecore_Evas_Engine_Wl_Data *wdata;
1704 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1706 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1705 1707
@@ -1710,14 +1712,15 @@ _ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h)
1710 ee->prop.max.w = w; 1712 ee->prop.max.w = w;
1711 ee->prop.max.h = h; 1713 ee->prop.max.h = h;
1712 wdata = ee->engine.data; 1714 wdata = ee->engine.data;
1715 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
1713 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel) 1716 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel)
1714 { 1717 {
1715 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, w, h); 1718 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, w + fw, h + fh);
1716 wdata->win->pending.max = 0; 1719 wdata->win->pending.max = 0;
1717 } 1720 }
1718 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel) 1721 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel)
1719 { 1722 {
1720 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, w, h); 1723 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, w + fw, h + fh);
1721 wdata->win->pending.max = 0; 1724 wdata->win->pending.max = 0;
1722 } 1725 }
1723 else 1726 else
@@ -2153,31 +2156,30 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee)
2153 { 2156 {
2154 int fw, fh; 2157 int fw, fh;
2155 2158
2159 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
2156 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min) 2160 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
2157 { 2161 {
2158 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w, ee->prop.min.h); 2162 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
2159 wdata->win->pending.min = 0; 2163 wdata->win->pending.min = 0;
2160 } 2164 }
2161 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max) 2165 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
2162 { 2166 {
2163 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w, ee->prop.max.h); 2167 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
2164 wdata->win->pending.max = 0; 2168 wdata->win->pending.max = 0;
2165 } 2169 }
2166 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min) 2170 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
2167 { 2171 {
2168 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h); 2172 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
2169 wdata->win->pending.min = 0; 2173 wdata->win->pending.min = 0;
2170 } 2174 }
2171 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max) 2175 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max)
2172 { 2176 {
2173 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w, ee->prop.max.h); 2177 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
2174 wdata->win->pending.max = 0; 2178 wdata->win->pending.max = 0;
2175 } 2179 }
2176 2180
2177 _ecore_evas_wayland_window_update(ee, wdata, ee->alpha); 2181 _ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
2178 2182
2179 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
2180
2181 ecore_wl2_window_show(wdata->win); 2183 ecore_wl2_window_show(wdata->win);
2182 einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas); 2184 einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
2183 if (einfo) 2185 if (einfo)
@@ -2560,7 +2562,8 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, i
2560 ee->alpha = EINA_FALSE; 2562 ee->alpha = EINA_FALSE;
2561 2563
2562 /* Wayland egl engine can't async render */ 2564 /* Wayland egl engine can't async render */
2563 if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER") || !strcmp(engine_name, "wayland_egl")) 2565 if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER") ||
2566 !strcmp(engine_name, "wayland_egl"))
2564 ee->can_async_render = 0; 2567 ee->can_async_render = 0;
2565 else 2568 else
2566 ee->can_async_render = 1; 2569 ee->can_async_render = 1;
@@ -2572,9 +2575,11 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, i
2572 wdata->display = ewd; 2575 wdata->display = ewd;
2573 2576
2574 wdata->win = ecore_wl2_window_new(ewd, p, x, y, w, h); 2577 wdata->win = ecore_wl2_window_new(ewd, p, x, y, w, h);
2575 ecore_wl2_window_close_callback_set(wdata->win, _ecore_evas_wl_common_win_close, ee); 2578 ecore_wl2_window_close_callback_set(wdata->win,
2579 _ecore_evas_wl_common_win_close, ee);
2576 ee->prop.window = (Ecore_Window)wdata->win; 2580 ee->prop.window = (Ecore_Window)wdata->win;
2577 ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win); 2581 ee->prop.aux_hint.supported_list =
2582 ecore_wl2_window_aux_hints_supported_get(wdata->win);
2578 ecore_evas_aux_hint_add(ee, "wm.policy.win.msg.use", "1"); 2583 ecore_evas_aux_hint_add(ee, "wm.policy.win.msg.use", "1");
2579 2584
2580 if (!ecore_evas_evas_new(ee, ee->w, ee->h)) 2585 if (!ecore_evas_evas_new(ee, ee->w, ee->h))
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index 97e5fb2..abea314 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -1534,6 +1534,8 @@ _ecore_evas_x_shadow_update(Ecore_Evas *ee)
1534 ECORE_X_ATOM_CARDINAL, 32, shadow, 4); 1534 ECORE_X_ATOM_CARDINAL, 32, shadow, 4);
1535} 1535}
1536 1536
1537static void _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee);
1538
1537static Eina_Bool 1539static Eina_Bool
1538_ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 1540_ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
1539{ 1541{
@@ -1672,6 +1674,8 @@ _ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSE
1672 } 1674 }
1673 } 1675 }
1674 } 1676 }
1677 if (framespace_resized)
1678 _ecore_evas_x_size_pos_hints_update(ee);
1675 } 1679 }
1676 return ECORE_CALLBACK_PASS_ON; 1680 return ECORE_CALLBACK_PASS_ON;
1677} 1681}
@@ -1763,15 +1767,19 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, vo
1763static void 1767static void
1764_ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee) 1768_ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee)
1765{ 1769{
1770 int fw, fh;
1771
1772 fw = ee->framespace.w;
1773 fh = ee->framespace.h;
1766 ecore_x_icccm_size_pos_hints_set(ee->prop.window, 1774 ecore_x_icccm_size_pos_hints_set(ee->prop.window,
1767 ee->prop.request_pos /*request_pos */, 1775 ee->prop.request_pos /*request_pos */,
1768 ECORE_X_GRAVITY_NW /* gravity */, 1776 ECORE_X_GRAVITY_NW /* gravity */,
1769 ee->prop.min.w /* min_w */, 1777 ee->prop.min.w + fw /* min_w */,
1770 ee->prop.min.h /* min_h */, 1778 ee->prop.min.h + fh /* min_h */,
1771 ee->prop.max.w /* max_w */, 1779 ee->prop.max.w + fw /* max_w */,
1772 ee->prop.max.h /* max_h */, 1780 ee->prop.max.h + fh /* max_h */,
1773 ee->prop.base.w /* base_w */, 1781 ee->prop.base.w + fw /* base_w */,
1774 ee->prop.base.h /* base_h */, 1782 ee->prop.base.h + fh /* base_h */,
1775 ee->prop.step.w /* step_x */, 1783 ee->prop.step.w /* step_x */,
1776 ee->prop.step.h /* step_y */, 1784 ee->prop.step.h /* step_y */,
1777 ee->prop.aspect /* min_aspect */, 1785 ee->prop.aspect /* min_aspect */,
diff --git a/src/modules/ecore_imf/meson.build b/src/modules/ecore_imf/meson.build
index b8a495a..72154d5 100644
--- a/src/modules/ecore_imf/meson.build
+++ b/src/modules/ecore_imf/meson.build
@@ -16,6 +16,11 @@ foreach mod_name : mods
16 mod_deps = [] 16 mod_deps = []
17 17
18 if loader_disabler.contains(mod_name) == false 18 if loader_disabler.contains(mod_name) == false
19 if mod_name == 'ibus'
20 if get_option('glib') == false
21 error('Need glib enabled if ibus is enabled')
22 endif
23 endif
19 mod_install_dir = join_paths(dir_package_modules, mod_name, version_name) 24 mod_install_dir = join_paths(dir_package_modules, mod_name, version_name)
20 subdir(mod_name) 25 subdir(mod_name)
21 module_files += join_paths(mod_install_dir, 'lib'+mod_name+'.'+sys_mod_extension) 26 module_files += join_paths(mod_install_dir, 'lib'+mod_name+'.'+sys_mod_extension)
diff --git a/src/modules/ecore_wl2/engines/dmabuf/ecore_wl2_surface_module_dmabuf.c b/src/modules/ecore_wl2/engines/dmabuf/ecore_wl2_surface_module_dmabuf.c
index 02e77f9..af394f3 100644
--- a/src/modules/ecore_wl2/engines/dmabuf/ecore_wl2_surface_module_dmabuf.c
+++ b/src/modules/ecore_wl2/engines/dmabuf/ecore_wl2_surface_module_dmabuf.c
@@ -3,6 +3,7 @@
3#endif 3#endif
4 4
5#include "Ecore_Wl2.h" 5#include "Ecore_Wl2.h"
6#include "ecore_wl2_internal.h"
6 7
7#include <sys/types.h> 8#include <sys/types.h>
8#include <sys/stat.h> 9#include <sys/stat.h>
diff --git a/src/modules/eeze/meson.build b/src/modules/eeze/meson.build
index e25ab50..919ff20 100644
--- a/src/modules/eeze/meson.build
+++ b/src/modules/eeze/meson.build
@@ -1,6 +1,5 @@
1sensors = [ 1sensors = [
2['fake', [ecore]], 2['fake', [ecore]],
3#['tizen', []],
4['udev', [ecore]], 3['udev', [ecore]],
5] 4]
6 5
diff --git a/src/modules/eeze/sensor/tizen/meson.build b/src/modules/eeze/sensor/tizen/meson.build
deleted file mode 100644
index c87f2cb..0000000
--- a/src/modules/eeze/sensor/tizen/meson.build
+++ /dev/null
@@ -1,8 +0,0 @@
1shared_module(module_name,
2 module_name+'.c',
3 dependencies: [eina, eeze, ecore],
4 install: true,
5 install_dir : join_paths(dir_package_modules, 'sensor', module_name, version_name),
6)
7
8module_files += join_paths(dir_package_modules, 'sensor', module_name, version_name, 'lib' + module_name + '.' + sys_lib_extension)
diff --git a/src/modules/eeze/sensor/tizen/tizen.c b/src/modules/eeze/sensor/tizen/tizen.c
deleted file mode 100644
index 93bea03..0000000
--- a/src/modules/eeze/sensor/tizen/tizen.c
+++ /dev/null
@@ -1,1383 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <system/sensors.h>
6
7#include <stdio.h>
8#include <stdlib.h>
9#include <stdbool.h>
10
11#include <Eina.h>
12#include <Ecore.h>
13#include <Eeze_Sensor.h>
14#include "eeze_sensor_private.h"
15
16static int _eeze_sensor_tizen_log_dom = -1;
17
18#ifdef ERR
19#undef ERR
20#endif
21#define ERR(...) EINA_LOG_DOM_ERR(_eeze_sensor_tizen_log_dom, __VA_ARGS__)
22
23static Eeze_Sensor_Module *esensor_module;
24/* Tizen sensor handle */
25static sensor_h sensor_handle;
26
27static void
28_dummy_free(void *user_data EINA_UNUSED, void *func_data EINA_UNUSED)
29{
30/* Don't free the event data after dispatching the event. We keep track of
31 * it on our own
32 */
33}
34
35
36/* The Tizen sensor type ENUM has shown to not be stable regarding its
37 * numbering scheme so we better translate between the Tizen types and the
38 * ones we use here.
39 */
40static sensor_type_e
41eeze_to_tizen(Eeze_Sensor_Type type)
42{
43 switch (type)
44 {
45 case EEZE_SENSOR_TYPE_ACCELEROMETER:
46 return SENSOR_ACCELEROMETER;
47
48 case EEZE_SENSOR_TYPE_GRAVITY:
49 return SENSOR_GRAVITY;
50
51 case EEZE_SENSOR_TYPE_LINEAR_ACCELERATION:
52 return SENSOR_LINEAR_ACCELERATION;
53
54 case EEZE_SENSOR_TYPE_DEVICE_ORIENTATION:
55 return SENSOR_DEVICE_ORIENTATION;
56
57 case EEZE_SENSOR_TYPE_MAGNETIC:
58 return SENSOR_MAGNETIC;
59
60 case EEZE_SENSOR_TYPE_ORIENTATION:
61 return SENSOR_ORIENTATION;
62
63 case EEZE_SENSOR_TYPE_GYROSCOPE:
64 return SENSOR_GYROSCOPE;
65
66 case EEZE_SENSOR_TYPE_LIGHT:
67 return SENSOR_LIGHT;
68
69 case EEZE_SENSOR_TYPE_PROXIMITY:
70 return SENSOR_PROXIMITY;
71
72 case EEZE_SENSOR_TYPE_MOTION_SNAP:
73 return SENSOR_MOTION_SNAP;
74
75 case EEZE_SENSOR_TYPE_MOTION_SHAKE:
76 return SENSOR_MOTION_SHAKE;
77
78 case EEZE_SENSOR_TYPE_MOTION_DOUBLETAP:
79 return SENSOR_MOTION_DOUBLETAP;
80
81 case EEZE_SENSOR_TYPE_MOTION_PANNING:
82 return SENSOR_MOTION_PANNING;
83
84 case EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE:
85 return SENSOR_MOTION_PANNING_BROWSE;
86
87 case EEZE_SENSOR_TYPE_MOTION_TILT:
88 return SENSOR_MOTION_TILT;
89
90 case EEZE_SENSOR_TYPE_MOTION_FACEDOWN:
91 return SENSOR_MOTION_FACEDOWN;
92
93 case EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL:
94 return SENSOR_MOTION_DIRECTCALL;
95
96 case EEZE_SENSOR_TYPE_MOTION_SMART_ALERT:
97 return SENSOR_MOTION_SMART_ALERT;
98
99 case EEZE_SENSOR_TYPE_MOTION_NO_MOVE:
100 return SENSOR_MOTION_NO_MOVE;
101
102 default:
103 ERR("No matching Tizen sensor type available.");
104 return -1;
105 }
106}
107
108/* Reverse mapping from Tizen to eeze sensor types */
109static Eeze_Sensor_Type
110tizen_to_eeze(sensor_type_e type)
111{
112 switch (type)
113 {
114 case SENSOR_ACCELEROMETER:
115 return EEZE_SENSOR_TYPE_ACCELEROMETER;
116
117 case SENSOR_GRAVITY:
118 return EEZE_SENSOR_TYPE_GRAVITY;
119
120 case SENSOR_LINEAR_ACCELERATION:
121 return EEZE_SENSOR_TYPE_LINEAR_ACCELERATION;
122
123 case SENSOR_DEVICE_ORIENTATION:
124 return EEZE_SENSOR_TYPE_DEVICE_ORIENTATION;
125
126 case SENSOR_MAGNETIC:
127 return EEZE_SENSOR_TYPE_MAGNETIC;
128
129 case SENSOR_ORIENTATION:
130 return EEZE_SENSOR_TYPE_ORIENTATION;
131
132 case SENSOR_GYROSCOPE:
133 return EEZE_SENSOR_TYPE_GYROSCOPE;
134
135 case SENSOR_LIGHT:
136 return EEZE_SENSOR_TYPE_LIGHT;
137
138 case SENSOR_PROXIMITY:
139 return EEZE_SENSOR_TYPE_PROXIMITY;
140
141 case SENSOR_MOTION_SNAP:
142 return EEZE_SENSOR_TYPE_MOTION_SNAP;
143
144 case SENSOR_MOTION_SHAKE:
145 return EEZE_SENSOR_TYPE_MOTION_SHAKE;
146
147 case SENSOR_MOTION_DOUBLETAP:
148 return EEZE_SENSOR_TYPE_MOTION_DOUBLETAP;
149
150 case SENSOR_MOTION_PANNING:
151 return EEZE_SENSOR_TYPE_MOTION_PANNING;
152
153 case SENSOR_MOTION_PANNING_BROWSE:
154 return EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE;
155
156 case SENSOR_MOTION_TILT:
157 return EEZE_SENSOR_TYPE_MOTION_TILT;
158
159 case SENSOR_MOTION_FACEDOWN:
160 return EEZE_SENSOR_TYPE_MOTION_FACEDOWN;
161
162 case SENSOR_MOTION_DIRECTCALL:
163 return EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL;
164
165 case SENSOR_MOTION_SMART_ALERT:
166 return EEZE_SENSOR_TYPE_MOTION_SMART_ALERT;
167
168 case SENSOR_MOTION_NO_MOVE:
169 return EEZE_SENSOR_TYPE_MOTION_NO_MOVE;
170
171 default:
172 ERR("No matching eeze sensor type available.");
173 return -1;
174 }
175}
176
177/* We receive the timestamp in nanoseconds from the Tizen system lib. Convert
178 * it to seconds as floating point value which is used in our public API.
179 */
180static double
181clock_convert(unsigned long long timestamp)
182{
183 return ((double)timestamp) / 1000000000.0;
184}
185
186/* All following callback function work with the same scheme.
187 * They are callbacks coming in from the tizen system sensor library. With the
188 * data we receive we update the matching sensor object to always have the
189 * latest data available. That includes updating the timestamp to show when the
190 * data was measured from the underlying system.
191 * After that we send out an ecore event to let all interested parties now that
192 * new data is available and then stop the sensor server to safe power. It will be
193 * started again the next time data gets requested.
194 */
195static void
196accelerometer_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
197{
198 Eeze_Sensor_Obj *obj = user_data;
199
200 if (obj == NULL)
201 {
202 ERR("No matching sensor object given.");
203 return;
204 }
205 obj->accuracy = accuracy;
206 obj->data[0] = x;
207 obj->data[1] = y;
208 obj->data[2] = z;
209 obj->timestamp = clock_convert(timestamp);
210 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, _dummy_free, NULL);
211 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER));
212}
213
214static void
215gravity_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
216{
217 Eeze_Sensor_Obj *obj = user_data;
218
219 if (obj == NULL)
220 {
221 ERR("No matching sensor object given.");
222 return;
223 }
224 obj->accuracy = accuracy;
225 obj->data[0] = x;
226 obj->data[1] = y;
227 obj->data[2] = z;
228 obj->timestamp = clock_convert(timestamp);
229 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, _dummy_free, NULL);
230 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY));
231}
232
233static void
234linear_acceleration_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
235{
236 Eeze_Sensor_Obj *obj = user_data;
237
238 if (obj == NULL)
239 {
240 ERR("No matching sensor object given.");
241 return;
242 }
243 obj->accuracy = accuracy;
244 obj->data[0] = x;
245 obj->data[1] = y;
246 obj->data[2] = z;
247 obj->timestamp = clock_convert(timestamp);
248 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, _dummy_free, NULL);
249 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION));
250}
251
252static void
253device_orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw,
254 float pitch, float roll, void *user_data)
255{
256 Eeze_Sensor_Obj *obj = user_data;
257
258 if (obj == NULL)
259 {
260 ERR("No matching sensor object given.");
261 return;
262 }
263 obj->accuracy = accuracy;
264 obj->data[0] = yaw;
265 obj->data[1] = pitch;
266 obj->data[2] = roll;
267 obj->timestamp = clock_convert(timestamp);
268 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, _dummy_free, NULL);
269 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION));
270}
271
272static void
273magnetic_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
274{
275 Eeze_Sensor_Obj *obj = user_data;
276
277 if (obj == NULL)
278 {
279 ERR("No matching sensor object given.");
280 return;
281 }
282 obj->accuracy = accuracy;
283 obj->data[0] = x;
284 obj->data[1] = y;
285 obj->data[2] = z;
286 obj->timestamp = clock_convert(timestamp);
287 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, _dummy_free, NULL);
288 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MAGNETIC));
289}
290
291static void
292orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float azimuth, float pitch, float roll, void *user_data)
293{
294 Eeze_Sensor_Obj *obj = user_data;
295
296 if (obj == NULL)
297 {
298 ERR("No matching sensor object given.");
299 return;
300 }
301 obj->accuracy = accuracy;
302 obj->data[0] = azimuth;
303 obj->data[1] = pitch;
304 obj->data[2] = roll;
305 obj->timestamp = clock_convert(timestamp);
306 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, _dummy_free, NULL);
307 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ORIENTATION));
308}
309
310static void
311gyroscope_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
312{
313 Eeze_Sensor_Obj *obj = user_data;
314
315 if (obj == NULL)
316 {
317 ERR("No matching sensor object given.");
318 return;
319 }
320 obj->accuracy = accuracy;
321 obj->data[0] = x;
322 obj->data[1] = y;
323 obj->data[2] = z;
324 obj->timestamp = clock_convert(timestamp);
325 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, _dummy_free, NULL);
326 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GYROSCOPE));
327}
328
329static void
330light_cb(unsigned long long timestamp, float lux, void *user_data)
331{
332 Eeze_Sensor_Obj *obj = user_data;
333
334 if (obj == NULL)
335 {
336 ERR("No matching sensor object given.");
337 return;
338 }
339 /* We have to set this ourselves because we don't get it for this type */
340 obj->accuracy = -1;
341 obj->data[0] = lux;
342 obj->timestamp = clock_convert(timestamp);
343 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, _dummy_free, NULL);
344 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LIGHT));
345}
346
347static void
348proximity_cb(unsigned long long timestamp, float distance, void *user_data)
349{
350 Eeze_Sensor_Obj *obj = user_data;
351
352 if (obj == NULL)
353 {
354 ERR("No matching sensor object given.");
355 return;
356 }
357 /* We have to set this ourselves because we don't get it for this type */
358 obj->accuracy = -1;
359 obj->data[0] = distance;
360 obj->timestamp = clock_convert(timestamp);
361 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, _dummy_free, NULL);
362 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_PROXIMITY));
363}
364
365static void
366snap_cb(unsigned long long timestamp, sensor_motion_snap_e snap, void *user_data)
367{
368 Eeze_Sensor_Obj *obj = user_data;
369
370 if (obj == NULL)
371 {
372 ERR("No matching sensor object given.");
373 return;
374 }
375 /* We have to set this ourselves because we don't get it for this type */
376 obj->accuracy = -1;
377 obj->data[0] = snap;
378 obj->timestamp = clock_convert(timestamp);
379 ecore_event_add(EEZE_SENSOR_EVENT_SNAP, obj, _dummy_free, NULL);
380 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SNAP));
381}
382
383static void
384shake_cb(unsigned long long timestamp, sensor_motion_shake_e shake, void *user_data)
385{
386 Eeze_Sensor_Obj *obj = user_data;
387
388 if (obj == NULL)
389 {
390 ERR("No matching sensor object given.");
391 return;
392 }
393 /* We have to set this ourselves because we don't get it for this type */
394 obj->accuracy = -1;
395 obj->data[0] = shake;
396 obj->timestamp = clock_convert(timestamp);
397 ecore_event_add(EEZE_SENSOR_EVENT_SHAKE, obj, _dummy_free, NULL);
398 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SHAKE));
399}
400
401static void
402panning_cb(unsigned long long timestamp, int x, int y, void *user_data)
403{
404 Eeze_Sensor_Obj *obj = user_data;
405
406 if (obj == NULL)
407 {
408 ERR("No matching sensor object given.");
409 return;
410 }
411 /* We have to set this ourselves because we don't get it for this type */
412 obj->accuracy = -1;
413 obj->data[0] = x;
414 obj->data[1] = y;
415 obj->timestamp = clock_convert(timestamp);
416 ecore_event_add(EEZE_SENSOR_EVENT_PANNING, obj, _dummy_free, NULL);
417 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING));
418}
419
420static void
421panning_browse_cb(unsigned long long timestamp, int x, int y, void *user_data)
422{
423 Eeze_Sensor_Obj *obj = user_data;
424
425 if (obj == NULL)
426 {
427 ERR("No matching sensor object given.");
428 return;
429 }
430 /* We have to set this ourselves because we don't get it for this type */
431 obj->accuracy = -1;
432 obj->data[0] = x;
433 obj->data[1] = y;
434 obj->timestamp = clock_convert(timestamp);
435 ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, _dummy_free, NULL);
436 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE));
437}
438
439static void
440tilt_cb(unsigned long long timestamp, int x, int y, void *user_data)
441{
442 Eeze_Sensor_Obj *obj = user_data;
443
444 if (obj == NULL)
445 {
446 ERR("No matching sensor object given.");
447 return;
448 }
449 /* We have to set this ourselves because we don't get it for this type */
450 obj->accuracy = -1;
451 obj->data[0] = x;
452 obj->data[1] = y;
453 obj->timestamp = clock_convert(timestamp);
454 ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, _dummy_free, NULL);
455 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT));
456}
457
458static void
459facedown_cb(unsigned long long timestamp, void *user_data)
460{
461 Eeze_Sensor_Obj *obj = user_data;
462
463 if (obj == NULL)
464 {
465 ERR("No matching sensor object given.");
466 return;
467 }
468 /* We have to set this ourselves because we don't get it for this type */
469 obj->accuracy = -1;
470 obj->timestamp = clock_convert(timestamp);
471 ecore_event_add(EEZE_SENSOR_EVENT_FACEDOWN, obj, _dummy_free, NULL);
472 /* We are not stopping the sensor here because we want to keep it as a motion
473 * event coming in at any time.
474 */
475}
476
477static void
478directcall_cb(unsigned long long timestamp, void *user_data)
479{
480 Eeze_Sensor_Obj *obj = user_data;
481
482 if (obj == NULL)
483 {
484 ERR("No matching sensor object given.");
485 return;
486 }
487 /* We have to set this ourselves because we don't get it for this type */
488 obj->accuracy = -1;
489 obj->timestamp = clock_convert(timestamp);
490 ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, _dummy_free, NULL);
491 /* We are not stopping the sensor here because we want to keep it as a motion
492 * event coming in at any time.
493 */
494}
495
496static void
497smart_alert_cb(unsigned long long timestamp, void *user_data)
498{
499 Eeze_Sensor_Obj *obj = user_data;
500
501 if (obj == NULL)
502 {
503 ERR("No matching sensor object given.");
504 return;
505 }
506 /* We have to set this ourselves because we don't get it for this type */
507 obj->accuracy = -1;
508 obj->timestamp = clock_convert(timestamp);
509 ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, _dummy_free, NULL);
510 /* We are not stopping the sensor here because we want to keep it as a motion
511 * event coming in at any time.
512 */
513}
514
515static void
516no_move_cb(unsigned long long timestamp, void *user_data)
517{
518 Eeze_Sensor_Obj *obj = user_data;
519
520 if (obj == NULL)
521 {
522 ERR("No matching sensor object given.");
523 return;
524 }
525 /* We have to set this ourselves because we don't get it for this type */
526 obj->accuracy = -1;
527 obj->timestamp = clock_convert(timestamp);
528 ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, _dummy_free, NULL);
529 /* We are not stopping the sensor here because we want to keep it as a motion
530 * event coming in at any time.
531 */
532}
533
534static void
535doubletap_cb(unsigned long long timestamp, void *user_data)
536{
537 Eeze_Sensor_Obj *obj = user_data;
538
539 if (obj == NULL)
540 {
541 ERR("No matching sensor object given.");
542 return;
543 }
544 /* We have to set this ourselves because we don't get it for this type */
545 obj->accuracy = -1;
546 obj->timestamp = clock_convert(timestamp);
547 ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, _dummy_free, NULL);
548 /* We are not stopping the sensor here because we want to keep it as a motion
549 * event coming in at any time.
550 */
551}
552
553static void
554accelerometer_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
555{
556 Eeze_Sensor_Obj *obj = user_data;
557
558 sensor_accelerometer_unset_cb(sensor_handle);
559
560 if (obj == NULL)
561 {
562 ERR("No matching sensor object given.");
563 return;
564 }
565 obj->accuracy = accuracy;
566 obj->data[0] = x;
567 obj->data[1] = y;
568 obj->data[2] = z;
569 obj->timestamp = clock_convert(timestamp);
570 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, _dummy_free, NULL);
571 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER));
572}
573
574static void
575gravity_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
576{
577 Eeze_Sensor_Obj *obj = user_data;
578
579 sensor_gravity_unset_cb(sensor_handle);
580
581 if (obj == NULL)
582 {
583 ERR("No matching sensor object given.");
584 return;
585 }
586 obj->accuracy = accuracy;
587 obj->data[0] = x;
588 obj->data[1] = y;
589 obj->data[2] = z;
590 obj->timestamp = clock_convert(timestamp);
591 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, _dummy_free, NULL);
592 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY));
593}
594
595static void
596linear_acceleration_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
597{
598 Eeze_Sensor_Obj *obj = user_data;
599
600 sensor_linear_acceleration_unset_cb(sensor_handle);
601
602 if (obj == NULL)
603 {
604 ERR("No matching sensor object given.");
605 return;
606 }
607 obj->accuracy = accuracy;
608 obj->data[0] = x;
609 obj->data[1] = y;
610 obj->data[2] = z;
611 obj->timestamp = clock_convert(timestamp);
612 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, _dummy_free, NULL);
613 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION));
614}
615
616static void
617device_orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw,
618 float pitch, float roll, void *user_data)
619{
620 Eeze_Sensor_Obj *obj = user_data;
621
622 sensor_device_orientation_unset_cb(sensor_handle);
623
624 if (obj == NULL)
625 {
626 ERR("No matching sensor object given.");
627 return;
628 }
629 obj->accuracy = accuracy;
630 obj->data[0] = yaw;
631 obj->data[1] = pitch;
632 obj->data[2] = roll;
633 obj->timestamp = clock_convert(timestamp);
634 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, _dummy_free, NULL);
635 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION));
636}
637
638static void
639magnetic_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
640{
641 Eeze_Sensor_Obj *obj = user_data;
642
643 sensor_magnetic_unset_cb(sensor_handle);
644
645 if (obj == NULL)
646 {
647 ERR("No matching sensor object given.");
648 return;
649 }
650 obj->accuracy = accuracy;
651 obj->data[0] = x;
652 obj->data[1] = y;
653 obj->data[2] = z;
654 obj->timestamp = clock_convert(timestamp);
655 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, _dummy_free, NULL);
656 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MAGNETIC));
657}
658
659static void
660orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float azimuth, float pitch, float roll, void *user_data)
661{
662 Eeze_Sensor_Obj *obj = user_data;
663
664 sensor_orientation_unset_cb(sensor_handle);
665
666 if (obj == NULL)
667 {
668 ERR("No matching sensor object given.");
669 return;
670 }
671 obj->accuracy = accuracy;
672 obj->data[0] = azimuth;
673 obj->data[1] = pitch;
674 obj->data[2] = roll;
675 obj->timestamp = clock_convert(timestamp);
676 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, _dummy_free, NULL);
677 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ORIENTATION));
678}
679
680static void
681gyroscope_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
682{
683 Eeze_Sensor_Obj *obj = user_data;
684
685 sensor_gyroscope_unset_cb(sensor_handle);
686
687 if (obj == NULL)
688 {
689 ERR("No matching sensor object given.");
690 return;
691 }
692 obj->accuracy = accuracy;
693 obj->data[0] = x;
694 obj->data[1] = y;
695 obj->data[2] = z;
696 obj->timestamp = clock_convert(timestamp);
697 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, _dummy_free, NULL);
698 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GYROSCOPE));
699}
700
701static void
702light_read_cb(unsigned long long timestamp, float lux, void *user_data)
703{
704 Eeze_Sensor_Obj *obj = user_data;
705
706 sensor_light_unset_cb(sensor_handle);
707
708 if (obj == NULL)
709 {
710 ERR("No matching sensor object given.");
711 return;
712 }
713 /* We have to set this ourselves because we don't get it for this type */
714 obj->accuracy = -1;
715 obj->data[0] = lux;
716 obj->timestamp = clock_convert(timestamp);
717 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, _dummy_free, NULL);
718 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LIGHT));
719}
720
721static void
722proximity_read_cb(unsigned long long timestamp, float distance, void *user_data)
723{
724 Eeze_Sensor_Obj *obj = user_data;
725
726 sensor_proximity_unset_cb(sensor_handle);
727
728 if (obj == NULL)
729 {
730 ERR("No matching sensor object given.");
731 return;
732 }
733 /* We have to set this ourselves because we don't get it for this type */
734 obj->accuracy = -1;
735 obj->data[0] = distance;
736 obj->timestamp = clock_convert(timestamp);
737 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, _dummy_free, NULL);
738 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_PROXIMITY));
739}
740
741static void
742snap_read_cb(unsigned long long timestamp, sensor_motion_snap_e snap, void *user_data)
743{
744 Eeze_Sensor_Obj *obj = user_data;
745
746 sensor_motion_snap_unset_cb(sensor_handle);
747
748 if (obj == NULL)
749 {
750 ERR("No matching sensor object given.");
751 return;
752 }
753 /* We have to set this ourselves because we don't get it for this type */
754 obj->accuracy = -1;
755 obj->data[0] = snap;
756 obj->timestamp = clock_convert(timestamp);
757 ecore_event_add(EEZE_SENSOR_EVENT_SNAP, obj, _dummy_free, NULL);
758 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SNAP));
759}
760
761static void
762shake_read_cb(unsigned long long timestamp, sensor_motion_shake_e shake, void *user_data)
763{
764 Eeze_Sensor_Obj *obj = user_data;
765
766 sensor_motion_shake_unset_cb(sensor_handle);
767
768 if (obj == NULL)
769 {
770 ERR("No matching sensor object given.");
771 return;
772 }
773 /* We have to set this ourselves because we don't get it for this type */
774 obj->accuracy = -1;
775 obj->data[0] = shake;
776 obj->timestamp = clock_convert(timestamp);
777 ecore_event_add(EEZE_SENSOR_EVENT_SHAKE, obj, _dummy_free, NULL);
778 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SHAKE));
779}
780
781static void
782doubletap_read_cb(unsigned long long timestamp, void *user_data)
783{
784 Eeze_Sensor_Obj *obj = user_data;
785
786 sensor_motion_doubletap_unset_cb(sensor_handle);
787
788 if (obj == NULL)
789 {
790 ERR("No matching sensor object given.");
791 return;
792 }
793 /* We have to set this ourselves because we don't get it for this type */
794 obj->accuracy = -1;
795 obj->timestamp = clock_convert(timestamp);
796 ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, _dummy_free, NULL);
797 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP));
798}
799
800static void
801panning_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
802{
803 Eeze_Sensor_Obj *obj = user_data;
804
805 sensor_motion_panning_unset_cb(sensor_handle);
806
807 if (obj == NULL)
808 {
809 ERR("No matching sensor object given.");
810 return;
811 }
812 /* We have to set this ourselves because we don't get it for this type */
813 obj->accuracy = -1;
814 obj->data[0] = x;
815 obj->data[1] = y;
816 obj->timestamp = clock_convert(timestamp);
817 ecore_event_add(EEZE_SENSOR_EVENT_PANNING, obj, _dummy_free, NULL);
818 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING));
819}
820
821static void
822panning_browse_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
823{
824 Eeze_Sensor_Obj *obj = user_data;
825
826 sensor_motion_panning_browse_unset_cb(sensor_handle);
827
828 if (obj == NULL)
829 {
830 ERR("No matching sensor object given.");
831 return;
832 }
833 /* We have to set this ourselves because we don't get it for this type */
834 obj->accuracy = -1;
835 obj->data[0] = x;
836 obj->data[1] = y;
837 obj->timestamp = clock_convert(timestamp);
838 ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, _dummy_free, NULL);
839 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE));
840}
841
842static void
843tilt_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
844{
845 Eeze_Sensor_Obj *obj = user_data;
846
847 sensor_motion_tilt_unset_cb(sensor_handle);
848
849 if (obj == NULL)
850 {
851 ERR("No matching sensor object given.");
852 return;
853 }
854 /* We have to set this ourselves because we don't get it for this type */
855 obj->accuracy = -1;
856 obj->data[0] = x;
857 obj->data[1] = y;
858 obj->timestamp = clock_convert(timestamp);
859 ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, _dummy_free, NULL);
860 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT));
861}
862
863static void
864facedown_read_cb(unsigned long long timestamp, void *user_data)
865{
866 Eeze_Sensor_Obj *obj = user_data;
867
868 sensor_motion_facedown_unset_cb(sensor_handle);
869
870 if (obj == NULL)
871 {
872 ERR("No matching sensor object given.");
873 return;
874 }
875 /* We have to set this ourselves because we don't get it for this type */
876 obj->accuracy = -1;
877 obj->timestamp = clock_convert(timestamp);
878 ecore_event_add(EEZE_SENSOR_EVENT_FACEDOWN, obj, _dummy_free, NULL);
879 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_FACEDOWN));
880}
881
882static void
883directcall_read_cb(unsigned long long timestamp, void *user_data)
884{
885 Eeze_Sensor_Obj *obj = user_data;
886
887 sensor_motion_directcall_unset_cb(sensor_handle);
888
889 if (obj == NULL)
890 {
891 ERR("No matching sensor object given.");
892 return;
893 }
894 /* We have to set this ourselves because we don't get it for this type */
895 obj->accuracy = -1;
896 obj->timestamp = clock_convert(timestamp);
897 ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, _dummy_free, NULL);
898 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL));
899}
900
901static void
902smart_alert_read_cb(unsigned long long timestamp, void *user_data)
903{
904 Eeze_Sensor_Obj *obj = user_data;
905
906 sensor_motion_smart_alert_unset_cb(sensor_handle);
907
908 if (obj == NULL)
909 {
910 ERR("No matching sensor object given.");
911 return;
912 }
913 /* We have to set this ourselves because we don't get it for this type */
914 obj->accuracy = -1;
915 obj->timestamp = clock_convert(timestamp);
916 ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, _dummy_free, NULL);
917 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT));
918}
919
920static void
921no_move_read_cb(unsigned long long timestamp, void *user_data)
922{
923 Eeze_Sensor_Obj *obj = user_data;
924
925 sensor_motion_no_move_unset_cb(sensor_handle);
926
927 if (obj == NULL)
928 {
929 ERR("No matching sensor object given.");
930 return;
931 }
932 /* We have to set this ourselves because we don't get it for this type */
933 obj->accuracy = -1;
934 obj->timestamp = clock_convert(timestamp);
935 ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, _dummy_free, NULL);
936 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_NO_MOVE));
937}
938
939/* Synchronous read function for sensor data. It uses the blocking calls to read
940 * out the data and returns after it finishes the readout. Be aware that this
941 * might take quite some time depending on the sensor and how it is connected to
942 * the system. Normally it is better to use the asynchronous reading functions.
943 */
944static Eina_Bool
945eeze_sensor_tizen_read(Eeze_Sensor_Obj *obj)
946{
947 sensor_data_accuracy_e accuracy;
948 float x, y, z;
949 float azimuth, pitch, roll, lux, distance, yaw;
950 bool supported;
951 sensor_type_e type;
952
953 type = eeze_to_tizen(obj->type);
954
955 /* Don't attempt to do anything if the sensor is not available on the system
956 * we are running on.
957 */
958 sensor_is_supported(type, &supported);
959 if (!supported)
960 {
961 ERR("Sensor type %d not available on this device.", type);
962 return EINA_FALSE;
963 }
964
965 sensor_start(sensor_handle, type);
966
967 switch (type)
968 {
969 case SENSOR_ACCELEROMETER:
970 sensor_accelerometer_read_data(sensor_handle, &accuracy, &x, &y, &z);
971 obj->accuracy = accuracy;
972 obj->data[0] = x;
973 obj->data[1] = y;
974 obj->data[2] = z;
975 obj->timestamp = ecore_time_get();
976 break;
977
978 case SENSOR_GRAVITY:
979 sensor_gravity_read_data(sensor_handle, &accuracy, &x, &y, &z);
980 obj->accuracy = accuracy;
981 obj->data[0] = x;
982 obj->data[1] = y;
983 obj->data[2] = z;
984 obj->timestamp = ecore_time_get();
985 break;
986
987 case SENSOR_LINEAR_ACCELERATION:
988 sensor_linear_acceleration_read_data(sensor_handle, &accuracy, &x, &y, &z);
989 obj->accuracy = accuracy;
990 obj->data[0] = x;
991 obj->data[1] = y;
992 obj->data[2] = z;
993 obj->timestamp = ecore_time_get();
994 break;
995
996 case SENSOR_DEVICE_ORIENTATION:
997 sensor_device_orientation_read_data(sensor_handle, &accuracy, &yaw, &pitch, &roll);
998 obj->accuracy = accuracy;
999 obj->data[0] = yaw;
1000 obj->data[1] = pitch;
1001 obj->data[2] = roll;
1002 obj->timestamp = ecore_time_get();
1003 break;
1004
1005 case SENSOR_MAGNETIC:
1006 sensor_magnetic_read_data(sensor_handle, &accuracy, &x, &y, &z);
1007 obj->accuracy = accuracy;
1008 obj->data[0] = x;
1009 obj->data[1] = y;
1010 obj->data[2] = z;
1011 obj->timestamp = ecore_time_get();
1012 break;
1013
1014 case SENSOR_ORIENTATION:
1015 sensor_orientation_read_data(sensor_handle, &accuracy, &azimuth, &pitch, &roll);
1016 obj->accuracy = accuracy;
1017 obj->data[0] = azimuth;
1018 obj->data[1] = pitch;
1019 obj->data[2] = roll;
1020 obj->timestamp = ecore_time_get();
1021 break;
1022
1023 case SENSOR_GYROSCOPE:
1024 sensor_gyroscope_read_data(sensor_handle, &accuracy, &x, &y, &z);
1025 obj->accuracy = accuracy;
1026 obj->data[0] = x;
1027 obj->data[1] = y;
1028 obj->data[2] = z;
1029 obj->timestamp = ecore_time_get();
1030 break;
1031
1032 case SENSOR_LIGHT:
1033 sensor_light_read_data(sensor_handle, &lux);
1034 /* As we do not get any accuracy value from the system we go with -1 */
1035 obj->accuracy = -1;
1036 obj->data[0] = lux;
1037 obj->timestamp = ecore_time_get();
1038 break;
1039
1040 case SENSOR_PROXIMITY:
1041 sensor_proximity_read_data(sensor_handle, &distance);
1042 /* As we do not get any accuracy value from the system we go with -1 */
1043 obj->accuracy = -1;
1044 obj->data[0] = distance;
1045 obj->timestamp = ecore_time_get();
1046 break;
1047
1048 default:
1049 ERR("Not possible to read from this sensor type.");
1050 return EINA_FALSE;
1051 }
1052
1053 sensor_stop(sensor_handle, type);
1054 return EINA_TRUE;
1055}
1056
1057// FIXME ho to handle this without explicit callback setting
1058#if 0
1059static Eina_Bool
1060eeze_sensor_tizen_cb_set(Eeze_Sensor *handle, Eeze_Sensor_Type sensor_type, void *cb_function, void *user_data)
1061{
1062 sensor_type_e type;
1063
1064 type = eeze_to_tizen(sensor_type);
1065
1066 handle->cb_function = cb_function;
1067
1068 sensor_start(sensor_handle, type);
1069
1070 switch (type)
1071 {
1072 case SENSOR_ACCELEROMETER:
1073 sensor_accelerometer_set_cb(sensor_handle, 0, accelerometer_cb, handle);
1074 break;
1075
1076 case SENSOR_GRAVITY:
1077 sensor_gravity_set_cb(sensor_handle, 0, gravity_cb, handle);
1078 break;
1079
1080 case SENSOR_LINEAR_ACCELERATION:
1081 sensor_linear_acceleration_set_cb(sensor_handle, 0, linear_acceleration_cb, handle);
1082 break;
1083
1084 case SENSOR_DEVICE_ORIENTATION:
1085 sensor_device_orientation_set_cb(sensor_handle, 0, device_orientation_cb, handle);
1086 break;
1087
1088 case SENSOR_MAGNETIC:
1089 sensor_magnetic_set_cb(sensor_handle, 0, magnetic_cb, handle);
1090 break;
1091
1092 case SENSOR_ORIENTATION:
1093 sensor_orientation_set_cb(sensor_handle, 0, orientation_cb, handle);
1094 break;
1095
1096 case SENSOR_GYROSCOPE:
1097 sensor_gyroscope_set_cb(sensor_handle, 0, gyroscope_cb, handle);
1098 break;
1099
1100 case SENSOR_LIGHT:
1101 sensor_light_set_cb(sensor_handle, 0, light_cb, handle);
1102 break;
1103
1104 case SENSOR_PROXIMITY:
1105 sensor_proximity_set_cb(sensor_handle, 0, proximity_cb, handle);
1106 break;
1107
1108 case SENSOR_MOTION_SNAP:
1109 sensor_motion_snap_set_cb(sensor_handle, snap_cb, handle);
1110 break;
1111
1112 case SENSOR_MOTION_SHAKE:
1113 sensor_motion_shake_set_cb(sensor_handle, shake_cb, handle);
1114 break;
1115
1116 case SENSOR_MOTION_DOUBLETAP:
1117 sensor_motion_doubletap_set_cb(sensor_handle, doubletap_cb, handle);
1118 break;
1119
1120 case SENSOR_MOTION_PANNING:
1121 sensor_motion_panning_set_cb(sensor_handle, panning_cb, handle);
1122 break;
1123
1124 case SENSOR_MOTION_PANNING_BROWSE:
1125 sensor_motion_panning_browse_set_cb(sensor_handle, panning_browse_cb, handle);
1126 break;
1127
1128 case SENSOR_MOTION_TILT:
1129 sensor_motion_tilt_set_cb(sensor_handle, tilt_cb, handle);
1130 break;
1131
1132 case SENSOR_MOTION_FACEDOWN:
1133 sensor_motion_facedown_set_cb(sensor_handle, facedown_cb, handle);
1134 break;
1135
1136 case SENSOR_MOTION_DIRECTCALL:
1137 sensor_motion_directcall_set_cb(sensor_handle, directcall_cb, handle);
1138 break;
1139
1140 case SENSOR_MOTION_SMART_ALERT:
1141 sensor_motion_smart_alert_set_cb(sensor_handle, smart_alert_cb, handle);
1142 break;
1143
1144 case SENSOR_MOTION_NO_MOVE:
1145 sensor_motion_no_move_set_cb(sensor_handle, no_move_cb, handle);
1146 break;
1147
1148 default:
1149 ERR("Not possible to set a callback for this sensor type.");
1150 return EINA_FALSE;
1151 }
1152 return EINA_TRUE;
1153}
1154#endif
1155
1156/* For the asynchronous reads we only start the sensor her and trigger the
1157 * readout. The callbacks above are actually taking care about putting the data
1158 * into the matching sensor objects and informing all subscribers with an ecore
1159 * event. The public API function does actually return right away with the cached
1160 * data. This is handled in the core and not in the different modules though.
1161 */
1162static Eina_Bool
1163eeze_sensor_tizen_async_read(Eeze_Sensor_Obj *obj, void *user_data)
1164{
1165 sensor_type_e type;
1166
1167 if (user_data)
1168 obj->user_data = user_data;
1169
1170 type = eeze_to_tizen(obj->type);
1171
1172 sensor_start(sensor_handle, type);
1173
1174 switch (type)
1175 {
1176 case SENSOR_ACCELEROMETER:
1177 sensor_accelerometer_set_cb(sensor_handle, 0, accelerometer_read_cb, obj);
1178 break;
1179
1180 case SENSOR_GRAVITY:
1181 sensor_gravity_set_cb(sensor_handle, 0, gravity_read_cb, obj);
1182 break;
1183
1184 case SENSOR_LINEAR_ACCELERATION:
1185 sensor_linear_acceleration_set_cb(sensor_handle, 0, linear_acceleration_read_cb, obj);
1186 break;
1187
1188 case SENSOR_DEVICE_ORIENTATION:
1189 sensor_device_orientation_set_cb(sensor_handle, 0, device_orientation_read_cb, obj);
1190 break;
1191
1192 case SENSOR_MAGNETIC:
1193 sensor_magnetic_set_cb(sensor_handle, 0, magnetic_read_cb, obj);
1194 break;
1195
1196 case SENSOR_ORIENTATION:
1197 sensor_orientation_set_cb(sensor_handle, 0, orientation_read_cb, obj);
1198 break;
1199
1200 case SENSOR_GYROSCOPE:
1201 sensor_gyroscope_set_cb(sensor_handle, 0, gyroscope_read_cb, obj);
1202 break;
1203
1204 case SENSOR_LIGHT:
1205 sensor_light_set_cb(sensor_handle, 0, light_read_cb, obj);
1206 break;
1207
1208 case SENSOR_PROXIMITY:
1209 sensor_proximity_set_cb(sensor_handle, 0, proximity_read_cb, obj);
1210 break;
1211
1212 case SENSOR_MOTION_SNAP:
1213 sensor_motion_snap_set_cb(sensor_handle, snap_read_cb, obj);
1214 break;
1215
1216 case SENSOR_MOTION_SHAKE:
1217 sensor_motion_shake_set_cb(sensor_handle, shake_read_cb, obj);
1218 break;
1219
1220 case SENSOR_MOTION_DOUBLETAP:
1221 sensor_motion_doubletap_set_cb(sensor_handle, doubletap_read_cb, obj);
1222 break;
1223
1224 case SENSOR_MOTION_PANNING:
1225 sensor_motion_panning_set_cb(sensor_handle, panning_read_cb, obj);
1226 break;
1227
1228 case SENSOR_MOTION_PANNING_BROWSE:
1229 sensor_motion_panning_browse_set_cb(sensor_handle, panning_browse_read_cb, obj);
1230 break;
1231
1232 case SENSOR_MOTION_TILT:
1233 sensor_motion_tilt_set_cb(sensor_handle, tilt_read_cb, obj);
1234 break;
1235
1236 case SENSOR_MOTION_FACEDOWN:
1237 sensor_motion_facedown_set_cb(sensor_handle, facedown_read_cb, obj);
1238 break;
1239
1240 case SENSOR_MOTION_DIRECTCALL:
1241 sensor_motion_directcall_set_cb(sensor_handle, directcall_read_cb, obj);
1242 break;
1243
1244 case SENSOR_MOTION_SMART_ALERT:
1245 sensor_motion_smart_alert_set_cb(sensor_handle, smart_alert_read_cb, obj);
1246 break;
1247
1248 case SENSOR_MOTION_NO_MOVE:
1249 sensor_motion_no_move_set_cb(sensor_handle, no_move_read_cb, obj);
1250 break;
1251
1252 default:
1253 ERR("Not possible to set a callback for this sensor type.");
1254 return EINA_FALSE;
1255 }
1256 return EINA_TRUE;
1257}
1258
1259/* Go through all potential Tizen sensor and test if they are available on the
1260 * system we are running on. If yes, create a matching sensor object and put it
1261 * the list of available sensor for the core.
1262 */
1263static void
1264eeze_sensor_tizen_sensors_find(void)
1265{
1266 sensor_type_e type;
1267 bool supported = 0;
1268
1269 for (type = SENSOR_ACCELEROMETER; type <= SENSOR_LAST; type++)
1270 {
1271 sensor_is_supported(type, &supported);
1272 if (supported)
1273 {
1274 Eeze_Sensor_Obj *obj = calloc(1, sizeof(Eeze_Sensor_Obj));
1275 obj->type = tizen_to_eeze(type);
1276 esensor_module->sensor_list = eina_list_append(esensor_module->sensor_list, obj);
1277 }
1278 }
1279}
1280
1281/* Cleanup when getting the shutdown callback from core */
1282static Eina_Bool
1283eeze_sensor_tizen_shutdown(void)
1284{
1285 Eeze_Sensor_Obj *obj;
1286
1287 EINA_LIST_FREE(esensor_module->sensor_list, obj)
1288 free(obj);
1289
1290 sensor_stop(sensor_handle, SENSOR_MOTION_FACEDOWN);
1291 sensor_stop(sensor_handle, SENSOR_MOTION_DOUBLETAP);
1292 if (sensor_destroy(sensor_handle) != 0)
1293 {
1294 ERR("Failing to destroy sensor handle.");
1295 return EINA_FALSE;
1296 }
1297 return EINA_TRUE;
1298}
1299
1300/* Callback from core once we registered as a module. Create the Tizen sensor
1301 * handle and find all available sensors.
1302 */
1303static Eina_Bool
1304eeze_sensor_tizen_init(void)
1305{
1306
1307 if (sensor_create(&sensor_handle) != 0)
1308 {
1309 ERR("Failing to create sensor handle.");
1310 return EINA_FALSE;
1311 }
1312
1313 eeze_sensor_tizen_sensors_find();
1314
1315 /* FIXME add other motion events in here */
1316 sensor_start(sensor_handle, SENSOR_MOTION_FACEDOWN);
1317 sensor_start(sensor_handle, SENSOR_MOTION_DOUBLETAP);
1318 sensor_motion_doubletap_set_cb(sensor_handle, doubletap_cb,
1319 eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP));
1320 sensor_motion_facedown_set_cb(sensor_handle, facedown_cb,
1321 eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_FACEDOWN));
1322
1323 return EINA_TRUE;
1324}
1325
1326/* This function gets called when the module is loaded from the disk. Its the
1327 * entry point to anything in this module. After setting ourself up we register
1328 * into the core of eeze sensor to make our functionality available.
1329 */
1330static Eina_Bool
1331sensor_tizen_init(void)
1332{
1333
1334 _eeze_sensor_tizen_log_dom = eina_log_domain_register("eeze_sensor_tizen", EINA_COLOR_BLUE);
1335 if (_eeze_sensor_tizen_log_dom < 0)
1336 {
1337 EINA_LOG_ERR("Could not register 'eeze_sensor_tizen' log domain.");
1338 return EINA_FALSE;
1339 }
1340
1341 /* Check to avoid multi-init */
1342 if (esensor_module) return EINA_FALSE;
1343
1344 /* Set module function pointer to allow calls into the module */
1345 esensor_module = calloc(1, sizeof(Eeze_Sensor_Module));
1346 if (!esensor_module) return EINA_FALSE;
1347
1348 esensor_module->init = eeze_sensor_tizen_init;
1349 esensor_module->shutdown = eeze_sensor_tizen_shutdown;
1350 esensor_module->read = eeze_sensor_tizen_read;
1351 esensor_module->async_read = eeze_sensor_tizen_async_read;
1352
1353 if (!eeze_sensor_module_register("tizen", esensor_module))
1354 {
1355 ERR("Failed to register tizen module");
1356 return EINA_FALSE;
1357 }
1358 return EINA_TRUE;
1359}
1360
1361/* Cleanup when the module gets unloaded. Unregister ourself from the core to
1362 * avoid calls into a not loaded module.
1363 */
1364static void
1365sensor_tizen_shutdown(void)
1366{
1367 Eeze_Sensor_Obj *sens;
1368
1369 eeze_sensor_module_unregister("tizen");
1370 EINA_LIST_FREE(esensor_module->sensor_list, sens)
1371 free(sens);
1372
1373 eina_log_domain_unregister(_eeze_sensor_tizen_log_dom);
1374
1375 free(esensor_module);
1376 esensor_module = NULL;
1377
1378 _eeze_sensor_tizen_log_dom = -1;
1379}
1380
1381EINA_MODULE_INIT(sensor_tizen_init);
1382EINA_MODULE_SHUTDOWN(sensor_tizen_shutdown);
1383
diff --git a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
index 6d4facf..261b02c 100644
--- a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
+++ b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
@@ -182,16 +182,10 @@ _eina_chained_mempool_usage_cmp(const Eina_Inlist *l1, const Eina_Inlist *l2)
182static void * 182static void *
183_eina_chained_mempool_alloc_in(Chained_Mempool *pool, Chained_Pool *p) 183_eina_chained_mempool_alloc_in(Chained_Mempool *pool, Chained_Pool *p)
184{ 184{
185 void *mem; 185 void *mem = NULL;
186 186
187 if (p->last) 187 // Let's try to first recycle memory
188 { 188 if (p->base)
189 mem = p->last;
190 p->last += pool->item_alloc;
191 if (p->last >= p->limit)
192 p->last = NULL;
193 }
194 else
195 { 189 {
196#ifndef NVALGRIND 190#ifndef NVALGRIND
197 VALGRIND_MAKE_MEM_DEFINED(p->base, pool->item_alloc); 191 VALGRIND_MAKE_MEM_DEFINED(p->base, pool->item_alloc);
@@ -199,6 +193,13 @@ _eina_chained_mempool_alloc_in(Chained_Mempool *pool, Chained_Pool *p)
199 // Request a free pointer 193 // Request a free pointer
200 mem = eina_trash_pop(&p->base); 194 mem = eina_trash_pop(&p->base);
201 } 195 }
196 else if (p->last)
197 {
198 mem = p->last;
199 p->last += pool->item_alloc;
200 if (p->last >= p->limit)
201 p->last = NULL;
202 }
202 203
203 // move to end - it just filled up 204 // move to end - it just filled up
204 if (!p->base && !p->last) 205 if (!p->base && !p->last)
@@ -306,7 +307,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
306 307
307 // we have reached the end of the list - no free pools 308 // we have reached the end of the list - no free pools
308 if (!p) 309 if (!p)
309 { 310 {
310 //new chain created ,point it to be the first_fill chain 311 //new chain created ,point it to be the first_fill chain
311 pool->first_fill = _eina_chained_mp_pool_new(pool); 312 pool->first_fill = _eina_chained_mp_pool_new(pool);
312 if (!pool->first_fill) 313 if (!pool->first_fill)
@@ -370,6 +371,56 @@ eina_chained_mempool_free(void *data, void *ptr)
370 return; 371 return;
371} 372}
372 373
374static void *
375eina_chained_mempool_malloc_near(void *data,
376 void *after, void *before,
377 unsigned int size EINA_UNUSED)
378{
379 Chained_Mempool *pool = data;
380 Chained_Pool *p = NULL;
381 void *mem = NULL;
382
383 if (!eina_spinlock_take(&pool->mutex))
384 {
385#ifdef EINA_HAVE_DEBUG_THREADS
386 assert(eina_thread_equal(pool->self, eina_thread_self()));
387#endif
388 }
389
390 if (after)
391 {
392 Eina_Rbtree *r = eina_rbtree_inline_lookup(pool->root, after,
393 0, _eina_chained_mp_pool_key_cmp, NULL);
394
395 if (r)
396 {
397 p = EINA_RBTREE_CONTAINER_GET(r, Chained_Pool);
398
399 if (!p->base && !p->last)
400 p = NULL;
401 }
402 }
403
404 if (before && p == NULL)
405 {
406 Eina_Rbtree *r = eina_rbtree_inline_lookup(pool->root, before,
407 0, _eina_chained_mp_pool_key_cmp, NULL);
408 if (r)
409 {
410 p = EINA_RBTREE_CONTAINER_GET(r, Chained_Pool);
411 if (!p->base && !p->last)
412 p = NULL;
413 }
414 }
415
416 if (p) mem = _eina_chained_mempool_alloc_in(pool, p);
417
418 eina_spinlock_release(&pool->mutex);
419
420 if (!mem) return eina_chained_mempool_malloc(pool, size);
421 return mem;
422}
423
373static Eina_Bool 424static Eina_Bool
374eina_chained_mempool_from(void *data, void *ptr) 425eina_chained_mempool_from(void *data, void *ptr)
375{ 426{
@@ -725,7 +776,8 @@ static Eina_Mempool_Backend _eina_chained_mp_backend = {
725 &eina_chained_mempool_shutdown, 776 &eina_chained_mempool_shutdown,
726 &eina_chained_mempool_repack, 777 &eina_chained_mempool_repack,
727 &eina_chained_mempool_from, 778 &eina_chained_mempool_from,
728 &eina_chained_mempool_iterator_new 779 &eina_chained_mempool_iterator_new,
780 &eina_chained_mempool_malloc_near
729}; 781};
730 782
731Eina_Bool chained_init(void) 783Eina_Bool chained_init(void)
diff --git a/src/modules/eina/mp/one_big/eina_one_big.c b/src/modules/eina/mp/one_big/eina_one_big.c
index b909dfb..50edfaa 100644
--- a/src/modules/eina/mp/one_big/eina_one_big.c
+++ b/src/modules/eina/mp/one_big/eina_one_big.c
@@ -452,7 +452,8 @@ static Eina_Mempool_Backend _eina_one_big_mp_backend = {
452 &eina_one_big_shutdown, 452 &eina_one_big_shutdown,
453 NULL, 453 NULL,
454 &eina_one_big_from, 454 &eina_one_big_from,
455 &eina_one_big_iterator_new 455 &eina_one_big_iterator_new,
456 NULL
456}; 457};
457 458
458Eina_Bool one_big_init(void) 459Eina_Bool one_big_init(void)
diff --git a/src/modules/eina/mp/pass_through/eina_pass_through.c b/src/modules/eina/mp/pass_through/eina_pass_through.c
index 2d2bc38..652df39 100644
--- a/src/modules/eina/mp/pass_through/eina_pass_through.c
+++ b/src/modules/eina/mp/pass_through/eina_pass_through.c
@@ -77,6 +77,7 @@ static Eina_Mempool_Backend _eina_pass_through_mp_backend = {
77 &eina_pass_through_shutdown, 77 &eina_pass_through_shutdown,
78 NULL, 78 NULL,
79 &eina_pass_through_from, 79 &eina_pass_through_from,
80 NULL,
80 NULL 81 NULL
81}; 82};
82 83
diff --git a/src/modules/emotion/gstreamer/emotion_alloc.c b/src/modules/emotion/gstreamer/emotion_alloc.c
deleted file mode 100644
index c4aae04..0000000
--- a/src/modules/emotion/gstreamer/emotion_alloc.c
+++ /dev/null
@@ -1,90 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include <Evas.h>
7#include <Ecore.h>
8
9#include <glib.h>
10#include <gst/gst.h>
11#include <gst/video/video.h>
12#include <gst/video/gstvideosink.h>
13
14#ifdef HAVE_ECORE_X
15# include <Ecore_X.h>
16# ifdef HAVE_XOVERLAY_H
17# include <gst/interfaces/xoverlay.h>
18# endif
19#endif
20
21#include "Emotion.h"
22#include "emotion_gstreamer.h"
23
24Emotion_Gstreamer_Buffer *
25emotion_gstreamer_buffer_alloc(EvasVideoSinkPrivate *sink,
26 GstBuffer *buffer,
27 Eina_Bool preroll)
28{
29 Emotion_Gstreamer_Buffer *send;
30
31 if (!sink->ev) return NULL;
32
33 send = malloc(sizeof (Emotion_Gstreamer_Buffer));
34 if (!send) return NULL;
35
36 send->sink = sink;
37 send->frame = gst_buffer_ref(buffer);
38 send->preroll = preroll;
39 send->force = EINA_FALSE;
40 sink->ev->out++;
41 send->ev = sink->ev;
42
43 return send;
44}
45
46void
47emotion_gstreamer_buffer_free(Emotion_Gstreamer_Buffer *send)
48{
49 send->ev->in++;
50
51 if (send->ev->in == send->ev->out
52 && send->ev->threads == NULL
53 && send->ev->delete_me)
54 send->ev->api->del(send->ev);
55
56 gst_buffer_unref(send->frame);
57 free(send);
58}
59
60Emotion_Gstreamer_Message *
61emotion_gstreamer_message_alloc(Emotion_Gstreamer_Video *ev,
62 GstMessage *msg)
63{
64 Emotion_Gstreamer_Message *send;
65
66 if (!ev) return NULL;
67
68 send = malloc(sizeof (Emotion_Gstreamer_Message));
69 if (!send) return NULL;
70
71 ev->out++;
72 send->ev = ev;
73 send->msg = gst_message_ref(msg);
74
75 return send;
76}
77
78void
79emotion_gstreamer_message_free(Emotion_Gstreamer_Message *send)
80{
81 send->ev->in++;
82
83 if (send->ev->in == send->ev->out
84 && send->ev->threads == NULL
85 && send->ev->delete_me)
86 send->ev->api->del(send->ev);
87
88 gst_message_unref(send->msg);
89 free(send);
90}
diff --git a/src/modules/emotion/gstreamer/emotion_convert.c b/src/modules/emotion/gstreamer/emotion_convert.c
deleted file mode 100644
index 2664d28..0000000
--- a/src/modules/emotion/gstreamer/emotion_convert.c
+++ /dev/null
@@ -1,251 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include <Evas.h>
7
8#include <glib.h>
9#include <gst/gst.h>
10#include <gst/video/video.h>
11#include <gst/video/gstvideosink.h>
12
13#ifdef HAVE_ECORE_X
14# include <Ecore_X.h>
15# ifdef HAVE_XOVERLAY_H
16# include <gst/interfaces/xoverlay.h>
17# endif
18#endif
19
20#include "Emotion.h"
21#include "emotion_gstreamer.h"
22
23static inline void
24_evas_video_bgrx_step(unsigned char *evas_data, const unsigned char *gst_data,
25 unsigned int w, unsigned int h EINA_UNUSED, unsigned int output_height, unsigned int step)
26{
27 unsigned int x;
28 unsigned int y;
29
30 for (y = 0; y < output_height; ++y)
31 {
32 for (x = 0; x < w; x++)
33 {
34 evas_data[0] = gst_data[0];
35 evas_data[1] = gst_data[1];
36 evas_data[2] = gst_data[2];
37 evas_data[3] = 255;
38 gst_data += step;
39 evas_data += 4;
40 }
41 }
42}
43
44static void
45_evas_video_bgr(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
46{
47 _evas_video_bgrx_step(evas_data, gst_data, w, h, output_height, 3);
48}
49
50static void
51_evas_video_bgrx(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
52{
53 _evas_video_bgrx_step(evas_data, gst_data, w, h, output_height, 4);
54}
55
56static void
57_evas_video_bgra(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h EINA_UNUSED, unsigned int output_height)
58{
59 unsigned int x;
60 unsigned int y;
61
62 for (y = 0; y < output_height; ++y)
63 {
64 unsigned char alpha;
65
66 for (x = 0; x < w; ++x)
67 {
68 alpha = gst_data[3];
69 evas_data[0] = (gst_data[0] * alpha) / 255;
70 evas_data[1] = (gst_data[1] * alpha) / 255;
71 evas_data[2] = (gst_data[2] * alpha) / 255;
72 evas_data[3] = alpha;
73 gst_data += 4;
74 evas_data += 4;
75 }
76 }
77}
78
79static void
80_evas_video_i420(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
81{
82 const unsigned char **rows;
83 unsigned int i, j;
84 unsigned int rh;
85 unsigned int stride_y, stride_uv;
86
87 rh = output_height;
88
89 rows = (const unsigned char **)evas_data;
90
91 stride_y = GST_ROUND_UP_4(w);
92 stride_uv = GST_ROUND_UP_8(w) / 2;
93
94 for (i = 0; i < rh; i++)
95 rows[i] = &gst_data[i * stride_y];
96
97 for (j = 0; j < (rh / 2); j++, i++)
98 rows[i] = &gst_data[h * stride_y + j * stride_uv];
99
100 for (j = 0; j < (rh / 2); j++, i++)
101 rows[i] = &gst_data[h * stride_y +
102 (rh / 2) * stride_uv +
103 j * stride_uv];
104}
105
106static void
107_evas_video_yv12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
108{
109 const unsigned char **rows;
110 unsigned int i, j;
111 unsigned int rh;
112 unsigned int stride_y, stride_uv;
113
114 rh = output_height;
115
116 rows = (const unsigned char **)evas_data;
117
118 stride_y = GST_ROUND_UP_4(w);
119 stride_uv = GST_ROUND_UP_8(w) / 2;
120
121 for (i = 0; i < rh; i++)
122 rows[i] = &gst_data[i * stride_y];
123
124 for (j = 0; j < (rh / 2); j++, i++)
125 rows[i] = &gst_data[h * stride_y +
126 (rh / 2) * stride_uv +
127 j * stride_uv];
128
129 for (j = 0; j < (rh / 2); j++, i++)
130 rows[i] = &gst_data[h * stride_y + j * stride_uv];
131}
132
133static void
134_evas_video_yuy2(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h EINA_UNUSED, unsigned int output_height)
135{
136 const unsigned char **rows;
137 unsigned int i;
138 unsigned int stride;
139
140 rows = (const unsigned char **)evas_data;
141
142 stride = GST_ROUND_UP_4(w * 2);
143
144 for (i = 0; i < output_height; i++)
145 rows[i] = &gst_data[i * stride];
146}
147
148static void
149_evas_video_nv12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h EINA_UNUSED, unsigned int output_height)
150{
151 const unsigned char **rows;
152 unsigned int i, j;
153 unsigned int rh;
154
155 rh = output_height;
156
157 rows = (const unsigned char **)evas_data;
158
159 for (i = 0; i < rh; i++)
160 rows[i] = &gst_data[i * w];
161
162 for (j = 0; j < (rh / 2); j++, i++)
163 rows[i] = &gst_data[rh * w + j * w];
164}
165
166static void
167_evas_video_mt12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height EINA_UNUSED)
168{
169 const unsigned char **rows;
170 unsigned int i;
171 unsigned int j;
172
173 rows = (const unsigned char **)evas_data;
174
175 for (i = 0; i < (h / 32) / 2; i++)
176 rows[i] = &gst_data[i * w * 2 * 32];
177
178 if ((h / 32) % 2)
179 {
180 rows[i] = &gst_data[i * w * 2 * 32];
181 i++;
182 }
183
184 for (j = 0; j < ((h / 2) / 32) / 2; ++j, ++i)
185 rows[i] = &gst_data[h * w + j * (w / 2) * 2 * 16];
186}
187
188void
189_evas_video_st12_multiplane(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height EINA_UNUSED)
190{
191 const GstMultiPlaneImageBuffer *mp_buf = (const GstMultiPlaneImageBuffer *) gst_data;
192 const unsigned char **rows;
193 unsigned int i;
194 unsigned int j;
195
196 rows = (const unsigned char **)evas_data;
197
198 for (i = 0; i < (h / 32) / 2; i++)
199 rows[i] = mp_buf->uaddr[0] + i * w * 2 * 32;
200 if ((h / 32) % 2)
201 {
202 rows[i] = mp_buf->uaddr[0] + i * w * 2 * 32;
203 i++;
204 }
205
206 for (j = 0; j < ((h / 2) / 16) / 2; j++, i++)
207 {
208 rows[i] = mp_buf->uaddr[1] + j * w * 2 * 16 * 2;
209 }
210 if (((h / 2) / 16) % 2)
211 rows[i] = mp_buf->uaddr[1] + j * w * 2 * 16 * 2;
212}
213
214void
215_evas_video_st12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w EINA_UNUSED, unsigned int h, unsigned int output_height EINA_UNUSED)
216{
217 const SCMN_IMGB *imgb = (const SCMN_IMGB *) gst_data;
218 const unsigned char **rows;
219 unsigned int i, j;
220
221 rows = (const unsigned char **)evas_data;
222
223 for (i = 0; i < (h / 32) / 2; i++)
224 rows[i] = imgb->uaddr[0] + i * imgb->stride[0] * 2 * 32;
225 if ((h / 32) % 2)
226 {
227 rows[i] = imgb->uaddr[0] + i * imgb->stride[0] * 2 * 32;
228 i++;
229 }
230
231 for (j = 0; j < (unsigned int) imgb->elevation[1] / 32 / 2; j++, i++)
232 rows[i] = imgb->uaddr[1] + j * imgb->stride[1] * 32 * 2;
233 if ((imgb->elevation[1] / 32) % 2)
234 rows[i++] = imgb->uaddr[1] + j * imgb->stride[1] * 32 * 2;
235}
236
237const ColorSpace_FourCC_Convertion colorspace_fourcc_convertion[] = {
238 { "I420", GST_MAKE_FOURCC('I', '4', '2', '0'), EVAS_COLORSPACE_YCBCR422P601_PL, _evas_video_i420, EINA_TRUE },
239 { "YV12", GST_MAKE_FOURCC('Y', 'V', '1', '2'), EVAS_COLORSPACE_YCBCR422P601_PL, _evas_video_yv12, EINA_TRUE },
240 { "YUY2", GST_MAKE_FOURCC('Y', 'U', 'Y', '2'), EVAS_COLORSPACE_YCBCR422601_PL, _evas_video_yuy2, EINA_FALSE },
241 { "NV12", GST_MAKE_FOURCC('N', 'V', '1', '2'), EVAS_COLORSPACE_YCBCR420NV12601_PL, _evas_video_nv12, EINA_TRUE },
242 { "TM12", GST_MAKE_FOURCC('T', 'M', '1', '2'), EVAS_COLORSPACE_YCBCR420TM12601_PL, _evas_video_mt12, EINA_TRUE },
243 { NULL, 0, 0, NULL, 0 }
244};
245
246const ColorSpace_Format_Convertion colorspace_format_convertion[] = {
247 { "BGR", GST_VIDEO_FORMAT_BGR, EVAS_COLORSPACE_ARGB8888, _evas_video_bgr },
248 { "BGRx", GST_VIDEO_FORMAT_BGRx, EVAS_COLORSPACE_ARGB8888, _evas_video_bgrx },
249 { "BGRA", GST_VIDEO_FORMAT_BGRA, EVAS_COLORSPACE_ARGB8888, _evas_video_bgra },
250 { NULL, 0, 0, NULL }
251};
diff --git a/src/modules/emotion/gstreamer/emotion_fakeeos.c b/src/modules/emotion/gstreamer/emotion_fakeeos.c
deleted file mode 100644
index fc6dc0f..0000000
--- a/src/modules/emotion/gstreamer/emotion_fakeeos.c
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include <Evas.h>
7
8#include <glib.h>
9#include <gst/gst.h>
10#include <gst/video/video.h>
11#include <gst/video/gstvideosink.h>
12
13#ifdef HAVE_ECORE_X
14# include <Ecore_X.h>
15# ifdef HAVE_XOVERLAY_H
16# include <gst/interfaces/xoverlay.h>
17# endif
18#endif
19
20#include "Emotion.h"
21#include "emotion_gstreamer.h"
22
23typedef struct _FakeEOSBin
24{
25 GstBin parent;
26} FakeEOSBin;
27
28typedef struct _FakeEOSBinClass
29{
30 GstBinClass parent;
31} FakeEOSBinClass;
32
33GST_BOILERPLATE(FakeEOSBin, fakeeos_bin, GstBin,
34 GST_TYPE_BIN);
35
36static void
37fakeeos_bin_handle_message(GstBin * bin, GstMessage * message)
38{
39 /* FakeEOSBin *fakeeos = (FakeEOSBin *)(bin); */
40
41 switch (GST_MESSAGE_TYPE(message)) {
42 case GST_MESSAGE_EOS:
43 /* what to do here ? just returning at the moment */
44 return;
45 default:
46 break;
47 }
48
49 GST_BIN_CLASS(parent_class)->handle_message(bin, message);
50}
51
52static void
53fakeeos_bin_base_init(gpointer g_class EINA_UNUSED)
54{
55}
56
57static void
58fakeeos_bin_class_init(FakeEOSBinClass * klass)
59{
60 GstBinClass *gstbin_class = GST_BIN_CLASS(klass);
61
62 gstbin_class->handle_message =
63 GST_DEBUG_FUNCPTR (fakeeos_bin_handle_message);
64}
65
66static void
67fakeeos_bin_init(FakeEOSBin *src EINA_UNUSED,
68 FakeEOSBinClass *klass EINA_UNUSED)
69{
70}
diff --git a/src/modules/emotion/gstreamer/emotion_gstreamer.c b/src/modules/emotion/gstreamer/emotion_gstreamer.c
deleted file mode 100644
index b37f5ce..0000000
--- a/src/modules/emotion/gstreamer/emotion_gstreamer.c
+++ /dev/null
@@ -1,2018 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <unistd.h>
6#include <fcntl.h>
7
8#ifdef _WIN32
9# include <direct.h> /* getcwd */
10#endif
11
12#include <Eina.h>
13#include <Evas.h>
14#include <Ecore.h>
15
16#define HTTP_STREAM 0
17#define RTSP_STREAM 1
18#include <glib.h>
19#include <gst/gst.h>
20#include <glib-object.h>
21#include <gst/video/gstvideosink.h>
22#include <gst/video/video.h>
23
24// forcibly disable x overlay window.. broken badly.
25#undef HAVE_ECORE_X
26
27#ifdef HAVE_ECORE_X
28# include <Ecore_X.h>
29# ifdef HAVE_XOVERLAY_H
30# include <gst/interfaces/xoverlay.h>
31# endif
32#endif
33
34#include "emotion_modules.h"
35#include "emotion_gstreamer.h"
36
37Eina_Bool window_manager_video = EINA_FALSE;
38int _emotion_gstreamer_log_domain = -1;
39Eina_Bool debug_fps = EINA_FALSE;
40Eina_Bool _ecore_x_available = EINA_FALSE;
41
42static Ecore_Idler *restart_idler;
43static int _emotion_init_count = 0;
44
45/* Callbacks to get the eos */
46static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data);
47static void _free_metadata (Emotion_Gstreamer_Metadata *m);
48
49static GstBusSyncReply _eos_sync_fct(GstBus *bus,
50 GstMessage *message,
51 gpointer data);
52
53static Eina_Bool _em_restart_stream(void *data);
54
55/* Module interface */
56
57
58static int priority_overide = 0;
59
60static Emotion_Video_Stream *
61emotion_video_stream_new(Emotion_Gstreamer_Video *ev)
62{
63 Emotion_Video_Stream *vstream;
64
65 if (!ev) return NULL;
66
67 vstream = (Emotion_Video_Stream *)calloc(1, sizeof(Emotion_Video_Stream));
68 if (!vstream) return NULL;
69
70 ev->video_streams = eina_list_append(ev->video_streams, vstream);
71 return vstream;
72}
73
74static const char *
75emotion_visualization_element_name_get(Emotion_Vis visualisation)
76{
77 switch (visualisation)
78 {
79 case EMOTION_VIS_NONE:
80 return NULL;
81 case EMOTION_VIS_GOOM:
82 return "goom";
83 case EMOTION_VIS_LIBVISUAL_BUMPSCOPE:
84 return "libvisual_bumpscope";
85 case EMOTION_VIS_LIBVISUAL_CORONA:
86 return "libvisual_corona";
87 case EMOTION_VIS_LIBVISUAL_DANCING_PARTICLES:
88 return "libvisual_dancingparticles";
89 case EMOTION_VIS_LIBVISUAL_GDKPIXBUF:
90 return "libvisual_gdkpixbuf";
91 case EMOTION_VIS_LIBVISUAL_G_FORCE:
92 return "libvisual_G-Force";
93 case EMOTION_VIS_LIBVISUAL_GOOM:
94 return "libvisual_goom";
95 case EMOTION_VIS_LIBVISUAL_INFINITE:
96 return "libvisual_infinite";
97 case EMOTION_VIS_LIBVISUAL_JAKDAW:
98 return "libvisual_jakdaw";
99 case EMOTION_VIS_LIBVISUAL_JESS:
100 return "libvisual_jess";
101 case EMOTION_VIS_LIBVISUAL_LV_ANALYSER:
102 return "libvisual_lv_analyzer";
103 case EMOTION_VIS_LIBVISUAL_LV_FLOWER:
104 return "libvisual_lv_flower";
105 case EMOTION_VIS_LIBVISUAL_LV_GLTEST:
106 return "libvisual_lv_gltest";
107 case EMOTION_VIS_LIBVISUAL_LV_SCOPE:
108 return "libvisual_lv_scope";
109 case EMOTION_VIS_LIBVISUAL_MADSPIN:
110 return "libvisual_madspin";
111 case EMOTION_VIS_LIBVISUAL_NEBULUS:
112 return "libvisual_nebulus";
113 case EMOTION_VIS_LIBVISUAL_OINKSIE:
114 return "libvisual_oinksie";
115 case EMOTION_VIS_LIBVISUAL_PLASMA:
116 return "libvisual_plazma";
117 default:
118 return "goom";
119 }
120}
121
122static void
123em_cleanup(Emotion_Gstreamer_Video *ev)
124{
125 Emotion_Audio_Stream *astream;
126 Emotion_Video_Stream *vstream;
127
128 if (ev->send)
129 {
130 emotion_gstreamer_buffer_free(ev->send);
131 ev->send = NULL;
132 }
133
134 if (ev->eos_bus)
135 {
136 gst_object_unref(GST_OBJECT(ev->eos_bus));
137 ev->eos_bus = NULL;
138 }
139
140 if (ev->metadata)
141 {
142 _free_metadata(ev->metadata);
143 ev->metadata = NULL;
144 }
145
146 if (ev->last_buffer)
147 {
148 gst_buffer_unref(ev->last_buffer);
149 ev->last_buffer = NULL;
150 }
151
152 if (!ev->stream)
153 {
154 evas_object_image_video_surface_set(emotion_object_image_get(ev->obj), NULL);
155 ev->stream = EINA_TRUE;
156 }
157
158 if (ev->pipeline)
159 {
160 gstreamer_video_sink_new(ev, ev->obj, NULL);
161
162 g_object_set(G_OBJECT(ev->esink), "ev", NULL, NULL);
163 g_object_set(G_OBJECT(ev->esink), "evas-object", NULL, NULL);
164 gst_element_set_state(ev->pipeline, GST_STATE_NULL);
165 gst_object_unref(ev->pipeline);
166
167 ev->pipeline = NULL;
168 ev->sink = NULL;
169
170 if (ev->eteepad) gst_object_unref(ev->eteepad);
171 ev->eteepad = NULL;
172 if (ev->xvteepad) gst_object_unref(ev->xvteepad);
173 ev->xvteepad = NULL;
174 if (ev->xvpad) gst_object_unref(ev->xvpad);
175 ev->xvpad = NULL;
176
177 ev->src_width = 0;
178 ev->src_height = 0;
179
180#ifdef HAVE_ECORE_X
181 INF("destroying window: %i", ev->win);
182 if (ev->win) ecore_x_window_free(ev->win);
183 ev->win = 0;
184#endif
185 }
186
187 if (restart_idler)
188 {
189 ecore_idler_del(restart_idler);
190 restart_idler = NULL;
191 }
192
193 EINA_LIST_FREE(ev->audio_streams, astream)
194 free(astream);
195 EINA_LIST_FREE(ev->video_streams, vstream)
196 free(vstream);
197}
198
199static void
200em_del(void *video)
201{
202 Emotion_Gstreamer_Video *ev = video;
203
204 if (ev->threads)
205 {
206 Ecore_Thread *t;
207
208 EINA_LIST_FREE(ev->threads, t)
209 ecore_thread_cancel(t);
210
211 ev->delete_me = EINA_TRUE;
212 return;
213 }
214
215 if (ev->in != ev->out)
216 {
217 ev->delete_me = EINA_TRUE;
218 return;
219 }
220
221 em_cleanup(ev);
222
223 free(ev);
224}
225
226static Eina_Bool
227em_file_open(void *video,
228 const char *file)
229{
230 Emotion_Gstreamer_Video *ev = video;
231 Eina_Strbuf *sbuf = NULL;
232 const char *uri;
233
234 if (!file) return EINA_FALSE;
235 if (strstr(file, "://") == NULL)
236 {
237 sbuf = eina_strbuf_new();
238 eina_strbuf_append(sbuf, "file://");
239 if (strncmp(file, "./", 2) == 0)
240 file += 2;
241 if (strstr(file, ":/") != NULL)
242 { /* We absolutely need file:///C:/ under Windows, so adding it here */
243 eina_strbuf_append(sbuf, "/");
244 }
245 else if (*file != '/')
246 {
247 char tmp[PATH_MAX];
248
249 if (getcwd(tmp, PATH_MAX))
250 {
251 eina_strbuf_append(sbuf, tmp);
252 eina_strbuf_append(sbuf, "/");
253 }
254 }
255 eina_strbuf_append(sbuf, file);
256 }
257
258 ev->play_started = 0;
259 ev->pipeline_parsed = 0;
260
261 uri = sbuf ? eina_strbuf_string_get(sbuf) : file;
262 DBG("setting file to '%s'", uri);
263 ev->pipeline = gstreamer_video_sink_new(ev, ev->obj, uri);
264 if (sbuf) eina_strbuf_free(sbuf);
265
266 if (!ev->pipeline)
267 return EINA_FALSE;
268
269 ev->eos_bus = gst_pipeline_get_bus(GST_PIPELINE(ev->pipeline));
270 if (!ev->eos_bus)
271 {
272 ERR("could not get the bus");
273 return EINA_FALSE;
274 }
275
276 gst_bus_set_sync_handler(ev->eos_bus, _eos_sync_fct, ev);
277
278 ev->position = 0.0;
279
280 return 1;
281}
282
283static void
284em_file_close(void *video)
285{
286 Emotion_Gstreamer_Video *ev;
287
288 ev = (Emotion_Gstreamer_Video *)video;
289 if (!ev)
290 return;
291
292 if (ev->threads)
293 {
294 Ecore_Thread *t;
295
296 EINA_LIST_FREE(ev->threads, t)
297 ecore_thread_cancel(t);
298 }
299
300 em_cleanup(ev);
301
302 ev->pipeline_parsed = EINA_FALSE;
303 ev->play_started = 0;
304}
305
306static void
307em_play(void *video,
308 double pos EINA_UNUSED)
309{
310 Emotion_Gstreamer_Video *ev;
311
312 ev = (Emotion_Gstreamer_Video *)video;
313 if (!ev->pipeline) return;
314
315 if (ev->pipeline_parsed)
316 gst_element_set_state(ev->pipeline, GST_STATE_PLAYING);
317 ev->play = 1;
318 ev->play_started = 1;
319}
320
321static void
322em_stop(void *video)
323{
324 Emotion_Gstreamer_Video *ev;
325
326 ev = (Emotion_Gstreamer_Video *)video;
327
328 if (!ev->pipeline) return;
329
330 if (ev->pipeline_parsed)
331 gst_element_set_state(ev->pipeline, GST_STATE_PAUSED);
332 ev->play = 0;
333}
334
335static void
336em_size_get(void *video,
337 int *width,
338 int *height)
339{
340 Emotion_Gstreamer_Video *ev;
341 Emotion_Video_Stream *vstream;
342
343 ev = (Emotion_Gstreamer_Video *)video;
344
345 if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
346 goto on_error;
347
348 vstream = eina_list_nth(ev->video_streams, ev->video_stream_nbr - 1);
349 if (vstream)
350 {
351 if (width) *width = vstream->width;
352 if (height) *height = vstream->height;
353
354 return;
355 }
356
357 on_error:
358 if (width) *width = 0;
359 if (height) *height = 0;
360}
361
362static void
363em_pos_set(void *video,
364 double pos)
365{
366 Emotion_Gstreamer_Video *ev;
367
368 ev = (Emotion_Gstreamer_Video *)video;
369
370 if (!ev->pipeline) return;
371
372 if (ev->play)
373 gst_element_set_state(ev->pipeline, GST_STATE_PAUSED);
374
375 gst_element_seek(ev->pipeline, 1.0,
376 GST_FORMAT_TIME,
377 GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH,
378 GST_SEEK_TYPE_SET,
379 (gint64)(pos * (double)GST_SECOND),
380 GST_SEEK_TYPE_NONE, -1);
381
382 if (ev->play)
383 gst_element_set_state(ev->pipeline, GST_STATE_PLAYING);
384}
385
386/**
387 * Returns stream duration in seconds
388 */
389static double
390em_len_get(void *video)
391{
392 Emotion_Gstreamer_Video *ev;
393 Emotion_Video_Stream *vstream;
394 Emotion_Audio_Stream *astream;
395 Eina_List *l;
396 GstFormat fmt;
397 gint64 val;
398 gboolean ret;
399
400 ev = video;
401 fmt = GST_FORMAT_TIME;
402
403 if (!ev->pipeline) return 0.0;
404
405 ret = gst_element_query_duration(ev->pipeline, &fmt, &val);
406 if (!ret)
407 goto fallback;
408
409 if (fmt != GST_FORMAT_TIME)
410 {
411 DBG("requested duration in time, but got %s instead.",
412 gst_format_get_name(fmt));
413 goto fallback;
414 }
415
416 if (val <= 0.0)
417 goto fallback;
418
419 return GST_TIME_AS_SECONDS(val);
420
421 fallback:
422 if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
423 return 0.0;
424
425 EINA_LIST_FOREACH(ev->audio_streams, l, astream)
426 if (astream->length_time >= 0)
427 return astream->length_time;
428
429 EINA_LIST_FOREACH(ev->video_streams, l, vstream)
430 if (vstream->length_time >= 0)
431 return vstream->length_time;
432
433 return 0.0;
434}
435
436static double
437em_buffer_size_get(void *video)
438{
439 Emotion_Gstreamer_Video *ev;
440
441 GstQuery *query;
442 gboolean busy;
443 gint percent;
444
445 ev = video;
446
447 if (!ev->pipeline) return 0.0;
448
449 query = gst_query_new_buffering(GST_FORMAT_DEFAULT);
450 if (gst_element_query(ev->pipeline, query))
451 gst_query_parse_buffering_percent(query, &busy, &percent);
452 else
453 percent = 100;
454
455 gst_query_unref(query);
456 return ((float)(percent)) / 100.0;
457}
458
459static int
460em_fps_num_get(void *video)
461{
462 Emotion_Gstreamer_Video *ev;
463 Emotion_Video_Stream *vstream;
464
465 ev = (Emotion_Gstreamer_Video *)video;
466
467 if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
468 return 0;
469
470 vstream = eina_list_nth(ev->video_streams, ev->video_stream_nbr - 1);
471 if (vstream)
472 return vstream->fps_num;
473
474 return 0;
475}
476
477static int
478em_fps_den_get(void *video)
479{
480 Emotion_Gstreamer_Video *ev;
481 Emotion_Video_Stream *vstream;
482
483 ev = (Emotion_Gstreamer_Video *)video;
484
485 if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
486 return 1;
487
488 vstream = eina_list_nth(ev->video_streams, ev->video_stream_nbr - 1);
489 if (vstream)
490 return vstream->fps_den;
491
492 return 1;
493}
494
495static double
496em_fps_get(void *video)
497{
498 Emotion_Gstreamer_Video *ev;
499 Emotion_Video_Stream *vstream;
500
501 ev = (Emotion_Gstreamer_Video *)video;
502
503 if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
504 return 0.0;
505
506 vstream = eina_list_nth(ev->video_streams, ev->video_stream_nbr - 1);
507 if (vstream)
508 return (double)vstream->fps_num / (double)vstream->fps_den;
509
510 return 0.0;
511}
512
513/**
514 * Returns stream position in seconds
515 */
516static double
517em_pos_get(void *video)
518{
519 Emotion_Gstreamer_Video *ev;
520 GstFormat fmt;
521 gint64 val;
522 gboolean ret;
523
524 ev = video;
525 fmt = GST_FORMAT_TIME;
526
527 if (!ev->pipeline) return 0.0;
528
529 ret = gst_element_query_position(ev->pipeline, &fmt, &val);
530 if (!ret)
531 return ev->position;
532
533 if (fmt != GST_FORMAT_TIME)
534 {
535 ERR("requested position in time, but got %s instead.",
536 gst_format_get_name(fmt));
537 return ev->position;
538 }
539
540 ev->position = GST_TIME_AS_SECONDS(val);
541 return ev->position;
542}
543
544static void
545em_vis_set(void *video,
546 Emotion_Vis vis)
547{
548 Emotion_Gstreamer_Video *ev;
549
550 ev = (Emotion_Gstreamer_Video *)video;
551
552 ev->vis = vis;
553}
554
555static Emotion_Vis
556em_vis_get(void *video)
557{
558 Emotion_Gstreamer_Video *ev;
559
560 ev = (Emotion_Gstreamer_Video *)video;
561
562 return ev->vis;
563}
564
565static Eina_Bool
566em_vis_supported(void *ef EINA_UNUSED, Emotion_Vis vis)
567{
568 const char *name;
569 GstElementFactory *factory;
570
571 if (vis == EMOTION_VIS_NONE)
572 return EINA_TRUE;
573
574 name = emotion_visualization_element_name_get(vis);
575 if (!name)
576 return EINA_FALSE;
577
578 factory = gst_element_factory_find(name);
579 if (!factory)
580 return EINA_FALSE;
581
582 gst_object_unref(factory);
583 return EINA_TRUE;
584}
585
586static double
587em_ratio_get(void *video)
588{
589 Emotion_Gstreamer_Video *ev;
590
591 ev = (Emotion_Gstreamer_Video *)video;
592
593 return ev->ratio;
594}
595
596static int
597em_video_handled(void *video)
598{
599 Emotion_Gstreamer_Video *ev;
600
601 ev = (Emotion_Gstreamer_Video *)video;
602
603 _emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE);
604
605 if (!eina_list_count(ev->video_streams))
606 return 0;
607
608 return 1;
609}
610
611static int
612em_audio_handled(void *video)
613{
614 Emotion_Gstreamer_Video *ev;
615
616 ev = (Emotion_Gstreamer_Video *)video;
617
618 _emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE);
619
620 if (!eina_list_count(ev->audio_streams))
621 return 0;
622
623 return 1;
624}
625
626static int
627em_seekable(void *video EINA_UNUSED)
628{
629 return 1;
630}
631
632static void
633em_frame_done(void *video EINA_UNUSED)
634{
635}
636
637static Emotion_Format
638em_format_get(void *video)
639{
640 Emotion_Gstreamer_Video *ev;
641 Emotion_Video_Stream *vstream;
642
643 ev = (Emotion_Gstreamer_Video *)video;
644
645 if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
646 return EMOTION_FORMAT_NONE;
647
648 vstream = eina_list_nth(ev->video_streams, ev->video_stream_nbr - 1);
649 if (vstream)
650 {
651 switch (vstream->fourcc)
652 {
653 case GST_MAKE_FOURCC('I', '4', '2', '0'):
654 return EMOTION_FORMAT_I420;
655 case GST_MAKE_FOURCC('Y', 'V', '1', '2'):
656 return EMOTION_FORMAT_YV12;
657 case GST_MAKE_FOURCC('Y', 'U', 'Y', '2'):
658 return EMOTION_FORMAT_YUY2;
659 case GST_MAKE_FOURCC('A', 'R', 'G', 'B'):
660 return EMOTION_FORMAT_BGRA;
661 default:
662 return EMOTION_FORMAT_NONE;
663 }
664 }
665 return EMOTION_FORMAT_NONE;
666}
667
668static void
669em_video_data_size_get(void *video, int *w, int *h)
670{
671 Emotion_Gstreamer_Video *ev;
672 Emotion_Video_Stream *vstream;
673
674 ev = (Emotion_Gstreamer_Video *)video;
675
676 if (ev->pipeline && (!ev->video_stream_nbr || !ev->video_streams))
677 if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
678 goto on_error;
679
680 vstream = eina_list_nth(ev->video_streams, ev->video_stream_nbr - 1);
681 if (vstream)
682 {
683 *w = vstream->width;
684 *h = vstream->height;
685
686 return;
687 }
688
689 on_error:
690 *w = 0;
691 *h = 0;
692}
693
694static int
695em_yuv_rows_get(void *video EINA_UNUSED,
696 int w EINA_UNUSED,
697 int h EINA_UNUSED,
698 unsigned char **yrows EINA_UNUSED,
699 unsigned char **urows EINA_UNUSED,
700 unsigned char **vrows EINA_UNUSED)
701{
702 return 0;
703}
704
705static int
706em_bgra_data_get(void *video EINA_UNUSED, unsigned char **bgra_data EINA_UNUSED)
707{
708 return 0;
709}
710
711static void
712em_event_feed(void *video EINA_UNUSED, int event EINA_UNUSED)
713{
714}
715
716static void
717em_event_mouse_button_feed(void *video EINA_UNUSED, int button EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
718{
719}
720
721static void
722em_event_mouse_move_feed(void *video EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
723{
724}
725
726/* Video channels */
727static int
728em_video_channel_count(void *video)
729{
730 Emotion_Gstreamer_Video *ev;
731
732 ev = (Emotion_Gstreamer_Video *)video;
733
734 _emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE);
735
736 return eina_list_count(ev->video_streams);
737}
738
739static void
740em_video_channel_set(void *video EINA_UNUSED,
741 int channel EINA_UNUSED)
742{
743#if 0
744 Emotion_Gstreamer_Video *ev;
745
746 ev = (Emotion_Gstreamer_Video *)video;
747
748 if (channel < 0) channel = 0;
749#endif
750 /* FIXME: a faire... */
751}
752
753static int
754em_video_channel_get(void *video)
755{
756 Emotion_Gstreamer_Video *ev;
757
758 ev = (Emotion_Gstreamer_Video *)video;
759
760 _emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE);
761
762 return ev->video_stream_nbr;
763}
764
765static void
766em_video_subtitle_file_set(void *video EINA_UNUSED,
767 const char *filepath EINA_UNUSED)
768{
769 DBG("video_subtitle_file_set not implemented for gstreamer yet.");
770}
771
772static const char *
773em_video_subtitle_file_get(void *video EINA_UNUSED)
774{
775 DBG("video_subtitle_file_get not implemented for gstreamer yet.");
776 return NULL;
777}
778
779static const char *
780em_video_channel_name_get(void *video EINA_UNUSED,
781 int channel EINA_UNUSED)
782{
783 return NULL;
784}
785
786static void
787em_video_channel_mute_set(void *video,
788 int mute)
789{
790 Emotion_Gstreamer_Video *ev;
791
792 ev = (Emotion_Gstreamer_Video *)video;
793
794 ev->video_mute = mute;
795}
796
797static int
798em_video_channel_mute_get(void *video)
799{
800 Emotion_Gstreamer_Video *ev;
801
802 ev = (Emotion_Gstreamer_Video *)video;
803
804 return ev->video_mute;
805}
806
807/* Audio channels */
808
809static int
810em_audio_channel_count(void *video)
811{
812 Emotion_Gstreamer_Video *ev;
813
814 ev = (Emotion_Gstreamer_Video *)video;
815
816 _emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE);
817
818 return eina_list_count(ev->audio_streams);
819}
820
821static void
822em_audio_channel_set(void *video EINA_UNUSED,
823 int channel EINA_UNUSED)
824{
825#if 0
826 Emotion_Gstreamer_Video *ev;
827
828 ev = (Emotion_Gstreamer_Video *)video;
829
830 if (channel < -1) channel = -1;
831#endif
832 /* FIXME: a faire... */
833}
834
835static int
836em_audio_channel_get(void *video)
837{
838 Emotion_Gstreamer_Video *ev;
839
840 ev = (Emotion_Gstreamer_Video *)video;
841
842 _emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE);
843
844 return ev->audio_stream_nbr;
845}
846
847static const char *
848em_audio_channel_name_get(void *video EINA_UNUSED,
849 int channel EINA_UNUSED)
850{
851 return NULL;
852}
853
854#define GST_PLAY_FLAG_AUDIO (1 << 1)
855
856static void
857em_audio_channel_mute_set(void *video,
858 int mute)
859{
860 /* NOTE: at first I wanted to completly shutdown the audio path on mute,
861 but that's not possible as the audio sink could be the clock source
862 for the pipeline (at least that's the case on some of the hardware
863 I have been tested emotion on.
864 */
865 Emotion_Gstreamer_Video *ev;
866
867 ev = (Emotion_Gstreamer_Video *)video;
868
869 if (!ev->pipeline) return;
870
871 ev->audio_mute = mute;
872
873 g_object_set(G_OBJECT(ev->pipeline), "mute", !!mute, NULL);
874}
875
876static int
877em_audio_channel_mute_get(void *video)
878{
879 Emotion_Gstreamer_Video *ev;
880
881 ev = (Emotion_Gstreamer_Video *)video;
882
883 return ev->audio_mute;
884}
885
886static void
887em_audio_channel_volume_set(void *video,
888 double vol)
889{
890 Emotion_Gstreamer_Video *ev;
891
892 ev = (Emotion_Gstreamer_Video *)video;
893
894 if (!ev->pipeline) return;
895
896 if (vol < 0.0)
897 vol = 0.0;
898 if (vol > 1.0)
899 vol = 1.0;
900 ev->volume = vol;
901 g_object_set(G_OBJECT(ev->pipeline), "volume", vol, NULL);
902}
903
904static double
905em_audio_channel_volume_get(void *video)
906{
907 Emotion_Gstreamer_Video *ev;
908
909 ev = (Emotion_Gstreamer_Video *)video;
910
911 return ev->volume;
912}
913
914/* spu stuff */
915
916static int
917em_spu_channel_count(void *video EINA_UNUSED)
918{
919 return 0;
920}
921
922static void
923em_spu_channel_set(void *video EINA_UNUSED, int channel EINA_UNUSED)
924{
925}
926
927static int
928em_spu_channel_get(void *video EINA_UNUSED)
929{
930 return 1;
931}
932
933static const char *
934em_spu_channel_name_get(void *video EINA_UNUSED, int channel EINA_UNUSED)
935{
936 return NULL;
937}
938
939static void
940em_spu_channel_mute_set(void *video EINA_UNUSED, int mute EINA_UNUSED)
941{
942}
943
944static int
945em_spu_channel_mute_get(void *video EINA_UNUSED)
946{
947 return 0;
948}
949
950static int
951em_chapter_count(void *video EINA_UNUSED)
952{
953 return 0;
954}
955
956static void
957em_chapter_set(void *video EINA_UNUSED, int chapter EINA_UNUSED)
958{
959}
960
961static int
962em_chapter_get(void *video EINA_UNUSED)
963{
964 return 0;
965}
966
967static const char *
968em_chapter_name_get(void *video EINA_UNUSED, int chapter EINA_UNUSED)
969{
970 return NULL;
971}
972
973static void
974em_speed_set(void *video EINA_UNUSED, double speed EINA_UNUSED)
975{
976}
977
978static double
979em_speed_get(void *video EINA_UNUSED)
980{
981 return 1.0;
982}
983
984static int
985em_eject(void *video EINA_UNUSED)
986{
987 return 1;
988}
989
990static const char *
991em_meta_get(void *video, int meta)
992{
993 Emotion_Gstreamer_Video *ev;
994 const char *str = NULL;
995
996 ev = (Emotion_Gstreamer_Video *)video;
997
998 if (!ev || !ev->metadata) return NULL;
999 switch (meta)
1000 {
1001 case META_TRACK_TITLE:
1002 str = ev->metadata->title;
1003 break;
1004 case META_TRACK_ARTIST:
1005 str = ev->metadata->artist;
1006 break;
1007 case META_TRACK_ALBUM:
1008 str = ev->metadata->album;
1009 break;
1010 case META_TRACK_YEAR:
1011 str = ev->metadata->year;
1012 break;
1013 case META_TRACK_GENRE:
1014 str = ev->metadata->genre;
1015 break;
1016 case META_TRACK_COMMENT:
1017 str = ev->metadata->comment;
1018 break;
1019 case META_TRACK_DISCID:
1020 str = ev->metadata->disc_id;
1021 break;
1022 default:
1023 break;
1024 }
1025
1026 return str;
1027}
1028
1029static void
1030em_priority_set(void *video, Eina_Bool pri)
1031{
1032 Emotion_Gstreamer_Video *ev;
1033
1034 ev = video;
1035 if (priority_overide > 3) return; /* If we failed to much to create that pipeline, let's don't wast our time anymore */
1036
1037 if (ev->priority != pri && ev->pipeline)
1038 {
1039 if (ev->threads)
1040 {
1041 Ecore_Thread *t;
1042
1043 EINA_LIST_FREE(ev->threads, t)
1044 ecore_thread_cancel(t);
1045 }
1046 em_cleanup(ev);
1047 restart_idler = ecore_idler_add(_em_restart_stream, ev);
1048 }
1049 ev->priority = pri;
1050}
1051
1052static Eina_Bool
1053em_priority_get(void *video)
1054{
1055 Emotion_Gstreamer_Video *ev;
1056
1057 ev = video;
1058 return !ev->stream;
1059}
1060
1061#ifdef HAVE_ECORE_X
1062static Eina_Bool
1063_ecore_event_x_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
1064{
1065 Ecore_X_Event_Window_Destroy *ev = event;
1066
1067 INF("killed window: %x (%x).", ev->win, ev->event_win);
1068
1069 return EINA_TRUE;
1070}
1071
1072static void
1073gstreamer_ecore_x_check(void)
1074{
1075 Ecore_X_Window *roots;
1076 int num;
1077
1078 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _ecore_event_x_destroy, NULL);
1079
1080 /* Check if the window manager is able to handle our special Xv window. */
1081 roots = ecore_x_window_root_list(&num);
1082 if (roots && num > 0)
1083 {
1084 Ecore_X_Window win, twin;
1085 int nwins;
1086
1087 nwins = ecore_x_window_prop_window_get(roots[0],
1088 ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
1089 &win, 1);
1090 if (nwins > 0)
1091 {
1092 nwins = ecore_x_window_prop_window_get(win,
1093 ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
1094 &twin, 1);
1095 if (nwins > 0 && twin == win)
1096 {
1097 Ecore_X_Atom *supported;
1098 int supported_num;
1099 int i;
1100
1101 if (ecore_x_netwm_supported_get(roots[0], &supported, &supported_num))
1102 {
1103 Eina_Bool parent = EINA_FALSE;
1104 Eina_Bool video_position = EINA_FALSE;
1105
1106 for (i = 0; i < supported_num; ++i)
1107 {
1108 if (supported[i] == ECORE_X_ATOM_E_VIDEO_PARENT)
1109 parent = EINA_TRUE;
1110 else if (supported[i] == ECORE_X_ATOM_E_VIDEO_POSITION)
1111 video_position = EINA_TRUE;
1112 if (parent && video_position)
1113 break;
1114 }
1115
1116 if (parent && video_position)
1117 {
1118 window_manager_video = EINA_TRUE;
1119 }
1120 }
1121 free(supported);
1122 }
1123 }
1124 }
1125 free(roots);
1126}
1127#endif
1128
1129static void *
1130em_add(const Emotion_Engine *api,
1131 Evas_Object *obj,
1132 const Emotion_Module_Options *opt EINA_UNUSED)
1133{
1134 Emotion_Gstreamer_Video *ev;
1135
1136 ev = calloc(1, sizeof(Emotion_Gstreamer_Video));
1137 EINA_SAFETY_ON_NULL_RETURN_VAL(ev, NULL);
1138
1139 ev->api = api;
1140 ev->obj = obj;
1141
1142 /* Default values */
1143 ev->ratio = 1.0;
1144 ev->vis = EMOTION_VIS_NONE;
1145 ev->volume = 0.8;
1146 ev->play_started = 0;
1147 ev->delete_me = EINA_FALSE;
1148 ev->threads = NULL;
1149
1150 return ev;
1151}
1152
1153static const Emotion_Engine em_engine =
1154{
1155 EMOTION_ENGINE_API_VERSION,
1156 EMOTION_ENGINE_PRIORITY_DEFAULT,
1157 "gstreamer",
1158 em_add, /* add */
1159 em_del, /* del */
1160 em_file_open, /* file_open */
1161 em_file_close, /* file_close */
1162 em_play, /* play */
1163 em_stop, /* stop */
1164 em_size_get, /* size_get */
1165 em_pos_set, /* pos_set */
1166 em_len_get, /* len_get */
1167 em_buffer_size_get, /* buffer_size_get */
1168 em_fps_num_get, /* fps_num_get */
1169 em_fps_den_get, /* fps_den_get */
1170 em_fps_get, /* fps_get */
1171 em_pos_get, /* pos_get */
1172 em_vis_set, /* vis_set */
1173 em_vis_get, /* vis_get */
1174 em_vis_supported, /* vis_supported */
1175 em_ratio_get, /* ratio_get */
1176 em_video_handled, /* video_handled */
1177 em_audio_handled, /* audio_handled */
1178 em_seekable, /* seekable */
1179 em_frame_done, /* frame_done */
1180 em_format_get, /* format_get */
1181 em_video_data_size_get, /* video_data_size_get */
1182 em_yuv_rows_get, /* yuv_rows_get */
1183 em_bgra_data_get, /* bgra_data_get */
1184 em_event_feed, /* event_feed */
1185 em_event_mouse_button_feed, /* event_mouse_button_feed */
1186 em_event_mouse_move_feed, /* event_mouse_move_feed */
1187 em_video_channel_count, /* video_channel_count */
1188 em_video_channel_set, /* video_channel_set */
1189 em_video_channel_get, /* video_channel_get */
1190 em_video_subtitle_file_set, /* video_subtitle_file_set */
1191 em_video_subtitle_file_get, /* video_subtitle_file_get */
1192 em_video_channel_name_get, /* video_channel_name_get */
1193 em_video_channel_mute_set, /* video_channel_mute_set */
1194 em_video_channel_mute_get, /* video_channel_mute_get */
1195 em_audio_channel_count, /* audio_channel_count */
1196 em_audio_channel_set, /* audio_channel_set */
1197 em_audio_channel_get, /* audio_channel_get */
1198 em_audio_channel_name_get, /* audio_channel_name_get */
1199 em_audio_channel_mute_set, /* audio_channel_mute_set */
1200 em_audio_channel_mute_get, /* audio_channel_mute_get */
1201 em_audio_channel_volume_set, /* audio_channel_volume_set */
1202 em_audio_channel_volume_get, /* audio_channel_volume_get */
1203 em_spu_channel_count, /* spu_channel_count */
1204 em_spu_channel_set, /* spu_channel_set */
1205 em_spu_channel_get, /* spu_channel_get */
1206 em_spu_channel_name_get, /* spu_channel_name_get */
1207 em_spu_channel_mute_set, /* spu_channel_mute_set */
1208 em_spu_channel_mute_get, /* spu_channel_mute_get */
1209 em_chapter_count, /* chapter_count */
1210 em_chapter_set, /* chapter_set */
1211 em_chapter_get, /* chapter_get */
1212 em_chapter_name_get, /* chapter_name_get */
1213 em_speed_set, /* speed_set */
1214 em_speed_get, /* speed_get */
1215 em_eject, /* eject */
1216 em_meta_get, /* meta_get */
1217 em_priority_set, /* priority_set */
1218 em_priority_get, /* priority_get */
1219 NULL /* em_meta_artwork_get */
1220};
1221
1222Eina_Bool
1223gstreamer_module_init(void)
1224{