summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2009-09-17 14:05:04 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2009-09-17 14:05:04 +0000
commitbea73e88bd2fd679bd52716b0b4fd8813f875019 (patch)
tree2bab645f5dce840a1db4c2e5e1fc6a671ebea9cf /legacy
parentbf4e52869bc0987dd93d49cea062987c472c3e11 (diff)
Ethumb improvements and more docs.
make some types unsigned int to better represent what they will contain, fix dbus api to match so. SVN revision: 42545
Diffstat (limited to '')
-rw-r--r--legacy/ethumb/src/bin/ethumbd.c18
-rw-r--r--legacy/ethumb/src/lib/Ethumb.c27
-rw-r--r--legacy/ethumb/src/lib/Ethumb.h173
-rw-r--r--legacy/ethumb/src/lib/client/Ethumb_Client.c276
-rw-r--r--legacy/ethumb/src/lib/client/Ethumb_Client.h53
-rw-r--r--legacy/ethumb/src/lib/ethumb_private.h6
-rw-r--r--legacy/ethumb/src/plugins/emotion/emotion.c18
-rw-r--r--legacy/ethumb/src/plugins/epdf/epdf.c3
8 files changed, 451 insertions, 123 deletions
diff --git a/legacy/ethumb/src/bin/ethumbd.c b/legacy/ethumb/src/bin/ethumbd.c
index c49204a016..ecc6f5fd92 100644
--- a/legacy/ethumb/src/bin/ethumbd.c
+++ b/legacy/ethumb/src/bin/ethumbd.c
@@ -93,9 +93,9 @@ struct _Ethumb_Setup
93 float video_time; 93 float video_time;
94 float video_start; 94 float video_start;
95 float video_interval; 95 float video_interval;
96 int video_ntimes; 96 unsigned int video_ntimes;
97 int video_fps; 97 unsigned int video_fps;
98 int document_page; 98 unsigned int document_page;
99}; 99};
100 100
101struct _Ethumb_Request 101struct _Ethumb_Request
@@ -1396,10 +1396,10 @@ static int
1396_ethumb_dbus_video_ntimes_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1396_ethumb_dbus_video_ntimes_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request)
1397{ 1397{
1398 int type; 1398 int type;
1399 int video_ntimes; 1399 unsigned int video_ntimes;
1400 1400
1401 type = dbus_message_iter_get_arg_type(iter); 1401 type = dbus_message_iter_get_arg_type(iter);
1402 if (type != DBUS_TYPE_INT32) 1402 if (type != DBUS_TYPE_UINT32)
1403 { 1403 {
1404 ERR("invalid param for video_ntimes_set.\n"); 1404 ERR("invalid param for video_ntimes_set.\n");
1405 return 0; 1405 return 0;
@@ -1417,10 +1417,10 @@ static int
1417_ethumb_dbus_video_fps_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1417_ethumb_dbus_video_fps_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request)
1418{ 1418{
1419 int type; 1419 int type;
1420 int video_fps; 1420 unsigned int video_fps;
1421 1421
1422 type = dbus_message_iter_get_arg_type(iter); 1422 type = dbus_message_iter_get_arg_type(iter);
1423 if (type != DBUS_TYPE_INT32) 1423 if (type != DBUS_TYPE_UINT32)
1424 { 1424 {
1425 ERR("invalid param for video_fps_set.\n"); 1425 ERR("invalid param for video_fps_set.\n");
1426 return 0; 1426 return 0;
@@ -1438,10 +1438,10 @@ static int
1438_ethumb_dbus_document_page_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1438_ethumb_dbus_document_page_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request)
1439{ 1439{
1440 int type; 1440 int type;
1441 dbus_int32_t document_page; 1441 unsigned int document_page;
1442 1442
1443 type = dbus_message_iter_get_arg_type(iter); 1443 type = dbus_message_iter_get_arg_type(iter);
1444 if (type != DBUS_TYPE_INT32) 1444 if (type != DBUS_TYPE_UINT32)
1445 { 1445 {
1446 ERR("invalid param for document_page_set.\n"); 1446 ERR("invalid param for document_page_set.\n");
1447 return 0; 1447 return 0;
diff --git a/legacy/ethumb/src/lib/Ethumb.c b/legacy/ethumb/src/lib/Ethumb.c
index 00326b396a..ef040c4546 100644
--- a/legacy/ethumb/src/lib/Ethumb.c
+++ b/legacy/ethumb/src/lib/Ethumb.c
@@ -202,6 +202,7 @@ ethumb_new(void)
202 ethumb = calloc(1, sizeof(Ethumb)); 202 ethumb = calloc(1, sizeof(Ethumb));
203 EINA_SAFETY_ON_NULL_RETURN_VAL(ethumb, NULL); 203 EINA_SAFETY_ON_NULL_RETURN_VAL(ethumb, NULL);
204 204
205 /* IF CHANGED, UPDATE DOCS in (Ethumb.c, Ethumb_Client.c, python...)!!! */
205 ethumb->tw = THUMB_SIZE_NORMAL; 206 ethumb->tw = THUMB_SIZE_NORMAL;
206 ethumb->th = THUMB_SIZE_NORMAL; 207 ethumb->th = THUMB_SIZE_NORMAL;
207 ethumb->crop_x = 0.5; 208 ethumb->crop_x = 0.5;
@@ -532,7 +533,7 @@ ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, c
532} 533}
533 534
534static const char * 535static const char *
535_ethumb_build_absolute_path(const char *path, char buf[]) 536_ethumb_build_absolute_path(const char *path, char buf[PATH_MAX])
536{ 537{
537 char *p; 538 char *p;
538 int len; 539 int len;
@@ -546,7 +547,10 @@ _ethumb_build_absolute_path(const char *path, char buf[])
546 strcpy(p, path); 547 strcpy(p, path);
547 else if (path[0] == '~') 548 else if (path[0] == '~')
548 { 549 {
549 strcpy(p, getenv("HOME")); 550 const char *home = getenv("HOME");
551 if (!home)
552 return NULL;
553 strcpy(p, home);
550 len = strlen(p); 554 len = strlen(p);
551 p += len; 555 p += len;
552 p[0] = '/'; 556 p[0] = '/';
@@ -555,7 +559,8 @@ _ethumb_build_absolute_path(const char *path, char buf[])
555 } 559 }
556 else 560 else
557 { 561 {
558 getcwd(p, PATH_MAX); 562 if (!getcwd(p, PATH_MAX))
563 return NULL;
559 len = strlen(p); 564 len = strlen(p);
560 p += len; 565 p += len;
561 p[0] = '/'; 566 p[0] = '/';
@@ -606,6 +611,8 @@ EAPI void
606ethumb_video_start_set(Ethumb *e, float start) 611ethumb_video_start_set(Ethumb *e, float start)
607{ 612{
608 EINA_SAFETY_ON_NULL_RETURN(e); 613 EINA_SAFETY_ON_NULL_RETURN(e);
614 EINA_SAFETY_ON_FALSE_RETURN(start >= 0.0);
615 EINA_SAFETY_ON_FALSE_RETURN(start <= 1.0);
609 616
610 DBG("ethumb=%p, video_start=%f", e, start); 617 DBG("ethumb=%p, video_start=%f", e, start);
611 e->video.start = start; 618 e->video.start = start;
@@ -654,15 +661,16 @@ ethumb_video_interval_get(const Ethumb *e)
654} 661}
655 662
656EAPI void 663EAPI void
657ethumb_video_ntimes_set(Ethumb *e, int ntimes) 664ethumb_video_ntimes_set(Ethumb *e, unsigned int ntimes)
658{ 665{
659 EINA_SAFETY_ON_NULL_RETURN(e); 666 EINA_SAFETY_ON_NULL_RETURN(e);
667 EINA_SAFETY_ON_FALSE_RETURN(ntimes > 0);
660 668
661 DBG("ethumb=%p, video_ntimes=%d", e, ntimes); 669 DBG("ethumb=%p, video_ntimes=%d", e, ntimes);
662 e->video.ntimes = ntimes; 670 e->video.ntimes = ntimes;
663} 671}
664 672
665EAPI int 673EAPI unsigned int
666ethumb_video_ntimes_get(const Ethumb *e) 674ethumb_video_ntimes_get(const Ethumb *e)
667{ 675{
668 EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); 676 EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0);
@@ -671,15 +679,16 @@ ethumb_video_ntimes_get(const Ethumb *e)
671} 679}
672 680
673EAPI void 681EAPI void
674ethumb_video_fps_set(Ethumb *e, int fps) 682ethumb_video_fps_set(Ethumb *e, unsigned int fps)
675{ 683{
676 EINA_SAFETY_ON_NULL_RETURN(e); 684 EINA_SAFETY_ON_NULL_RETURN(e);
685 EINA_SAFETY_ON_FALSE_RETURN(fps > 0);
677 686
678 DBG("ethumb=%p, video_fps=%d", e, fps); 687 DBG("ethumb=%p, video_fps=%d", e, fps);
679 e->video.fps = fps; 688 e->video.fps = fps;
680} 689}
681 690
682EAPI int 691EAPI unsigned int
683ethumb_video_fps_get(const Ethumb *e) 692ethumb_video_fps_get(const Ethumb *e)
684{ 693{
685 EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); 694 EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0);
@@ -688,7 +697,7 @@ ethumb_video_fps_get(const Ethumb *e)
688} 697}
689 698
690EAPI void 699EAPI void
691ethumb_document_page_set(Ethumb *e, int page) 700ethumb_document_page_set(Ethumb *e, unsigned int page)
692{ 701{
693 EINA_SAFETY_ON_NULL_RETURN(e); 702 EINA_SAFETY_ON_NULL_RETURN(e);
694 703
@@ -696,7 +705,7 @@ ethumb_document_page_set(Ethumb *e, int page)
696 e->document.page = page; 705 e->document.page = page;
697} 706}
698 707
699EAPI int 708EAPI unsigned int
700ethumb_document_page_get(const Ethumb *e) 709ethumb_document_page_get(const Ethumb *e)
701{ 710{
702 EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); 711 EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0);
diff --git a/legacy/ethumb/src/lib/Ethumb.h b/legacy/ethumb/src/lib/Ethumb.h
index 8d9530440d..956e31a108 100644
--- a/legacy/ethumb/src/lib/Ethumb.h
+++ b/legacy/ethumb/src/lib/Ethumb.h
@@ -40,34 +40,33 @@
40extern "C" { 40extern "C" {
41#endif 41#endif
42 42
43enum _Ethumb_Thumb_FDO_Size 43/**
44{ 44 * @defgroup Ethumb Ethumb
45 ETHUMB_THUMB_NORMAL, 45 *
46 ETHUMB_THUMB_LARGE 46 * @{
47}; 47 */
48 48/**
49typedef enum _Ethumb_Thumb_FDO_Size Ethumb_Thumb_FDO_Size; 49 * @defgroup Ethumb_Basics Ethumb Basics
50 50 *
51enum _Ethumb_Thumb_Format 51 * Functions that all users must know of to use Ethumb.
52{ 52 *
53 ETHUMB_THUMB_FDO, 53 * @{
54 ETHUMB_THUMB_JPEG, 54 */
55 ETHUMB_THUMB_EET 55
56}; 56/**
57 57 * @brief thumbnailer handle.
58typedef enum _Ethumb_Thumb_Format Ethumb_Thumb_Format; 58 *
59 59 * The handle is returned by ethumb_new() and destroyed by ethumb_free().
60enum _Ethumb_Thumb_Aspect 60 */
61{
62 ETHUMB_THUMB_KEEP_ASPECT,
63 ETHUMB_THUMB_IGNORE_ASPECT,
64 ETHUMB_THUMB_CROP
65};
66
67typedef enum _Ethumb_Thumb_Aspect Ethumb_Thumb_Aspect;
68
69typedef struct _Ethumb_Frame Ethumb_Frame;
70typedef struct _Ethumb Ethumb; 61typedef struct _Ethumb Ethumb;
62
63/**
64 * @brief reports results of ethumb_generate().
65 *
66 * @param data extra context given to ethumb_generate().
67 * @param e handle of the current thumbnailer.
68 * @param success @c EINA_TRUE if generated or @c EINA_FALSE on errors.
69 */
71typedef void (*Ethumb_Generate_Cb)(void *data, Ethumb *e, Eina_Bool success); 70typedef void (*Ethumb_Generate_Cb)(void *data, Ethumb *e, Eina_Bool success);
72 71
73EAPI int ethumb_init(void); 72EAPI int ethumb_init(void);
@@ -76,58 +75,106 @@ EAPI int ethumb_shutdown(void);
76EAPI Ethumb * ethumb_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT; 75EAPI Ethumb * ethumb_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
77EAPI void ethumb_free(Ethumb *e); 76EAPI void ethumb_free(Ethumb *e);
78 77
79EAPI void ethumb_thumb_fdo_set(Ethumb *e, Ethumb_Thumb_FDO_Size s) EINA_ARG_NONNULL(1); 78/**
80 79 * @}
81EAPI void ethumb_thumb_size_set(Ethumb *e, int tw, int th) EINA_ARG_NONNULL(1); 80 */
82EAPI void ethumb_thumb_size_get(const Ethumb *e, int *tw, int *th) EINA_ARG_NONNULL(1);
83 81
84EAPI void ethumb_thumb_format_set(Ethumb *e, Ethumb_Thumb_Format f) EINA_ARG_NONNULL(1); 82/**
85EAPI Ethumb_Thumb_Format ethumb_thumb_format_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 83 * @defgroup Ethumb_Setup Ethumb Fine Tune Setup
84 *
85 * How to fine tune thumbnail generation, setting size, aspect,
86 * frames, quality and so on.
87 *
88 * @{
89 */
86 90
87EAPI void ethumb_thumb_aspect_set(Ethumb *e, Ethumb_Thumb_Aspect a) EINA_ARG_NONNULL(1); 91EAPI Eina_Bool ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const char *swallow) EINA_ARG_NONNULL(1);
88EAPI Ethumb_Thumb_Aspect ethumb_thumb_aspect_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 92EAPI void ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) EINA_ARG_NONNULL(1);
89 93
90EAPI void ethumb_thumb_crop_align_set(Ethumb *e, float x, float y) EINA_ARG_NONNULL(1); 94EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) EINA_ARG_NONNULL(1);
91EAPI void ethumb_thumb_crop_align_get(const Ethumb *e, float *x, float *y) EINA_ARG_NONNULL(1); 95EAPI const char *ethumb_thumb_dir_path_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
92 96
93EAPI void ethumb_thumb_quality_set(Ethumb *e, int quality) EINA_ARG_NONNULL(1); 97EAPI void ethumb_thumb_category_set(Ethumb *e, const char *category) EINA_ARG_NONNULL(1);
94EAPI int ethumb_thumb_quality_get(const Ethumb *e) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE; 98EAPI const char *ethumb_thumb_category_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
95 99
96EAPI void ethumb_thumb_compress_set(Ethumb *e, int compress) EINA_ARG_NONNULL(1); 100EAPI void ethumb_thumb_path_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1);
97EAPI int ethumb_thumb_compress_get(const Ethumb *e) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE; 101EAPI void ethumb_thumb_path_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1);
98 102
99EAPI Eina_Bool ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const char *swallow) EINA_ARG_NONNULL(1); 103typedef enum _Ethumb_Thumb_FDO_Size
100EAPI void ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) EINA_ARG_NONNULL(1); 104{
105 ETHUMB_THUMB_NORMAL, /**< 128x128 as defined by FreeDesktop.Org standard */
106 ETHUMB_THUMB_LARGE /**< 256x256 as defined by FreeDesktop.Org standard */
107} Ethumb_Thumb_FDO_Size;
101 108
102EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) EINA_ARG_NONNULL(1); 109typedef enum _Ethumb_Thumb_Format
103EAPI const char * ethumb_thumb_dir_path_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 110{
111 ETHUMB_THUMB_FDO, /**< PNG as defined by FreeDesktop.Org standard */
112 ETHUMB_THUMB_JPEG, /**< JPEGs are often smaller and faster to read/write */
113 ETHUMB_THUMB_EET /**< EFL's own storage system, supports key parameter */
114} Ethumb_Thumb_Format;
104 115
105EAPI void ethumb_thumb_category_set(Ethumb *e, const char *category) EINA_ARG_NONNULL(1); 116typedef enum _Ethumb_Thumb_Aspect
106EAPI const char * ethumb_thumb_category_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 117{
118 ETHUMB_THUMB_KEEP_ASPECT, /**< keep original proportion between width and height */
119 ETHUMB_THUMB_IGNORE_ASPECT, /**< ignore aspect and foce it to match thumbnail's width and height */
120 ETHUMB_THUMB_CROP /**< keep aspect but crop (cut) the largest dimension */
121} Ethumb_Thumb_Aspect;
107 122
123EAPI void ethumb_thumb_fdo_set(Ethumb *e, Ethumb_Thumb_FDO_Size s) EINA_ARG_NONNULL(1);
108 124
109EAPI void ethumb_video_start_set(Ethumb *e, float start) EINA_ARG_NONNULL(1); 125EAPI void ethumb_thumb_size_set(Ethumb *e, int tw, int th) EINA_ARG_NONNULL(1);
110EAPI float ethumb_video_start_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 126EAPI void ethumb_thumb_size_get(const Ethumb *e, int *tw, int *th) EINA_ARG_NONNULL(1);
111EAPI void ethumb_video_time_set(Ethumb *e, float time) EINA_ARG_NONNULL(1);
112EAPI float ethumb_video_time_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
113EAPI void ethumb_video_interval_set(Ethumb *e, float interval) EINA_ARG_NONNULL(1);
114EAPI float ethumb_video_interval_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
115EAPI void ethumb_video_ntimes_set(Ethumb *e, int ntimes) EINA_ARG_NONNULL(1);
116EAPI int ethumb_video_ntimes_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
117EAPI void ethumb_video_fps_set(Ethumb *e, int fps) EINA_ARG_NONNULL(1);
118EAPI int ethumb_video_fps_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
119 127
128EAPI void ethumb_thumb_format_set(Ethumb *e, Ethumb_Thumb_Format f) EINA_ARG_NONNULL(1);
129EAPI Ethumb_Thumb_Format ethumb_thumb_format_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
120 130
121EAPI void ethumb_document_page_set(Ethumb *e, int page) EINA_ARG_NONNULL(1); 131EAPI void ethumb_thumb_aspect_set(Ethumb *e, Ethumb_Thumb_Aspect a) EINA_ARG_NONNULL(1);
122EAPI int ethumb_document_page_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 132EAPI Ethumb_Thumb_Aspect ethumb_thumb_aspect_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
123 133
134EAPI void ethumb_thumb_crop_align_set(Ethumb *e, float x, float y) EINA_ARG_NONNULL(1);
135EAPI void ethumb_thumb_crop_align_get(const Ethumb *e, float *x, float *y) EINA_ARG_NONNULL(1);
136
137EAPI void ethumb_thumb_quality_set(Ethumb *e, int quality) EINA_ARG_NONNULL(1);
138EAPI int ethumb_thumb_quality_get(const Ethumb *e) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE;
139
140EAPI void ethumb_thumb_compress_set(Ethumb *e, int compress) EINA_ARG_NONNULL(1);
141EAPI int ethumb_thumb_compress_get(const Ethumb *e) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE;
142
143EAPI void ethumb_video_start_set(Ethumb *e, float start) EINA_ARG_NONNULL(1);
144EAPI float ethumb_video_start_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
145EAPI void ethumb_video_time_set(Ethumb *e, float time) EINA_ARG_NONNULL(1);
146EAPI float ethumb_video_time_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
147EAPI void ethumb_video_interval_set(Ethumb *e, float interval) EINA_ARG_NONNULL(1);
148EAPI float ethumb_video_interval_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
149EAPI void ethumb_video_ntimes_set(Ethumb *e, unsigned int ntimes) EINA_ARG_NONNULL(1);
150EAPI unsigned int ethumb_video_ntimes_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
151EAPI void ethumb_video_fps_set(Ethumb *e, unsigned int fps) EINA_ARG_NONNULL(1);
152EAPI unsigned int ethumb_video_fps_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
153
154
155EAPI void ethumb_document_page_set(Ethumb *e, unsigned int page) EINA_ARG_NONNULL(1);
156EAPI unsigned int ethumb_document_page_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
157/**
158 * @}
159 */
160
161/**
162 * @addtogroup Ethumb_Basics Ethumb Basics
163 * @{
164 */
124EAPI Eina_Bool ethumb_file_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1, 2); 165EAPI Eina_Bool ethumb_file_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1, 2);
125EAPI void ethumb_file_get(const Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1); 166EAPI void ethumb_file_get(const Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1);
126EAPI void ethumb_file_free(Ethumb *e) EINA_ARG_NONNULL(1); 167EAPI void ethumb_file_free(Ethumb *e) EINA_ARG_NONNULL(1);
127EAPI void ethumb_thumb_path_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1); 168
128EAPI void ethumb_thumb_path_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1);
129EAPI Eina_Bool ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, const void *data, Eina_Free_Cb free_data) EINA_ARG_NONNULL(1, 2); 169EAPI Eina_Bool ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, const void *data, Eina_Free_Cb free_data) EINA_ARG_NONNULL(1, 2);
130EAPI Eina_Bool ethumb_exists(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 170EAPI Eina_Bool ethumb_exists(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
171/**
172 * @}
173 */
174
175/**
176 * @}
177 */
131 178
132#ifdef __cplusplus 179#ifdef __cplusplus
133} 180}
diff --git a/legacy/ethumb/src/lib/client/Ethumb_Client.c b/legacy/ethumb/src/lib/client/Ethumb_Client.c
index 1ddd8d4f8f..3b421cc9ca 100644
--- a/legacy/ethumb/src/lib/client/Ethumb_Client.c
+++ b/legacy/ethumb/src/lib/client/Ethumb_Client.c
@@ -463,6 +463,23 @@ error:
463 * @endcond 463 * @endcond
464 */ 464 */
465 465
466/**
467 * @brief Initialize the Ethumb_Client library.
468 *
469 * @return 1 or greater on success, 0 on error.
470 *
471 * This function sets up all the Ethumb_Client module dependencies. It
472 * returns 0 on failure (that is, when one of the dependency fails to
473 * initialize), otherwise it returns the number of times it has
474 * already been called.
475 *
476 * When Ethumb_Client is not used anymore, call
477 * ethumb_client_shutdown() to shut down the Ethumb_Client library.
478 *
479 * @see ethumb_client_shutdown()
480 * @see ethumb_client_connect()
481 * @see @ref tutorial_ethumb_client
482 */
466EAPI int 483EAPI int
467ethumb_client_init(void) 484ethumb_client_init(void)
468{ 485{
@@ -488,6 +505,22 @@ ethumb_client_init(void)
488 return ++_initcount; 505 return ++_initcount;
489} 506}
490 507
508/**
509 * @brief Shut down the Ethumb_Client library.
510 *
511 * @return 0 when everything is shut down, 1 or greater if there are
512 * other users of the Ethumb_Client library pending shutdown.
513 *
514 * This function shuts down the Ethumb_Client library. It returns 0
515 * when it has been called the same number of times than
516 * ethumb_client_init(). In that case it shut down all the
517 * Ethumb_Client modules dependencies.
518 *
519 * Once this function succeeds (that is, @c 0 is returned), you must
520 * not call any of the Eina function anymore. You must call
521 * ethumb_client_init() again to use the Ethumb_Client functions
522 * again.
523 */
491EAPI int 524EAPI int
492ethumb_client_shutdown(void) 525ethumb_client_shutdown(void)
493{ 526{
@@ -604,6 +637,9 @@ err:
604 * 637 *
605 * This is the destructor of Ethumb_Client, after it's disconnected 638 * This is the destructor of Ethumb_Client, after it's disconnected
606 * the client handle is now gone and should not be used. 639 * the client handle is now gone and should not be used.
640 *
641 * @param client client instance to be destroyed. Must @b not be @c
642 * NULL.
607 */ 643 */
608EAPI void 644EAPI void
609ethumb_client_disconnect(Ethumb_Client *client) 645ethumb_client_disconnect(Ethumb_Client *client)
@@ -914,19 +950,19 @@ ethumb_client_ethumb_setup(Ethumb_Client *client)
914 dbus_message_iter_append_basic(&viter, DBUS_TYPE_DOUBLE, &video_interval); 950 dbus_message_iter_append_basic(&viter, DBUS_TYPE_DOUBLE, &video_interval);
915 _close_variant_iter(viter); 951 _close_variant_iter(viter);
916 952
917 _open_variant_iter("video_ntimes", "i", viter); 953 _open_variant_iter("video_ntimes", "u", viter);
918 video_ntimes = ethumb_video_ntimes_get(e); 954 video_ntimes = ethumb_video_ntimes_get(e);
919 dbus_message_iter_append_basic(&viter, DBUS_TYPE_INT32, &video_ntimes); 955 dbus_message_iter_append_basic(&viter, DBUS_TYPE_UINT32, &video_ntimes);
920 _close_variant_iter(viter); 956 _close_variant_iter(viter);
921 957
922 _open_variant_iter("video_fps", "i", viter); 958 _open_variant_iter("video_fps", "u", viter);
923 video_fps = ethumb_video_fps_get(e); 959 video_fps = ethumb_video_fps_get(e);
924 dbus_message_iter_append_basic(&viter, DBUS_TYPE_INT32, &video_fps); 960 dbus_message_iter_append_basic(&viter, DBUS_TYPE_UINT32, &video_fps);
925 _close_variant_iter(viter); 961 _close_variant_iter(viter);
926 962
927 _open_variant_iter("document_page", "i", viter); 963 _open_variant_iter("document_page", "u", viter);
928 document_page = ethumb_document_page_get(e); 964 document_page = ethumb_document_page_get(e);
929 dbus_message_iter_append_basic(&viter, DBUS_TYPE_INT32, &document_page); 965 dbus_message_iter_append_basic(&viter, DBUS_TYPE_UINT32, &document_page);
930 _close_variant_iter(viter); 966 _close_variant_iter(viter);
931 967
932#undef _open_variant_iter 968#undef _open_variant_iter
@@ -1299,6 +1335,9 @@ ethumb_client_generate_cancel_all(Ethumb_Client *client)
1299 * ~/.thumbnails/SIZE, with size being either normal (128x128) or 1335 * ~/.thumbnails/SIZE, with size being either normal (128x128) or
1300 * large (256x256). 1336 * large (256x256).
1301 * 1337 *
1338 * @param client the client instance to use. Must @b not be @c
1339 * NULL. May be pending connected (can be called before @c
1340 * connected_cb)
1302 * @param s size identifier, either #ETHUMB_THUMB_NORMAL (0) or 1341 * @param s size identifier, either #ETHUMB_THUMB_NORMAL (0) or
1303 * #ETHUMB_THUMB_LARGE (1). 1342 * #ETHUMB_THUMB_LARGE (1).
1304 * 1343 *
@@ -1320,8 +1359,11 @@ ethumb_client_fdo_set(Ethumb_Client *client, Ethumb_Thumb_FDO_Size s)
1320/** 1359/**
1321 * Configure future request to use custom size. 1360 * Configure future request to use custom size.
1322 * 1361 *
1323 * @param w width, default is 128. 1362 * @param client the client instance to use. Must @b not be @c
1324 * @param h height, default is 128. 1363 * NULL. May be pending connected (can be called before @c
1364 * connected_cb)
1365 * @param tw width, default is 128.
1366 * @param th height, default is 128.
1325 */ 1367 */
1326EAPI void 1368EAPI void
1327ethumb_client_size_set(Ethumb_Client *client, int tw, int th) 1369ethumb_client_size_set(Ethumb_Client *client, int tw, int th)
@@ -1335,8 +1377,11 @@ ethumb_client_size_set(Ethumb_Client *client, int tw, int th)
1335/** 1377/**
1336 * Retrieve future request to use custom size. 1378 * Retrieve future request to use custom size.
1337 * 1379 *
1338 * @param w where to return width. May be #NULL. 1380 * @param client the client instance to use. Must @b not be @c
1339 * @param h where to return height. May be #NULL. 1381 * NULL. May be pending connected (can be called before @c
1382 * connected_cb)
1383 * @param tw where to return width. May be @c NULL.
1384 * @param th where to return height. May be @c NULL.
1340 */ 1385 */
1341EAPI void 1386EAPI void
1342ethumb_client_size_get(const Ethumb_Client *client, int *tw, int *th) 1387ethumb_client_size_get(const Ethumb_Client *client, int *tw, int *th)
@@ -1351,6 +1396,9 @@ ethumb_client_size_get(const Ethumb_Client *client, int *tw, int *th)
1351/** 1396/**
1352 * Configure format to use for future requests. 1397 * Configure format to use for future requests.
1353 * 1398 *
1399 * @param client the client instance to use. Must @b not be @c
1400 * NULL. May be pending connected (can be called before @c
1401 * connected_cb)
1354 * @param f format identifier to use, either #ETHUMB_THUMB_FDO (0), 1402 * @param f format identifier to use, either #ETHUMB_THUMB_FDO (0),
1355 * #ETHUMB_THUMB_JPEG (1) or #ETHUMB_THUMB_EET (2). Default is FDO. 1403 * #ETHUMB_THUMB_JPEG (1) or #ETHUMB_THUMB_EET (2). Default is FDO.
1356 */ 1404 */
@@ -1366,6 +1414,10 @@ ethumb_client_format_set(Ethumb_Client *client, Ethumb_Thumb_Format f)
1366/** 1414/**
1367 * Retrieve format to use for future requests. 1415 * Retrieve format to use for future requests.
1368 * 1416 *
1417 * @param client the client instance to use. Must @b not be @c
1418 * NULL. May be pending connected (can be called before @c
1419 * connected_cb)
1420 *
1369 * @return format identifier to use, either #ETHUMB_THUMB_FDO (0), 1421 * @return format identifier to use, either #ETHUMB_THUMB_FDO (0),
1370 * #ETHUMB_THUMB_JPEG (1) or #ETHUMB_THUMB_EET (2). 1422 * #ETHUMB_THUMB_JPEG (1) or #ETHUMB_THUMB_EET (2).
1371 */ 1423 */
@@ -1400,6 +1452,9 @@ ethumb_client_format_get(const Ethumb_Client *client)
1400 * pixels from left and 250 pixels from right being lost, that is just 1452 * pixels from left and 250 pixels from right being lost, that is just
1401 * the 500x500 central pixels of image will be considered for scaling. 1453 * the 500x500 central pixels of image will be considered for scaling.
1402 * 1454 *
1455 * @param client the client instance to use. Must @b not be @c
1456 * NULL. May be pending connected (can be called before @c
1457 * connected_cb)
1403 * @param a aspect mode identifier, either #ETHUMB_THUMB_KEEP_ASPECT (0), 1458 * @param a aspect mode identifier, either #ETHUMB_THUMB_KEEP_ASPECT (0),
1404 * #ETHUMB_THUMB_IGNORE_ASPECT (1) or #ETHUMB_THUMB_CROP (2). 1459 * #ETHUMB_THUMB_IGNORE_ASPECT (1) or #ETHUMB_THUMB_CROP (2).
1405 */ 1460 */
@@ -1415,6 +1470,10 @@ ethumb_client_aspect_set(Ethumb_Client *client, Ethumb_Thumb_Aspect a)
1415/** 1470/**
1416 * Get current aspect in use for requests. 1471 * Get current aspect in use for requests.
1417 * 1472 *
1473 * @param client the client instance to use. Must @b not be @c
1474 * NULL. May be pending connected (can be called before @c
1475 * connected_cb)
1476 *
1418 * @return aspect in use for future requests. 1477 * @return aspect in use for future requests.
1419 */ 1478 */
1420EAPI Ethumb_Thumb_Aspect 1479EAPI Ethumb_Thumb_Aspect
@@ -1428,6 +1487,9 @@ ethumb_client_aspect_get(const Ethumb_Client *client)
1428/** 1487/**
1429 * Configure crop alignment in use for future requests. 1488 * Configure crop alignment in use for future requests.
1430 * 1489 *
1490 * @param client the client instance to use. Must @b not be @c
1491 * NULL. May be pending connected (can be called before @c
1492 * connected_cb)
1431 * @param x horizontal alignment. 0.0 means left side will be visible 1493 * @param x horizontal alignment. 0.0 means left side will be visible
1432 * or right side is being lost. 1.0 means right side will be 1494 * or right side is being lost. 1.0 means right side will be
1433 * visible or left side is being lost. 0.5 means just center is 1495 * visible or left side is being lost. 0.5 means just center is
@@ -1447,8 +1509,11 @@ ethumb_client_crop_align_set(Ethumb_Client *client, float x, float y)
1447/** 1509/**
1448 * Get current crop alignment in use for requests. 1510 * Get current crop alignment in use for requests.
1449 * 1511 *
1450 * @param x where to return horizontal alignment. May be #NULL. 1512 * @param client the client instance to use. Must @b not be @c
1451 * @param y where to return vertical alignment. May be #NULL. 1513 * NULL. May be pending connected (can be called before @c
1514 * connected_cb)
1515 * @param x where to return horizontal alignment. May be @c NULL.
1516 * @param y where to return vertical alignment. May be @c NULL.
1452 */ 1517 */
1453EAPI void 1518EAPI void
1454ethumb_client_crop_align_get(const Ethumb_Client *client, float *x, float *y) 1519ethumb_client_crop_align_get(const Ethumb_Client *client, float *x, float *y)
@@ -1463,6 +1528,9 @@ ethumb_client_crop_align_get(const Ethumb_Client *client, float *x, float *y)
1463/** 1528/**
1464 * Configure quality to be used in thumbnails. 1529 * Configure quality to be used in thumbnails.
1465 * 1530 *
1531 * @param client the client instance to use. Must @b not be @c
1532 * NULL. May be pending connected (can be called before @c
1533 * connected_cb)
1466 * @param quality value from 0 to 100, default is 80. The effect 1534 * @param quality value from 0 to 100, default is 80. The effect
1467 * depends on the format being used, PNG will not use it. 1535 * depends on the format being used, PNG will not use it.
1468 */ 1536 */
@@ -1477,6 +1545,10 @@ ethumb_client_quality_set(Ethumb_Client *client, int quality)
1477/** 1545/**
1478 * Get quality to be used in thumbnails. 1546 * Get quality to be used in thumbnails.
1479 * 1547 *
1548 * @param client the client instance to use. Must @b not be @c
1549 * NULL. May be pending connected (can be called before @c
1550 * connected_cb)
1551 *
1480 * @return quality value from 0 to 100, default is 80. The effect 1552 * @return quality value from 0 to 100, default is 80. The effect
1481 * depends on the format being used, PNG will not use it. 1553 * depends on the format being used, PNG will not use it.
1482 */ 1554 */
@@ -1491,6 +1563,9 @@ ethumb_client_quality_get(const Ethumb_Client *client)
1491/** 1563/**
1492 * Configure compression level used in requests. 1564 * Configure compression level used in requests.
1493 * 1565 *
1566 * @param client the client instance to use. Must @b not be @c
1567 * NULL. May be pending connected (can be called before @c
1568 * connected_cb)
1494 * @param compress value from 0 to 9, default is 9. The effect 1569 * @param compress value from 0 to 9, default is 9. The effect
1495 * depends on the format being used, JPEG will not use it. 1570 * depends on the format being used, JPEG will not use it.
1496 */ 1571 */
@@ -1505,6 +1580,10 @@ ethumb_client_compress_set(Ethumb_Client *client, int compress)
1505/** 1580/**
1506 * Get compression level used in requests. 1581 * Get compression level used in requests.
1507 * 1582 *
1583 * @param client the client instance to use. Must @b not be @c
1584 * NULL. May be pending connected (can be called before @c
1585 * connected_cb)
1586 *
1508 * @return compress value from 0 to 9, default is 9. The effect 1587 * @return compress value from 0 to 9, default is 9. The effect
1509 * depends on the format being used, JPEG will not use it. 1588 * depends on the format being used, JPEG will not use it.
1510 */ 1589 */
@@ -1525,6 +1604,9 @@ ethumb_client_compress_get(const Ethumb_Client *client)
1525 * of thumbnails, but sometimes it's useful to have it composited and 1604 * of thumbnails, but sometimes it's useful to have it composited and
1526 * avoid runtime overhead. 1605 * avoid runtime overhead.
1527 * 1606 *
1607 * @param client the client instance to use. Must @b not be @c
1608 * NULL. May be pending connected (can be called before @c
1609 * connected_cb)
1528 * @param file file path to edje. 1610 * @param file file path to edje.
1529 * @param group group inside edje to use. 1611 * @param group group inside edje to use.
1530 * @param swallow name of swallow part. 1612 * @param swallow name of swallow part.
@@ -1541,11 +1623,25 @@ ethumb_client_frame_set(Ethumb_Client *client, const char *file, const char *gro
1541/** 1623/**
1542 * Configure where to store thumbnails in future requests. 1624 * Configure where to store thumbnails in future requests.
1543 * 1625 *
1626 * This value will be used to generate thumbnail paths, that is, it
1627 * will be used when ethumb_client_thumb_path_set() was not called
1628 * after last ethumb_client_file_set().
1629 *
1544 * Note that this is the base, a category is added to this path as a 1630 * Note that this is the base, a category is added to this path as a
1545 * sub directory. 1631 * sub directory. This is not the final directory where files are
1632 * stored, the thumbnail system will account @b category as well, see
1633 * ethumb_client_category_set().
1546 * 1634 *
1635 * As other options, this value will only be applied to future
1636 * requests.
1637 *
1638 * @param client the client instance to use. Must @b not be @c
1639 * NULL. May be pending connected (can be called before @c
1640 * connected_cb)
1547 * @param path base directory where to store thumbnails. Default is 1641 * @param path base directory where to store thumbnails. Default is
1548 * ~/.thumbnails 1642 * ~/.thumbnails
1643 *
1644 * @see ethumb_client_category_set()
1549 */ 1645 */
1550EAPI void 1646EAPI void
1551ethumb_client_dir_path_set(Ethumb_Client *client, const char *path) 1647ethumb_client_dir_path_set(Ethumb_Client *client, const char *path)
@@ -1556,6 +1652,18 @@ ethumb_client_dir_path_set(Ethumb_Client *client, const char *path)
1556 ethumb_thumb_dir_path_set(client->ethumb, path); 1652 ethumb_thumb_dir_path_set(client->ethumb, path);
1557} 1653}
1558 1654
1655/**
1656 * Get base directory path where to store thumbnails.
1657 *
1658 * @param client the client instance to use. Must @b not be @c
1659 * NULL. May be pending connected (can be called before @c
1660 * connected_cb)
1661 *
1662 * @return pointer to internal string with current path. This string
1663 * should not be modified or freed.
1664 *
1665 * @see ethumb_client_dir_path_set()
1666 */
1559EAPI const char * 1667EAPI const char *
1560ethumb_client_dir_path_get(const Ethumb_Client *client) 1668ethumb_client_dir_path_get(const Ethumb_Client *client)
1561{ 1669{
@@ -1567,10 +1675,26 @@ ethumb_client_dir_path_get(const Ethumb_Client *client)
1567/** 1675/**
1568 * Category directory to store thumbnails. 1676 * Category directory to store thumbnails.
1569 * 1677 *
1678 * This value will be used to generate thumbnail paths, that is, it
1679 * will be used when ethumb_client_thumb_path_set() was not called
1680 * after last ethumb_client_file_set().
1681 *
1682 * This is a sub-directory inside base directory
1683 * (ethumb_client_dir_path_set()) that creates a namespace to avoid
1684 * different options resulting in the same file.
1685 *
1686 * As other options, this value will only be applied to future
1687 * requests.
1688 *
1689 * @param client the client instance to use. Must @b not be @c
1690 * NULL. May be pending connected (can be called before @c
1691 * connected_cb)
1570 * @param category category sub directory to store thumbnail. Default 1692 * @param category category sub directory to store thumbnail. Default
1571 * is either "normal" or "large" for FDO compliant thumbnails 1693 * is either "normal" or "large" for FDO compliant thumbnails
1572 * or WIDTHxHEIGHT-ASPECT[-FRAMED]-FORMAT. It can be a string 1694 * or WIDTHxHEIGHT-ASPECT[-FRAMED]-FORMAT. It can be a string
1573 * or None to use auto generated names. 1695 * or @c NULL to use auto generated names.
1696 *
1697 * @see ethumb_client_dir_path_set()
1574 */ 1698 */
1575EAPI void 1699EAPI void
1576ethumb_client_category_set(Ethumb_Client *client, const char *category) 1700ethumb_client_category_set(Ethumb_Client *client, const char *category)
@@ -1581,6 +1705,18 @@ ethumb_client_category_set(Ethumb_Client *client, const char *category)
1581 ethumb_thumb_category_set(client->ethumb, category); 1705 ethumb_thumb_category_set(client->ethumb, category);
1582} 1706}
1583 1707
1708/**
1709 * Get category sub-directory where to store thumbnails.
1710 *
1711 * @param client the client instance to use. Must @b not be @c
1712 * NULL. May be pending connected (can be called before @c
1713 * connected_cb)
1714 *
1715 * @return pointer to internal string with current path. This string
1716 * should not be modified or freed.
1717 *
1718 * @see ethumb_client_category_set()
1719 */
1584EAPI const char * 1720EAPI const char *
1585ethumb_client_category_get(const Ethumb_Client *client) 1721ethumb_client_category_get(const Ethumb_Client *client)
1586{ 1722{
@@ -1589,6 +1725,14 @@ ethumb_client_category_get(const Ethumb_Client *client)
1589 return ethumb_thumb_category_get(client->ethumb); 1725 return ethumb_thumb_category_get(client->ethumb);
1590} 1726}
1591 1727
1728/**
1729 * Set the video time (duration) in seconds.
1730 *
1731 * @param client the client instance to use. Must @b not be @c
1732 * NULL. May be pending connected (can be called before @c
1733 * connected_cb)
1734 * @param time duration (in seconds). Defaults to 3 seconds.
1735 */
1592EAPI void 1736EAPI void
1593ethumb_client_video_time_set(Ethumb_Client *client, float time) 1737ethumb_client_video_time_set(Ethumb_Client *client, float time)
1594{ 1738{
@@ -1598,15 +1742,48 @@ ethumb_client_video_time_set(Ethumb_Client *client, float time)
1598 ethumb_video_time_set(client->ethumb, time); 1742 ethumb_video_time_set(client->ethumb, time);
1599} 1743}
1600 1744
1745/**
1746 * Set initial video position to start thumbnailing, in percentage.
1747 *
1748 * This is useful to avoid thumbnailing the company/producer logo or
1749 * movie opening.
1750 *
1751 * @param client the client instance to use. Must @b not be @c
1752 * NULL. May be pending connected (can be called before @c
1753 * connected_cb)
1754 * @param start initial video positon to thumbnail, in percentage (0.0
1755 * to 1.0, inclusive). Defaults to 10% (0.1).
1756 */
1601EAPI void 1757EAPI void
1602ethumb_client_video_start_set(Ethumb_Client *client, float start) 1758ethumb_client_video_start_set(Ethumb_Client *client, float start)
1603{ 1759{
1604 EINA_SAFETY_ON_NULL_RETURN(client); 1760 EINA_SAFETY_ON_NULL_RETURN(client);
1761 EINA_SAFETY_ON_FALSE_RETURN(start >= 0.0);
1762 EINA_SAFETY_ON_FALSE_RETURN(start <= 1.0);
1605 1763
1606 client->ethumb_dirty = 1; 1764 client->ethumb_dirty = 1;
1607 ethumb_video_start_set(client->ethumb, start); 1765 ethumb_video_start_set(client->ethumb, start);
1608} 1766}
1609 1767
1768/**
1769 * Set the video frame interval, in seconds.
1770 *
1771 * This is useful for animated thumbnail and will define skip time
1772 * before going to the next frame. Note that video backends might not
1773 * be able to precisely skip that amount as it will depend on various
1774 * factors, including video encoding.
1775 *
1776 * Although this seems similar to ethumb_client_video_fps_set(), this
1777 * one is the time that will be used to seek. The math is simple, for
1778 * each new frame the video position will be set to:
1779 * ((video_length * start_time) + (interval * current_frame_number)).
1780 *
1781 * @param client the client instance to use. Must @b not be @c
1782 * NULL. May be pending connected (can be called before @c
1783 * connected_cb)
1784 * @param interval time between frames, in seconds. Defaults to 0.05
1785 * seconds.
1786 */
1610EAPI void 1787EAPI void
1611ethumb_client_video_interval_set(Ethumb_Client *client, float interval) 1788ethumb_client_video_interval_set(Ethumb_Client *client, float interval)
1612{ 1789{
@@ -1616,26 +1793,64 @@ ethumb_client_video_interval_set(Ethumb_Client *client, float interval)
1616 ethumb_video_interval_set(client->ethumb, interval); 1793 ethumb_video_interval_set(client->ethumb, interval);
1617} 1794}
1618 1795
1796/**
1797 * Set the number of frames to thumbnail.
1798 *
1799 * This is useful for animated thumbnail and will define how many
1800 * frames the generated file will have.
1801 *
1802 * @param client the client instance to use. Must @b not be @c
1803 * NULL. May be pending connected (can be called before @c
1804 * connected_cb)
1805 * @param ntimes number of times, must be greater than zero.
1806 * Defaults to 3.
1807 */
1619EAPI void 1808EAPI void
1620ethumb_client_video_ntimes_set(Ethumb_Client *client, int ntimes) 1809ethumb_client_video_ntimes_set(Ethumb_Client *client, unsigned int ntimes)
1621{ 1810{
1622 EINA_SAFETY_ON_NULL_RETURN(client); 1811 EINA_SAFETY_ON_NULL_RETURN(client);
1812 EINA_SAFETY_ON_FALSE_RETURN(ntimes > 0);
1623 1813
1624 client->ethumb_dirty = 1; 1814 client->ethumb_dirty = 1;
1625 ethumb_video_ntimes_set(client->ethumb, ntimes); 1815 ethumb_video_ntimes_set(client->ethumb, ntimes);
1626} 1816}
1627 1817
1818/**
1819 * Set the number of frames per second to thumbnail the video.
1820 *
1821 * This configures the number of times per seconds the thumbnail will
1822 * use to create thumbnails.
1823 *
1824 * Although this is similar to ethumb_client_video_interval_set(), it
1825 * is the delay used between calling functions thata generates frames,
1826 * while the other is the time used to skip inside the video.
1827 *
1828 * @param client the client instance to use. Must @b not be @c
1829 * NULL. May be pending connected (can be called before @c
1830 * connected_cb)
1831 * @param fps number of frames per second to thumbnail. Must be greater
1832 * than zero. Defaults to 10.
1833 */
1628EAPI void 1834EAPI void
1629ethumb_client_video_fps_set(Ethumb_Client *client, int fps) 1835ethumb_client_video_fps_set(Ethumb_Client *client, unsigned int fps)
1630{ 1836{
1631 EINA_SAFETY_ON_NULL_RETURN(client); 1837 EINA_SAFETY_ON_NULL_RETURN(client);
1838 EINA_SAFETY_ON_FALSE_RETURN(fps > 0);
1632 1839
1633 client->ethumb_dirty = 1; 1840 client->ethumb_dirty = 1;
1634 ethumb_video_fps_set(client->ethumb, fps); 1841 ethumb_video_fps_set(client->ethumb, fps);
1635} 1842}
1636 1843
1844/**
1845 * Set the page number to thumbnail in paged documents.
1846 *
1847 * @param client the client instance to use. Must @b not be @c
1848 * NULL. May be pending connected (can be called before @c
1849 * connected_cb)
1850 * @param page page number, defaults to 0 (first).
1851 */
1637EAPI void 1852EAPI void
1638ethumb_client_document_page_set(Ethumb_Client *client, int page) 1853ethumb_client_document_page_set(Ethumb_Client *client, unsigned int page)
1639{ 1854{
1640 EINA_SAFETY_ON_NULL_RETURN(client); 1855 EINA_SAFETY_ON_NULL_RETURN(client);
1641 1856
@@ -1658,7 +1873,7 @@ ethumb_client_document_page_set(Ethumb_Client *client, int page)
1658 * from. This is only used for formats that allow multiple 1873 * from. This is only used for formats that allow multiple
1659 * resources in one file, like EET or Edje (group name). 1874 * resources in one file, like EET or Edje (group name).
1660 * 1875 *
1661 * @return #EINA_TRUE on success, #EINA_FALSE on failure. 1876 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
1662 */ 1877 */
1663EAPI Eina_Bool 1878EAPI Eina_Bool
1664ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key) 1879ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key)
@@ -1670,6 +1885,18 @@ ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key)
1670 1885
1671/** 1886/**
1672 * Get values set with ethumb_client_file_get() 1887 * Get values set with ethumb_client_file_get()
1888 *
1889 * @param client the client instance to use. Must @b not be @c
1890 * NULL. May be pending connected (can be called before @c
1891 * connected_cb)
1892 * @param path where to return configured path. May be @c NULL. If
1893 * not @c NULL, then it will be a pointer to a stringshared
1894 * instance, but @b no references are added (do it with
1895 * eina_stringshare_ref())!
1896 * @param key where to return configured key. May be @c NULL.If not @c
1897 * NULL, then it will be a pointer to a stringshared instance,
1898 * but @b no references are added (do it with
1899 * eina_stringshare_ref())!
1673 */ 1900 */
1674EAPI void 1901EAPI void
1675ethumb_client_file_get(Ethumb_Client *client, const char **path, const char **key) 1902ethumb_client_file_get(Ethumb_Client *client, const char **path, const char **key)
@@ -1705,6 +1932,14 @@ ethumb_client_file_free(Ethumb_Client *client)
1705 * 1932 *
1706 * Set these to @c NULL to forget previously given values. After 1933 * Set these to @c NULL to forget previously given values. After
1707 * ethumb_client_file_set() these values will be reset to @c NULL. 1934 * ethumb_client_file_set() these values will be reset to @c NULL.
1935 *
1936 * @param client the client instance to use. Must @b not be @c
1937 * NULL. May be pending connected (can be called before @c
1938 * connected_cb)
1939 * @param path force generated thumbnail to the exact given path. If
1940 * @c NULL, then reverts back to auto-generation.
1941 * @param key force generated thumbnail to the exact given key. If
1942 * @c NULL, then reverts back to auto-generation.
1708 */ 1943 */
1709EAPI void 1944EAPI void
1710ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key) 1945ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key)
@@ -1720,6 +1955,9 @@ ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char
1720 * This returns the value set with ethumb_client_thumb_path_set() or 1955 * This returns the value set with ethumb_client_thumb_path_set() or
1721 * auto-generated by ethumb_client_thumb_exists() if it was not set. 1956 * auto-generated by ethumb_client_thumb_exists() if it was not set.
1722 * 1957 *
1958 * @param client the client instance to use. Must @b not be @c
1959 * NULL. May be pending connected (can be called before @c
1960 * connected_cb)
1723 * @param path where to return configured path. May be @c NULL. If 1961 * @param path where to return configured path. May be @c NULL. If
1724 * there was no path configured with 1962 * there was no path configured with
1725 * ethumb_client_thumb_path_set() and 1963 * ethumb_client_thumb_path_set() and
@@ -1757,7 +1995,7 @@ ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const cha
1757 * @param client client instance. Must @b not be @c NULL and client 1995 * @param client client instance. Must @b not be @c NULL and client
1758 * must be configured with ethumb_client_file_set(). 1996 * must be configured with ethumb_client_file_set().
1759 * 1997 *
1760 * @return #EINA_TRUE if it exists, #EINA_FALSE otherwise. 1998 * @return @c EINA_TRUE if it exists, @c EINA_FALSE otherwise.
1761 */ 1999 */
1762EAPI Eina_Bool 2000EAPI Eina_Bool
1763ethumb_client_thumb_exists(Ethumb_Client *client) 2001ethumb_client_thumb_exists(Ethumb_Client *client)
diff --git a/legacy/ethumb/src/lib/client/Ethumb_Client.h b/legacy/ethumb/src/lib/client/Ethumb_Client.h
index 4b64cb4a37..fbecbeca70 100644
--- a/legacy/ethumb/src/lib/client/Ethumb_Client.h
+++ b/legacy/ethumb/src/lib/client/Ethumb_Client.h
@@ -38,7 +38,15 @@ extern "C" {
38#endif 38#endif
39 39
40/** 40/**
41 * @defgroup Ethumb_Client Client 41 * @defgroup Ethumb_Client Ethumb Client
42 *
43 * @{
44 */
45
46/**
47 * @defgroup Ethumb_Client_Basics Ethumb Client Basics
48 *
49 * Functions that all users must know of to use Ethumb_Client.
42 * 50 *
43 * @{ 51 * @{
44 */ 52 */
@@ -58,7 +66,8 @@ typedef struct _Ethumb_Client Ethumb_Client;
58 * 66 *
59 * @param data extra context given to ethumb_client_connect(). 67 * @param data extra context given to ethumb_client_connect().
60 * @param client handle of the current connection to server. 68 * @param client handle of the current connection to server.
61 * @param success #EINA_TRUE if connected or #EINA_FALSE if it was not possible. 69 * @param success @c EINA_TRUE if connected or @c EINA_FALSE if it was
70 * not possible.
62 */ 71 */
63typedef void (*Ethumb_Client_Connect_Cb)(void *data, Ethumb_Client *client, Eina_Bool success); 72typedef void (*Ethumb_Client_Connect_Cb)(void *data, Ethumb_Client *client, Eina_Bool success);
64 73
@@ -80,12 +89,12 @@ typedef void (*Ethumb_Client_Die_Cb)(void *data, Ethumb_Client *client);
80 * @param client handle of the current connection to server. 89 * @param client handle of the current connection to server.
81 * @param id identifier returned by ethumb_client_generate(). 90 * @param id identifier returned by ethumb_client_generate().
82 * @param file path set with ethumb_client_file_set(). 91 * @param file path set with ethumb_client_file_set().
83 * @param key value set with ethumb_client_file_set() or #NULL. 92 * @param key value set with ethumb_client_file_set() or @c NULL.
84 * @param thumb_path where thumbnail was stored, either set with 93 * @param thumb_path where thumbnail was stored, either set with
85 * ethumb_client_thumb_path_set() or automatically calculated 94 * ethumb_client_thumb_path_set() or automatically calculated
86 * using parameters. 95 * using parameters.
87 * @param thumb_key key inside thumb_path where thumbnail was stored or #NULL. 96 * @param thumb_key key inside thumb_path where thumbnail was stored or @c NULL.
88 * @param success #EINA_TRUE if generated or #EINA_FALSE on errors. 97 * @param success @c EINA_TRUE if generated or @c EINA_FALSE on errors.
89 */ 98 */
90typedef void (*Ethumb_Client_Generate_Cb)(void *data, Ethumb_Client *client, int id, const char *file, const char *key, const char *thumb_path, const char *thumb_key, Eina_Bool success); 99typedef void (*Ethumb_Client_Generate_Cb)(void *data, Ethumb_Client *client, int id, const char *file, const char *key, const char *thumb_path, const char *thumb_key, Eina_Bool success);
91 100
@@ -104,6 +113,19 @@ EAPI Ethumb_Client * ethumb_client_connect(Ethumb_Client_Connect_Cb connect_cb,
104EAPI void ethumb_client_disconnect(Ethumb_Client *client); 113EAPI void ethumb_client_disconnect(Ethumb_Client *client);
105EAPI void ethumb_client_on_server_die_callback_set(Ethumb_Client *client, Ethumb_Client_Die_Cb server_die_cb, const void *data, Eina_Free_Cb free_data); 114EAPI void ethumb_client_on_server_die_callback_set(Ethumb_Client *client, Ethumb_Client_Die_Cb server_die_cb, const void *data, Eina_Free_Cb free_data);
106 115
116/**
117 * @}
118 */
119
120/**
121 * @defgroup Ethumb_Client_Setup Ethumb Client Fine Tune Setup
122 *
123 * How to fine tune thumbnail generation, setting size, aspect,
124 * frames, quality and so on.
125 *
126 * @{
127 */
128
107EAPI void ethumb_client_fdo_set(Ethumb_Client *client, Ethumb_Thumb_FDO_Size s); 129EAPI void ethumb_client_fdo_set(Ethumb_Client *client, Ethumb_Thumb_FDO_Size s);
108EAPI void ethumb_client_size_set(Ethumb_Client *client, int tw, int th); 130EAPI void ethumb_client_size_set(Ethumb_Client *client, int tw, int th);
109EAPI void ethumb_client_size_get(const Ethumb_Client *client, int *tw, int *th); 131EAPI void ethumb_client_size_get(const Ethumb_Client *client, int *tw, int *th);
@@ -125,22 +147,33 @@ EAPI const char * ethumb_client_category_get(const Ethumb_Client *client);
125EAPI void ethumb_client_video_time_set(Ethumb_Client *client, float time); 147EAPI void ethumb_client_video_time_set(Ethumb_Client *client, float time);
126EAPI void ethumb_client_video_start_set(Ethumb_Client *client, float start); 148EAPI void ethumb_client_video_start_set(Ethumb_Client *client, float start);
127EAPI void ethumb_client_video_interval_set(Ethumb_Client *client, float interval); 149EAPI void ethumb_client_video_interval_set(Ethumb_Client *client, float interval);
128EAPI void ethumb_client_video_ntimes_set(Ethumb_Client *client, int ntimes); 150EAPI void ethumb_client_video_ntimes_set(Ethumb_Client *client, unsigned int ntimes);
129EAPI void ethumb_client_video_fps_set(Ethumb_Client *client, int fps); 151EAPI void ethumb_client_video_fps_set(Ethumb_Client *client, unsigned int fps);
130EAPI void ethumb_client_document_page_set(Ethumb_Client *client, int page); 152EAPI void ethumb_client_document_page_set(Ethumb_Client *client, unsigned int page);
131 153
132EAPI void ethumb_client_ethumb_setup(Ethumb_Client *client); 154EAPI void ethumb_client_ethumb_setup(Ethumb_Client *client);
133 155
156EAPI void ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key);
157EAPI void ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const char **key);
158/**
159 * @}
160 */
161
162/**
163 * @addtogroup Ethumb_Client_Basics Ethumb Client Basics
164 * @{
165 */
134EAPI Eina_Bool ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key); 166EAPI Eina_Bool ethumb_client_file_set(Ethumb_Client *client, const char *path, const char *key);
135EAPI void ethumb_client_file_get(Ethumb_Client *client, const char **path, const char **key); 167EAPI void ethumb_client_file_get(Ethumb_Client *client, const char **path, const char **key);
136EAPI void ethumb_client_file_free(Ethumb_Client *client); 168EAPI void ethumb_client_file_free(Ethumb_Client *client);
137 169
138EAPI void ethumb_client_thumb_path_set(Ethumb_Client *client, const char *path, const char *key);
139EAPI void ethumb_client_thumb_path_get(Ethumb_Client *client, const char **path, const char **key);
140EAPI Eina_Bool ethumb_client_thumb_exists(Ethumb_Client *client); 170EAPI Eina_Bool ethumb_client_thumb_exists(Ethumb_Client *client);
141EAPI int ethumb_client_generate(Ethumb_Client *client, Ethumb_Client_Generate_Cb generated_cb, const void *data, Eina_Free_Cb free_data); 171EAPI int ethumb_client_generate(Ethumb_Client *client, Ethumb_Client_Generate_Cb generated_cb, const void *data, Eina_Free_Cb free_data);
142EAPI void ethumb_client_generate_cancel(Ethumb_Client *client, int id, Ethumb_Client_Generate_Cancel_Cb cancel_cb, const void *data, Eina_Free_Cb free_data); 172EAPI void ethumb_client_generate_cancel(Ethumb_Client *client, int id, Ethumb_Client_Generate_Cancel_Cb cancel_cb, const void *data, Eina_Free_Cb free_data);
143EAPI void ethumb_client_generate_cancel_all(Ethumb_Client *client); 173EAPI void ethumb_client_generate_cancel_all(Ethumb_Client *client);
174/**
175 * @}
176 */
144 177
145/** 178/**
146 * @} 179 * @}
diff --git a/legacy/ethumb/src/lib/ethumb_private.h b/legacy/ethumb/src/lib/ethumb_private.h
index ed7937bc3d..a647c5b27a 100644
--- a/legacy/ethumb/src/lib/ethumb_private.h
+++ b/legacy/ethumb/src/lib/ethumb_private.h
@@ -3,6 +3,8 @@
3 3
4#include <Ethumb.h> 4#include <Ethumb.h>
5 5
6typedef struct _Ethumb_Frame Ethumb_Frame;
7
6struct _Ethumb_Frame 8struct _Ethumb_Frame
7{ 9{
8 const char *file; 10 const char *file;
@@ -29,11 +31,11 @@ struct _Ethumb
29 struct 31 struct
30 { 32 {
31 double start, time, interval; 33 double start, time, interval;
32 int ntimes, fps; 34 unsigned int ntimes, fps;
33 } video; 35 } video;
34 struct 36 struct
35 { 37 {
36 int page; 38 unsigned int page;
37 } document; 39 } document;
38 Ethumb_Frame *frame; 40 Ethumb_Frame *frame;
39 Ecore_Evas *ee, *sub_ee; 41 Ecore_Evas *ee, *sub_ee;
diff --git a/legacy/ethumb/src/plugins/emotion/emotion.c b/legacy/ethumb/src/plugins/emotion/emotion.c
index 51776d3fd2..8695b67eed 100644
--- a/legacy/ethumb/src/plugins/emotion/emotion.c
+++ b/legacy/ethumb/src/plugins/emotion/emotion.c
@@ -17,12 +17,12 @@
17 17
18struct _emotion_plugin 18struct _emotion_plugin
19{ 19{
20 int fps; 20 unsigned int fps;
21 double ptotal, len, pi; 21 double ptotal, len, pi;
22 double total_time, tmp_time; 22 double total_time, tmp_time;
23 int pcount; 23 unsigned int pcount;
24 int frnum; 24 unsigned int frnum;
25 int first; 25 Eina_Bool first;
26 Eet_File *ef; 26 Eet_File *ef;
27 Evas_Object *video; 27 Evas_Object *video;
28 Ethumb *e; 28 Ethumb *e;
@@ -64,7 +64,7 @@ _video_stopped_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUS
64 64
65 _plugin->pi = 0; 65 _plugin->pi = 0;
66 _plugin->ptotal = 0; 66 _plugin->ptotal = 0;
67 _plugin->first = 0; 67 _plugin->first = EINA_FALSE;
68 _plugin->total_time = _plugin->tmp_time; 68 _plugin->total_time = _plugin->tmp_time;
69} 69}
70 70
@@ -79,10 +79,10 @@ _video_pos_set(struct _emotion_plugin *_plugin)
79 _plugin->len = emotion_object_play_length_get(_plugin->video); 79 _plugin->len = emotion_object_play_length_get(_plugin->video);
80 80
81 if (_plugin->len > 0) 81 if (_plugin->len > 0)
82 _plugin->first = 1; 82 _plugin->first = EINA_TRUE;
83 83
84 if (pos <=0 || pos >= 1) 84 if (pos <=0 || pos >= 1)
85 _plugin->pi = 0.2 * _plugin->len + _plugin->pcount * 85 _plugin->pi = 0.1 * _plugin->len + _plugin->pcount *
86 _plugin->len * interval; 86 _plugin->len * interval;
87 else 87 else
88 _plugin->pi = pos * _plugin->len + _plugin->pcount * 88 _plugin->pi = pos * _plugin->len + _plugin->pcount *
@@ -97,7 +97,7 @@ _setup_thumbnail(struct _emotion_plugin *_plugin)
97 char buf[4096]; 97 char buf[4096];
98 Evas *evas; 98 Evas *evas;
99 Evas_Object *edje; 99 Evas_Object *edje;
100 int i; 100 unsigned int i;
101 const char *thumb_path; 101 const char *thumb_path;
102 102
103 ethumb_thumb_path_get(_plugin->e, &thumb_path, NULL); 103 ethumb_thumb_path_get(_plugin->e, &thumb_path, NULL);
@@ -221,7 +221,7 @@ _frame_grab(void *data)
221 if (_plugin->first) 221 if (_plugin->first)
222 { 222 {
223 _plugin->pi = p; 223 _plugin->pi = p;
224 _plugin->first = 0; 224 _plugin->first = EINA_FALSE;
225 } 225 }
226 226
227 if (p > _plugin->pi + _plugin->ptotal) 227 if (p > _plugin->pi + _plugin->ptotal)
diff --git a/legacy/ethumb/src/plugins/epdf/epdf.c b/legacy/ethumb/src/plugins/epdf/epdf.c
index 3c74398645..c3fad4fdb2 100644
--- a/legacy/ethumb/src/plugins/epdf/epdf.c
+++ b/legacy/ethumb/src/plugins/epdf/epdf.c
@@ -20,8 +20,7 @@ _generate_thumb(Ethumb *e)
20 const char *src_path; 20 const char *src_path;
21 int w, h, ww, hh; 21 int w, h, ww, hh;
22 int fx, fy, fw, fh; 22 int fx, fy, fw, fh;
23 int npages; 23 unsigned int npages, pagenum;
24 int pagenum;
25 24
26 ethumb_file_get(e, &src_path, NULL); 25 ethumb_file_get(e, &src_path, NULL);
27 document = epdf_document_new(src_path); 26 document = epdf_document_new(src_path);