Tizen 2.1 base
[platform/framework/native/content.git] / src / FCntVideoMetadata.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                FCntVideoMetadata.cpp
19  * @brief               This is the implementation file for the %VideoMetadata class.
20  *
21  * This file contains implementation of the %VideoMetadata class.
22  */
23
24 // includes
25 #include <FBaseSysLog.h>
26 #include <FCntVideoMetadata.h>
27 #include <FCnt_VideoMetadataImpl.h>
28
29 // using namespaces
30 using namespace Tizen::Base;
31 using namespace Tizen::Graphics;
32
33 namespace Tizen { namespace Content
34 {
35
36 VideoMetadata::VideoMetadata(void)
37         : Object()
38         , __pImpl(new (std::nothrow) _VideoMetadataImpl())
39 {
40
41 }
42
43 VideoMetadata::~VideoMetadata(void)
44 {
45         if (__pImpl != null)
46         {
47                 delete __pImpl;
48                 __pImpl = null;
49         }
50 }
51
52 VideoMetadata::VideoMetadata(const VideoMetadata& rhs)
53         : Tizen::Base::Object()
54         , __pImpl(new (std::nothrow) _VideoMetadataImpl(*rhs.__pImpl))
55 {
56
57 }
58
59 VideoMetadata&
60 VideoMetadata::operator =(const VideoMetadata& rhs)
61 {
62         // check for self-assignment
63         if (this == &rhs)
64         {
65                 return *this;
66         }
67
68         *__pImpl = *rhs.__pImpl;
69
70         return *this;
71 }
72
73 int
74 VideoMetadata::GetHashCode(void) const
75 {
76         return __pImpl->GetHashCode();
77 }
78
79 bool
80 VideoMetadata::Equals(const Object& rhs) const
81 {
82         const VideoMetadata* pRhs = dynamic_cast <const VideoMetadata*>(&rhs);
83         if (pRhs == null)
84         {
85                 return false;
86         }
87
88         return __pImpl->Equals(*pRhs->__pImpl);
89 }
90
91 int
92 VideoMetadata::GetWidth(void) const
93 {
94         if (__pImpl == null)
95         {
96                 return 0;
97         }
98         return __pImpl->GetWidth();
99 }
100
101 int
102 VideoMetadata::GetHeight(void) const
103 {
104         if (__pImpl == null)
105         {
106                 return 0;
107         }
108         return __pImpl->GetHeight();
109 }
110
111 long
112 VideoMetadata::GetDuration(void) const
113 {
114         if (__pImpl == null)
115         {
116                 return 0;
117         }
118         return __pImpl->GetDuration();
119 }
120
121 int
122 VideoMetadata::GetFramerate(void) const
123 {
124         if (__pImpl == null)
125         {
126                 return 0;
127         }
128         return __pImpl->GetFramerate();
129 }
130
131 int
132 VideoMetadata::GetBitrate(void) const
133 {
134         if (__pImpl == null)
135         {
136                 return 0;
137         }
138         return __pImpl->GetAudioBitrate();
139 }
140
141 int
142 VideoMetadata::GetAudioBitrate(void) const
143 {
144         if (__pImpl == null)
145         {
146                 return 0;
147         }
148         return __pImpl->GetAudioBitrate();
149 }
150
151 int
152 VideoMetadata::GetVideoBitrate(void) const
153 {
154         if (__pImpl == null)
155         {
156                 return 0;
157         }
158         return __pImpl->GetVideoBitrate();
159 }
160
161 String
162 VideoMetadata::GetGenre(void) const
163 {
164         if (__pImpl == null)
165         {
166                 return String();
167         }
168         return __pImpl->GetGenre();
169 }
170
171 Bitmap*
172 VideoMetadata::GetAlbumArtN(void) const
173 {
174         ClearLastResult();
175         result r = E_SUCCESS;
176
177         Bitmap* pBitmap = null;
178         SysTryReturn(NID_CNT, __pImpl != null, null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetAlbumArtN failed.");
179
180         pBitmap = __pImpl->GetAlbumArtN();
181         r = GetLastResult();
182         SysTryReturn(NID_CNT, pBitmap != null, null, r, "[%s] GetAlbumArtN failed.", GetErrorMessage(r));
183
184         return pBitmap;
185 }
186 }}