4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Yong Yeon Kim <yy9875.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 * This file defines api utilities of contents manager engines.
25 * @file media-server-drm.c
26 * @author Yong Yeon Kim(yy9875.kim@samsung.com)
28 * @brief This file implements main database operation.
30 #include <drm_client_types.h>
31 #include <drm_client.h>
33 #include "media-util.h"
35 #include "media-scanner-dbg.h"
36 #include "media-server-types.h"
37 #include "media-scanner-drm.h"
40 msc_is_drm_file(const char *path)
43 drm_bool_type_e is_drm_file = DRM_UNKNOWN;
45 ret = drm_is_drm_file(path,&is_drm_file);
46 if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file)
53 msc_get_mime_in_drm_info(const char *path, char *mime)
56 drm_content_info_s contentInfo;
58 if (path == NULL || mime == NULL)
59 return MS_MEDIA_ERR_INVALID_PARAMETER;
61 memset(&contentInfo,0x0,sizeof(drm_content_info_s));
62 ret = drm_get_content_info(path, &contentInfo);
63 if (ret != DRM_RETURN_SUCCESS) {
64 MSC_DBG_ERR("drm_svc_get_content_info() failed");
65 MSC_DBG_ERR("%s [%d]", path, ret);
66 return MS_MEDIA_ERR_DRM_GET_INFO_FAIL;
69 strncpy(mime, contentInfo.mime_type, 100);
71 return MS_MEDIA_ERR_NONE;
75 msc_drm_register(const char* path)
77 int res = MS_MEDIA_ERR_NONE;
80 ret = drm_process_request(DRM_REQUEST_TYPE_REGISTER_FILE, (void *)path, NULL);
81 if (ret != DRM_RETURN_SUCCESS) {
82 MSC_DBG_ERR("drm_svc_register_file error : %d %s", ret, path);
83 res = MS_MEDIA_ERR_DRM_REGISTER_FAIL;
90 msc_drm_unregister(const char* path)
94 ret = drm_process_request(DRM_REQUEST_TYPE_UNREGISTER_FILE, (void *)path, NULL);
95 if (ret != DRM_RETURN_SUCCESS)
96 MSC_DBG_ERR("drm_process_request error : %d", ret);
100 msc_drm_unregister_all(void)
102 if (drm_process_request(DRM_REQUEST_TYPE_UNREGISTER_ALL_FILES , NULL, NULL) == DRM_RETURN_SUCCESS)
103 MSC_DBG_INFO("drm_svc_unregister_all_contents OK");
107 msc_drm_insert_ext_memory(void)
109 if (drm_process_request(DRM_REQUEST_TYPE_INSERT_EXT_MEMORY, NULL, NULL) != DRM_RETURN_SUCCESS)
116 msc_drm_extract_ext_memory(void)
118 if (drm_process_request(DRM_REQUEST_TYPE_EXTRACT_EXT_MEMORY , NULL, NULL) != DRM_RETURN_SUCCESS)