#include "FMedia_CameraUtil.h"
#include "FMedia_RecorderUtil.h"
-//#define _VIDEO_RECORDER_ROTATION_
-
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
, __recorderHandle(MM_INVALID_HANDLE)
, __mode(_CAMERA_MODE_NONE)
, __pListenerList(null, _ListPtrUtil::remover)
- , __orientationFlag(0)
- , __cameraOrientation(CAMERA_EXIF_ORIENTATION_TOP_LEFT)
- , __recordingRotation(RECORDING_ROTATION_NONE)
, __reloadCameraPreviewFormat(::CAMERA_PIXEL_FORMAT_I420)
{
}
SysLog(NID_MEDIA, "Enter. recorder device:%d", recorderDevice);
_RecorderManager::Release(recorderDevice);
__recorderHandle = MM_INVALID_HANDLE;
- __orientationFlag = __orientationFlag & (~_ORIENTATION_FOR_RECORDING);
}
_CameraCoordinator*
result r = E_SUCCESS;
int err = MM_SUCCESS;
- if (__orientationFlag & _ORIENTATION_FOR_CAMERA)
- {
- r = SetCameraOrientationAttr(__cameraOrientation);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- }
- else if (__orientationFlag & _ORIENTATION_FOR_RECORDING) // If recorder setting is remained.
- {
- r = SetCameraOrientationAttr(CAMERA_EXIF_ORIENTATION_TOP_LEFT); // To set the init value
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- }
-
__mode = _CAMERA_MODE_IMAGE;
err = camera_start_capture(__cameraHandle, capturingCb, completedCb, pUserData);
r = ConvertResult(err);
result r = E_SUCCESS;
int err = MM_SUCCESS;
- if (__orientationFlag & _ORIENTATION_FOR_RECORDING)
- {
- r = SetRecordingOrientationAttr(__recordingRotation);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- }
- else if (__orientationFlag & _ORIENTATION_FOR_CAMERA) // If recorder setting is remained.
- {
- r = SetRecordingOrientationAttr(RECORDING_ROTATION_NONE); // To set the init value
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- }
-
__mode = _CAMERA_MODE_VIDEO;
err = recorder_start(__recorderHandle);
r = ConvertResult(err);
return r;
}
-void
-_CameraCoordinator::SetRecordingOrientation(RecordingRotation rotation)
-{
- __orientationFlag = __orientationFlag | _ORIENTATION_FOR_RECORDING;
- __recordingRotation = rotation;
-}
-
-void
-_CameraCoordinator::SetCameraOrientation(CameraExifOrientation orientation)
-{
- __orientationFlag = __orientationFlag | _ORIENTATION_FOR_CAMERA;
- __cameraOrientation = orientation;
-}
-
-result
-_CameraCoordinator::SetRecordingOrientationAttr(RecordingRotation rotation)
-{
- result r = E_SUCCESS;
- int err = MM_SUCCESS;
-#if _VIDEO_RECORDER_ROTATION_
- recorder_rotation_e mmAttr = ::RECORDER_ROTATION_NONE;
- r = _RecorderUtil::GetMmRotation(rotation, mmAttr);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. rotation:%d", GetErrorMessage(r), rotation);
-
- err = recorder_attr_set_recording_orientation(__recorderHandle, mmAttr);
- r = ConvertResult(err);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Camcorder set attribute failed. rotation:%d", GetErrorMessage(r), rotation);
-#else
- CameraRotation cameraRotation = CAMERA_ROTATION_NONE;
- r = _RecorderUtil::GetCameraRotation(rotation, cameraRotation);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. rotation:%d", GetErrorMessage(r), rotation);
-
- camera_attr_tag_orientation_e mmOrientationAttr = CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT;
- r = _CameraUtil::GetMmExifOrientation(cameraRotation, mmOrientationAttr);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. rotation:%d", GetErrorMessage(r), rotation);
-
- err = camera_attr_set_tag_orientation(__cameraHandle, mmOrientationAttr);
- r = ConvertResult(err);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Camcorder set attribute failed. Mm orientation:%d", GetErrorMessage(r), mmOrientationAttr);
-#endif
-
- return r;
-}
-
-result
-_CameraCoordinator::SetCameraOrientationAttr(CameraExifOrientation orientation)
-{
- result r = E_SUCCESS;
- int err = MM_SUCCESS;
- camera_attr_tag_orientation_e attr = ::CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT;
-
- r = _CameraUtil::GetMmExifOrientation(orientation, attr);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. orientation:%d", GetErrorMessage(r), orientation);
-
- err = camera_attr_set_tag_orientation(__cameraHandle, attr);
- r = ConvertResult(err);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. orientation:%d", GetErrorMessage(r), orientation);
-
- return r;
-}
-
camera_pixel_format_e
_CameraCoordinator::GetReloadPreviewFormat(void) const
{
result StartRecord(void);
/**
- * Sets the orientation of the recorder.
- *
- * @return An error code
- */
- void SetRecordingOrientation(RecordingRotation rotation);
-
- /**
- * Sets the orientation of the camera.
- *
- * @return An error code
- */
- void SetCameraOrientation(CameraExifOrientation orientation);
-
- /**
* Gets the reloaded preview format of the camera.
*
* @return An error code
*/
result ChangeRecorderStateTo(recorder_state_e destState);
- /**
- * Sets the orientation of the recorder.
- *
- * @return An error code
- * @param[in] rotation The rotation of the recorder
- * @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 SetRecordingOrientationAttr(RecordingRotation rotation);
-
- /**
- * 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 SetCameraOrientationAttr(CameraExifOrientation orientation);
-
_CameraCoordinator(const _CameraCoordinator& rhs);
_CameraCoordinator& operator =(const _CameraCoordinator& rhs);
_RecorderHandle __recorderHandle;
_CameraMode __mode;
std::unique_ptr<Tizen::Base::Collection::LinkedListT <_ICameraCoordinatorListener*>, _ListPtrUtil::Remover> __pListenerList;
- int __orientationFlag;
- CameraExifOrientation __cameraOrientation;
- RecordingRotation __recordingRotation;
camera_pixel_format_e __reloadCameraPreviewFormat;
static _CameraCoordinatorSafeHashMapT* __pMap;
if ( __isPoweredOn )
{
- __pCoordinator->SetCameraOrientation(orientation);
+ r = SetExifOrientationAttr(orientation);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
__exifOrientation = orientation;
return r;
}
result
+_CameraImpl::SetExifOrientationAttr(CameraExifOrientation orientation)
+{
+ result r = E_SUCCESS;
+ int err = MM_SUCCESS;
+ camera_attr_tag_orientation_e attr = ::CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT;
+
+ r = _CameraUtil::GetMmExifOrientation(orientation, attr);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. orientation:%d", GetErrorMessage(r), orientation);
+
+ err = camera_attr_set_tag_orientation(__handle, attr);
+ r = ConvertResult(err);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. orientation:%d", GetErrorMessage(r), orientation);
+
+ return r;
+}
+
+result
_CameraImpl::SetExifGpsCoordinates(double latitude, double longitude, float altitude)
{
result r = E_SUCCESS;
}
if ((reload & _RELOAD_EXIF_ORIENTATION) && (__exifOrientation != CAMERA_EXIF_ORIENTATION_NONE)) //TODO check whether the exif data is lasting or one-time.
{
- __pCoordinator->SetCameraOrientation(__exifOrientation);
+ r = SetExifOrientationAttr(__exifOrientation);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
if (reload & _RELOAD_EXIF_GPS_COORDINATES)
{
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
#include "FMedia_CamPtrUtil.h"
#include "FMedia_AudioStreamCoordinator.h"
+//#define _VIDEO_RECORDER_ROTATION_
+
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
using namespace Tizen::Graphics;
SysTryReturn(NID_MEDIA, (rotation >= RECORDING_ROTATION_NONE&& rotation <= RECORDING_ROTATION_270)
, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument(rotation) is used. The rotation=%d.", rotation);
- __pCoordinator->SetRecordingOrientation(rotation);
- __rotation = rotation;
+ r = SetRecordingOrientationAttr(rotation);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] propogated", GetErrorMessage(r));
+ __rotation = rotation;
return r;
}
}
result
+_VideoRecorderImpl::SetRecordingOrientationAttr(RecordingRotation rotation)
+{
+ result r = E_SUCCESS;
+ int err = MM_SUCCESS;
+ recorder_rotation_e mmAttr = ::RECORDER_ROTATION_NONE;
+ r = _RecorderUtil::GetMmRotation(rotation, mmAttr);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. rotation:%d", GetErrorMessage(r), rotation);
+
+#if _VIDEO_RECORDER_ROTATION_
+ err = recorder_attr_set_recording_orientation(__handle, mmAttr);
+ r = ConvertResult(err);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Camcorder set attribute failed. rotation:%d", GetErrorMessage(r), rotation);
+#else
+ err = recorder_attr_set_orientation_tag(__handle, mmAttr);
+ r = ConvertResult(err);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Camcorder set attribute failed. rotation:%d", GetErrorMessage(r), rotation);
+#endif
+
+ return r;
+}
+
+result
_VideoRecorderImpl::SetCallback(void)
{
result r = E_SUCCESS;
}
if (reload & _RELOAD_ROTATION)
{
- __pCoordinator->SetRecordingOrientation(__rotation);
+ r = SetRecordingOrientationAttr(__rotation);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] video recorder set orientation failed", GetErrorMessage(r));
}
return r;
result SetMaxRecordingTimeAttr(long msTime);
/**
+ * Sets the orientation of the recorder.
+ *
+ * @return An error code
+ * @param[in] rotation The rotation of the recorder
+ * @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 SetRecordingOrientationAttr(RecordingRotation rotation);
+
+ /**
* Sets the callback of the recorder.
*
* @return An error code