2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FCntVideoContentInfo.cpp
18 * @brief This is the implementation file for the %VideoContentInfo class.
20 * This file contains implementation of the %VideoContentInfo class.
23 #include <FBaseSysLog.h>
24 #include <FCntVideoContentInfo.h>
25 #include "FCnt_VideoContentInfoImpl.h"
26 #include "FCnt_ContentInfoHelper.h"
28 using namespace Tizen::Base;
30 namespace Tizen { namespace Content
33 VideoContentInfo::VideoContentInfo(void)
34 : __pVideoContentData(null)
35 , __pVideoContentInfoImpl(null)
40 VideoContentInfo::~VideoContentInfo(void)
42 delete __pVideoContentInfoImpl;
47 VideoContentInfo::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
49 SysAssertf(__pVideoContentInfoImpl == null || __pVideoContentInfoImpl->IsReconstructable(),
50 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
54 _VideoContentInfoImpl* pVideoContentInfoImpl = new (std::nothrow) _VideoContentInfoImpl();
55 SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
57 r = pVideoContentInfoImpl->Construct(contentPath, thumbnailPath, setGps);
58 SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
60 _ContentInfoHelper::SetContentInfoImpl(this, pVideoContentInfoImpl);
62 delete __pVideoContentInfoImpl;
63 __pVideoContentInfoImpl = pVideoContentInfoImpl;
65 if (r == E_FILE_NOT_FOUND)
67 __pVideoContentInfoImpl->SetReconstructable(true);
71 __pVideoContentInfoImpl->SetReconstructable(false);
77 delete pVideoContentInfoImpl;
83 VideoContentInfo::Construct(const String* pContentPath)
85 SysAssertf(__pVideoContentInfoImpl == null || __pVideoContentInfoImpl->IsReconstructable(),
86 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
90 _VideoContentInfoImpl* pVideoContentInfoImpl = new (std::nothrow) _VideoContentInfoImpl();
91 SysTryReturnResult(NID_CNT, pVideoContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
93 r = pVideoContentInfoImpl->Construct(pContentPath);
94 SysTryCatch(NID_CNT, r == E_SUCCESS || r == E_FILE_NOT_FOUND, , r, "[%s] Propagating.", GetErrorMessage(r));
96 _ContentInfoHelper::SetContentInfoImpl(this, pVideoContentInfoImpl);
98 delete __pVideoContentInfoImpl;
99 __pVideoContentInfoImpl = pVideoContentInfoImpl;
101 if (r == E_FILE_NOT_FOUND)
103 __pVideoContentInfoImpl->SetReconstructable(true);
107 __pVideoContentInfoImpl->SetReconstructable(false);
113 delete pVideoContentInfoImpl;
119 VideoContentInfo::GetGenre(void) const
121 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
123 return __pVideoContentInfoImpl->GetGenre();
127 VideoContentInfo::GetArtist(void) const
129 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
131 return __pVideoContentInfoImpl->GetArtist();
135 VideoContentInfo::GetBitrate(void) const
137 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
139 return __pVideoContentInfoImpl->GetBitrate();
143 VideoContentInfo::GetAudioBitrate(void) const
145 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
147 return __pVideoContentInfoImpl->GetAudioBitrate();
151 VideoContentInfo::GetVideoBitrate(void) const
153 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
155 return __pVideoContentInfoImpl->GetVideoBitrate();
159 VideoContentInfo::GetFramerate(void) const
161 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
163 return __pVideoContentInfoImpl->GetFramerate();
167 VideoContentInfo::GetWidth(void) const
169 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
171 return __pVideoContentInfoImpl->GetWidth();
175 VideoContentInfo::GetHeight(void) const
177 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
179 return __pVideoContentInfoImpl->GetHeight();
183 VideoContentInfo::GetTitle(void) const
185 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
187 return __pVideoContentInfoImpl->GetTitle();
191 VideoContentInfo::GetAlbumName(void) const
193 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
195 return __pVideoContentInfoImpl->GetAlbumName();
199 VideoContentInfo::GetDuration(void) const
201 SysAssertf(__pVideoContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
203 return __pVideoContentInfoImpl->GetDuration();