4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@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.
22 #include "img-codec-osal.h"
27 #include <drm-service.h>
29 void *IfegMemAlloc(unsigned int size)
36 void IfegMemFree(void *pMem)
42 void *IfegMemcpy(void *dest, const void *src, unsigned int count)
44 return memcpy(dest, src, count);
47 void *IfegMemset(void *dest, int c, unsigned int count)
49 return memset(dest, c, count);
52 ULONG IfegGetAvailableMemSize(void)
57 int IfegMemcmp(const void *pMem1, const void *pMem2, size_t length)
59 return memcmp(pMem1, pMem2, length);
62 DRM_FILE_HANDLE hDrmFile = NULL;
63 static BOOL _is_real_drm = FALSE;
65 HFile DrmOpenFile(const char *szPathName)
67 if (drm_svc_is_drm_file(szPathName) == DRM_TRUE) {
74 FILE *fp = fopen(szPathName, "rb");
77 return (HFile) INVALID_HOBJ;
84 drm_svc_open_file(szPathName, DRM_PERMISSION_DISPLAY,
87 if (ret != DRM_RESULT_SUCCESS) {
88 return (HFile) INVALID_HOBJ;
94 BOOL DrmReadFile(HFile hFile, void *pBuffer, ULONG bufLen, ULONG * pReadLen)
99 readCnt = fread(pBuffer, sizeof(char), bufLen, hFile);
100 *pReadLen = (ULONG) readCnt;
102 drm_svc_read_file((DRM_FILE_HANDLE) hFile, pBuffer, bufLen,
104 *pReadLen = (ULONG) readCnt;
109 long DrmTellFile(HFile hFile)
114 return drm_svc_tell_file((DRM_FILE_HANDLE) hFile);
118 BOOL DrmSeekFile(HFile hFile, long position, long offset)
125 fseek(hFile, offset, position);
127 drm_svc_seek_file((DRM_FILE_HANDLE) hFile, offset, position);
133 BOOL DrmGetFileAttributes(const char *szPathName, FmFileAttribute * pFileAttr)
137 f = fopen(szPathName, "r");
143 fseek(f, 0, SEEK_END);
144 pFileAttr->fileSize = ftell(f);
150 BOOL DrmCloseFile(HFile hFile)
155 drm_svc_close_file((DRM_FILE_HANDLE) hFile);