Modify media-content CAPI
authorJiansong Jin <jiansong.jin@samsung.com>
Fri, 31 Aug 2012 06:27:11 +0000 (15:27 +0900)
committerJiansong Jin <jiansong.jin@samsung.com>
Fri, 31 Aug 2012 06:27:11 +0000 (15:27 +0900)
Change-Id: Iffef5c925a9a83cac9e2d7ef4782430b6a4a26f6

16 files changed:
CMakeLists.txt
include/data/gl-data.h
include/util/gl-strings.h
include/util/gl-util.h
packaging/org.tizen.gallery.spec
src/data/gl-data.c
src/data/gl-local-data.c
src/features/gl-gridview.c
src/util/gl-ui-util.c
src/util/gl-util.c
ug/ug-gallery-efl/CMakeLists.txt
ug/ug-gallery-efl/include/ge-data.h
ug/ug-gallery-efl/include/ge-util.h
ug/ug-gallery-efl/src/ge-data.c
ug/ug-gallery-efl/src/ge-gridview.c
ug/ug-gallery-efl/src/ge-util.c

index 5b2b3f7a8a2b452c13bdc3f954c87cb1b9087152..76c26e7c35826adcbdb8547de6d788ace8bb61dd 100755 (executable)
@@ -62,7 +62,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/features)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED
-       media-thumbnail
        capi-content-media-content
        drm-client
        ui-gadget-1
index 95c87745567487e96456e36e29f6fc94e4e72f0d..eee5d9fd4cb6e7424e74e90286abae63f71c3921 100755 (executable)
@@ -138,6 +138,8 @@ bool _gl_data_is_default_album(const char *match_folder, gl_album_s *album);
 int gl_db_free_cluster(gl_cluster *gcluster);\r
 int _gl_data_get_item_by_fullpath(void *data, char *path, gl_media_s **mitem);\r
 int _gl_data_delete_media(void *data, gl_media_s *media_item);\r
+int _gl_data_create_thumb(gl_item *gitem, media_thumbnail_completed_cb callback,\r
+                         void *user_data);\r
 \r
 #ifdef _cplusplus\r
 }\r
index 3c98d5408e1775d6f34e05c8a15901f157ed636a..af42a2c9f36b9b5e1900efcd85f7411fb2a580e9 100755 (executable)
@@ -42,8 +42,8 @@ extern "C"
 
 #ifdef _USE_ROTATE_BG
 #define GL_STR_MORE dgettext("sys_string", "IDS_COM_BODY_MORE")
-#define GL_STR_ROTATE_LEFT _("Rotate left")
-#define GL_STR_ROTATE_RIGHT _("Rotate right")
+#define GL_STR_ROTATE_LEFT _("IDS_MEDIABR_OPT_ROTATE_LEFT")
+#define GL_STR_ROTATE_RIGHT _("IDS_MEDIABR_OPT_ROTATE_RIGHT")
 #define GL_STR_ROTATING _("Rotating")
 #define GL_STR_ROTATED _("Rotated")
 #endif
index 66ac07b7c7c48b3b75d5ae7dff5f8fafc5c66382..84664eaca05e17358f99af7b772c8175998decd6 100755 (executable)
@@ -21,7 +21,7 @@
 #include "gallery.h"
 
 #define GL_FILE_EXISTS(path) \
-       ((1 == ecore_file_exists(path)) && (ecore_file_size(path) > 0))
+       (path && (1 == ecore_file_exists(path)) && (ecore_file_size(path) > 0))
 
 #define GL_IF_DEL_TIMER(timer) if(timer){ecore_timer_del(timer); timer = NULL;}
 #define GL_IF_DEL_IDLER(idler) if(idler){ecore_idler_del(idler); idler = NULL;}
@@ -132,6 +132,5 @@ int gl_pop_to_ctrlbar_ly(void *data, bool b_update_albums_list);
 int gl_play_vibration(void *data);
 
 char *_gl_get_duration_string(unsigned int v_dur);
