summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-06-10 20:47:13 +0900
committerMinje Ahn <minje.ahn@samsung.com>2015-06-10 20:47:13 +0900
commitcbb11bf8d28059cdf57cea64a04150a740cbcf91 (patch)
tree123d6e47b7682e8497e104f383feccc93218c16f
parent9d333c7852195d9d4cb75e681b6e4d0be686dbe5 (diff)
downloadlibmedia-thumbnail-cbb11bf8d28059cdf57cea64a04150a740cbcf91.tar.gz
libmedia-thumbnail-cbb11bf8d28059cdf57cea64a04150a740cbcf91.tar.bz2
libmedia-thumbnail-cbb11bf8d28059cdf57cea64a04150a740cbcf91.zip
Change-Id: I404d21bdeb3f23786c9b30303ede8edac4b24149 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rw-r--r--CMakeLists.txt5
-rw-r--r--md5/media-thumb-hash.c36
-rw-r--r--packaging/libmedia-thumbnail.spec1
-rwxr-xr-xserver/include/thumb-server-internal.h4
-rw-r--r--src/codec/img-codec-osal.c16
-rwxr-xr-xsrc/media-thumb-internal.c34
-rwxr-xr-xsrc/util/media-thumb-util.c89
7 files changed, 46 insertions, 139 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b307e40..7e5f59c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,10 +42,7 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/codec ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/ipc ${CMAKE_SOURCE_DIR}/server/include ${CMAKE_SOURCE_DIR}/md5)
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
-glib-2.0 gthread-2.0 dlog mm-fileinfo drm-client aul
-libexif mmutil-imgp mmutil-jpeg heynoti libmedia-utils vconf libtzplatform-config gdk-pixbuf-2.0)
-
+pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo aul libexif mmutil-imgp mmutil-jpeg heynoti libmedia-utils vconf libtzplatform-config gdk-pixbuf-2.0)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/md5/media-thumb-hash.c b/md5/media-thumb-hash.c
index 755e2cd..aed15b0 100644
--- a/md5/media-thumb-hash.c
+++ b/md5/media-thumb-hash.c
@@ -1,28 +1,22 @@
-/* GLIB - Library of useful routines for C programming
+/*
+ * libmedia-thumbnail
*
- * gconvert.c: Convert between character sets using iconv
- * Copyright Red Hat Inc., 2000
- * Authors: Havoc Pennington <hp@redhat.com>, Owen Taylor <otaylor@redhat.com
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* The array below is taken from gconvert.c, which is licensed by GNU Lesser General Public License
- * Code to escape string is also taken partially from gconvert.c
- * File name is changed to media-thumb-hash.c
*/
#include "md5.h"
diff --git a/packaging/libmedia-thumbnail.spec b/packaging/libmedia-thumbnail.spec
index 4409f0b..1902bb7 100644
--- a/packaging/libmedia-thumbnail.spec
+++ b/packaging/libmedia-thumbnail.spec
@@ -15,7 +15,6 @@ BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(mm-fileinfo)
BuildRequires: pkgconfig(mmutil-imgp)
BuildRequires: pkgconfig(mmutil-jpeg)
-BuildRequires: pkgconfig(drm-client)
BuildRequires: pkgconfig(heynoti)
BuildRequires: pkgconfig(libexif)
BuildRequires: pkgconfig(aul)
diff --git a/server/include/thumb-server-internal.h b/server/include/thumb-server-internal.h
index 818a02c..64648b1 100755
--- a/server/include/thumb-server-internal.h
+++ b/server/include/thumb-server-internal.h
@@ -44,8 +44,6 @@ void _thumb_daemon_finish_jobs();
void _thumb_daemon_mmc_eject_vconf_cb(void *data);
void _thumb_daemon_vconf_cb(void *data);
gboolean _thumb_server_prepare_socket(int *sock_fd);
-gboolean _thumb_server_read_socket(GIOChannel *src,
- GIOCondition condition,
- gpointer data);
+gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpointer data);
#endif /*_THUMB_DAEMON_INTERNAL_H_*/
diff --git a/src/codec/img-codec-osal.c b/src/codec/img-codec-osal.c
index 88123bb..cefe59f 100644
--- a/src/codec/img-codec-osal.c
+++ b/src/codec/img-codec-osal.c
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <drm_client.h>
void *IfegMemAlloc(unsigned int size)
{
@@ -64,20 +63,7 @@ static BOOL _is_real_drm = FALSE;
HFile DrmOpenFile(const char *szPathName)
{
- int ret = 0;
- drm_bool_type_e drm_type;
-
- ret = drm_is_drm_file(szPathName, &drm_type);
- if (ret < 0) {
- thumb_err("drm_is_drm_file falied : %d", ret);
- drm_type = DRM_FALSE;
- }
-
- if (drm_type == DRM_TRUE) {
- _is_real_drm = TRUE;
- } else {
- _is_real_drm = FALSE;
- }
+ _is_real_drm = FALSE;
if (!_is_real_drm) {
FILE *fp = fopen(szPathName, "rb");
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index 12e36f2..f7b764f 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -36,7 +36,6 @@
#include <fcntl.h>
#include <unistd.h>
-#include <drm_client.h>
#include <mm_file.h>
#include <mm_error.h>
#include <mm_util_imgp.h>
@@ -59,28 +58,6 @@ int _media_thumb_get_proper_thumb_size(media_thumb_type thumb_type,
portrait = TRUE;
}
-#if 0
- /* Set Lager length to default size */
- if (portrait) {
- if (orig_h < _media_thumb_get_width(thumb_type)) {
- *thumb_h = orig_h;
- } else {
- *thumb_h = _media_thumb_get_width(thumb_type);
- }
-
- ratio = (double)orig_w / (double)orig_h;
- *thumb_w = *thumb_h * ratio;
- } else {
- if (orig_w < _media_thumb_get_width(thumb_type)) {
- *thumb_w = orig_w;
- } else {
- *thumb_w = _media_thumb_get_width(thumb_type);
- }
-
- ratio = (double)orig_h / (double)orig_w;
- *thumb_h = *thumb_w * ratio;
- }
-#else
/* Set smaller length to default size */
if (portrait) {
if (orig_w < _media_thumb_get_width(thumb_type)) {
@@ -103,7 +80,6 @@ int _media_thumb_get_proper_thumb_size(media_thumb_type thumb_type,
ratio = (double)orig_w / (double)orig_h;
*thumb_w = *thumb_h * ratio;
}
-#endif
/* The width of RGB888 raw data has to be rounded by 4 */
*thumb_w = MEDA_THUMB_ROUND_UP_4(*thumb_w);
@@ -130,7 +106,7 @@ int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value
entry = exif_content_get_entry(ed->ifd[ifd], tag);
if (entry) {
if (tag == EXIF_TAG_ORIENTATION ||
- tag == EXIF_TAG_PIXEL_X_DIMENSION ||
+ tag == EXIF_TAG_PIXEL_X_DIMENSION ||
tag == EXIF_TAG_PIXEL_Y_DIMENSION) {
if (value == NULL) {
@@ -1003,13 +979,7 @@ int _media_thumb_video(const char *origin_path,
int height = 0;
int ret = 0;
GdkPixbuf *pixbuf;
- drm_bool_type_e drm_type;
-
- ret = (drm_is_drm_file(origin_path, &drm_type) == 1);
- if (ret != MS_MEDIA_ERR_NONE) {
- thumb_err("drm_is_drm_file falied : %d", ret);
- drm_type = DRM_FALSE;
- }
+ bool drm_type = FALSE;
is_drm = drm_type;
err = mm_file_create_content_attrs(&content, origin_path);
diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c
index a6c4fb4..5d98222 100755
--- a/src/util/media-thumb-util.c
+++ b/src/util/media-thumb-util.c
@@ -26,7 +26,6 @@
#include <glib.h>
#include <aul.h>
#include <string.h>
-#include <drm_client.h>
#include <sys/stat.h>
#include <grp.h>
#include <pwd.h>
@@ -79,79 +78,43 @@ int
_media_thumb_get_file_type(const char *file_full_path)
{
int ret = 0;
- drm_bool_type_e drm_type;
- drm_file_type_e drm_file_type;
- char mimetype[255];
+ char mimetype[255] = {0,};
if (file_full_path == NULL)
return MS_MEDIA_ERR_INVALID_PARAMETER;
- ret = drm_is_drm_file(file_full_path, &drm_type);
+ /* get content type and mime type from file. */
+ ret = aul_get_mime_from_file(file_full_path, mimetype, sizeof(mimetype));
if (ret < 0) {
- thumb_err("drm_is_drm_file falied : %d", ret);
- drm_type = DRM_FALSE;
- }
-
- if (drm_type == DRM_TRUE) {
- thumb_dbg("DRM file : %s", file_full_path);
+ thumb_warn
+ ("aul_get_mime_from_file fail.. Now trying to get type by extension");
- ret = drm_get_file_type(file_full_path, &drm_file_type);
+ char ext[255] = { 0 };
+ int ret = _media_thumb_get_file_ext(file_full_path, ext, sizeof(ext));
if (ret < 0) {
- thumb_err("drm_get_file_type falied : %d", ret);
+ thumb_err("_media_thumb_get_file_ext failed");
return THUMB_NONE_TYPE;
}
- if (drm_file_type == DRM_TYPE_UNDEFINED) {
- return THUMB_NONE_TYPE;
+ if (strcasecmp(ext, "JPG") == 0 ||
+ strcasecmp(ext, "JPEG") == 0 ||
+ strcasecmp(ext, "PNG") == 0 ||
+ strcasecmp(ext, "GIF") == 0 ||
+ strcasecmp(ext, "AGIF") == 0 ||
+ strcasecmp(ext, "XWD") == 0 ||
+ strcasecmp(ext, "BMP") == 0 ||
+ strcasecmp(ext, "WBMP") == 0) {
+ return THUMB_IMAGE_TYPE;
+ } else if (strcasecmp(ext, "AVI") == 0 ||
+ strcasecmp(ext, "MPEG") == 0 ||
+ strcasecmp(ext, "MP4") == 0 ||
+ strcasecmp(ext, "DCF") == 0 ||
+ strcasecmp(ext, "WMV") == 0 ||
+ strcasecmp(ext, "3GPP") == 0 ||
+ strcasecmp(ext, "3GP") == 0) {
+ return THUMB_VIDEO_TYPE;
} else {
- drm_content_info_s contentInfo;
- memset(&contentInfo, 0x00, sizeof(drm_content_info_s));
-
- ret = drm_get_content_info(file_full_path, &contentInfo);
- if (ret != DRM_RETURN_SUCCESS) {
- thumb_err("drm_get_content_info() fails. : %d", ret);
- return THUMB_NONE_TYPE;
- }
- thumb_dbg("DRM mime type: %s", contentInfo.mime_type);
-
- strncpy(mimetype, contentInfo.mime_type, sizeof(mimetype) - 1);
- mimetype[sizeof(mimetype) - 1] = '\0';
- }
- } else {
- /* get content type and mime type from file. */
- ret =
- aul_get_mime_from_file(file_full_path, mimetype, sizeof(mimetype));
- if (ret < 0) {
- thumb_warn
- ("aul_get_mime_from_file fail.. Now trying to get type by extension");
-
- char ext[255] = { 0 };
- int ret = _media_thumb_get_file_ext(file_full_path, ext, sizeof(ext));
- if (ret < 0) {
- thumb_err("_media_thumb_get_file_ext failed");
- return THUMB_NONE_TYPE;
- }
-
- if (strcasecmp(ext, "JPG") == 0 ||
- strcasecmp(ext, "JPEG") == 0 ||
- strcasecmp(ext, "PNG") == 0 ||
- strcasecmp(ext, "GIF") == 0 ||
- strcasecmp(ext, "AGIF") == 0 ||
- strcasecmp(ext, "XWD") == 0 ||
- strcasecmp(ext, "BMP") == 0 ||
- strcasecmp(ext, "WBMP") == 0) {
- return THUMB_IMAGE_TYPE;
- } else if (strcasecmp(ext, "AVI") == 0 ||
- strcasecmp(ext, "MPEG") == 0 ||
- strcasecmp(ext, "MP4") == 0 ||
- strcasecmp(ext, "DCF") == 0 ||
- strcasecmp(ext, "WMV") == 0 ||
- strcasecmp(ext, "3GPP") == 0 ||
- strcasecmp(ext, "3GP") == 0) {
- return THUMB_VIDEO_TYPE;
- } else {
- return THUMB_NONE_TYPE;
- }
+ return THUMB_NONE_TYPE;
}
}