2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <FBaseColArrayListT.h>
19 #include <FMediaVideoDecoder.h>
20 #include <FBaseSysLog.h>
21 #include "FMedia_VideoDecoderImpl.h"
23 using namespace Tizen::Base;
24 using namespace Tizen::Base::Collection;
27 namespace Tizen { namespace Media
30 VideoDecoder::VideoDecoder(void)
35 VideoDecoder::~VideoDecoder(void)
44 VideoDecoder::Construct(CodecType type, const Tizen::Base::Collection::HashMap* pOption)
48 SysAssertf(__pImpl == null,
49 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
50 _VideoDecoderImpl* pVideoDecoderImpl = new (std::nothrow) _VideoDecoderImpl();
51 SysTryCatch(NID_MEDIA, pVideoDecoderImpl != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
52 "[E_OUT_OF_MEMORY] Construct Failed ");
53 r = pVideoDecoderImpl->Construct(type, pOption);
54 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagated", GetErrorMessage(r));
55 __pImpl = pVideoDecoderImpl;
58 if (pVideoDecoderImpl != null)
60 delete pVideoDecoderImpl;
61 pVideoDecoderImpl = null;
67 VideoDecoder::Probe(const Tizen::Base::ByteBuffer& srcBuf,
68 int& width, int& height, MediaPixelFormat& pixelFormat)
70 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
71 return __pImpl->Probe(srcBuf, width, height, pixelFormat);
75 VideoDecoder::Decode(Tizen::Base::ByteBuffer& srcBuf, Tizen::Base::ByteBuffer& dstBuf, bool& gotFrame)
79 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
80 r = __pImpl->Decode(srcBuf, dstBuf, gotFrame);
85 VideoDecoder::Reset(void)
88 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
94 VideoDecoder::GetValue(MediaPropertyType key, int& value) const
97 SysTryReturnResult(NID_MEDIA, __pImpl, E_INVALID_STATE, "not constructed");
98 r = __pImpl->GetValue(key, value);
103 VideoDecoder::GetValue(MediaPropertyType key, float& value) const
105 result r = E_SUCCESS;
107 SysTryReturnResult(NID_MEDIA, __pImpl, E_INVALID_STATE, "not constructed");
108 r = __pImpl->GetValue(key, value);
113 Tizen::Base::Collection::IListT<MediaPropertyType>*
114 VideoDecoder::GetSupportedPropertyListN(void) const
116 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
117 return __pImpl->GetSupportedPropertyListN();
122 VideoDecoder::IsPropertySupported(MediaPropertyType key) const
124 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
125 return __pImpl->IsPropertySupported(key);
129 Tizen::Base::Collection::IListT<CodecType>*
130 VideoDecoder::GetSupportedCodecListN(void)
132 result r = E_SUCCESS;
133 Tizen::Base::Collection::IListT<CodecType> *pList = null;
135 pList = _VideoDecoderImpl::GetSupportedCodecListN();
137 SysTryReturn(NID_MEDIA, pList != null, null, r, "[%s] Propagating", GetErrorMessage(r));
139 SetLastResult(E_SUCCESS);