-int _gl_get_thumb(void *data, const char *file_path, char **thumb_path);
 
 #endif /* _GL_UTIL_H_ */
index bc7480b154dd7a58eee2b9f863e7f6785cc873c5..8fce5c406e9c352a4bc1eb03cd64e41a0891be7f 100755 (executable)
@@ -4,7 +4,7 @@
 
 Name:       org.tizen.gallery
 Summary:    org.tizen.gallery UX
-Version:    1.1.30
+Version:    1.1.31
 Release:    1
 Group:      Applications
 License:    Flora Software License
@@ -12,7 +12,6 @@ Source0:    %{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  gettext-tools
 BuildRequires:  edje-tools
-BuildRequires:  pkgconfig(media-thumbnail)
 BuildRequires:  pkgconfig(capi-content-media-content)
 BuildRequires:  pkgconfig(drm-client)
 BuildRequires:  pkgconfig(ui-gadget-1)
index faa2e8a23903240a7606e7eb1db507603eb18f04..680a55b8c75636b9b4b1b3afff1f1f583de57f15 100755 (executable)
@@ -1546,3 +1546,22 @@ int _gl_data_delete_media(void *data, gl_media_s *media_item)
        return ret;\r
 }\r
 \r
+/* Creates a thumbnail image for given the media, asynchronously */\r
+int _gl_data_create_thumb(gl_item *gitem, media_thumbnail_completed_cb callback,\r
+                         void *user_data)\r
+{\r
+       GL_CHECK_VAL(gitem, -1);\r
+       GL_CHECK_VAL(gitem->item, -1);\r
+       GL_CHECK_VAL(gitem->item->media_h, -1);\r
+       int ret = -1;\r
+       gl_dbg("File[%s]", gitem->item->file_url);\r
+\r
+       ret = media_info_create_thumbnail(gitem->item->media_h, callback,\r
+                                         user_data);\r
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {\r
+               gl_dbgE("Failed to create thumbnail!");\r
+               return -1;\r
+       }\r
+       return 0;\r
+}\r
+\r
index 64480f55ff5c0dcb715f0b07bd1b9017efc072de..1ff3457301a7dbbe333664fa000bd2a3ba447563 100755 (executable)
@@ -800,12 +800,11 @@ int _gl_local_data_move_media(gl_media_s *mitem, const char *dst)
        GL_CHECK_VAL(mitem, -1);\r
        GL_CHECK_VAL(mitem->media_h, -1);\r
 \r
-       if (media_info_move_media_to_db(mitem->media_h, dst) != MEDIA_CONTENT_ERROR_NONE) {\r
+       if (media_info_move_to_db(mitem->media_h, dst) != MEDIA_CONTENT_ERROR_NONE) {\r
                gl_dbgE("Move media thumbnail failed!");\r
                return -1;\r
        }\r
 \r
-       gl_dbgW("Checkme: use correct api!");\r
        return 0;\r
 }\r
 \r
index 8b1ca978ecf11880fda2d7b0f5557744ff1d6729..865f96385aecdd9c770f3e8f574aed54dea9f038 100755 (executable)
@@ -96,6 +96,25 @@ _gl_grid_shrink_resp_cb(void *data, Evas_Object *obj,
 
 }
 
