From: Enlightenment S. <no-...@en...> - 2009-05-18 21:27:02
|
Log: Added some missing getters to ethumb API. Author: antognolli Date: 2009-05-18 14:26:56 -0700 (Mon, 18 May 2009) New Revision: 40730 Modified: trunk/PROTO/ethumb/src/lib/Ethumb.c trunk/PROTO/ethumb/src/lib/Ethumb.h trunk/PROTO/ethumb/src/lib/Ethumb_Plugin.h trunk/PROTO/ethumb/src/plugins/emotion/emotion.c trunk/PROTO/ethumb/src/plugins/epdf/epdf.c Modified: trunk/PROTO/ethumb/src/lib/Ethumb.c =================================================================== --- trunk/PROTO/ethumb/src/lib/Ethumb.c 2009-05-18 17:33:54 UTC (rev 40729) +++ trunk/PROTO/ethumb/src/lib/Ethumb.c 2009-05-18 21:26:56 UTC (rev 40730) @@ -428,6 +428,25 @@ } EAPI void +ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) +{ + EINA_SAFETY_ON_NULL_RETURN(e); + + if (e->frame) + { + if (theme_file) *theme_file = e->frame->file; + if (group) *group = e->frame->group; + if (swallow) *swallow = e->frame->swallow; + } + else + { + if (theme_file) *theme_file = NULL; + if (group) *group = NULL; + if (swallow) *swallow = NULL; + } +} + +EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) { EINA_SAFETY_ON_NULL_RETURN(e); @@ -467,6 +486,14 @@ e->video.time = time; } +EAPI float +ethumb_video_time_get(const Ethumb *e) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); + + return e->video.time; +} + EAPI void ethumb_document_page_set(Ethumb *e, int page) { @@ -476,6 +503,14 @@ } EAPI int +ethumb_document_page_get(const Ethumb *e) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); + + return e->document.page; +} + +EAPI int ethumb_file_set(Ethumb *e, const char *path, const char *key) { EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL); @@ -955,3 +990,11 @@ return r; } + +Evas * +ethumb_evas_get(Ethumb *e) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL); + + return e->sub_e; +} Modified: trunk/PROTO/ethumb/src/lib/Ethumb.h =================================================================== --- trunk/PROTO/ethumb/src/lib/Ethumb.h 2009-05-18 17:33:54 UTC (rev 40729) +++ trunk/PROTO/ethumb/src/lib/Ethumb.h 2009-05-18 21:26:56 UTC (rev 40730) @@ -89,6 +89,7 @@ EAPI void ethumb_thumb_crop_align_get(Ethumb *e, float *x, float *y) EINA_ARG_NONNULL(1); EAPI int ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const char *swallow) EINA_ARG_NONNULL(1); +EAPI void ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) EINA_ARG_NONNULL(1); EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) EINA_ARG_NONNULL(1); EAPI const char * ethumb_thumb_dir_path_get(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; @@ -97,7 +98,10 @@ EAPI const char * ethumb_thumb_category_get(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI void ethumb_video_time_set(Ethumb *e, float time) EINA_ARG_NONNULL(1); +EAPI float ethumb_video_time_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; + EAPI void ethumb_document_page_set(Ethumb *e, int page) EINA_ARG_NONNULL(1); +EAPI int ethumb_document_page_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI int ethumb_file_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1, 2); EAPI void ethumb_file_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1); Modified: trunk/PROTO/ethumb/src/lib/Ethumb_Plugin.h =================================================================== --- trunk/PROTO/ethumb/src/lib/Ethumb_Plugin.h 2009-05-18 17:33:54 UTC (rev 40729) +++ trunk/PROTO/ethumb/src/lib/Ethumb_Plugin.h 2009-05-18 21:26:56 UTC (rev 40730) @@ -18,5 +18,6 @@ int ethumb_plugin_image_resize(Ethumb *e, int w, int h); int ethumb_image_save(Ethumb *e); void ethumb_finished_callback_call(Ethumb *e); +Evas * ethumb_evas_get(Ethumb *e); #endif /* _ETHUMB_PLUGIN_H_ */ Modified: trunk/PROTO/ethumb/src/plugins/emotion/emotion.c =================================================================== --- trunk/PROTO/ethumb/src/plugins/emotion/emotion.c 2009-05-18 17:33:54 UTC (rev 40729) +++ trunk/PROTO/ethumb/src/plugins/emotion/emotion.c 2009-05-18 21:26:56 UTC (rev 40730) @@ -1,5 +1,4 @@ #include "Ethumb.h" -#include "ethumb_private.h" #include "Ethumb_Plugin.h" #include "config.h" @@ -38,8 +37,10 @@ { Evas_Object *o; int r; + const char *file; + float time; - o = emotion_object_add(e->sub_e); + o = emotion_object_add(ethumb_evas_get(e)); r = emotion_object_init(o, "xine"); if (!r) { @@ -49,8 +50,11 @@ return r; } - emotion_object_file_set(o, e->src_path); - emotion_object_position_set(o, e->video.time); + ethumb_file_get(e, &file, NULL); + time = ethumb_video_time_get(e); + + emotion_object_file_set(o, file); + emotion_object_position_set(o, time); emotion_object_play_set(o, 1); evas_object_smart_callback_add(o, "frame_resize", _frame_resized_cb, e); Modified: trunk/PROTO/ethumb/src/plugins/epdf/epdf.c =================================================================== --- trunk/PROTO/ethumb/src/plugins/epdf/epdf.c 2009-05-18 17:33:54 UTC (rev 40729) +++ trunk/PROTO/ethumb/src/plugins/epdf/epdf.c 2009-05-18 21:26:56 UTC (rev 40730) @@ -1,5 +1,4 @@ #include "Ethumb.h" -#include "ethumb_private.h" #include "Ethumb_Plugin.h" #include "config.h" @@ -18,6 +17,7 @@ int w, h, ww, hh; int fx, fy, fw, fh; int npages; + int pagenum; document = epdf_document_new(e->src_path); if (!document) @@ -35,13 +35,14 @@ } npages = epdf_document_page_count_get(document); - if (e->document.page < npages) - epdf_page_page_set(page, e->document.page); + pagenum = ethumb_document_page_get(e); + if (pagenum < npages) + epdf_page_page_set(page, pagenum); epdf_page_size_get(page, &w, &h); ethumb_calculate_aspect(e, w, h, &ww, &hh); ethumb_plugin_image_resize(e, ww, hh); - o = evas_object_image_add(e->sub_e); + o = evas_object_image_add(ethumb_evas_get(e)); epdf_page_render(page, o); evas_object_resize(o, ww, hh); evas_object_move(o, 0, 0); |