2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FCntContentManagerUtil.cpp
19 * @brief This is the implementation file for the %ContentManagerUtil class.
21 * This file contains implementation of the %ContentManagerUtil class.
24 #include <FBaseSysLog.h>
25 #include <FCntContentManagerUtil.h>
26 #include <FCntImageMetadata.h>
27 #include <FCntAudioMetadata.h>
28 #include <FCntVideoMetadata.h>
29 #include <FCnt_ContentManagerUtilImpl.h>
31 using namespace Tizen::Base;
33 namespace Tizen { namespace Content
37 ContentManagerUtil::GetImageMetaN(const String& filePath)
42 ImageMetadata* pImageMetadata = null;
44 pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(filePath);
46 SysTryReturn(NID_CNT, pImageMetadata != null, null, r, "[%s] GetImageMetaN failed.", GetErrorMessage(r));
48 return pImageMetadata;
52 ContentManagerUtil::GetAudioMetaN(const String& filePath)
57 AudioMetadata* pAudioMetadata = null;
59 pAudioMetadata = _ContentManagerUtilImpl::GetAudioMetaN(filePath);
61 SysTryReturn(NID_CNT, pAudioMetadata != null, null, r, "[%s] GetAudioMetaN failed.", GetErrorMessage(r));
63 return pAudioMetadata;
67 ContentManagerUtil::GetVideoMetaN(const String& filePath)
72 VideoMetadata* pVideoMetadata = null;
74 pVideoMetadata = _ContentManagerUtilImpl::GetVideoMetaN(filePath);
76 SysTryReturn(NID_CNT, pVideoMetadata != null, null, r, "[%s] GetVideoMetaN failed.", GetErrorMessage(r));
78 return pVideoMetadata;
82 ContentManagerUtil::GetImageMetaN(const ByteBuffer& byteBuffer)
87 ImageMetadata* pImageMetadata = null;
89 pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(byteBuffer);
91 SysTryReturn(NID_CNT, pImageMetadata != null, null, r, "[%s] GetImageMetaN failed.", GetErrorMessage(r));
93 return pImageMetadata;
97 ContentManagerUtil::GetAudioMetaN(const ByteBuffer& byteBuffer)
101 result r = E_SUCCESS;
102 AudioMetadata* pAudioMetadata = null;
104 pAudioMetadata = _ContentManagerUtilImpl::GetAudioMetaN(byteBuffer);
106 SysTryReturn(NID_CNT, pAudioMetadata != null, null, r, "[%s] GetAudioMetaN failed.", GetErrorMessage(r));
108 return pAudioMetadata;
112 ContentManagerUtil::GetVideoMetaN(const ByteBuffer& byteBuffer)
116 result r = E_SUCCESS;
117 VideoMetadata* pVideoMetadata = null;
119 pVideoMetadata = _ContentManagerUtilImpl::GetVideoMetaN(byteBuffer);
121 SysTryReturn(NID_CNT, pVideoMetadata != null, null, r, "[%s] GetVideoMetaN failed.", GetErrorMessage(r));
123 return pVideoMetadata;
127 ContentManagerUtil::CheckContentType(const String& filePath)
131 result r = E_SUCCESS;
132 ContentType contentType = CONTENT_TYPE_UNKNOWN;
134 contentType = _ContentManagerUtilImpl::CheckContentType(filePath);
136 SysTryReturn(NID_CNT, contentType != CONTENT_TYPE_UNKNOWN, CONTENT_TYPE_UNKNOWN, r,
137 "[%s] CheckContentType failed.", GetErrorMessage(r));
143 ContentManagerUtil::CopyToMediaDirectory(const String& srcFilePath, const String& destFilePath)
147 result r = E_SUCCESS;
149 r = _ContentManagerUtilImpl::CopyToMediaDirectory(srcFilePath, destFilePath);
150 SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] CopyToMediaDirectory failed.", GetErrorMessage(r));
156 ContentManagerUtil::MoveToMediaDirectory(const String& srcFilePath, const String& destFilePath)
160 result r = E_SUCCESS;
162 r = _ContentManagerUtilImpl::MoveToMediaDirectory(srcFilePath, destFilePath);
163 SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] MoveToMediaDirectory failed.", GetErrorMessage(r));