#ifndef _FMEDIA_INTERNAL_CAMERA_IMPL_H_
#define _FMEDIA_INTERNAL_CAMERA_IMPL_H_
+#include <unique_ptr.h>
#include <camera.h>
#include <FBaseColIList.h>
#include <FBaseColIListT.h>
#include <FGrpRectangle.h>
#include <FMediaCameraTypes.h>
#include <FMediaTypes.h>
+#include <FMediaIVideoStreamFilter.h>
#include "FMedia_CameraTypes.h"
#include "FMedia_CapabilityTypes.h"
#include "FMedia_ICameraCoordinatorListener.h"
#include "FMedia_CameraBuffer.h"
+#include "FMedia_CamPtrUtil.h"
namespace Tizen { namespace Media
{
class Camera;
class ICameraEventListener;
+class _CameraRef;
class _CameraEvent;
class _CameraCoordinator;
class _CameraCapability;
class _ImageUtilImpl;
-
-typedef void (*_CameraPreprocessingCallback)( MediaPixelFormat format, byte* data[4], int size[4], void* user);
+class _VideoStreamCoordinator;
/**
* @class _CameraImpl
result SetExifOrientation(CameraExifOrientation orientation);
/**
+ * Sets the orientation of the camera.
+ *
+ * @return An error code
+ * @param[in] orientation The orientation of the camera
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE This method is invalid for the current state of this instance.
+ * @exception E_INVALID_ARG The specified @c rotation is not supported.
+ */
+ result SetExifOrientationAttr(CameraExifOrientation orientation);
+
+ /**
* Sets the GPS coordinates in the Exchangeable Image File Format (EXIF) field for the captured data.
*
* @return An error code
CameraMeteringMode GetMeteringMode(void) const;
/**
+ * Sets the scene mode of the camera.
+ *
+ * @return An error code
+ * @param[in] sceneMode The scene mode
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE This instance is in an invalid state for this method.
+ * @exception E_DEVICE_BUSY The camera is under use by other application.
+ * @exception E_DEVICE_UNAVAILABLE The camera becomes unavailable.
+ * @exception E_DEVICE_FAILED The device operation has failed.
+ * @exception E_INVALID_ARG The specified scene mode is invalid.
+ * @exception E_UNSUPPORTED_OPERATION The target device does not support scene mode configuration feature.
+ * @exception E_UNSUPPORTED_TYPE The specified @c sceneMode is not supported.
+ * @remarks In a specific scene mode, camera's attributes such as brightness, metering mode, iso level, white balance, flash and focus are changed to the ones which are pre-defined by each scene mode.@n
+ * In a specific scene mode, if an application sets any attribute which is related to the scene, the mode can be changed to ::CAMERA_SCENE_OFF.@n
+ * Thus it is recommended that the application checks the current scene mode after setting the attributes.@n
+ * In case that the scene mode is changed to ::CAMERA_SCENE_OFF, all the attributes set by the application are re-loaded.@n
+ */
+ result SetSceneMode(CameraSceneMode sceneMode);
+
+ /**
+ * Adds the stream filter to process the video stream data while previewing or recording.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @remarks IVideoStreamFilter::ProcessVideoStream() will be called when the video frame is ready.
+ */
+ result AddVideoStreamFilter(IVideoStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop receiving the video stream data.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ */
+ result RemoveVideoStreamFilter(IVideoStreamFilter& filter);
+
+ /**
+ * Gets the scene mode of the camera.
+ *
+ * @return The %Camera scene mode
+ */
+ CameraSceneMode GetSceneMode(void) const;
+
+ /**
* Gets the camera's state.
*
* @return The state
void SetState(CameraState state);
/**
- * Get the event processing object.
- *
- * @return The event processing object.
- * @remarks This event is working synchronously.
- */
- _CameraEvent* GetEvent(void) const;
-
- /**
* Get the camera selection.
*
* @return The camera selection.
CameraSelection GetSelection(void) const;
/**
- * Gets the preview process flag
- *
- * @return The preview processing flag
- */
- int GetPreviewProcessing(void) const;
-
- /**
* Enqueues the preview or captured data.
*
* @return An error code
_CameraBuffer* DequeueDataN(_CameraBufferType bufferType);
/**
- * Gets the queue's element count.
- *
- * @return A count of queue element
- * @param[in] bufferType Queue type
- */
- int GetDataCount(_CameraBufferType bufferType);
-
- /**
* Gets the camera coordinator.
*
* @return camera coordinator
*/
bool IsZeroShutterLag(void) const;
+
+ /**
+ * Gets the camera's recommened preview format
+ *
+ * @return recommened preview format
+ */
+ Tizen::Graphics::PixelFormat GetDeviceRecommendPreviewFormat(void) const;
+
/**
* Called when the event is received from the %_ICameraCoordinatorListener object.
*
result OnCameraCoordinatorModeChanged(_CameraMode mode);
/**
- * Sets the preprocessing callback fuction pointer.
+ * Called when the other module is removed
*
- * @param[in] pPreProcessCbFunc preprocessing callback fuction pointer
- * @param[in] pPreProcessUserData preprocessing userdata pointer
- */
- void SetPreprocessingCb(_CameraPreprocessingCallback pPreProcessCbFunc, void* pPreProcessUserData);
-
- /**
- * Gets the preprocessing callback fuction pointer.
- *
- * @param[out] pPreProcessCbFunc preprocessing callback fuction pointer
- * @param[out] pPreProcessUserData preprocessing userdata pointer
+ * @return An error code
*/
- void GetPreprocessingCb(_CameraPreprocessingCallback& pPreProcessCbFunc, void*& pPreProcessUserData);
+ result OnCameraCoordinatorOtherRemoved(void);
/**
* Function definition for start capture.
*/
static void InterruptedCb(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *pUserData);
+
/**
- * Function definition for focus changed callback.
+ * Function definition for error callback.
*
- * @param[in] state focus state
+ * @param[in] error The cause which made the error
+ * @param[in] current Current state
* @param[in] pUserData User parameter which is received from user when callback function was set
* @remarks This function is called in the camera created thread.
*/
- static void FocusStateChangedCb(camera_focus_state_e state, void *pUserData);
+ static void ErrorCb(camera_error_e error, camera_state_e current, void *pUserData);
/**
- * Function check fo this object is alive.
+ * Function definition for focus changed callback.
*
- * @return true if the object is alive, otherwise false.
+ * @param[in] state focus state
+ * @param[in] pUserData User parameter which is received from user when callback function was set
+ * @remarks This function is called in the camera created thread.
*/
- static bool IsAlive(void);
+ static void FocusStateChangedCb(camera_focus_state_e state, void *pUserData);
/**
* Gets the Impl instance.
* @param[in] reload reload configuration field
* @exception E_SUCCESS The method is successful.
* @exception E_SYSTEM A system error has occurred.
- * @remarks Multiple configuration field can be set using reloadConf parameter appending.
+ * @remarks Multiple configuration field can be set using reload parameter appending.
*/
result ReloadConfiguration(int reload);
* Change the focus state.
*
* @return An error code
- * @param[in] currentMode focus' current mode
- * @param[in] destMode focus' destinationed mode
+ * @param[in] focusMode focus' destinationed mode
* @exception E_SUCCESS The method is successful.
* @exception E_SYSTEM A system error has occurred.
*/
- result ChangeFocusModeTo(CameraFocusMode currentMode, CameraFocusMode destMode);
+ result ChangeFocusModeTo(CameraFocusMode focusMode);
/**
* Handle the auto focus operations.
*/
result HandleAutoFocus(CameraFocusMode currentMode);
+ /**
+ * Sets the scene mode off.
+ *
+ * @return An error code
+ * @param[in] reload The reload flag
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_DEVICE_FAILED The device operation has failed.
+ * @exception E_SYSTEM A system error has occurred.
+ */
+ result SetSceneModeOff(int reload);
+
_CameraImpl(const _CameraImpl& camera);
_CameraImpl& operator =(const _CameraImpl& camera);
CameraState __state;
_CameraHandle __handle;
- _CameraEvent* __pCameraEvent;
+ std::unique_ptr <_CameraRef> __pCameraRef;
+ std::unique_ptr <_CameraEvent> __pCameraEvent;
+ std::unique_ptr <_VideoStreamCoordinator> __pVideoStreamCoordinator;
ICameraEventListener* __pCameraEventListener;
- Tizen::Base::Collection::Queue* __pCaptureBufferQueue;
- Tizen::Base::Collection::Queue* __pPreviewBufferQueue;
+ std::unique_ptr <Tizen::Base::Collection::Queue, _ListPtrUtil::Remover> __pCaptureBufferQueue;
+ std::unique_ptr <Tizen::Base::Collection::Queue, _ListPtrUtil::Remover> __pPreviewBufferQueue;
bool __isConstructed;
bool __isPoweredOn;
CameraFlashMode __flashMode;
bool __zeroShutterLag;
CameraMeteringMode __meteringMode;
+ CameraSceneMode __sceneMode;
bool __focusCallback;
bool __isFocusAreaSet;
CameraRotation __previewRotation;
int __fps;
CameraFocusMode __focusMode;
+ CameraFocusMode __currentFocusMode;
int __previewProcessing;
Tizen::Graphics::Rectangle __previewRegionRect;
int __focusPoints[2][MAX_FOCUS_POINT];
int __supportedFocusPointCount;
- static bool __isUsed;
-
- _CameraPreprocessingCallback __pPreProcessCbFunc;
- void* __pPreProcessUserData;
+ static const int MAX_CAMERA_PLANE_COUNT = 4;
};
}}// Tizen::Media