summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-06-11 05:16:38 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2015-06-12 04:32:13 (GMT)
commita12bc773900c611d8ca0e159397f039fa588893d (patch)
tree04ab5a27bd40f5441ccb45c0ed01e746f846279c /src/util
parentcbb11bf8d28059cdf57cea64a04150a740cbcf91 (diff)
downloadlibmedia-thumbnail-a12bc773900c611d8ca0e159397f039fa588893d.zip
libmedia-thumbnail-a12bc773900c611d8ca0e159397f039fa588893d.tar.gz
libmedia-thumbnail-a12bc773900c611d8ca0e159397f039fa588893d.tar.bz2
support thumbnail-util.refs/changes/54/41054/3
Change-Id: Ia218f4ef9ea66318eb67ed1fef2c6034044c18cb Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/media-thumb-util.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c
index 5d98222..6dd2282 100755
--- a/src/util/media-thumb-util.c
+++ b/src/util/media-thumb-util.c
@@ -373,7 +373,7 @@ int _thumbnail_get_data(const char *origin_path,
file_type = _media_thumb_get_file_type(origin_path);
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info, uid);
+ err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info, false, uid);
if (err < 0) {
thumb_err("_media_thumb_image failed");
return err;
@@ -399,4 +399,66 @@ int _thumbnail_get_data(const char *origin_path,
*size, *width, *height, *data);
return MS_MEDIA_ERR_NONE;
+}
+
+int _thumbnail_get_raw_data(const char *origin_path,
+ media_thumb_format format,
+ unsigned char **data,
+ int *size,
+ int *width,
+ int *height,
+ uid_t uid)
+{
+ int err = -1;
+ int thumb_width = -1;
+ int thumb_height = -1;
+
+ if (origin_path == NULL || * width >= 0 || *height >= 0) {
+ thumb_err("Invalid parameter");
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
+ }
+
+ if (format < MEDIA_THUMB_BGRA || format > MEDIA_THUMB_RGB888) {
+ thumb_err("parameter format is invalid");
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
+ }
+
+ if (!g_file_test
+ (origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ thumb_err("Original path (%s) does not exist", origin_path);
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
+ }
+
+ thumb_dbg("Origin path : %s", origin_path);
+
+ int file_type = THUMB_NONE_TYPE;
+ media_thumb_info thumb_info = {0,};
+ file_type = _media_thumb_get_file_type(origin_path);
+ thumb_width = *width;
+ thumb_height = *height;
+
+ if (file_type == THUMB_IMAGE_TYPE) {
+ err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info, true, uid);
+ if (err < 0) {
+ thumb_err("_media_thumb_image failed");
+ return err;
+ }
+
+ } else if (file_type == THUMB_VIDEO_TYPE) {
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info,uid);
+ if (err < 0) {
+ thumb_err("_media_thumb_image failed");
+ return err;
+ }
+ }
+
+ if (size) *size = thumb_info.size;
+ if (width) *width = thumb_info.width;
+ if (height) *height = thumb_info.height;
+ *data = thumb_info.gdkdata;
+
+ thumb_dbg("Thumb data is generated successfully (Size:%d, W:%d, H:%d) 0x%x",
+ *size, *width, *height, *data);
+
+ return MS_MEDIA_ERR_NONE;
} \ No newline at end of file