merge with master
[platform/framework/native/content.git] / src / FCnt_AudioMetadataImpl.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                FCnt_AudioMetadataImpl.cpp
19  * @brief               This is the implementation file for the %_AudioMetadataImpl class.
20  *
21  * This file contains implementation of the %_AudioMetadataImpl class.
22  */
23
24 #include <FBaseSysLog.h>
25 #include <FCntAudioMetadata.h>
26 #include <FCnt_AudioMetadataImpl.h>
27 #include <FGrp_BitmapImpl.h>
28
29 using namespace std;
30 using namespace Tizen::Base;
31 using namespace Tizen::Graphics;
32
33 namespace Tizen { namespace Content
34 {
35
36 _AudioMetadataImpl::_AudioMetadataImpl(void)
37         : Object()
38 {
39         unique_ptr<AudioMeta, AudioMetaDeleter> pNewAudioMeta(new (nothrow) AudioMeta());
40         if (pNewAudioMeta != null)
41         {
42                 __pAudioMeta = move(pNewAudioMeta);
43         }
44         else
45         {
46                 __pAudioMeta = null;
47                 SysLog(NID_CNT, "The memory is insufficient.");
48         }
49 }
50
51 _AudioMetadataImpl::~_AudioMetadataImpl(void)
52 {
53
54 }
55
56 _AudioMetadataImpl*
57 _AudioMetadataImpl::GetInstance(AudioMetadata& audioMetadata)
58 {
59         return audioMetadata.__pImpl;
60 }
61
62 const _AudioMetadataImpl*
63 _AudioMetadataImpl::GetInstance(const AudioMetadata& audioMetadata)
64 {
65         return audioMetadata.__pImpl;
66 }
67
68 result
69 _AudioMetadataImpl::SetAudioMetadata(const AudioMeta* pAudioMeta)
70 {
71         ClearLastResult();
72
73         SysTryReturnResult(NID_CNT, pAudioMeta != null, E_INVALID_ARG, "pAudioMeta is null.");
74
75         __pAudioMeta->bitrate = pAudioMeta->bitrate;
76         __pAudioMeta->channelCount = pAudioMeta->channelCount;
77         __pAudioMeta->duration = pAudioMeta->duration;
78         __pAudioMeta->frequency = pAudioMeta->frequency;
79         __pAudioMeta->trackNum = pAudioMeta->trackNum;
80         __pAudioMeta->year = pAudioMeta->year;
81         __pAudioMeta->contentPath = pAudioMeta->contentPath;
82
83         if (pAudioMeta->pAlbumName != null)
84         {
85                 __pAudioMeta->pAlbumName = new (nothrow) String(*(pAudioMeta->pAlbumName));
86                 SysTryReturnResult(NID_CNT, __pAudioMeta->pAlbumName != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
87         }
88         if (pAudioMeta->pArtist != null)
89         {
90                 __pAudioMeta->pArtist = new (nothrow) String(*(pAudioMeta->pArtist));
91                 SysTryReturnResult(NID_CNT, __pAudioMeta->pArtist != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
92         }
93         if (pAudioMeta->pComment != null)
94         {
95                 __pAudioMeta->pComment = new (nothrow) String(*(pAudioMeta->pComment));
96                 SysTryReturnResult(NID_CNT, __pAudioMeta->pComment != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
97         }
98         if (pAudioMeta->pDescription != null)
99         {
100                 __pAudioMeta->pDescription = new (nothrow) String(*(pAudioMeta->pDescription));
101                 SysTryReturnResult(NID_CNT, __pAudioMeta->pDescription != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
102         }
103         if (pAudioMeta->pComposer != null)
104         {
105                 __pAudioMeta->pComposer = new (nothrow) String(*(pAudioMeta->pComposer));
106                 SysTryReturnResult(NID_CNT, __pAudioMeta->pComposer != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
107         }
108         if (pAudioMeta->pCopyright != null)
109         {
110                 __pAudioMeta->pCopyright = new (nothrow) String(*(pAudioMeta->pCopyright));
111                 SysTryReturnResult(NID_CNT, __pAudioMeta->pCopyright != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
112         }
113         if (pAudioMeta->pGenre != null)
114         {
115                 __pAudioMeta->pGenre = new (nothrow) String(*(pAudioMeta->pGenre));
116                 SysTryReturnResult(NID_CNT, __pAudioMeta->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
117         }
118         if (pAudioMeta->pRecordingDate != null)
119         {
120                 __pAudioMeta->pRecordingDate = new (nothrow) String(*(pAudioMeta->pRecordingDate));
121                 SysTryReturnResult(NID_CNT, __pAudioMeta->pRecordingDate != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
122         }
123         if (pAudioMeta->pTitle != null)
124         {
125                 __pAudioMeta->pTitle = new (nothrow) String(*(pAudioMeta->pTitle));
126                 SysTryReturnResult(NID_CNT, __pAudioMeta->pTitle != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
127         }
128         if (pAudioMeta->pTrackInfo != null)
129         {
130                 __pAudioMeta->pTrackInfo = new (nothrow) String(*(pAudioMeta->pTrackInfo));
131                 SysTryReturnResult(NID_CNT, __pAudioMeta->pTrackInfo != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
132         }
133         if (pAudioMeta->pThumbnail != null)
134         {
135                 __pAudioMeta->pThumbnail = _BitmapImpl::CloneN(*(pAudioMeta->pThumbnail));
136                 if (__pAudioMeta->pThumbnail == null)
137                 {
138                         SysLog(NID_CNT, "_BitmapImpl::CloneN failed.");
139                         // Because thumbnail is one of the metadata, it is not exception in this function but is exception in _AudioMetadataImpl::GetThumbnailN().
140                 }
141         }
142         if (pAudioMeta->pAlbumArt != null)
143         {
144                 __pAudioMeta->pAlbumArt = _BitmapImpl::CloneN(*(pAudioMeta->pAlbumArt));
145                 if (__pAudioMeta->pAlbumArt == null)
146                 {
147                         SysLog(NID_CNT, "_BitmapImpl::CloneN failed.");
148                         // Because album art is one of the metadata, it is not exception in this function but is exception in _AudioMetadataImpl::GetAlbumArtN().
149                 }
150         }
151
152         return E_SUCCESS;
153 }
154
155 AudioMeta*
156 _AudioMetadataImpl::GetAudioMetadata(void) const
157 {
158         return __pAudioMeta.get();
159 }
160
161 _AudioMetadataImpl::_AudioMetadataImpl(const _AudioMetadataImpl& rhs)
162         : Object()
163 {
164         unique_ptr<AudioMeta, AudioMetaDeleter> pNewAudioMeta(new (nothrow) AudioMeta());
165         if (pNewAudioMeta != null)
166         {
167                 pNewAudioMeta->bitrate = (rhs.__pAudioMeta)->bitrate;
168                 pNewAudioMeta->channelCount = (rhs.__pAudioMeta)->channelCount;
169                 pNewAudioMeta->duration = (rhs.__pAudioMeta)->duration;
170                 pNewAudioMeta->frequency = (rhs.__pAudioMeta)->frequency;
171                 pNewAudioMeta->trackNum = (rhs.__pAudioMeta)->trackNum;
172                 pNewAudioMeta->year = (rhs.__pAudioMeta)->year;
173                 pNewAudioMeta->contentPath = (rhs.__pAudioMeta)->contentPath;
174
175                 // pAlbumName
176                 if ((rhs.__pAudioMeta)->pAlbumName != null)
177                 {
178                         pNewAudioMeta->pAlbumName = new (nothrow) String(*((rhs.__pAudioMeta)->pAlbumName));
179                         if (pNewAudioMeta->pAlbumName == null)
180                         {
181                                 SysLog(NID_CNT, "The memory is insufficient.");
182                                 return;
183                         }
184                 }
185                 // pArtist
186                 if ((rhs.__pAudioMeta)->pArtist != null)
187                 {
188                         pNewAudioMeta->pArtist = new (nothrow) String(*((rhs.__pAudioMeta)->pArtist));
189                         if (pNewAudioMeta->pArtist == null)
190                         {
191                                 SysLog(NID_CNT, "The memory is insufficient.");
192                                 return;
193                         }
194                 }
195                 // pComment
196                 if ((rhs.__pAudioMeta)->pComment != null)
197                 {
198                         pNewAudioMeta->pComment = new (nothrow) String(*((rhs.__pAudioMeta)->pComment));
199                         if (pNewAudioMeta->pComment == null)
200                         {
201                                 SysLog(NID_CNT, "The memory is insufficient.");
202                                 return;
203                         }
204                 }
205                 // pDescription
206                 if ((rhs.__pAudioMeta)->pDescription != null)
207                 {
208                         pNewAudioMeta->pDescription = new (nothrow) String(*((rhs.__pAudioMeta)->pDescription));
209                         if (pNewAudioMeta->pDescription == null)
210                         {
211                                 SysLog(NID_CNT, "The memory is insufficient.");
212                                 return;
213                         }
214                 }
215                 // pComposer
216                 if ((rhs.__pAudioMeta)->pComposer != null)
217                 {
218                         pNewAudioMeta->pComposer = new (nothrow) String(*((rhs.__pAudioMeta)->pComposer));
219                         if (pNewAudioMeta->pComposer == null)
220                         {
221                                 SysLog(NID_CNT, "The memory is insufficient.");
222                                 return;
223                         }
224                 }
225                 // pCopyright
226                 if ((rhs.__pAudioMeta)->pCopyright != null)
227                 {
228                         pNewAudioMeta->pCopyright = new (nothrow) String(*((rhs.__pAudioMeta)->pCopyright));
229                         if (pNewAudioMeta->pCopyright == null)
230                         {
231                                 SysLog(NID_CNT, "The memory is insufficient.");
232                                 return;
233                         }
234                 }
235                 // pGenre
236                 if ((rhs.__pAudioMeta)->pGenre != null)
237                 {
238                         pNewAudioMeta->pGenre = new (nothrow) String(*((rhs.__pAudioMeta)->pGenre));
239                         if (pNewAudioMeta->pGenre == null)
240                         {
241                                 SysLog(NID_CNT, "The memory is insufficient.");
242                                 return;
243                         }
244                 }
245                 // pRecordingDate
246                 if ((rhs.__pAudioMeta)->pRecordingDate != null)
247                 {
248                         pNewAudioMeta->pRecordingDate = new (nothrow) String(*((rhs.__pAudioMeta)->pRecordingDate));
249                         if (pNewAudioMeta->pRecordingDate == null)
250                         {
251                                 SysLog(NID_CNT, "The memory is insufficient.");
252                                 return;
253                         }
254                 }
255                 // pTitle
256                 if ((rhs.__pAudioMeta)->pTitle != null)
257                 {
258                         pNewAudioMeta->pTitle = new (nothrow) String(*((rhs.__pAudioMeta)->pTitle));
259                         if (pNewAudioMeta->pTitle == null)
260                         {
261                                 SysLog(NID_CNT, "The memory is insufficient.");
262                                 return;
263                         }
264                 }
265                 // pTrackInfo
266                 if ((rhs.__pAudioMeta)->pTrackInfo != null)
267                 {
268                         pNewAudioMeta->pTrackInfo = new (nothrow) String(*((rhs.__pAudioMeta)->pTrackInfo));
269                         if (pNewAudioMeta->pTrackInfo == null)
270                         {
271                                 SysLog(NID_CNT, "The memory is insufficient.");
272                                 return;
273                         }
274                 }
275                 // pThumbnail
276                 if ((rhs.__pAudioMeta)->pThumbnail != null)
277                 {
278                         pNewAudioMeta->pThumbnail = _BitmapImpl::CloneN(*((rhs.__pAudioMeta)->pThumbnail));
279                         if (pNewAudioMeta->pThumbnail == null)
280                         {
281                                 SysLog(NID_CNT, "The memory is insufficient.");
282                                 return;
283                         }
284                 }
285                 // pAlbumArt
286                 if ((rhs.__pAudioMeta)->pAlbumArt != null)
287                 {
288                         pNewAudioMeta->pAlbumArt = _BitmapImpl::CloneN(*((rhs.__pAudioMeta)->pAlbumArt));
289                         if (pNewAudioMeta->pAlbumArt == null)
290                         {
291                                 SysLog(NID_CNT, "The memory is insufficient.");
292                                 return;
293                         }
294                 }
295
296                 __pAudioMeta = move(pNewAudioMeta);
297         }
298         else
299         {
300                 __pAudioMeta = null;
301                 SysLog(NID_CNT, "The memory is insufficient.");
302         }
303 }
304
305 _AudioMetadataImpl&
306 _AudioMetadataImpl::operator =(const _AudioMetadataImpl& rhs)
307 {
308         // check for self-assignment
309         if (this == &rhs)
310         {
311                 return *this;
312         }
313
314         // __pAudioMeta
315         if (__pAudioMeta != null && (rhs.__pAudioMeta) != null)
316         {
317                 // DeleteMetadata(__pAudioMeta);
318                 // __pAudioMeta = new (nothrow) AudioMeta;
319
320                 __pAudioMeta.reset(new (nothrow) AudioMeta);
321         }
322         else if (__pAudioMeta != null)
323         {
324                 //DeleteMetadata(__pAudioMeta);
325
326                 __pAudioMeta.reset(null);
327                 return *this;
328         }
329         else if ((rhs.__pAudioMeta) != null)
330         {
331                 //__pAudioMeta = new (nothrow) AudioMeta;
332
333                 __pAudioMeta.reset(new (nothrow) AudioMeta);
334         }
335         else
336         {
337                 // __pAudioMeta and rhs.__pAudioMeta are null.
338                 return *this;
339         }
340
341         __pAudioMeta->bitrate = (rhs.__pAudioMeta)->bitrate;
342         __pAudioMeta->channelCount = (rhs.__pAudioMeta)->channelCount;
343         __pAudioMeta->duration = (rhs.__pAudioMeta)->duration;
344         __pAudioMeta->frequency = (rhs.__pAudioMeta)->frequency;
345         __pAudioMeta->trackNum = (rhs.__pAudioMeta)->trackNum;
346         __pAudioMeta->year = (rhs.__pAudioMeta)->year;
347         __pAudioMeta->contentPath = (rhs.__pAudioMeta)->contentPath;
348
349         // pAlbumName
350         if (__pAudioMeta->pAlbumName != null && (rhs.__pAudioMeta)->pAlbumName != null)
351         {
352                 // delete previous data
353                 delete __pAudioMeta->pAlbumName;
354                 __pAudioMeta->pAlbumName = null;
355
356                 __pAudioMeta->pAlbumName = new (nothrow) String(*((rhs.__pAudioMeta)->pAlbumName));
357         }
358         else if (__pAudioMeta->pAlbumName != null)
359         {
360                 delete __pAudioMeta->pAlbumName;
361                 __pAudioMeta->pAlbumName = null;
362         }
363         else if ((rhs.__pAudioMeta)->pAlbumName != null)
364         {
365                 __pAudioMeta->pAlbumName = new (nothrow) String(*((rhs.__pAudioMeta)->pAlbumName));
366         }
367
368         // pArtist
369         if (__pAudioMeta->pArtist != null && (rhs.__pAudioMeta)->pArtist != null)
370         {
371                 // delete previous data
372                 delete __pAudioMeta->pArtist;
373                 __pAudioMeta->pArtist = null;
374
375                 __pAudioMeta->pArtist = new (nothrow) String(*((rhs.__pAudioMeta)->pArtist));
376         }
377         else if (__pAudioMeta->pArtist != null)
378         {
379                 delete __pAudioMeta->pArtist;
380                 __pAudioMeta->pArtist = null;
381         }
382         else if ((rhs.__pAudioMeta)->pArtist != null)
383         {
384                 __pAudioMeta->pArtist = new (nothrow) String(*((rhs.__pAudioMeta)->pArtist));
385         }
386
387         // pComment
388         if (__pAudioMeta->pComment != null && (rhs.__pAudioMeta)->pComment != null)
389         {
390                 // delete previous data
391                 delete __pAudioMeta->pComment;
392                 __pAudioMeta->pComment = null;
393
394                 __pAudioMeta->pComment = new (nothrow) String(*((rhs.__pAudioMeta)->pComment));
395         }
396         else if (__pAudioMeta->pComment != null)
397         {
398                 delete __pAudioMeta->pComment;
399                 __pAudioMeta->pComment = null;
400         }
401         else if ((rhs.__pAudioMeta)->pComment != null)
402         {
403                 __pAudioMeta->pComment = new (nothrow) String(*((rhs.__pAudioMeta)->pComment));
404         }
405
406         // pDescription
407         if (__pAudioMeta->pDescription != null && (rhs.__pAudioMeta)->pDescription != null)
408         {
409                 // delete previous data
410                 delete __pAudioMeta->pDescription;
411                 __pAudioMeta->pDescription = null;
412
413                 __pAudioMeta->pDescription = new (nothrow) String(*((rhs.__pAudioMeta)->pDescription));
414         }
415         else if (__pAudioMeta->pDescription != null)
416         {
417                 delete __pAudioMeta->pDescription;
418                 __pAudioMeta->pDescription = null;
419         }
420         else if ((rhs.__pAudioMeta)->pDescription != null)
421         {
422                 __pAudioMeta->pDescription = new (nothrow) String(*((rhs.__pAudioMeta)->pDescription));
423         }
424
425         // pComposer
426         if (__pAudioMeta->pComposer != null && (rhs.__pAudioMeta)->pComposer != null)
427         {
428                 // delete previous data
429                 delete __pAudioMeta->pComposer;
430                 __pAudioMeta->pComposer = null;
431
432                 __pAudioMeta->pComposer = new (nothrow) String(*((rhs.__pAudioMeta)->pComposer));
433         }
434         else if (__pAudioMeta->pComposer != null)
435         {
436                 delete __pAudioMeta->pComposer;
437                 __pAudioMeta->pComposer = null;
438         }
439         else if ((rhs.__pAudioMeta)->pComposer != null)
440         {
441                 __pAudioMeta->pComposer = new (nothrow) String(*((rhs.__pAudioMeta)->pComposer));
442         }
443
444         // pCopyright
445         if (__pAudioMeta->pCopyright != null && (rhs.__pAudioMeta)->pCopyright != null)
446         {
447                 // delete previous data
448                 delete __pAudioMeta->pCopyright;
449                 __pAudioMeta->pCopyright = null;
450
451                 __pAudioMeta->pCopyright = new (nothrow) String(*((rhs.__pAudioMeta)->pCopyright));
452         }
453         else if (__pAudioMeta->pCopyright != null)
454         {
455                 delete __pAudioMeta->pCopyright;
456                 __pAudioMeta->pCopyright = null;
457         }
458         else if ((rhs.__pAudioMeta)->pCopyright != null)
459         {
460                 __pAudioMeta->pCopyright = new (nothrow) String(*((rhs.__pAudioMeta)->pCopyright));
461         }
462
463         // pGenre
464         if (__pAudioMeta->pGenre != null && (rhs.__pAudioMeta)->pGenre != null)
465         {
466                 // delete previous data
467                 delete __pAudioMeta->pGenre;
468                 __pAudioMeta->pGenre = null;
469
470                 __pAudioMeta->pGenre = new (nothrow) String(*((rhs.__pAudioMeta)->pGenre));
471         }
472         else if (__pAudioMeta->pGenre != null)
473         {
474                 delete __pAudioMeta->pGenre;
475                 __pAudioMeta->pGenre = null;
476         }
477         else if ((rhs.__pAudioMeta)->pGenre != null)
478         {
479                 __pAudioMeta->pGenre = new (nothrow) String(*((rhs.__pAudioMeta)->pGenre));
480         }
481
482         // pRecordingDate
483         if (__pAudioMeta->pRecordingDate != null && (rhs.__pAudioMeta)->pRecordingDate != null)
484         {
485                 // delete previous data
486                 delete __pAudioMeta->pRecordingDate;
487                 __pAudioMeta->pRecordingDate = null;
488
489                 __pAudioMeta->pRecordingDate = new (nothrow) String(*((rhs.__pAudioMeta)->pRecordingDate));
490         }
491         else if (__pAudioMeta->pRecordingDate != null)
492         {
493                 delete __pAudioMeta->pRecordingDate;
494                 __pAudioMeta->pRecordingDate = null;
495         }
496         else if ((rhs.__pAudioMeta)->pRecordingDate != null)
497         {
498                 __pAudioMeta->pRecordingDate = new (nothrow) String(*((rhs.__pAudioMeta)->pRecordingDate));
499         }
500
501         // pTitle
502         if (__pAudioMeta->pTitle != null && (rhs.__pAudioMeta)->pTitle != null)
503         {
504                 // delete previous data
505                 delete __pAudioMeta->pTitle;
506                 __pAudioMeta->pTitle = null;
507
508                 __pAudioMeta->pTitle = new (nothrow) String(*((rhs.__pAudioMeta)->pTitle));
509         }
510         else if (__pAudioMeta->pTitle != null)
511         {
512                 delete __pAudioMeta->pTitle;
513                 __pAudioMeta->pTitle = null;
514         }
515         else if ((rhs.__pAudioMeta)->pTitle != null)
516         {
517                 __pAudioMeta->pTitle = new (nothrow) String(*((rhs.__pAudioMeta)->pTitle));
518         }
519
520         // pTrackInfo
521         if (__pAudioMeta->pTrackInfo != null && (rhs.__pAudioMeta)->pTrackInfo != null)
522         {
523                 // delete previous data
524                 delete __pAudioMeta->pTrackInfo;
525                 __pAudioMeta->pTrackInfo = null;
526
527                 __pAudioMeta->pTrackInfo = new (nothrow) String(*((rhs.__pAudioMeta)->pTrackInfo));
528         }
529         else if (__pAudioMeta->pTrackInfo != null)
530         {
531                 delete __pAudioMeta->pTrackInfo;
532                 __pAudioMeta->pTrackInfo = null;
533         }
534         else if ((rhs.__pAudioMeta)->pTrackInfo != null)
535         {
536                 __pAudioMeta->pTrackInfo = new (nothrow) String(*((rhs.__pAudioMeta)->pTrackInfo));
537         }
538
539         // pThumbnail
540         if (__pAudioMeta->pThumbnail != null && (rhs.__pAudioMeta)->pThumbnail != null)
541         {
542                 // delete previous data
543                 delete __pAudioMeta->pThumbnail;
544                 __pAudioMeta->pThumbnail = null;
545
546                 __pAudioMeta->pThumbnail = _BitmapImpl::CloneN(*((rhs.__pAudioMeta)->pThumbnail));
547         }
548         else if (__pAudioMeta->pThumbnail != null)
549         {
550                 delete __pAudioMeta->pThumbnail;
551                 __pAudioMeta->pThumbnail = null;
552         }
553         else if ((rhs.__pAudioMeta)->pThumbnail != null)
554         {
555                 __pAudioMeta->pThumbnail = _BitmapImpl::CloneN(*((rhs.__pAudioMeta)->pThumbnail));
556         }
557
558         // pAlbumArt
559         if (__pAudioMeta->pAlbumArt != null && (rhs.__pAudioMeta)->pAlbumArt != null)
560         {
561                 // delete previous data
562                 delete __pAudioMeta->pAlbumArt;
563                 __pAudioMeta->pAlbumArt = null;
564
565                 __pAudioMeta->pAlbumArt = _BitmapImpl::CloneN(*((rhs.__pAudioMeta)->pAlbumArt));
566         }
567         else if (__pAudioMeta->pAlbumArt != null)
568         {
569                 delete __pAudioMeta->pAlbumArt;
570                 __pAudioMeta->pAlbumArt = null;
571         }
572         else if ((rhs.__pAudioMeta)->pAlbumArt != null)
573         {
574                 __pAudioMeta->pAlbumArt = _BitmapImpl::CloneN(*((rhs.__pAudioMeta)->pAlbumArt));
575         }
576
577         SysLog(NID_CNT, "_AudioMetadataImpl::operator =(const _AudioMetadataImpl& rhs) is called.");
578         return *this;
579 }
580
581 bool
582 _AudioMetadataImpl::Equals(const Tizen::Base::Object& rhs) const
583 {
584         const _AudioMetadataImpl* pRhs = dynamic_cast <const _AudioMetadataImpl*>(&rhs);
585         if (pRhs == null)
586         {
587                 return false;
588         }
589
590         if (!((this->GetAlbumName()).Equals(pRhs->GetAlbumName())))
591         {
592                 return false;
593         }
594         if (!((this->GetArtist()).Equals(pRhs->GetArtist())))
595         {
596                 return false;
597         }
598         if (this->GetBitrate() != pRhs->GetBitrate())
599         {
600                 return false;
601         }
602         if (this->GetChannelCount() != pRhs->GetChannelCount())
603         {
604                 return false;
605         }
606         if (!((this->GetComment()).Equals(pRhs->GetComment())))
607         {
608                 return false;
609         }
610         if (!((this->GetDescription()).Equals(pRhs->GetDescription())))
611         {
612                 return false;
613         }
614         if (!((this->GetComposer()).Equals(pRhs->GetComposer())))
615         {
616                 return false;
617         }
618         if (!((this->GetCopyright()).Equals(pRhs->GetCopyright())))
619         {
620                 return false;
621         }
622         if (this->GetDuration() != pRhs->GetDuration())
623         {
624                 return false;
625         }
626         if (this->GetFrequency() != pRhs->GetFrequency())
627         {
628                 return false;
629         }
630         if (!((this->GetGenre()).Equals(pRhs->GetGenre())))
631         {
632                 return false;
633         }
634         if (!((this->GetRecordingDate()).Equals(pRhs->GetRecordingDate())))
635         {
636                 return false;
637         }
638         if (!((this->GetTitle()).Equals(pRhs->GetTitle())))
639         {
640                 return false;
641         }
642         if (this->GetTrack() != pRhs->GetTrack())
643         {
644                 return false;
645         }
646         if (!((this->GetTrackInfo()).Equals(pRhs->GetTrackInfo())))
647         {
648                 return false;
649         }
650         if (this->GetYear() != pRhs->GetYear())
651         {
652                 return false;
653         }
654
655         return true;
656 }
657
658 int
659 _AudioMetadataImpl::GetHashCode(void) const
660 {
661         return (this->GetAlbumName()).GetHashCode()
662                         ^ (this->GetArtist()).GetHashCode()
663                         ^ Integer::GetHashCode(this->GetBitrate())
664                         ^ Integer::GetHashCode(this->GetChannelCount())
665                         ^ (this->GetComment()).GetHashCode()
666                         ^ (this->GetDescription()).GetHashCode()
667                         ^ (this->GetComposer()).GetHashCode()
668                         ^ (this->GetCopyright()).GetHashCode()
669                         ^ Long::GetHashCode(this->GetDuration())
670                         ^ Integer::GetHashCode(this->GetFrequency())
671                         ^ (this->GetGenre()).GetHashCode()
672                         ^ (this->GetRecordingDate()).GetHashCode()
673                         ^ (this->GetTitle()).GetHashCode()
674                         ^ Integer::GetHashCode(this->GetTrack())
675                         ^ (this->GetTrackInfo()).GetHashCode()
676                         ^ Integer::GetHashCode(this->GetYear());
677 }
678
679 String
680 _AudioMetadataImpl::GetTitle(void) const
681 {
682         if (__pAudioMeta == null || __pAudioMeta->pTitle == null)
683         {
684                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pTitle is null.");
685                 return String();
686         }
687         return *(__pAudioMeta->pTitle);
688 }
689
690 int
691 _AudioMetadataImpl::GetBitrate(void) const
692 {
693         if (__pAudioMeta == null)
694         {
695                 SysLog(NID_CNT, "__pAudioMeta is null.");
696                 return 0;
697         }
698         return __pAudioMeta->bitrate;
699 }
700
701 int
702 _AudioMetadataImpl::GetFrequency(void) const
703 {
704         if (__pAudioMeta == null)
705         {
706                 SysLog(NID_CNT, "__pAudioMeta is null.");
707                 return 0;
708         }
709         return __pAudioMeta->frequency;
710 }
711
712 String
713 _AudioMetadataImpl::GetArtist(void) const
714 {
715         if (__pAudioMeta == null || __pAudioMeta->pArtist == null)
716         {
717                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pArtist is null.");
718                 return String();
719         }
720         return *(__pAudioMeta->pArtist);
721 }
722
723 String
724 _AudioMetadataImpl::GetAlbumName(void) const
725 {
726         if (__pAudioMeta == null || __pAudioMeta->pAlbumName == null)
727         {
728                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pAlbumName is null.");
729                 return String();
730         }
731         return *(__pAudioMeta->pAlbumName);
732 }
733
734 String
735 _AudioMetadataImpl::GetComment(void) const
736 {
737         if (__pAudioMeta == null || __pAudioMeta->pComment == null)
738         {
739                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pComment is null.");
740                 return String();
741         }
742         return *(__pAudioMeta->pComment);
743 }
744
745 String
746 _AudioMetadataImpl::GetDescription(void) const
747 {
748         if (__pAudioMeta == null || __pAudioMeta->pDescription == null)
749         {
750                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pDescription is null.");
751                 return String();
752         }
753         return *(__pAudioMeta->pDescription);
754 }
755
756 int
757 _AudioMetadataImpl::GetTrack(void) const
758 {
759         if (__pAudioMeta == null)
760         {
761                 SysLog(NID_CNT, "__pAudioMeta is null.");
762                 return 0;
763         }
764         return __pAudioMeta->trackNum;
765 }
766
767 String
768 _AudioMetadataImpl::GetGenre(void) const
769 {
770         if (__pAudioMeta == null || __pAudioMeta->pGenre == null)
771         {
772                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pGenre is null.");
773                 return String();
774         }
775         return *(__pAudioMeta->pGenre);
776 }
777
778 String
779 _AudioMetadataImpl::GetComposer(void) const
780 {
781         if (__pAudioMeta == null || __pAudioMeta->pComposer == null)
782         {
783                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pComposer is null.");
784                 return String();
785         }
786         return *(__pAudioMeta->pComposer);
787 }
788
789 String
790 _AudioMetadataImpl::GetCopyright(void) const
791 {
792         if (__pAudioMeta == null || __pAudioMeta->pCopyright == null)
793         {
794                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pCopyright is null.");
795                 return String();
796         }
797         return *(__pAudioMeta->pCopyright);
798 }
799
800 long
801 _AudioMetadataImpl::GetDuration(void) const
802 {
803         if (__pAudioMeta == null)
804         {
805                 SysLog(NID_CNT, "__pAudioMeta is null.");
806                 return 0;
807         }
808         return __pAudioMeta->duration;
809 }
810
811 int
812 _AudioMetadataImpl::GetYear(void) const
813 {
814         if (__pAudioMeta == null)
815         {
816                 SysLog(NID_CNT, "__pAudioMeta is null.");
817                 return 0;
818         }
819         return __pAudioMeta->year;
820 }
821
822 String
823 _AudioMetadataImpl::GetTrackInfo(void) const
824 {
825         if (__pAudioMeta == null || __pAudioMeta->pTrackInfo == null)
826         {
827                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pTrackInfo is null.");
828                 return String();
829         }
830         return *(__pAudioMeta->pTrackInfo);
831 }
832
833 String
834 _AudioMetadataImpl::GetRecordingDate(void) const
835 {
836         if (__pAudioMeta == null || __pAudioMeta->pRecordingDate == null)
837         {
838                 SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pRecordingDate is null.");
839                 return String();
840         }
841         return *(__pAudioMeta->pRecordingDate);
842 }
843
844 int
845 _AudioMetadataImpl::GetChannelCount(void) const
846 {
847         if (__pAudioMeta == null)
848         {
849                 SysLog(NID_CNT, "__pAudioMeta is null.");
850                 return 0;
851         }
852         return __pAudioMeta->channelCount;
853 }
854
855 //
856 // E_SUCCESS
857 // E_DATA_NOT_FOUND
858 // - E_OUT_OF_MEMORY
859 //
860 Bitmap*
861 _AudioMetadataImpl::GetThumbnailN(void) const
862 {
863         ClearLastResult();
864
865         if (__pAudioMeta == null || __pAudioMeta->pThumbnail == null)
866         {
867                 SysLogException(NID_CNT, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] __pAudioMeta or __pAudioMeta->pThumbnail is null.");
868                 return null;
869         }
870
871         Bitmap* pBitmap = _BitmapImpl::CloneN(*(__pAudioMeta->pThumbnail));
872         SysTryReturn(NID_CNT, pBitmap != null, null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] _BitmapImpl::CloneN failed.");
873
874         return pBitmap;
875 }
876
877 //
878 // E_SUCCESS
879 // E_DATA_NOT_FOUND
880 // - E_OUT_OF_MEMORY
881 //
882 Bitmap*
883 _AudioMetadataImpl::GetAlbumArtN(void) const
884 {
885         ClearLastResult();
886
887         if (__pAudioMeta == null || __pAudioMeta->pAlbumArt == null)
888         {
889                 SysLogException(NID_CNT, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] __pAudioMeta or __pAudioMeta->pAlbumArt is null.");
890                 return null;
891         }
892
893         Bitmap* pBitmap = _BitmapImpl::CloneN(*(__pAudioMeta->pAlbumArt));
894         SysTryReturn(NID_CNT, pBitmap != null, null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] _BitmapImpl::CloneN failed.");
895
896         return pBitmap;
897 }
898 }}