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 <FMediaVideoEncoder.h>
20 #include <FBaseSysLog.h>
21 #include "FMedia_VideoEncoderImpl.h"
23 using namespace Tizen::Base;
24 using namespace Tizen::Base::Collection;
27 namespace Tizen { namespace Media
30 VideoEncoder::VideoEncoder(void)
35 VideoEncoder::~VideoEncoder(void)
44 VideoEncoder::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 _VideoEncoderImpl* pVideoEncoderImpl = new (std::nothrow) _VideoEncoderImpl();
51 SysTryCatch(NID_MEDIA, pVideoEncoderImpl != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
52 "[%s] Memory Allocation Failed ", GetErrorMessage(E_OUT_OF_MEMORY));
\r
53 r = pVideoEncoderImpl->Construct(type, pOption);
54 SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Failed to construct _VideoEncoderImpl", GetErrorMessage(r));
\r
55 __pImpl = pVideoEncoderImpl;
59 if (pVideoEncoderImpl != null)
61 delete pVideoEncoderImpl;
62 pVideoEncoderImpl = null;
68 VideoEncoder::Encode(Tizen::Base::ByteBuffer& srcBuf, Tizen::Base::ByteBuffer& dstBuf)
72 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
73 r = __pImpl->Encode(srcBuf, dstBuf);
79 VideoEncoder::Reset(void)
83 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
90 VideoEncoder::SetValue(MediaPropertyType key, int value)
94 SysTryReturnResult(NID_MEDIA, __pImpl, E_INVALID_STATE, "not constructed");
95 r = __pImpl->SetValue(key, value);
102 VideoEncoder::SetValue(MediaPropertyType key, bool value)
104 result r = E_SUCCESS;
106 SysTryReturnResult(NID_MEDIA, __pImpl, E_INVALID_STATE, "not constructed");
107 r = __pImpl->SetValue(key, value);
113 Tizen::Base::Collection::IListT<MediaPropertyType>*
114 VideoEncoder::GetSupportedPropertyListN(void) const
116 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
117 return __pImpl->GetSupportedPropertyListN();
122 VideoEncoder::IsPropertySupported(MediaPropertyType key) const
124 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
125 return __pImpl->IsPropertySupported(key);
128 Tizen::Base::Collection::IListT<CodecType>*
129 VideoEncoder::GetSupportedCodecListN(void)
131 result r = E_SUCCESS;
132 Tizen::Base::Collection::IListT<CodecType> *pList = null;
134 pList = _VideoEncoderImpl::GetSupportedCodecListN();
136 SysTryReturn(NID_MEDIA, pList != null, null, r, "[%s] Propagating", GetErrorMessage(r));
138 SetLastResult(E_SUCCESS);