[content] Fix a buf on ContentTransfer
[platform/framework/native/content.git] / src / FCntVideoMetadata.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                FCntVideoMetadata.cpp
18  * @brief               This is the implementation file for the %VideoMetadata class.
19  *
20  * This file contains implementation of the %VideoMetadata class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FCntVideoMetadata.h>
25 #include <FCnt_VideoMetadataImpl.h>
26
27 using namespace Tizen::Base;
28 using namespace Tizen::Graphics;
29
30 namespace Tizen { namespace Content
31 {
32
33 VideoMetadata::VideoMetadata(void)
34         : Object()
35         , __pImpl(new (std::nothrow) _VideoMetadataImpl())
36 {
37
38 }
39
40 VideoMetadata::~VideoMetadata(void)
41 {
42         if (__pImpl != null)
43         {
44                 delete __pImpl;
45                 __pImpl = null;
46         }
47 }
48
49 VideoMetadata::VideoMetadata(const VideoMetadata& rhs)
50         : Tizen::Base::Object()
51         , __pImpl(new (std::nothrow) _VideoMetadataImpl(*rhs.__pImpl))
52 {
53
54 }
55
56 VideoMetadata&
57 VideoMetadata::operator =(const VideoMetadata& rhs)
58 {
59         // check for self-assignment
60         if (this == &rhs)
61         {
62                 return *this;
63         }
64
65         *__pImpl = *rhs.__pImpl;
66
67         return *this;
68 }
69
70 int
71 VideoMetadata::GetHashCode(void) const
72 {
73         return __pImpl->GetHashCode();
74 }
75
76 bool
77 VideoMetadata::Equals(const Object& rhs) const
78 {
79         const VideoMetadata* pRhs = dynamic_cast <const VideoMetadata*>(&rhs);
80         if (pRhs == null)
81         {
82                 return false;
83         }
84
85         return __pImpl->Equals(*pRhs->__pImpl);
86 }
87
88 int
89 VideoMetadata::GetWidth(void) const
90 {
91         if (__pImpl == null)
92         {
93                 return 0;
94         }
95         return __pImpl->GetWidth();
96 }
97
98 int
99 VideoMetadata::GetHeight(void) const
100 {
101         if (__pImpl == null)
102         {
103                 return 0;
104         }
105         return __pImpl->GetHeight();
106 }
107
108 long
109 VideoMetadata::GetDuration(void) const
110 {
111         if (__pImpl == null)
112         {
113                 return 0;
114         }
115         return __pImpl->GetDuration();
116 }
117
118 int
119 VideoMetadata::GetFramerate(void) const
120 {
121         if (__pImpl == null)
122         {
123                 return 0;
124         }
125         return __pImpl->GetFramerate();
126 }
127
128 int
129 VideoMetadata::GetBitrate(void) const
130 {
131         if (__pImpl == null)
132         {
133                 return 0;
134         }
135         return __pImpl->GetAudioBitrate();
136 }
137
138 int
139 VideoMetadata::GetAudioBitrate(void) const
140 {
141         if (__pImpl == null)
142         {
143                 return 0;
144         }
145         return __pImpl->GetAudioBitrate();
146 }
147
148 int
149 VideoMetadata::GetVideoBitrate(void) const
150 {
151         if (__pImpl == null)
152         {
153                 return 0;
154         }
155         return __pImpl->GetVideoBitrate();
156 }
157
158 String
159 VideoMetadata::GetGenre(void) const
160 {
161         if (__pImpl == null)
162         {
163                 return String();
164         }
165         return __pImpl->GetGenre();
166 }
167
168 String
169 VideoMetadata::GetComment(void) const
170 {
171         if (__pImpl == null)
172         {
173                 return String();
174         }
175         return __pImpl->GetComment();
176 }
177
178 String
179 VideoMetadata::GetDescription(void) const
180 {
181         if (__pImpl == null)
182         {
183                 return String();
184         }
185         return __pImpl->GetDescription();
186 }
187
188 Bitmap*
189 VideoMetadata::GetAlbumArtN(void) const
190 {
191         ClearLastResult();
192         result r = E_SUCCESS;
193
194         Bitmap* pBitmap = null;
195         SysTryReturn(NID_CNT, __pImpl != null, null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetAlbumArtN failed.");
196
197         pBitmap = __pImpl->GetAlbumArtN();
198         r = GetLastResult();
199         SysTryReturn(NID_CNT, pBitmap != null, null, r, "[%s] GetAlbumArtN failed.", GetErrorMessage(r));
200
201         return pBitmap;
202 }
203 }}