[content] Change secure log
[platform/framework/native/content.git] / src / FCntAudioMetadata.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                FCntAudioMetadata.cpp
19  * @brief               This is the implementation file for the %AudioMetadata class.
20  *
21  * This file contains implementation of the %AudioMetadata class.
22  */
23
24 #include <FBaseSysLog.h>
25 #include <FCntAudioMetadata.h>
26 #include <FCnt_AudioMetadataImpl.h>
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30
31 namespace Tizen { namespace Content
32 {
33
34 AudioMetadata::AudioMetadata(void)
35         : Object()
36         , __pImpl(new (std::nothrow) _AudioMetadataImpl())
37 {
38
39 }
40
41 AudioMetadata::~AudioMetadata(void)
42 {
43         if (__pImpl != null)
44         {
45                 delete __pImpl;
46                 __pImpl = null;
47         }
48 }
49
50 AudioMetadata::AudioMetadata(const AudioMetadata& rhs)
51         : Tizen::Base::Object()
52         , __pImpl(new (std::nothrow) _AudioMetadataImpl(*rhs.__pImpl))
53 {
54
55 }
56
57 AudioMetadata&
58 AudioMetadata::operator =(const AudioMetadata& rhs)
59 {
60         // check for self-assignment
61         if (this == &rhs)
62         {
63                 return *this;
64         }
65
66         *__pImpl = *rhs.__pImpl;
67
68         return *this;
69 }
70
71 int
72 AudioMetadata::GetHashCode(void) const
73 {
74         return __pImpl->GetHashCode();
75 }
76
77 bool
78 AudioMetadata::Equals(const Object& rhs) const
79 {
80         const AudioMetadata* pRhs = dynamic_cast <const AudioMetadata*>(&rhs);
81         if (pRhs == null)
82         {
83                 return false;
84         }
85
86         return __pImpl->Equals(*pRhs->__pImpl);
87 }
88
89 String
90 AudioMetadata::GetTitle(void) const
91 {
92         if (__pImpl == null)
93         {
94                 return String();
95         }
96         return __pImpl->GetTitle();
97 }
98
99 int
100 AudioMetadata::GetBitrate(void) const
101 {
102         if (__pImpl == null)
103         {
104                 return 0;
105         }
106         return __pImpl->GetBitrate();
107 }
108
109 int
110 AudioMetadata::GetFrequency(void) const
111 {
112         if (__pImpl == null)
113         {
114                 return 0;
115         }
116         return __pImpl->GetFrequency();
117 }
118
119 String
120 AudioMetadata::GetArtist(void) const
121 {
122         if (__pImpl == null)
123         {
124                 return String();
125         }
126         return __pImpl->GetArtist();
127 }
128
129 String
130 AudioMetadata::GetAlbumName(void) const
131 {
132         if (__pImpl == null)
133         {
134                 return String();
135         }
136         return __pImpl->GetAlbumName();
137 }
138
139 String
140 AudioMetadata::GetComment(void) const
141 {
142         if (__pImpl == null)
143         {
144                 return String();
145         }
146         return __pImpl->GetComment();
147 }
148
149 String
150 AudioMetadata::GetDescription(void) const
151 {
152         if (__pImpl == null)
153         {
154                 return String();
155         }
156         return __pImpl->GetDescription();
157 }
158
159 int
160 AudioMetadata::GetTrack(void) const
161 {
162         if (__pImpl == null)
163         {
164                 return 0;
165         }
166         return __pImpl->GetTrack();
167 }
168
169 String
170 AudioMetadata::GetGenre(void) const
171 {
172         if (__pImpl == null)
173         {
174                 return String();
175         }
176         return __pImpl->GetGenre();
177 }
178
179 String
180 AudioMetadata::GetComposer(void) const
181 {
182         if (__pImpl == null)
183         {
184                 return String();
185         }
186         return __pImpl->GetComposer();
187 }
188
189 String
190 AudioMetadata::GetCopyright(void) const
191 {
192         if (__pImpl == null)
193         {
194                 return String();
195         }
196         return __pImpl->GetCopyright();
197 }
198
199 long
200 AudioMetadata::GetDuration(void) const
201 {
202         if (__pImpl == null)
203         {
204                 return 0;
205         }
206         return __pImpl->GetDuration();
207 }
208
209 int
210 AudioMetadata::GetYear(void) const
211 {
212         if (__pImpl == null)
213         {
214                 return 0;
215         }
216         return __pImpl->GetYear();
217 }
218
219 String
220 AudioMetadata::GetTrackInfo(void) const
221 {
222         if (__pImpl == null)
223         {
224                 return String();
225         }
226         return __pImpl->GetTrackInfo();
227 }
228
229 String
230 AudioMetadata::GetRecordingDate(void) const
231 {
232         if (__pImpl == null)
233         {
234                 return String();
235         }
236         return __pImpl->GetRecordingDate();
237 }
238
239 int
240 AudioMetadata::GetChannelCount(void) const
241 {
242         if (__pImpl == null)
243         {
244                 return 0;
245         }
246         return __pImpl->GetChannelCount();
247 }
248
249 /**
250  * E_SUCCESS
251  * E_DATA_NOT_FOUND
252  * E_OUT_OF_MEMORY
253  */
254 Bitmap*
255 AudioMetadata::GetThumbnailN(void) const
256 {
257         ClearLastResult();
258         result r = E_SUCCESS;
259
260         Bitmap* pBitmap = null;
261         SysTryReturn(NID_CNT, __pImpl != null, null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetThumbnailN failed.");
262
263         pBitmap = __pImpl->GetThumbnailN();
264         r = GetLastResult();
265         SysTryReturn(NID_CNT, pBitmap != null, null, r, "[%s] GetThumbnailN failed.", GetErrorMessage(r));
266
267         return pBitmap;
268 }
269
270 /**
271  * E_SUCCESS
272  * E_DATA_NOT_FOUND
273  * E_OUT_OF_MEMORY
274  */
275 Bitmap*
276 AudioMetadata::GetAlbumArtN(void) const
277 {
278         ClearLastResult();
279         result r = E_SUCCESS;
280
281         Bitmap* pBitmap = null;
282
283         SysTryReturn(NID_CNT, __pImpl != null, null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetAlbumArtN failed.");
284
285         pBitmap = __pImpl->GetAlbumArtN();
286         r = GetLastResult();
287         SysTryReturn(NID_CNT, pBitmap != null, null, r, "[%s] GetAlbumArtN failed.", GetErrorMessage(r));
288
289         return pBitmap;
290 }
291 }}