* @brief This file contains the implementation of the %AudioRecorder class.
*/
+#include <unique_ptr.h>
#include <FMediaAudioRecorder.h>
#include <FBaseSysLog.h>
#include <FSec_AccessController.h>
#include "FMedia_RecorderTypes.h"
#include "FMedia_AudioRecorderImpl.h"
+#include "FMedia_CamPtrUtil.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
SysAssertf(__pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
result r = E_SUCCESS;
- //Create impl
- _AudioRecorderImpl* pImpl = new (std::nothrow) _AudioRecorderImpl();
- SysTryCatch(NID_MEDIA, pImpl != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ std::unique_ptr <_AudioRecorderImpl> pImpl (new (std::nothrow) _AudioRecorderImpl());
+ SysTryReturn(NID_MEDIA, pImpl.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = pImpl->Construct(listener);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- __pImpl = pImpl;
- return r;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-CATCH:
- if (pImpl != null)
- {
- delete pImpl;
- pImpl = null;
- }
+ __pImpl = pImpl.release();
return r;
}
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- ArrayListT <CodecType>* pDestListT = null;
ClearLastResult();
- pDestListT = __pImpl->GetSupportedCodecListN();
+ std::unique_ptr <IListT<CodecType>, _ListPtrUtil::Remover> pDestListT (__pImpl->GetSupportedCodecListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- return pDestListT;
-
-CATCH:
- if (pDestListT != null)
- {
- pDestListT->RemoveAll();
- delete pDestListT;
- }
-
- return null;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ return pDestListT.release();
}
Tizen::Base::Collection::IListT <MediaContainerType>*
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- ArrayListT <MediaContainerType>* pDestListT = null;
ClearLastResult();
- pDestListT = __pImpl->GetSupportedContainerListN();
+ std::unique_ptr <IListT<MediaContainerType>, _ListPtrUtil::Remover> pDestListT (__pImpl->GetSupportedContainerListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- return pDestListT;
-
-CATCH:
- if (pDestListT != null)
- {
- pDestListT->RemoveAll();
- delete pDestListT;
- }
-
- return null;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ return pDestListT.release();
}
result
Camera::Construct(ICameraEventListener& listener, CameraSelection camSel)
{
SysAssertf(__pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
-
result r = E_SUCCESS;
- // Create impl
- _CameraImpl* pImpl = new (std::nothrow) _CameraImpl();
- SysTryCatch(NID_MEDIA, pImpl !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ std::unique_ptr <_CameraImpl> pImpl (new (std::nothrow) _CameraImpl());
+ SysTryReturn(NID_MEDIA, pImpl.get() !=null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = pImpl->Construct(listener, camSel);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- __pImpl = pImpl;
- return r;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-CATCH:
- if (pImpl != null)
- {
- delete pImpl;
- pImpl = null;
- }
+ __pImpl = pImpl.release();
return r;
}
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- IList* pList = null;
ClearLastResult();
- pList = __pImpl->GetSupportedPreviewResolutionListN();
+ std::unique_ptr <IList, _ListPtrUtil::Remover> pList (__pImpl->GetSupportedPreviewResolutionListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- return pList;
-
-CATCH:
- if (pList != null)
- {
- pList->RemoveAll(true);
- delete pList;
- }
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return null;
+ return pList.release();
}
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- IList* pList = null;
ClearLastResult();
- pList = __pImpl->GetSupportedCaptureResolutionListN();
+ std::unique_ptr <IList, _ListPtrUtil::Remover> pList (__pImpl->GetSupportedCaptureResolutionListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- return pList;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
-CATCH:
- if (pList != null)
- {
- pList->RemoveAll(true);
- delete pList;
- }
-
- return null;
+ return pList.release();
}
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- IListT <PixelFormat>* pListT = null;
ClearLastResult();
- pListT = __pImpl->GetSupportedCaptureFormatListN();
+ std::unique_ptr <IListT<PixelFormat>, _ListPtrUtil::Remover> pListT (__pImpl->GetSupportedCaptureFormatListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- return pListT;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
-CATCH:
- if (pListT != null)
- {
- pListT->RemoveAll();
- delete pListT;
- }
-
- return null;
+ return pListT.release();
}
result
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- IListT <PixelFormat>* pListT = null;
ClearLastResult();
- pListT = __pImpl->GetSupportedPreviewFormatListN();
+ std::unique_ptr <IListT<PixelFormat>, _ListPtrUtil::Remover> pListT (__pImpl->GetSupportedPreviewFormatListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- return pListT;
-
-CATCH:
- if (pListT != null)
- {
- pListT->RemoveAll();
- delete pListT;
- }
-
- return null;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ return pListT.release();
}
result
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- IListT <int>* pListT = null;
ClearLastResult();
- pListT = __pImpl->GetSupportedPreviewFrameRateListN();
+ std::unique_ptr <IListT<int>, _ListPtrUtil::Remover> pListT (__pImpl->GetSupportedPreviewFrameRateListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return pListT;
-
-CATCH:
- if (pListT != null)
- {
- pListT->RemoveAll();
- delete pListT;
- }
-
- return null;
+ return pListT.release();
}
Tizen::Base::Collection::IListT <int>*
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- IListT <int>* pListT = null;
ClearLastResult();
- pListT = __pImpl->GetSupportedPreviewFrameRateListN(dim);
+ std::unique_ptr <IListT<int>, _ListPtrUtil::Remover> pListT (__pImpl->GetSupportedPreviewFrameRateListN(dim), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return pListT;
-
-CATCH:
- if (pListT != null)
- {
- pListT->RemoveAll();
- delete pListT;
- }
-
- return null;
+ return pListT.release();
}
#include <FMediaCameraTypes.h>
#include <FBaseSysLog.h>
#include "FMedia_CapabilityImpl.h"
+#include "FMedia_CamPtrUtil.h"
using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
namespace Tizen { namespace Media
{
MediaCapability::GetValueN(const Tizen::Base::String& key)
{
result r = E_SUCCESS;
- Tizen::Base::Collection::ArrayList* pList = null;
ClearLastResult();
_CapabilityImpl* pImpl = _CapabilityImpl::GetInstance();
- SysTryCatch(NID_MEDIA, pImpl != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
+ SysTryReturn(NID_MEDIA, pImpl != null, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Internal object is not found.");
- pList = new (std::nothrow) Tizen::Base::Collection::ArrayList();
- SysTryCatch(NID_MEDIA, pList !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ std::unique_ptr <ArrayList, _ListPtrUtil::Remover> pList (new (std::nothrow) Tizen::Base::Collection::ArrayList(), _ListPtrUtil::remover);
+ SysTryReturn(NID_MEDIA, pList.get() !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = pList->Construct();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
r = pImpl->GetValueN(key, *pList);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- return pList;
-
-CATCH:
- if (pList != null)
- {
- delete pList;
- }
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return null;
+ return pList.release();
}
#include <FBaseSysLog.h>
#include <FSec_AccessController.h>
#include "FMedia_VideoRecorderImpl.h"
+#include "FMedia_CamPtrUtil.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
if (__pImpl != null)
{
delete __pImpl;
- __pImpl = null;
}
}
SysAssertf(__pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
result r = E_SUCCESS;
- _VideoRecorderImpl* pImpl = new (std::nothrow) _VideoRecorderImpl();
- SysTryCatch(NID_MEDIA, pImpl != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ std::unique_ptr <_VideoRecorderImpl> pImpl (new (std::nothrow) _VideoRecorderImpl());
+ SysTryReturn(NID_MEDIA, pImpl.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = pImpl->Construct(listener, camera);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- __pImpl = pImpl;
- return r;
-
-CATCH:
- if (pImpl != null)
- {
- delete pImpl;
- pImpl = null;
- }
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ __pImpl = pImpl.release();
return r;
}
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- Tizen::Base::Collection::IList* pCodecList = null;
ClearLastResult();
- pCodecList = __pImpl->GetSupportedCodecListN();
+ std::unique_ptr <IList, _ListPtrUtil::Remover> pCodecList (__pImpl->GetSupportedCodecListN(), _ListPtrUtil::remover);
+ SysTryReturn(NID_MEDIA, pCodecList.get() != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
-
- return pCodecList;
-
-CATCH:
- if (pCodecList != null)
- {
- pCodecList->RemoveAll(true);
- delete pCodecList;
- }
-
- return null;
+ return pCodecList.release();
}
result
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- ArrayListT <CodecType>* pDestList = null;
ClearLastResult();
- pDestList = __pImpl->GetSupportedAudioCodecListN();
+ std::unique_ptr <IListT<CodecType>, _ListPtrUtil::Remover> pDestList (__pImpl->GetSupportedAudioCodecListN());
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return pDestList;
-
-CATCH:
- if (pDestList != null)
- {
- pDestList->RemoveAll();
- delete pDestList;
- }
- return null;
+ return pDestList.release();
}
Tizen::Base::Collection::IListT <CodecType>*
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- ArrayListT <CodecType>* pDestList = null;
ClearLastResult();
- pDestList = __pImpl->GetSupportedVideoCodecListN();
+ std::unique_ptr <IListT<CodecType>, _ListPtrUtil::Remover> pDestList (__pImpl->GetSupportedVideoCodecListN());
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return pDestList;
-
-CATCH:
- if (pDestList != null)
- {
- pDestList->RemoveAll();
- delete pDestList;
- }
- return null;
+ return pDestList.release();
}
Tizen::Base::Collection::IListT <MediaContainerType>*
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- ArrayListT <MediaContainerType>* pDestList = null;
ClearLastResult();
- pDestList = __pImpl->GetSupportedContainerListN();
+ std::unique_ptr <IListT<MediaContainerType>, _ListPtrUtil::Remover> pDestList (__pImpl->GetSupportedContainerListN());
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return pDestList;
-
-CATCH:
- if (pDestList != null)
- {
- pDestList->RemoveAll();
- delete pDestList;
- }
- return null;
+ return pDestList.release();
}
result
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
result r = E_SUCCESS;
- Tizen::Base::Collection::IList* pResolutionList = null;
ClearLastResult();
- pResolutionList = __pImpl->GetSupportedRecordingResolutionListN();
+ std::unique_ptr <IList, _ListPtrUtil::Remover> pResolutionList (__pImpl->GetSupportedRecordingResolutionListN(), _ListPtrUtil::remover);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return pResolutionList;
-
-CATCH:
- if (pResolutionList != null)
- {
- pResolutionList->RemoveAll(true);
- delete pResolutionList;
- }
- return null;
+ return pResolutionList.release();
}
int
_AudioRecorderEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
{
IAudioRecorderEventListener* pAudioRecorderEventListener = dynamic_cast <IAudioRecorderEventListener*>(&listener);
- SysTryReturn(NID_MEDIA, pAudioRecorderEventListener != null, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Listener is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pAudioRecorderEventListener != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Listener is null.");
Tizen::Base::Runtime::IEventArg* pTtempArg = const_cast <Tizen::Base::Runtime::IEventArg*>(&arg);
_RecorderEventArg* pArg = dynamic_cast <_RecorderEventArg*>(pTtempArg);
- SysTryReturn(NID_MEDIA, pArg != null, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. EventArg is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pArg != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. EventArg is null.");
switch (pArg->GetEventType())
{
__handle = MM_INVALID_HANDLE;
}
- if (__pAudioRecorderEvent != null)
- {
- delete __pAudioRecorderEvent;
- }
-
if (__pRecorderManager != null)
{
_RecorderManager::Release(_RECORDER_DEVICE_AUDIO);
SysTryReturn(NID_MEDIA, !__isConstructed, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] AudioRecorder is in an invalid state. A device is already constructed.");
//Create Event
- __pAudioRecorderEvent = new (std::nothrow) _AudioRecorderEvent();
- SysTryReturn(NID_MEDIA, __pAudioRecorderEvent !=null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ __pAudioRecorderEvent.reset(new (std::nothrow) _AudioRecorderEvent());
+ SysTryReturn(NID_MEDIA, __pAudioRecorderEvent.get() !=null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = __pAudioRecorderEvent->Construct(*this);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
__pAudioRecorderEventListener = null;
}
- if (__pAudioRecorderEvent != null)
- {
- delete __pAudioRecorderEvent;
- __pAudioRecorderEvent = null;
- }
+ __pAudioRecorderEvent.reset(null);
return r;
}
_AudioRecorderEvent*
_AudioRecorderImpl::GetEvent(void) const
{
- return __pAudioRecorderEvent;
+ return __pAudioRecorderEvent.get();
}
void
_AudioRecorderImpl* pObj = static_cast<_AudioRecorderImpl*>( pUserData);
int tableTotalCount = 0;
int i = 0;
- SysTryReturn(NID_MEDIA, _AudioRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pObj != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _AudioRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
SysLog(NID_MEDIA, "State previous:%d, current:%d, byPolicy:%d", previous, current, byPolicy);
tableTotalCount = sizeof(_AUDIO_CALLBACK_EVENT) / sizeof(_AUDIO_CALLBACK_EVENT[0]);
if (previous == _AUDIO_CALLBACK_EVENT[i].prevState && current == _AUDIO_CALLBACK_EVENT[i].postState && pObj->GetStateChangeReason() == _AUDIO_CALLBACK_EVENT[i].reason)
{
r = pObj->GetEvent()->SendEvent(_AUDIO_CALLBACK_EVENT[i].event, _AUDIO_CALLBACK_EVENT[i].error, E_SUCCESS);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. i:%d", GetErrorMessage(r), i);
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating. i:%d", GetErrorMessage(r), i);
break;
}
}
- SysTryReturn(NID_MEDIA, i != tableTotalCount, , E_INVALID_STATE, "[E_INVALID_STATE] Not found. ");
+ SysTryReturnVoidResult(NID_MEDIA, i != tableTotalCount, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Not found. ");
}
void
_AudioRecorderImpl::RecordingStatusCb(unsigned long long elapsedTime, unsigned long long fileSize, void *pUserData)
{
_AudioRecorderImpl* pObj = static_cast<_AudioRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _AudioRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pObj != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _AudioRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
SysLog(NID_MEDIA, " FileSize:%llu,elapsedTime:%llu",fileSize,elapsedTime);
{
_AudioRecorderImpl* pObj = static_cast<_AudioRecorderImpl*>(pUserData);
int samplingRate =0;
- SysTryReturn(NID_MEDIA, _AudioRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pObj != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
- SysTryReturn(NID_MEDIA, pStream != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. Stream data is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _AudioRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pStream != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. Stream data is null.");
if (pObj->__audioStreamCallback == true)
{
{
result r = E_SUCCESS;
_AudioRecorderImpl* pObj = static_cast<_AudioRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, pObj != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
- SysTryReturn(NID_MEDIA, _AudioRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _AudioRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
SysLog(NID_MEDIA, "Type:%d", type);
{
result r = E_SUCCESS;
_AudioRecorderImpl* pObj = static_cast<_AudioRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _AudioRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pObj != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _AudioRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
SysLog(NID_MEDIA, "Error:%d, state:%d", error, state);
r = pObj->GetEvent()->SendEvent(_RECORDER_EVENT_ERROR, RECORDER_ERROR_DEVICE_FAILED, E_SUCCESS);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
return;
}
_AudioRecorderImpl::InterruptedCb(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *pUserData)
{
_AudioRecorderImpl* pObj = static_cast<_AudioRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _AudioRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pObj != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] pObj _AudioRecorderImpl is not available. pObj is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _AudioRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] pObj _AudioRecorderImpl is not available. pObj is null.");
SysLog(NID_MEDIA, "Policy:%d, previous:%d, current:%d", policy, previous, current);
}
_AudioRecorderImpl(const _AudioRecorderImpl&);
_AudioRecorderImpl& operator =(const _AudioRecorderImpl& _AudioRecorderImpl);
- _AudioRecorderEvent* __pAudioRecorderEvent;
+ std::unique_ptr <_AudioRecorderEvent> __pAudioRecorderEvent;
IAudioRecorderEventListener* __pAudioRecorderEventListener;
_RecorderManager* __pRecorderManager;
bool __isConstructed;
#include <camera.h>
#include <FBaseColIList.h>
#include <FBaseColIListT.h>
+#include <FBaseColLinkedListT.h>
#include <FBaseColQueue.h>
#include <FGrpPixelFormat.h>
#include <FMediaTypes.h>
#include <FMediaIAudioStreamFilter.h>
#include <FMediaIVideoStreamFilter.h>
#include "FMedia_CameraTypes.h"
+#include "FMedia_ICameraCoordinatorListener.h"
namespace Tizen { namespace Media
{
}
}
+ void operator() (Tizen::Base::Collection::LinkedListT <_ICameraCoordinatorListener*>* pList) const
+ {
+ if (pList != null)
+ {
+ pList->RemoveAll();
+ delete pList;
+ }
+ }
+
void operator() (Tizen::Base::Collection::Queue* pQueue) const
{
if (pQueue != null)
result r = E_SUCCESS;
std::unique_ptr<IListT<_CameraDeviceType>, _ListPtrUtil::Remover> pList (GetKeysN(), _ListPtrUtil::remover);
- SysTryReturn(NID_MEDIA, pList.get() != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
+ SysTryReturnVoidResult(NID_MEDIA, pList.get() != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
for (int i = 0; i < GetCount(); i++)
{
{
pthread_once(&once_block, InitSafeHashMapInst);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, __pMap != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, __pMap != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
}
r = __pMap->ContainsKey(cameraDevice, out);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
if (out)
{
r = __pMap->GetValue(cameraDevice, pCapability);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS && pCapability != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS && pCapability != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
}
else
{
- pCapability = new (std::nothrow) _CameraCapability();
- SysTryCatch(NID_MEDIA, pCapability !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ std::unique_ptr <_CameraCapability> pCap (new (std::nothrow) _CameraCapability());
+ SysTryReturn(NID_MEDIA, pCap.get() !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ r = pCap->Construct(cameraDevice);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- r = pCapability->Construct(cameraDevice);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = __pMap->Add(cameraDevice, pCap.get());
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- r = __pMap->Add(cameraDevice, pCapability);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ pCapability = pCap.release();
}
pCapability->AddRefCount();
return pCapability;
-
-CATCH:
- if (pCapability != null)
- {
- delete pCapability;
- }
- return null;
}
void
{
_CameraCapability* pCameraCapability = null;
r = __pMap->GetValue(cameraDevice, pCameraCapability);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
if (pCameraCapability->ReleaseRefCount() == 0)
{
delete pCameraCapability;
r = __pMap->Remove(cameraDevice);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
}
}
static Tizen::Base::Object* GetValueN(_CameraOperationType key, _QueryType queryType, _ResultType& itemType);
/**
+ * The destructor.
+ * Resources are deallocated by this method.
+ */
+ virtual ~_CameraCapability(void);
+
+ /**
* Gets the device selection.
*
* @return The device selection
_CameraCapability(void);
/**
- * The destructor.
- * Resources are deallocated by this method.
- */
- ~_CameraCapability(void);
-
- /**
* Initializes this instance of _CamcorderCoordinator.
*
* @return An error code
void
_CameraCoordinatorSafeHashMapT::RemoveItems(void)
{
- IListT <_CameraDeviceType>* pList = null;
_CameraCoordinator* pCoordinator = null;
result r = E_SUCCESS;
- pList = GetKeysN();
- SysTryReturn(NID_MEDIA, pList != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
+ std::unique_ptr <IListT <_CameraDeviceType>, _ListPtrUtil::Remover> pList (GetKeysN(), _ListPtrUtil::remover);
+ SysTryReturnVoidResult(NID_MEDIA, pList.get() != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
for (int i = 0; i < GetCount(); i++)
{
_CameraDeviceType deviceType = _CAMERA_DEVICE_NONE;
}
delete pCoordinator;
}
- pList->RemoveAll();
- delete pList;
- RemoveAll();
}
_CameraCoordinator::_CameraCoordinator()
, __cameraHandle(MM_INVALID_HANDLE)
, __recorderHandle(MM_INVALID_HANDLE)
, __mode(_CAMERA_MODE_NONE)
- , __pListenerList(null)
+ , __pListenerList(null, _ListPtrUtil::remover)
, __orientationFlag(0)
, __cameraOrientation(CAMERA_EXIF_ORIENTATION_TOP_LEFT)
, __recordingRotation(RECORDING_ROTATION_NONE)
_CameraCoordinator::~_CameraCoordinator()
{
- if (__pListenerList != null)
- {
- __pListenerList->RemoveAll();
- delete __pListenerList;
- }
-
_CameraManager::Release(__cameraDevice);
SysLog(NID_MEDIA, "Camera manager released");
}
__cameraHandle = pCameraManager->GetHandle();
- __pListenerList = new (std::nothrow) LinkedListT <_ICameraCoordinatorListener*>();
- SysTryCatch(NID_MEDIA, __pListenerList !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ __pListenerList.reset(new (std::nothrow) LinkedListT <_ICameraCoordinatorListener*>());
+ SysTryReturn(NID_MEDIA, __pListenerList.get() !=null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
__cameraDevice = cameraDevice;
__mode = _CAMERA_MODE_IMAGE;
return r;
-
-CATCH:
- return r;
}
result
if (!isMapConstructed)
{
r = map.Construct();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
isMapConstructed = true;
__pMap = ↦
}
r = map.ContainsKey(cameraDevice, out);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
if (out)
{
r = map.GetValue(cameraDevice, pCoordinator);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS && pCoordinator != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS && pCoordinator != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
}
else
{
- pCoordinator = new (std::nothrow) _CameraCoordinator();
- SysTryCatch(NID_MEDIA, pCoordinator !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ std::unique_ptr <_CameraCoordinator> pCoord (new (std::nothrow) _CameraCoordinator());
+ SysTryReturn(NID_MEDIA, pCoord.get() !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
- r = pCoordinator->Construct(cameraDevice);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pCoord->Construct(cameraDevice);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- r = map.Add(cameraDevice, pCoordinator);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = map.Add(cameraDevice, pCoord.get());
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pCoordinator = pCoord.release();
}
pCoordinator->AddRefCount();
return pCoordinator;
-
-CATCH:
- if (pCoordinator != null)
- {
- delete pCoordinator;
- }
- return null;
}
_CameraCoordinator*
{
_CameraCoordinator* pCoordinator = null;
r = __pMap->GetValue(cameraDevice, pCoordinator);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
if (pCoordinator->ReleaseRefCount() == 0)
{
delete pCoordinator;
r = __pMap->Remove(cameraDevice);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
}
}
_CameraCoordinator::NotifyModeChangePrepared(_CameraMode mode)
{
result r = E_SUCCESS;
- IEnumeratorT <_ICameraCoordinatorListener*>* pEnum = null;
_ICameraCoordinatorListener* pListener = null;
SysLog(NID_MEDIA, "mode:%d", mode);
- pEnum = __pListenerList->GetEnumeratorN();
- r = GetLastResult();
- SysTryCatch(NID_MEDIA, pEnum != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ std::unique_ptr <IEnumeratorT <_ICameraCoordinatorListener*> > pEnum (__pListenerList->GetEnumeratorN());
+ SysTryReturn(NID_MEDIA, pEnum.get() != null, GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
while (pEnum->MoveNext() == E_SUCCESS)
{
r = pEnum->GetCurrent(pListener);
- SysTryCatch(NID_MEDIA, pListener != null && r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM,
+ SysTryReturn(NID_MEDIA, pListener != null && r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
"[E_SYSTEM] A system error has been occurred. The listener is not proper");
r = pListener->OnCameraCoordinatorModeChangePrepared(mode);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- }
-
- delete pEnum;
- return r;
-
-CATCH:
- if (pEnum != null)
- {
- delete pEnum;
- pEnum = null;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
return r;
}
_CameraCoordinator::NotifyModeChanged(_CameraMode mode)
{
result r = E_SUCCESS;
- IEnumeratorT <_ICameraCoordinatorListener*>* pEnum = null;
_ICameraCoordinatorListener* pListener = null;
SysLog(NID_MEDIA, "mode:%d", mode);
- pEnum = __pListenerList->GetEnumeratorN();
- r = GetLastResult();
- SysTryCatch(NID_MEDIA, pEnum != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ std::unique_ptr <IEnumeratorT <_ICameraCoordinatorListener*> > pEnum (__pListenerList->GetEnumeratorN());
+ SysTryReturn(NID_MEDIA, pEnum.get() != null, GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
while (pEnum->MoveNext() == E_SUCCESS)
{
r = pEnum->GetCurrent(pListener);
- SysTryCatch(NID_MEDIA, pListener != null && r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM,
+ SysTryReturn(NID_MEDIA, pListener != null && r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
"[E_SYSTEM] A system error has been occurred. The listener is not proper");
r = pListener->OnCameraCoordinatorModeChanged(mode);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- }
-
- delete pEnum;
- return r;
-
-CATCH:
- if (pEnum != null)
- {
- delete pEnum;
- pEnum = null;
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
return r;
}
#ifndef _FMEDIA_INTERNAL_CAMERA_COORDINATOR_H_
#define _FMEDIA_INTERNAL_CAMERA_COORDINATOR_H_
+#include <unique_ptr.h>
#include <camera.h>
#include <recorder.h>
#include <FBaseColLinkedListT.h>
#include "FMedia_CameraTypes.h"
#include "FMedia_RecorderTypes.h"
#include "FMedia_CameraRefHelper.h"
+#include "FMedia_CamPtrUtil.h"
namespace Tizen { namespace Media
{
static _CameraCoordinator* HasInstance(_RecorderDeviceType recorderDevice);
/**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method. This method should be called in the same thread
+ * where the Construct() method is called.
+ *
+ * @see Construct()
+ */
+ virtual ~_CameraCoordinator(void);
+
+ /**
* Adds the listener to this object. @n
* Added listeners are called after this object's callbacks are called from the camera.
*
_CameraCoordinator(void);
/**
- * This is the destructor for this class. @n
- * All allocated resources are deallocated by this method. This method should be called in the same thread
- * where the Construct() method is called.
- *
- * @see Construct()
- */
- virtual ~_CameraCoordinator(void);
-
- /**
* Initializes this instance of _CameraCoordinator.
*
* @return An error code
_CameraHandle __cameraHandle;
_RecorderHandle __recorderHandle;
_CameraMode __mode;
- Tizen::Base::Collection::LinkedListT <_ICameraCoordinatorListener*>* __pListenerList;
+ std::unique_ptr<Tizen::Base::Collection::LinkedListT <_ICameraCoordinatorListener*>, _ListPtrUtil::Remover> __pListenerList;
int __orientationFlag;
CameraExifOrientation __cameraOrientation;
RecordingRotation __recordingRotation;
}
result
-_CameraEvent::SendEvent(_CameraEventType event, CameraErrorReason err, result res, const ByteBuffer* pByteBuffer)
+_CameraEvent::SendEvent(_CameraEventType event, CameraErrorReason err, result res, ByteBuffer* pByteBuffer)
{
result r = E_SUCCESS;
std::unique_ptr <_CameraEventArg> pCameraEventArg (new (std::nothrow) _CameraEventArg());
_CameraEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
{
ICameraEventListener* pCameraEventListener = dynamic_cast <ICameraEventListener*>(&listener);
- SysTryReturn(NID_MEDIA, pCameraEventListener != null, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Listener is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pCameraEventListener != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Listener is null.");
Tizen::Base::Runtime::IEventArg* pTempArg = const_cast <Tizen::Base::Runtime::IEventArg*>(&arg);
_CameraEventArg* pArg = dynamic_cast <_CameraEventArg*>(pTempArg);
- SysTryReturn(NID_MEDIA, pArg != null, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. EventArg is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pArg != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. EventArg is null.");
result r = E_SUCCESS;
switch (pArg->GetEventType())
case _CAMERA_EVENT_PREVIEWED_DATA:
{
- _CameraBuffer* pBuffer = __pCameraImpl->DequeueDataN(_CAMERA_BUFFER_PREVIEW);
- SysTryReturn(NID_MEDIA, pBuffer != null, , E_INVALID_DATA, "[E_INVALID_DATA] Invalid preview data.");
+ std::unique_ptr <_CameraBuffer> pBuffer (__pCameraImpl->DequeueDataN(_CAMERA_BUFFER_PREVIEW));
+ SysTryReturnVoidResult(NID_MEDIA, pBuffer.get() != null, E_INVALID_DATA, "[E_INVALID_DATA] Invalid preview data.");
MediaPixelFormat mediaSrcFormat = pBuffer->GetPixelFormat();
SysLog(NID_MEDIA, "Preview callback. MM format should be converted from %d to %d", mediaSrcFormat, mediaUserFormat);
r = cvt.Construct(mediaSrcFormat, width, height, mediaUserFormat, width, height);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
convertedBufSize = _ImageUtil::GetBufferSize(mediaUserFormat, width, height);
- SysTryCatch(NID_MEDIA, convertedBufSize > 0, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ SysTryReturnVoidResult(NID_MEDIA, convertedBufSize > 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
r = dstCameraBuffer.Construct(convertedBufSize, _CAMERA_BUFFER_PREVIEW, mediaUserFormat, width, height);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. size:%d", GetErrorMessage(r), convertedBufSize);
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating. size:%d", GetErrorMessage(r), convertedBufSize);
pConvertedBuf = const_cast<byte*>(dstCameraBuffer.GetPointer());
- SysTryCatch(NID_MEDIA, pConvertedBuf != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] byte instance is not available. dstCameraBuffer.GetPointer() is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pConvertedBuf != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] byte instance is not available. dstCameraBuffer.GetPointer() is null.");
r = cvt.Convert(pSrcBuf, pBuffer->GetCapacity(), pConvertedBuf, convertedBufSize);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
pCameraEventListener->OnCameraPreviewed(dstCameraBuffer, pArg->GetResult());
}
else //If the conversion is not needed.
{
SysLog(NID_MEDIA, "Preview callback. Format is %d", mediaSrcFormat);
- pCameraEventListener->OnCameraPreviewed(*pBuffer, pArg->GetResult());
+ pCameraEventListener->OnCameraPreviewed(*pBuffer.get(), pArg->GetResult());
}
-
-CATCH:
- delete pBuffer;
}
break;
* @exception E_INVALID_STATE - This instance is in an invalid state for this method.
* @exception E_INVALID_ARG - The argument passed to a method contains an invalid value.
*/
- result SendEvent(_CameraEventType event, CameraErrorReason err, result res, const Tizen::Base::ByteBuffer* pByteBuffer);
+ result SendEvent(_CameraEventType event, CameraErrorReason err, result res, Tizen::Base::ByteBuffer* pByteBuffer);
protected:
/**
_CameraEventArg::~_CameraEventArg(void)
{
- if (__pCameraData != null)
- {
- delete __pCameraData;
- }
}
void
}
void
-_CameraEventArg::SetData(const Tizen::Base::ByteBuffer* pData)
+_CameraEventArg::SetData(Tizen::Base::ByteBuffer* pData)
{
if (pData != null)
{
- __pCameraData = new (std::nothrow) ByteBuffer();
- SysTryReturn(NID_MEDIA, __pCameraData !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
- __pCameraData->Construct(*pData); //shallow copy
+ __pCameraData.reset(pData);
}
}
Tizen::Base::ByteBuffer*
_CameraEventArg::GetData(void) const
{
- return __pCameraData;
+ return __pCameraData.get();
}
result
#ifndef _FMEDIA_INTERNAL_CAMERA_EVENTARG_H_
#define _FMEDIA_INTERNAL_CAMERA_EVENTARG_H_
+#include <unique_ptr.h>
#include <FBaseByteBuffer.h>
#include <FBaseRtIEventArg.h>
#include <FMediaCameraTypes.h>
/**
* Set the data provided by the Camera
*/
- void SetData(const Tizen::Base::ByteBuffer* data);
+ void SetData(Tizen::Base::ByteBuffer* data);
/**
* Get the result.
_CameraEventType __cameraEventType;
- Tizen::Base::ByteBuffer* __pCameraData;
+ std::unique_ptr <Tizen::Base::ByteBuffer> __pCameraData;
result __result;
CameraErrorReason __error;
};
_CameraImpl::EnqueueData(_CameraBuffer& cameraBuffer)
{
result r = E_SUCCESS;
- _CameraBuffer* pCameraBuffer = null;
_CameraBufferType bufferType = cameraBuffer.GetBufferType();
+ SysTryReturn(NID_MEDIA, cameraBuffer.GetLimit() > 0, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] Propagating. bufferType:%d", GetErrorMessage(r), bufferType);
- SysTryCatch(NID_MEDIA, cameraBuffer.GetLimit() > 0, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] Propagating. bufferType:%d", GetErrorMessage(r), bufferType);
-
- pCameraBuffer = new (std::nothrow) _CameraBuffer();
- SysTryCatch(NID_MEDIA, pCameraBuffer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ std::unique_ptr <_CameraBuffer> pCameraBuffer (new (std::nothrow) _CameraBuffer());
+ SysTryReturn(NID_MEDIA, pCameraBuffer.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = pCameraBuffer->Construct(cameraBuffer);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. bufferType:%d", GetErrorMessage(r), bufferType);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. bufferType:%d", GetErrorMessage(r), bufferType);
switch (bufferType)
{
case _CAMERA_BUFFER_CAPTURE:
- r = __pCaptureBufferQueue->Enqueue(*pCameraBuffer);
+ r = __pCaptureBufferQueue->Enqueue(*pCameraBuffer.get());
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. bufferType:%d", GetErrorMessage(r), bufferType);
break;
case _CAMERA_BUFFER_PREVIEW:
- r = __pPreviewBufferQueue->Enqueue(*pCameraBuffer);
+ r = __pPreviewBufferQueue->Enqueue(*pCameraBuffer.get());
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. bufferType:%d", GetErrorMessage(r), bufferType);
break;
default:
SysLogException(NID_MEDIA, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument(bufferType) is used. bufferType=%d.", bufferType);
break;
}
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. bufferType:%d", GetErrorMessage(r), bufferType);
-
- return r;
-
-CATCH:
- if (pCameraBuffer != null)
- {
- delete pCameraBuffer;
- }
+ pCameraBuffer.release();
return r;
}
_CameraImpl::LoadDefaultConfiguration(int reload)
{
result r = E_SUCCESS;
- Object* pObj = null;
SysLog(NID_MEDIA, "Enter.");
// Preview resolution
Dimension* pDim = null;
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_PREVIEW_RESOLUTION : _COP_SECONDARY_PREVIEW_RESOLUTION);
- pObj = _CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType);
- SysTryCatch(NID_MEDIA, itemType == _RESULT_DIMENSION, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
- pDim = dynamic_cast<Dimension*>(pObj);
- SysTryCatch(NID_MEDIA, pDim != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The item is wrong. preview resolution.");
+ std::unique_ptr <Object> pObj (_CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType));
+ SysTryReturn(NID_MEDIA, itemType == _RESULT_DIMENSION, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
+ pDim = dynamic_cast<Dimension*>(pObj.get());
+ SysTryReturn(NID_MEDIA, pDim != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The preview resolution is wrong.");
__deviceDefaultPreviewResolution = *pDim;
- delete pObj;
- pObj = null;
-
__previewResolution = __deviceDefaultPreviewResolution;
}
Dimension* pDim = null;
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_CAPTURE_RESOLUTION : _COP_SECONDARY_CAPTURE_RESOLUTION);
- pObj = _CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType);
- SysTryCatch(NID_MEDIA, itemType == _RESULT_DIMENSION, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
- pDim = dynamic_cast<Dimension*>(pObj);
- SysTryCatch(NID_MEDIA, pDim != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The item is wrong. capture resolution.");
+ std::unique_ptr <Object> pObj (_CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType));
+ SysTryReturn(NID_MEDIA, itemType == _RESULT_DIMENSION, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
+ pDim = dynamic_cast<Dimension*>(pObj.get());
+ SysTryReturn(NID_MEDIA, pDim != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The capture resolution is wrong.");
__deviceDefaultCaptureResolution = *pDim;
- delete pObj;
- pObj = null;
-
__captureResolution = __deviceDefaultCaptureResolution;
}
Integer *pInteger = null;
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_PREVIEW_FORMAT : _COP_SECONDARY_PREVIEW_FORMAT);
- pObj = _CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType);
- SysTryCatch(NID_MEDIA, itemType == _RESULT_INTEGER, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
- pInteger = dynamic_cast<Integer*>(pObj);
- SysTryCatch(NID_MEDIA, pInteger != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The item is wrong. preview format.");
+ std::unique_ptr <Object> pObj (_CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType));
+ SysTryReturn(NID_MEDIA, itemType == _RESULT_INTEGER, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
+ pInteger = dynamic_cast<Integer*>(pObj.get());
+ SysTryReturn(NID_MEDIA, pInteger != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The preview format is wrong.");
__deviceDefaultPreviewFormat = (Tizen::Graphics::PixelFormat)pInteger->ToInt();
- delete pObj;
- pObj = null;
-
__previewFormat = __deviceDefaultPreviewFormat;
}
Integer *pInteger = null;
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_CAPTURE_FORMAT : _COP_SECONDARY_CAPTURE_FORMAT);
- pObj = _CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType);
- SysTryCatch(NID_MEDIA, itemType == _RESULT_INTEGER, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
- pInteger = dynamic_cast<Integer*>(pObj);
- SysTryCatch(NID_MEDIA, pInteger != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The item is wrong. capture format.");
+ std::unique_ptr <Object> pObj (_CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType));
+ SysTryReturn(NID_MEDIA, itemType == _RESULT_INTEGER, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
+ pInteger = dynamic_cast<Integer*>(pObj.get());
+ SysTryReturn(NID_MEDIA, pInteger != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The capture format is wrong.");
__deviceDefaultCaptureFormat = (Tizen::Graphics::PixelFormat)pInteger->ToInt();
- delete pObj;
- pObj = null;
-
__captureFormat = __deviceDefaultCaptureFormat;
}
Integer *pInteger = null;
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_ZERO_SHUTTER_LAG: _COP_SECONDARY_ZERO_SHUTTER_LAG);
- pObj = _CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType);
- SysTryCatch(NID_MEDIA, itemType == _RESULT_INTEGER, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The type is wrong. itemType:%d", itemType);
- pInteger = dynamic_cast<Integer*>(pObj);
- SysTryCatch(NID_MEDIA, pInteger != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The item is wrong. Zero shutter lag.");
+ std::unique_ptr <Object> pObj (_CameraCapability::GetValueN(operation, _QUERY_DEFAULT_VALUE, itemType));
+ SysTryReturn(NID_MEDIA, itemType == _RESULT_INTEGER, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The type is wrong. itemType:%d", itemType);
+ pInteger = dynamic_cast<Integer*>(pObj.get());
+ SysTryReturn(NID_MEDIA, pInteger != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The zero shutter lag value is wrong.");
__zeroShutterLag = (bool)pInteger->ToInt();
- delete pObj;
- pObj = null;
}
//Metering mode
}
return r;
-
-CATCH:
- if (pObj != null)
- {
- delete pObj;
- }
- return r;
}
result
_CameraImpl::StateChangedCb(camera_state_e previous, camera_state_e current, bool byPolicy, void *pUserData)
{
_CameraImpl* pImpl = static_cast<_CameraImpl*>( pUserData);
- SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[%s] _CameraImpl instance is not available.", GetErrorMessage(E_OBJ_NOT_FOUND));
+ SysTryReturnVoidResult(NID_MEDIA, _CameraImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[%s] _CameraImpl instance is not available.", GetErrorMessage(E_OBJ_NOT_FOUND));
SysLog(NID_MEDIA, "State previous:%d, current:%d, byPolicy:%d", previous, current, byPolicy);
}
_CameraImpl* pImpl = static_cast<_CameraImpl*>(pUserData);
MediaPixelFormat format = MEDIA_PIXEL_FORMAT_NONE;
double ratio = 0.0;
- SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl is null.");
- SysTryReturn(NID_MEDIA, pImpl->GetState() == CAMERA_STATE_CAPTURING, , E_INVALID_STATE, "[E_INVALID_STATE] The camera is already capturing");
+ SysTryReturnVoidResult(NID_MEDIA, _CameraImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl->GetState() == CAMERA_STATE_CAPTURING, E_INVALID_STATE, "[E_INVALID_STATE] The camera is already capturing");
SysTryCatch(NID_MEDIA, pImage != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] image is null.");
SysLog(NID_MEDIA, "Enter. image size:%d, format:%d", pImage->size, pImage->format);
_CameraImpl::CaptureCompletedCb(void *pUserData)
{
result r = E_SUCCESS;
- ByteBuffer* pBuffer = null;
_CameraImpl* pImpl = static_cast<_CameraImpl*>(pUserData);
SysLog(NID_MEDIA, "CaptureCompletedCb");
- SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
-// SysTryReturn(NID_MEDIA, pImpl->GetState() == CAMERA_STATE_CAPTURING, , E_INVALID_STATE, "[E_INVALID_STATE] Camera is in an invalid state. The camera is already power-offed");
+ SysTryReturnVoidResult(NID_MEDIA, _CameraImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
- pBuffer = pImpl->DequeueDataN(_CAMERA_BUFFER_CAPTURE);
- if (pBuffer != null)
+ std::unique_ptr <ByteBuffer> pBuffer (pImpl->DequeueDataN(_CAMERA_BUFFER_CAPTURE));
+ if (pBuffer.get() != null)
{
SysLog(NID_MEDIA, "Captured data sending. size is %d", pBuffer->GetLimit());
if (pBuffer->GetLimit() > 0)
{
- r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_NONE, E_SUCCESS, pBuffer);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_NONE, E_SUCCESS, pBuffer.release());
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
else
{
SysLogException(NID_MEDIA, E_INVALID_DATA, "[E_INVALID_DATA] The captured data is invalid.");
- r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_DEVICE_FAILED, E_INVALID_DATA, pBuffer);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_DEVICE_FAILED, E_INVALID_DATA, pBuffer.release());
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
- delete pBuffer;
- pBuffer = null;
}
else
{
SysLogException(NID_MEDIA, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Out of memory for capturing anymore.");
r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_OUT_OF_MEMORY, E_OUT_OF_MEMORY, null);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
return;
-CATCH:
- if (pBuffer != null)
- {
- delete pBuffer;
- }
- return;
}
void
int queueCount = 0;
_CameraImpl* pImpl = static_cast<_CameraImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
- SysTryReturn(NID_MEDIA, pFrame != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] camera_preview_data_s instance is not available.");
+ SysTryReturnVoidResult(NID_MEDIA, _CameraImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
+ SysTryReturnVoidResult(NID_MEDIA, pFrame != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] camera_preview_data_s instance is not available.");
SysLog(NID_MEDIA, "Enter. preview format:%d, width:%d, height:%d, num_of_planes:%d", pFrame->format, pFrame->width, pFrame->height, pFrame->num_of_planes);
queueCount = pImpl->__pPreviewBufferQueue->GetCount();
SysLogException(NID_MEDIA, E_INVALID_DATA, "[E_INVALID_DATA] Invalid data is streamed..");
if (queueCount < pImpl->__pPreviewBufferQueue->GetCount()) // if the queue is increased.
{
- ByteBuffer* pBuffer = null;
- pBuffer = pImpl->DequeueDataN(_CAMERA_BUFFER_PREVIEW);
- if (pBuffer)
- {
- delete pBuffer;
- }
+ std::unique_ptr <ByteBuffer> pBuffer (pImpl->DequeueDataN(_CAMERA_BUFFER_PREVIEW));
+ pBuffer.reset(null);
}
return;
}
result r = E_SUCCESS;
_CameraImpl* pImpl = static_cast<_CameraImpl*>(pUserData);
SysLog(NID_MEDIA, "InterruptedCb called, policy is %d, previous state is %d, current state is %d, pUserData address is %x ", policy, previous, current, pUserData );
- SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
- SysTryReturn(NID_MEDIA, pImpl->IsPoweredOn() == true, , E_INVALID_OPERATION ,"The camera is already power-offed");
+ SysTryReturnVoidResult(NID_MEDIA, _CameraImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl->IsPoweredOn() == true, E_INVALID_OPERATION ,"The camera is already power-offed");
r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_ERROR, CAMERA_ERROR_DEVICE_INTERRUPTED, E_DEVICE_FAILED, null);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "Sending camera interrupted failed [%s] .", GetErrorMessage(r));
CATCH:
result r = E_SUCCESS;
_CameraImpl* pImpl = static_cast<_CameraImpl*>(pUserData);
SysLog(NID_MEDIA, "ErrorCb called, error is 0x%x, current state is %d, pUserData address is %x ", error, current, pUserData );
- SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
+ SysTryReturnVoidResult(NID_MEDIA, _CameraImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
switch (error)
{
case ::CAMERA_ERROR_OUT_OF_MEMORY:
CameraErrorReason cameraErrorReason = CAMERA_ERROR_NONE;
result cameraResult = E_SUCCESS;
SysLog(NID_MEDIA, "Enter. state is %d.", state);
- SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
+ SysTryReturnVoidResult(NID_MEDIA, _CameraImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
CameraFocusMode focusMode = pImpl->GetFocusMode();
*
*/
+#include <unique_ptr.h>
#include <pthread.h>
#include <camera.h>
#include <FBaseSysLog.h>
#include "FMedia_CameraManager.h"
+#include "FMedia_CameraManager.h"
+#include "FMedia_CamPtrUtil.h"
#define MM_SUCCESS 0
void
_CameraManagerSafeHashMapT::RemoveItems(void)
{
- IListT <_CameraDeviceType>* pList = null;
_CameraManager* pManager = null;
result r = E_SUCCESS;
- pList = GetKeysN();
- SysTryReturn(NID_MEDIA, pList != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
+ std::unique_ptr <IListT<_CameraDeviceType>, _ListPtrUtil::Remover > pList (GetKeysN(), _ListPtrUtil::remover);
+ SysTryReturnVoidResult(NID_MEDIA, pList.get() != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
for (int i = 0; i < GetCount(); i++)
{
}
delete pManager;
}
- pList->RemoveAll();
- delete pList;
RemoveAll();
}
{
result r = E_SUCCESS;
bool out = false;
-
_CameraManager* pManager = null;
-
SysTryReturn(NID_MEDIA, cameraDevice > _CAMERA_DEVICE_NONE && cameraDevice < _CAMERA_DEVICE_MAX,
null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument(cameraDevice) is used. camderDevice:%d is wrong.", cameraDevice);
static pthread_once_t once_block = PTHREAD_ONCE_INIT;
-
if (!__pMap)
{
pthread_once(&once_block, InitSafeHashMapInst);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, __pMap != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, __pMap != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
}
r = __pMap->ContainsKey(cameraDevice, out);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
if (out)
{
r = __pMap->GetValue(cameraDevice, pManager);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS && pManager != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS && pManager != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
}
else
{
- pManager = new (std::nothrow) _CameraManager();
- SysTryCatch(NID_MEDIA, pManager !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ std::unique_ptr <_CameraManager> pMan (new (std::nothrow) _CameraManager());
+ SysTryReturn(NID_MEDIA, pMan.get() !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ r = pMan->Construct(cameraDevice);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- r = pManager->Construct(cameraDevice);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = __pMap->Add(cameraDevice, pMan.get());
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- r = __pMap->Add(cameraDevice, pManager);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ pManager = pMan.release();
}
return pManager;
-
-CATCH:
- if (pManager != null)
- {
- delete pManager;
- }
- return null;
}
void
{
_CameraManager* pManager = null;
r = __pMap->GetValue(cameraDevice, pManager);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
if (pManager->ReleaseRefCount() == 0)
{
delete pManager;
r = __pMap->Remove(cameraDevice);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
}
}
{
public:
/**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method. This method should be called in the same thread
+ * where the Construct() method is called.
+ *
+ * @see Construct()
+ */
+ virtual ~_CameraManager(void);
+
+ /**
* Get the instance of _CameraManager.
*
* @return The _CameraManager instance
_CameraManager(void);
/**
- * This is the destructor for this class. @n
- * All allocated resources are deallocated by this method. This method should be called in the same thread
- * where the Construct() method is called.
- *
- * @see Construct()
- */
- virtual ~_CameraManager(void);
-
- /**
* Initializes this instance of _CameraManager.
*
* @return An error code
_CapabilityImpl::~_CapabilityImpl(void)
{
- if (__pMap != null)
- {
- __pMap->RemoveAll(true);
- delete __pMap;
- }
}
result
result r = E_SUCCESS;
long long length = 0;
int readLen = 0;
- std::unique_ptr<char[]> pXmlBuffer;
FileAttributes attributes;
File fileObj;
const String mediaCapabilityFilePath(L"/usr/etc/media-capability.xml");
SysLog(NID_MEDIA, "Enter ");
- __pMap = new (std::nothrow) HashMap();
- SysTryCatch(NID_MEDIA, null != __pMap, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. ");
+ std::unique_ptr <HashMap> pMap (new (std::nothrow) HashMap(SingleObjectDeleter));
+
+ pMap.reset(new (std::nothrow) HashMap(SingleObjectDeleter));
+ SysTryReturn(NID_MEDIA, null != pMap.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. ");
+
+ r = pMap->Construct();
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- r = __pMap->Construct();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ __pMap.reset(pMap.release());
SysLog(NID_MEDIA, "Capability XML path:%ls", mediaCapabilityFilePath.GetPointer());
r = File::GetAttributes( mediaCapabilityFilePath, attributes);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. File path is %ls", GetErrorMessage(r), mediaCapabilityFilePath.GetPointer());
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. File path is %ls", GetErrorMessage(r), mediaCapabilityFilePath.GetPointer());
length = attributes.GetFileSize();
- SysTryCatch(NID_MEDIA, length > 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Propagating.");
+ SysTryReturn(NID_MEDIA, length > 0, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Propagating.");
- pXmlBuffer.reset(new (std::nothrow) char[length]);
- SysTryCatch(NID_MEDIA, null != pXmlBuffer.get(), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. ");
+ std::unique_ptr<char[]> pXmlBuffer (new (std::nothrow) char[length]);
+ SysTryReturn(NID_MEDIA, null != pXmlBuffer.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. ");
r = fileObj.Construct(mediaCapabilityFilePath, L"r");
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
// read the capability xml file content as parse the capability
readLen = fileObj.Read(pXmlBuffer.get(), length);
- SysTryCatch(NID_MEDIA, readLen == length, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Propagating. length:%d, readLen:%d", length,
+ SysTryReturn(NID_MEDIA, readLen == length, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Propagating. length:%d, readLen:%d", length,
readLen);
// parse the capability file buffer all the parse key value pair shall be added in __pMap object
r = ParseCapability(pXmlBuffer.get(), readLen);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
// Get the camera count
- {
- int cameraCount = 0;
- bool flag = false;
-
- r = _SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/camera.back", flag);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- if (flag)
- {
- cameraCount++;
- }
+ int cameraCount = 0;
+ bool flag = false;
- r = _SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/camera.front", flag);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- if (flag)
- {
- cameraCount++;
- }
- __cameraCount = cameraCount;
+ r = _SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/camera.back", flag);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ if (flag)
+ {
+ cameraCount++;
}
- return E_SUCCESS;
-
-CATCH:
- SysLog(NID_MEDIA, "[%s]", GetErrorMessage(r));
- if (__pMap != null)
+ r = _SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/camera.front", flag);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ if (flag)
{
- __pMap->RemoveAll(true);
- delete __pMap;
- __pMap = 0;
+ cameraCount++;
}
+ __cameraCount = cameraCount;
return r;
}
{
String* pKey = null;
pKey = new (std::nothrow) Tizen::Base::String(key);
- SysTryReturn(NID_MEDIA, pKey !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The key is not created.");
+ SysTryReturnVoidResult(NID_MEDIA, pKey !=null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The key is not created.");
r = __pMap->Add(*pKey, *pRet);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
break;
}
_RecorderEventArg::~_RecorderEventArg(void)
{
- if (__pRecordedData != null)
- {
- delete (Tizen::Base::ByteBuffer*) __pRecordedData;
- __pRecordedData = null;
- }
}
void
void
_RecorderEventArg::SetData(Tizen::Base::ByteBuffer* data)
{
- __pRecordedData = data;
+ __pRecordedData.reset(data);
}
Tizen::Base::ByteBuffer*
_RecorderEventArg::GetData(void) const
{
- return __pRecordedData;
+ return __pRecordedData.get();
}
result
#ifndef _FMEDIA_INTERNAL_EVENTARG_H_
#define _FMEDIA_INTERNAL_EVENTARG_H_
-
+#include <unique_ptr.h>
#include <FBaseObject.h>
#include <FBaseRtIEventArg.h>
#include <FBaseByteBuffer.h>
_RecorderEventArg& operator =(const _RecorderEventArg& value);
_RecorderEventType __recorderEventType;
- Tizen::Base::ByteBuffer* __pRecordedData;
+ std::unique_ptr <Tizen::Base::ByteBuffer> __pRecordedData;
result __result;
RecorderErrorReason __error;
};
*
*/
+#include <unique_ptr.h>
#include <pthread.h>
#include <recorder.h>
#include <FBaseSysLog.h>
result r = E_SUCCESS;
pList = GetKeysN();
- SysTryReturn(NID_MEDIA, pList != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
+ SysTryReturnVoidResult(NID_MEDIA, pList != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] There is no instance.");
for (int i = 0; i < GetCount(); i++)
{
{
pthread_once(&once_block, InitSafeHashMapInst);
r = GetLastResult();
- SysTryCatch(NID_MEDIA, __pMap != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, __pMap != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
}
r = __pMap->ContainsKey(recorderDevice, out);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
if (out)
{
r = __pMap->GetValue(recorderDevice, pManager);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS && pManager != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS && pManager != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
}
else
{
break;
}
- pManager = new (std::nothrow) _RecorderManager();
- SysTryCatch(NID_MEDIA, pManager !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The object is not created.");
+ std::unique_ptr <_RecorderManager> pMan (new (std::nothrow) _RecorderManager());
+ SysTryReturn(NID_MEDIA, pMan.get() !=null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The object is not created.");
- r = pManager->Construct(cameraDevice, recorderDevice);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pMan->Construct(cameraDevice, recorderDevice);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- r = __pMap->Add(recorderDevice, pManager);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = __pMap->Add(recorderDevice, pMan.get());
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pManager = pMan.release();
}
pManager->AddRefCount();
return pManager;
-
-CATCH:
- if (pManager != null)
- {
- delete pManager;
- }
- return null;
}
void
{
_RecorderManager* pManager = null;
r = __pMap->GetValue(recorderDevice, pManager);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
if (pManager->ReleaseRefCount() == 0)
{
delete pManager;
r = __pMap->Remove(recorderDevice);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
}
}
{
public:
/**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method. This method should be called in the same thread
+ * where the Construct() method is called.
+ *
+ * @see Construct()
+ */
+ virtual ~_RecorderManager(void);
+
+ /**
* Get the instance of _RecorderManager.
*
* @return The _RecorderManager instance
_RecorderManager(void);
/**
- * This is the destructor for this class. @n
- * All allocated resources are deallocated by this method. This method should be called in the same thread
- * where the Construct() method is called.
- *
- * @see Construct()
- */
- virtual ~_RecorderManager(void);
-
- /**
* Initializes this instance of _RecorderManager.
*
* @return An error code
{
{ VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_YUV420P, 1 },
{ VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_NV12, 1 },
- { VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_NV21, 1 },
+ { VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_NV21, 1 },
{ VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_YUV444P, 1 },
{ VIDEO_PLANE_TYPE_U, MEDIA_PIXEL_FORMAT_YUV420P, 0.5 },
_VideoRecorderEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
{
IVideoRecorderEventListener* pVideoRecorderEventListener = dynamic_cast <IVideoRecorderEventListener*>(&listener);
- SysTryReturn(NID_MEDIA, pVideoRecorderEventListener != null, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Listener is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pVideoRecorderEventListener != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Listener is null.");
Tizen::Base::Runtime::IEventArg* pTempArg = const_cast <Tizen::Base::Runtime::IEventArg*>(&arg);
_RecorderEventArg* pArg = dynamic_cast <_RecorderEventArg*>(pTempArg);
- SysTryReturn(NID_MEDIA, pArg != null, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. EventArg is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pArg != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. EventArg is null.");
switch (pArg->GetEventType())
{
_CameraCoordinator::Release(__deviceType);
}
- if (__pVideoSourceAdapter != null)
- {
- delete __pVideoSourceAdapter;
- }
-
- if (__pVideoRecorderEvent != null)
- {
- delete __pVideoRecorderEvent;
- }
-
if ( __isConstructed )
{
__isUsed = false;
pCamImpl = _CameraImpl::GetInstance(pCamera);
// Source Adapter
- __pVideoSourceAdapter = new (std::nothrow) _VideoSourceAdapter(*pCamImpl);
- SysTryCatch(NID_MEDIA, __pVideoSourceAdapter != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ __pVideoSourceAdapter.reset(new (std::nothrow) _VideoSourceAdapter(*pCamImpl));
+ SysTryCatch(NID_MEDIA, __pVideoSourceAdapter.get() != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
// Create Event
- __pVideoRecorderEvent = new (std::nothrow) _VideoRecorderEvent();
- SysTryCatch(NID_MEDIA, __pVideoRecorderEvent != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ __pVideoRecorderEvent.reset(new (std::nothrow) _VideoRecorderEvent());
+ SysTryCatch(NID_MEDIA, __pVideoRecorderEvent.get() != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = __pVideoRecorderEvent->Construct(*this);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
__pCoordinator->RemoveCameraCoordinatorListener(*this);
}
- if (__pVideoSourceAdapter != null)
- {
- delete __pVideoSourceAdapter;
- __pVideoSourceAdapter = null;
- }
-
- if (__pVideoRecorderEventListener != null)
- {
- __pVideoRecorderEvent->RemoveListener(*__pVideoRecorderEventListener);
- __pVideoRecorderEventListener = null;
- }
-
- if (__pVideoRecorderEvent != null)
- {
- delete __pVideoRecorderEvent;
- __pVideoRecorderEvent = null;
- }
-
return r;
}
Tizen::Base::Collection::IList*
_VideoRecorderImpl::GetSupportedRecordingResolutionListN(void) const
{
- SysTryReturn(NID_MEDIA, __pVideoSourceAdapter != null, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The source is deleted.");
+ SysTryReturn(NID_MEDIA, __pVideoSourceAdapter.get() != null, null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The source is deleted.");
return __pVideoSourceAdapter->GetSupportedRecordingResolutionListN();
}
result r = E_SUCCESS;
int maxFrameRate = 0;
- SysTryReturn(NID_MEDIA, __pVideoSourceAdapter != null, 0, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The source is deleted.");
+ SysTryReturn(NID_MEDIA, __pVideoSourceAdapter.get() != null, 0, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. The source is deleted.");
std::unique_ptr<IListT<int>, _ListPtrUtil::Remover> pListT (__pVideoSourceAdapter->GetSupportedFrameRateListN(dim), _ListPtrUtil::remover);
SysTryCatch(NID_MEDIA, pListT.get() != null, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Supported list was wrong.");
_VideoRecorderImpl* pImpl = static_cast<_VideoRecorderImpl*>( pUserData);
int tableTotalCount = 0;
int i = 0;
- SysTryReturn(NID_MEDIA, _VideoRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _VideoRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
SysLog(NID_MEDIA, "State previous:%d, current:%d, byPolicy:%d", previous, current, byPolicy);
tableTotalCount = sizeof(_VIDEO_CALLBACK_EVENT) / sizeof(_VIDEO_CALLBACK_EVENT[0]);
{
r = pImpl->GetEvent()->SendEvent(_VIDEO_CALLBACK_EVENT[i].event, _VIDEO_CALLBACK_EVENT[i].error, E_SUCCESS);
SysLog(NID_MEDIA, "VIDEO_CALLBACK_EVENT(%d) is sent by StateChangedCb", _VIDEO_CALLBACK_EVENT[i].event);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. i:%d", GetErrorMessage(r), i);
+ SysTryReturnVoidResult(NID_MEDIA, r == E_SUCCESS, r, "[%s] Propagating. i:%d", GetErrorMessage(r), i);
break;
}
}
_VideoRecorderImpl::RecordingStatusCb(unsigned long long elapsedTime, unsigned long long fileSize, void *pUserData)
{
_VideoRecorderImpl* pImpl = static_cast<_VideoRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _VideoRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _VideoRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
SysLog(NID_MEDIA, "FileSize:%llu,elapsedTime:%llu",fileSize,elapsedTime);
{
_VideoRecorderImpl* pImpl = static_cast<_VideoRecorderImpl*>(pUserData);
int samplingRate =0;
- SysTryReturn(NID_MEDIA, _VideoRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. Impl is null.");
- SysTryReturn(NID_MEDIA, pStream != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] void instance is not available. pStream is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _VideoRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. Impl is null.");
+ SysTryReturnVoidResult(NID_MEDIA, pStream != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] void instance is not available. pStream is null.");
if (pImpl->__audioStreamCallback == true)
{
{
result r = E_SUCCESS;
_VideoRecorderImpl* pImpl = static_cast<_VideoRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _VideoRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _VideoRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
SysLog(NID_MEDIA, "Type:%d", type);
{
result r = E_SUCCESS;
_VideoRecorderImpl* pImpl = static_cast<_VideoRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _VideoRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _VideoRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
SysLog(NID_MEDIA, "Error:%d, state:%d", error, state);
_CameraCoordinator* __pCoordinator = null;
_VideoRecorderImpl::InterruptedCb(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *pUserData)
{
_VideoRecorderImpl* pImpl = static_cast<_VideoRecorderImpl*>(pUserData);
- SysTryReturn(NID_MEDIA, _VideoRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
- SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
+ SysTryReturnVoidResult(NID_MEDIA, _VideoRecorderImpl::IsAlive(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturnVoidResult(NID_MEDIA, pImpl != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. pImpl is null.");
SysLog(NID_MEDIA, "Policy:%d, previous:%d, current:%d", policy, previous, current);
}
_VideoRecorderEvent*
_VideoRecorderImpl::GetEvent(void) const
{
- return __pVideoRecorderEvent;
+ return __pVideoRecorderEvent.get();
}
void
/**
* This is the default constructor for this class.
*
- * @remarks The object is not fully constructed after this constructor is called. For full construction,
+ * @remarks The object is not fully constructed after this constructor is called. For full construction,
* the Construct() method must be called right after calling this constructor.
* @see Construct()
*/
_VideoRecorderImpl& operator =(const _VideoRecorderImpl& _VideoRecorderImpl);
_CameraCoordinator* __pCoordinator;
- _VideoRecorderEvent* __pVideoRecorderEvent;
+ std::unique_ptr <_VideoRecorderEvent> __pVideoRecorderEvent;
IVideoRecorderEventListener* __pVideoRecorderEventListener;
- _VideoSourceAdapter* __pVideoSourceAdapter;
+ std::unique_ptr <_VideoSourceAdapter> __pVideoSourceAdapter;
bool __isConstructed;
RecorderState __state;
long __recTime;
#ifndef _FMEDIA_INTERNAL_CAPABILITY_IMPL_H_
#define _FMEDIA_INTERNAL_CAPABILITY_IMPL_H_
+#include <unique_ptr.h>
#include <libxml/tree.h>
#include <FBaseColIList.h>
#include <FBaseColHashMap.h>
static void InitCapabilityImpl(void);
- Tizen::Base::Collection::HashMap* __pMap;
+ std::unique_ptr <Tizen::Base::Collection::HashMap> __pMap;
int __cameraCount;
bool __primaryCameraDone;
bool __secondaryCameraDone;