+static void __gl_grid_thumb_created_cb(media_content_error_e error,
+                                      const char *path, void *user_data)
+{
+       GL_CHECK(user_data);
+       gl_item *gitem = (gl_item *)user_data;
+       GL_CHECK(gitem->item);
+
+       if (GL_FILE_EXISTS(path)) {
+               gl_dbg("Update item with new thumb path[%s]", path);
+               /* Update thumb path */
+               if (gitem->item->thumb_url)
+                       free(gitem->item->thumb_url);
+               gitem->item->thumb_url = strdup(path);
+               elm_gengrid_item_update(gitem->elm_item);
+       } else {
+               gl_dbgE("Invalid thumb path!");
+       }
+}
+
 static Evas_Object *__gl_grid_get_content(void *data, Evas_Object *obj, const char *part)
 {
        GL_CHECK_NULL(part);
@@ -137,14 +156,16 @@ static Evas_Object *__gl_grid_get_content(void *data, Evas_Object *obj, const ch
 #endif
                        }
                } else {
-                       int ret = -1;
-                       ret = _gl_get_thumb(ad, gitem->item->file_url,
-                                           &gitem->item->thumb_url);
                        /* Use default image */
-                       if (ret < 0)
-                               path = GL_DEFAULT_THUMB_ICON;
-                       else
+                       if (GL_FILE_EXISTS(gitem->item->thumb_url)) {
                                path = gitem->item->thumb_url;
+                       } else {
+                               path = GL_DEFAULT_THUMB_ICON;
+                               if (GL_FILE_EXISTS(gitem->item->file_url))
+                                       _gl_data_create_thumb(gitem,
+                                                             __gl_grid_thumb_created_cb,
+                                                             gitem);
+                       }
                }
 
                if (gitem->item->type == MEDIA_CONTENT_TYPE_VIDEO) {
index e13e09ca84db7fc8f4202887e7cc9abc81fd4738..da74d9525a9c63f47c19cb483a450339cd287dc1 100755 (executable)
@@ -587,6 +587,15 @@ static void _gl_ui_selall_check_changed(void *data, Evas_Object *obj,
                                gl_dbgE("Invalid item data!");
                                continue;
                        }
+
+                       if (album->checked == state){
+                               /* Get next item */
+                               next_it = elm_gengrid_item_next_get(first_it);
+                               first_it = next_it;
+                               album = NULL;
+                               continue;
+                       }
+
                        /* Update checkbox state */
                        album->checked = state;
                        /* Update selected list */
@@ -608,6 +617,7 @@ static void _gl_ui_selall_check_changed(void *data, Evas_Object *obj,
                        }
                        album = NULL;
                }
+               sel_all_cnt = item_cnt;
        } else {
                /* Get all medias count of current album */
                item_cnt = ad->maininfo.medias_cnt;
index f39dbb366f89ca090c171990aa44bb968f794afd..7c5465338f2dbc2732b9aa29cc11d5707982cae2 100755 (executable)
@@ -20,7 +20,6 @@
 #include <vconf-keys.h>
 #include <errno.h>
 #include <haptic.h>
-#include <media-thumbnail.h>
 #include "gl-debug.h"
 #include "gallery.h"
 #include "gl-albums.h"
@@ -2114,40 +2113,3 @@ char *_gl_get_duration_string(unsigned int v_dur)
        return dur_str;
 }
 
-/* Fetch thumbnail from media-service, if it's invalid, generate new one */
-int _gl_get_thumb(void *data, const char *file_path, char **thumb_path)
-{
-       GL_CHECK_VAL(thumb_path, -1);
-       GL_CHECK_VAL(file_path, -1);
-       GL_CHECK_VAL(data, -1);
-       /* Return if thumbnail is valid */
-       if (*thumb_path && ecore_file_exists(*thumb_path) &&
-           (ecore_file_size(*thumb_path) > 0)) {
-               return 0;
-       }
-
-       /* Free allocated memory first */
-       if (*thumb_path) {
-               gl_dbgW("Wrong thumb path[%s]", *thumb_path);
-               free(*thumb_path);
-               *thumb_path = NULL;
-       }
-       gl_dbg("File[%s]", file_path);
-
-       char *new_path = calloc(1, GL_FILE_PATH_LEN_MAX);
-       GL_CHECK_VAL(new_path, -1);
-
-       /* Generate thumbnail via thumbnail-service */
-       int ret = -1;
-       ret = thumbnail_request_from_db(file_path, new_path,
-                                       GL_FILE_PATH_LEN_MAX);
-       if (ret < 0) {
-               gl_dbgE("thumbnail_request_from_db failed!");
-               return -1;
-       }
-
-       *thumb_path = new_path;
-       gl_dbg("Request thumbnail[%s]", new_path);
-       return 0;
-}
-
index 186eeb8a35e5c4817e7b3b82b050ea3e18459be1..6b13ee37bc9e10749e7c31cd6301e3e267c7f73f 100755 (executable)
@@ -52,7 +52,6 @@ pkg_check_modules(pkgs REQUIRED
        capi-appfw-application
        capi-content-media-content
        ui-gadget-1
-       media-thumbnail
        drm-client
 )
 
index 55b3abf42e7e21d1f14e832011039be3ae8c57bd..6968ca5f8282e32fcb12ec8268a4bb28eb0288b0 100755 (executable)
@@ -54,6 +54,8 @@ int _ge_data_selected_list_remove(ge_item* gitem);
 int _ge_data_selected_list_finalize(void);\r
 bool _ge_data_is_default_album(const char *match_folder, ge_album_s *mcluster);\r
 bool _ge_data_is_root_path(const char *path);\r
+int _ge_data_create_thumb(ge_item *gitem, media_thumbnail_completed_cb callback,\r
+                         void *user_data);\r
 int _ge_data_init(ge_ugdata* ugd);\r
 int _ge_data_finalize(ge_ugdata* ugd);\r
 \r
index 9eb4ba42edefd4043cbb4299267cb368ab604ae7..124e0b634531c5862b7d2a42014a547251f18161 100755 (executable)
@@ -19,6 +19,9 @@
 
 #include "gallery-efl.h"
 
+#define GE_FILE_EXISTS(path) \
+       (path && (1 == ecore_file_exists(path)) && (ecore_file_size(path) > 0))
+
 ge_item* _ge_get_current_item(void);
 void _ge_set_current_item(ge_item* gitem);
 int ge_reg_db_update_noti(ge_ugdata* ugd);
@@ -29,7 +32,6 @@ void _ge_ug_iv_set(int ug_iv_state);
 ge_cluster* _ge_get_current_album(void);
 void _ge_set_current_album(ge_cluster* album_item);
 bool _ge_is_image_valid(void *data, char *filepath);
-int _ge_get_thumb(const char *file_path, char **thumb_path);
 char *_ge_get_duration_string(unsigned int v_dur);
 #endif /* _GE_EXT_EXEC_H_ */
 
index ea553e8777e4dcb145c93fdad0ce50a02bad1ad8..a57adf125de096be0813a13a6edec352b089d995 100755 (executable)
@@ -923,6 +923,25 @@ bool _ge_data_is_root_path(const char *path)
        return false;\r
 }\r
 \r
+/* Creates a thumbnail image for given the media, asynchronously */\r
+int _ge_data_create_thumb(ge_item *gitem, media_thumbnail_completed_cb callback,\r
+                         void *user_data)\r
+{\r
+       GE_CHECK_VAL(gitem, -1);\r
+       GE_CHECK_VAL(gitem->item, -1);\r
+       GE_CHECK_VAL(gitem->item->media_h, -1);\r
+       int ret = -1;\r
+       ge_dbg("File[%s]", gitem->item->file_url);\r
+\r
+       ret = media_info_create_thumbnail(gitem->item->media_h, callback,\r
+                                         user_data);\r
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {\r
+               ge_dbgE("Failed to create thumbnail!");\r
+               return -1;\r
+       }\r
+       return 0;\r
+}\r
+\r
 int _ge_data_init(ge_ugdata* ugd)\r
 {\r
        ge_dbg("Connect to DB!");\r
index 2000eb6b14e8b90027c6fdf6a6946c024dda7be9..905651e856a8900bacf31ae1624aa184e69d568a 100755 (executable)
@@ -283,6 +283,25 @@ static void _ge_grid_check_changed(void *data, Evas_Object *obj, void *event_inf
        }
 }
 
+static void __ge_grid_thumb_created_cb(media_content_error_e error,
+                                      const char *path, void *user_data)
+{
+       GE_CHECK(user_data);
+       ge_item *gitem = (ge_item *)user_data;
+       GE_CHECK(gitem->item);
+
+       if (GE_FILE_EXISTS(path)) {
+               ge_dbg("Update item with new thumb path[%s]", path);
+               /* Update thumb path */
+               if (gitem->item->thumb_url)
+                       free(gitem->item->thumb_url);
+               gitem->item->thumb_url = strdup(path);
+               elm_gengrid_item_update(gitem->elm_item);
+       } else {
+               ge_dbgE("Invalid thumb path!");
+       }
+}
+
 static Evas_Object *__ge_grid_get_content(void *data, Evas_Object *obj, const char *part)
 {
        GE_CHECK_NULL(data);
@@ -329,14 +348,16 @@ static Evas_Object *__ge_grid_get_content(void *data, Evas_Object *obj, const ch
 #endif
                        }
                } else {
-                       int ret = -1;
-                       ret = _ge_get_thumb(gitem->item->file_url,
-                                                 &gitem->item->thumb_url);
                        /* Use default image */
-                       if (ret < 0)
-                               path = GE_DEFAULT_THUMB_ICON;
-                       else
+                       if (GE_FILE_EXISTS(gitem->item->thumb_url)) {
                                path = gitem->item->thumb_url;
+                       } else {
+                               path = GE_DEFAULT_THUMB_ICON;
+                               if (GE_FILE_EXISTS(gitem->item->file_url))
+                                       _ge_data_create_thumb(gitem,
+                                                             __ge_grid_thumb_created_cb,
+                                                             gitem);
+                       }
                }
 
                if(gitem->item->type == MEDIA_CONTENT_TYPE_VIDEO){
index a7d9fda1aad0b059404fa8772364fbfb5771f9fe..c3e9f80ca09ec5ac490afb614ec96d0e8c9db9d3 100755 (executable)
@@ -18,7 +18,6 @@
 #include <vconf.h>
 #include <vconf-keys.h>
 #include <errno.h>
-#include <media-thumbnail.h>
 #include "ge-debug.h"
 #include "ge-albums.h"
 #include "ge-gridview.h"
@@ -273,42 +272,6 @@ bool _ge_is_image_valid(void *data, char *filepath)
        return true;
 }
 
-/* Fetch thumbnail from media-service, if it's invalid, generate new one */
-int _ge_get_thumb(const char *file_path, char **thumb_path)
-{
-       GE_CHECK_VAL(thumb_path, -1);
-       GE_CHECK_VAL(file_path, -1);
-       /* Return if thumbnail is valid */
-       if (*thumb_path && ecore_file_exists(*thumb_path) &&
-           (ecore_file_size(*thumb_path) > 0)) {
-               return 0;
-       }
-
-       /* Free allocated memory first */
-       if (*thumb_path) {
-               ge_dbgW("Wrong thumb path[%s]", *thumb_path);
-               free(*thumb_path);
-               *thumb_path = NULL;
-       }
-       ge_dbg("File[%s]", file_path);
-
-       char *new_path = calloc(1, GE_FILE_PATH_LEN_MAX);
-       GE_CHECK_VAL(new_path, -1);
-
-       /* Generate thumbnail via thumbnail-service */
-       int ret = -1;
-       ret = thumbnail_request_from_db(file_path, new_path,
-                                       GE_FILE_PATH_LEN_MAX);
-       if (ret < 0) {
-               ge_dbgE("thumbnail_request_from_db failed!");
-               return -1;
-       }
-
-       *thumb_path = new_path;
-       ge_dbg("Request thumbnail[%s]", new_path);
-       return 0;
-}
-
 /* Change int to char * of video duration, caller need to free the allocated memory */
 char *_ge_get_duration_string(unsigned int v_dur)
 {