Removed writing to conf file in camera and recorder app:N_SE-52855
authorRahul Varna <rahul.varna@samsung.com>
Fri, 20 Sep 2013 03:41:56 +0000 (12:41 +0900)
committerRahul Varna <rahul.varna@samsung.com>
Fri, 20 Sep 2013 03:41:56 +0000 (12:41 +0900)
Change-Id: I37b11fbbd36d59d5421c3cef3c23e501137abfaf
Signed-off-by: Rahul Varna <rahul.varna@samsung.com>
project/src/Camera/CameraCaptureForm.cpp
project/src/Recorder/VideoRecorderForm.cpp
project/src/Recorder/VideoRecorderForm.h

index b866503..1a28386 100644 (file)
@@ -971,7 +971,6 @@ CameraCaptureForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListPreviewFormat->SetItemChecked", GetErrorMessage(r));
 
                __previewFormatIndex = index;
-               __pConfig->SetValue(SECTION_NAME, String(L"PreviewFormat"), tempVal);
        }
        else if (&source == __pListViewFlashMode)
        {
@@ -1188,7 +1187,6 @@ CameraCaptureForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListViewFrameRate->SetItemChecked", GetErrorMessage(r));
 
                __frameRateIndex = index;
-               __pConfig->SetValue(SECTION_NAME, String(L"framerate"), tempVal);
        }
        else if (&source == __pListViewPrevResolution)
        {
@@ -1221,8 +1219,6 @@ CameraCaptureForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                __pListViewPrevResolution->Draw();
                __pListViewPrevResolution->Show();
 
-               __pConfig->SetValue(SECTION_NAME, String(L"previewresolutionWidth"), pResolution->width);
-               __pConfig->SetValue(SECTION_NAME, String(L"previewresolutionHeight"), pResolution->height);
                __previewResolutionIndex = index;
        }
        else if (&source == __pListViewCaptureResolution)
@@ -1254,8 +1250,6 @@ CameraCaptureForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                r = __pListViewCaptureResolution->SetItemChecked(__captureResolutionIndex, false);
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListViewCaptureResolution->SetItemChecked", GetErrorMessage(r));
 
-               __pConfig->SetValue(SECTION_NAME, String(L"captureresolutionWidth"), pResolution->width);
-               __pConfig->SetValue(SECTION_NAME, String(L"captureresolutionHeight"), pResolution->height);
                __captureResolutionIndex = index;
        }
        else if (&source == __pListViewQuality)
@@ -1277,7 +1271,6 @@ CameraCaptureForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListViewQuality->SetItemChecked", GetErrorMessage(r));
 
                __qualityIndex = index;
-               __pConfig->SetValue(SECTION_NAME, String(L"quality"), __qualityIndex);
        }
 
        Invalidate(true);
index d95578c..68009f8 100644 (file)
@@ -1260,16 +1260,6 @@ VideoRecorderForm::Activate(void* pActivateParam)
 {
        result r = E_SUCCESS;
 
-       int tempVal = INIT;
-       int index = 0;
-       int count = 0;
-       char* pTemp;
-       Dimension tempDimension(INIT, INIT);
-       CodecType tempAudioCodecType = CODEC_NONE;
-       CodecType tempVideoCodecType = CODEC_NONE;
-       MediaContainerType tempContainerType = MEDIA_CONTAINER_NONE;
-       PixelFormat pixFormat = PIXEL_FORMAT_YCbCr420_PLANAR;
-
        AppLog("VideoRecorderForm::Activate enter CAM TYPE = %d", __camType);
 
        __cameraError = CAMERA_ERROR_NONE;
@@ -1363,252 +1353,8 @@ VideoRecorderForm::Activate(void* pActivateParam)
        __previewByCallback = __pConfig->GetInt(1, SECTION_NAME, String(L"previewByCallback"));
        AppLog("Camera __bPreviewByCallback is = %d", __previewByCallback);
 
-       tempVal = (__camType == CAMERA_PRIMARY) ? __pConfig->GetInt(INIT, SECTION_NAME, String(L"framerate")) : __pConfig->GetInt(-1, SECTION_NAME, String(L"framerateSec"));
-       if (tempVal == INIT)
-       {
-               tempVal = __pCamera->GetPreviewFrameRate();
-       }
-
-       count = __pPreviewFrameRateList->GetCount();
-
-       for (index = 0; index < count; index++)
-       {
-               int object = INIT;
-               r = __pPreviewFrameRateList->GetAt(index, object);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pPreviewFrameRateList->GetAt", GetErrorMessage(r));
-
-               if (tempVal == object)
-               {
-                       (__camType == CAMERA_PRIMARY) ? __frameRateIndex = index : __frameRateIndexSec = index;
-                       break;
-               }
-       }
-
-       if (index >= count)
-       {
-               ShowError(E_FAILURE, METHOD_FILE_LINENO);
-               goto CATCH;
-       }
-
-       tempVal = __pConfig->GetInt(INIT, SECTION_NAME, String(L"PreviewFormat"));
-       if (tempVal == INIT)
-       {
-               tempVal = __pCamera->GetPreviewFormat();
-       }
-
-       count = __pPreviewFormatList->GetCount();
-
-       for (index = 0; index < count; index++)
-       {
-               PixelFormat object = __pCamera->GetPreviewFormat();
-               r = __pPreviewFormatList->GetAt(index, object);
-               TryCatch(__pPreviewFormatList != null, ShowError(r, METHOD_FILE_LINENO), " __pPreviewFormatList is empty");
-
-               if (tempVal == object)
-               {
-                       __previewFormatIndex = index;
-                       break;
-               }
-       }
-
-       TryCatch(index < count, ShowError(E_FAILURE, METHOD_FILE_LINENO),"index >= count failed");
-
-       tempDimension.width = (__camType == CAMERA_PRIMARY) ? __pConfig->GetInt(INIT, SECTION_NAME, String(L"resolutionWidth")) : __pConfig->GetInt(INIT, SECTION_NAME, String(L"resolutionWidthSec"));
-       tempDimension.height = (__camType == CAMERA_PRIMARY) ? __pConfig->GetInt(INIT, SECTION_NAME, String(L"resolutionHeight")) : __pConfig->GetInt(INIT, SECTION_NAME, String(L"resolutionHeightSec"));
-       if ((tempDimension.width == INIT) || (tempDimension.height == INIT))
-       {
-               tempDimension = __pVideoRecorder->GetRecordingResolution();
-       }
-
-       count = __pRecordingResolutionList->GetCount();
-
-       for (index = 0; index < count; index++)
-       {
-               Dimension* pDimention = null;
-               pDimention = static_cast< Dimension* >(__pRecordingResolutionList->GetAt(index));
-               TryCatch(pDimention != null, ShowErrorResult(E_FAILURE, METHOD_FILE_LINENO), "[%s] __pRecordingResolutionList->GetAt", GetErrorMessage(r));
-
-               if (*pDimention == tempDimension)
-               {
-                       (__camType == CAMERA_PRIMARY) ? __resolutionIndex = index : __resolutionIndexSec = index;
-                       break;
-               }
-       }
-
-       if (index >= count)
-       {
-               ShowError(E_FAILURE, METHOD_FILE_LINENO);
-               goto CATCH;
-       }
-
-       tempVal = __pConfig->GetInt(INIT, SECTION_NAME, String(L"videocodec"));
-       if (tempVal == INIT)
-       {
-               r = __pVideoRecorder->GetFormat(tempAudioCodecType, tempVideoCodecType, tempContainerType);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pVideoRecorder->GetFormat", GetErrorMessage(r));
-       }
-       else
-       {
-               tempVideoCodecType = static_cast< CodecType >(tempVal);
-       }
-
-       count = __pRecorderVideoCodecList->GetCount();
-
-       for (index = 0; index < count; index++)
-       {
-               CodecType codec = CODEC_NONE;
-               r = __pRecorderVideoCodecList->GetAt(index, codec);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pRecorderVideoCodecList->GetAt", GetErrorMessage(r));
-
-               if (tempVideoCodecType == codec)
-               {
-                       __videoCodecIndex = index;
-                       break;
-               }
-       }
-
-       if (index >= count)
-       {
-               ShowError(E_FAILURE, METHOD_FILE_LINENO);
-               goto CATCH;
-       }
-
-       tempVal = __pConfig->GetInt(INIT, SECTION_NAME, String(L"audiocodec"));
-
-       if (tempVal == INIT)
-       {
-               r = __pVideoRecorder->GetFormat(tempAudioCodecType, tempVideoCodecType, tempContainerType);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] _pVideoRecorder->GetFormat", GetErrorMessage(r));
-       }
-       else
-       {
-               tempAudioCodecType = static_cast< CodecType >(tempVal);
-       }
-
-       count = __pRecorderAudioCodecList->GetCount();
-
-       for (index = 0; index < count; index++)
-       {
-               CodecType codec = CODEC_NONE;
-               r = __pRecorderAudioCodecList->GetAt(index, codec);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pRecorderAudioCodecList->GetAt", GetErrorMessage(r));
-
-               if (codec == tempAudioCodecType)
-               {
-                       __audioCodecIndex = index;
-                       break;
-               }
-       }
-
-       if (index >= count)
-       {
-               ShowError(E_FAILURE, METHOD_FILE_LINENO);
-               goto CATCH;
-       }
-
-       tempVal = __pConfig->GetInt(INIT, SECTION_NAME, String(L"fileformat"));
-       if (tempVal == INIT)
-       {
-               r = __pVideoRecorder->GetFormat(tempAudioCodecType, tempVideoCodecType, tempContainerType);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pVideoRecorder->GetFormat", GetErrorMessage(r));
-       }
-       else
-       {
-               tempContainerType = static_cast< MediaContainerType >(tempVal);
-       }
-
-       pTemp = (char*) &tempContainerType;
-
-       AppLog("codec type %c %c %c %c", pTemp[0], pTemp[1], pTemp[2], pTemp[3]);
-
-       count = __pRecorderVideoContainerList->GetCount();
-
-       for (index = 0; index < count; index++)
-       {
-               MediaContainerType container = MEDIA_CONTAINER_NONE;
-               r = __pRecorderVideoContainerList->GetAt(index, container);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pRecorderVideoContainerList->GetAt", GetErrorMessage(r));
-
-               pTemp = (char*) &container;
-               AppLog("[index = %d] codec type %c %c %c %c", index, pTemp[0], pTemp[1], pTemp[2], pTemp[3]);
-               if (tempContainerType == container)
-               {
-                       if (__formatIndex == INIT)
-                       {
-                               __formatIndex = index;
-                       }
-                       break;
-               }
-       }
-
-       if (index >= count)
-       {
-               ShowError(E_FAILURE, METHOD_FILE_LINENO);
-               goto CATCH;
-       }
-
-       __qualityIndex = __pConfig->GetInt(INIT, SECTION_NAME, String(L"quality"));
-       if (__qualityIndex == INIT)
-       {
-               r = __pVideoRecorder->SetQuality(RECORDING_QUALITY_HIGH);
-               TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pVideoRecorder->SetQuality", GetErrorMessage(r));
-               __qualityIndex = __pVideoRecorder->GetQuality();
-       }
-       AppLog("quality index = %d", __qualityIndex);
-
-       if (__audioStreamCallbackIndex == INIT)
-       {
-               __audioStreamCallbackIndex = DISABLE_AUDIO_STREAM;
-               __isAudioStreamCallback = false;
-       }
-
-       if (__videoStreamCallbackIndex == INIT)
-       {
-               __videoStreamCallbackIndex = DISABLE_AUDIO_STREAM;
-               __isVideoStreamCallback = false;
-       }
-
-       if (__isVideoStreamCallback == true)
-       {
-               r = __pCamera->AddVideoStreamFilter(*this);
-               TryCatch(r == E_SUCCESS || r == E_OBJ_ALREADY_EXIST, ShowError(r, METHOD_FILE_LINENO),"[%s] __pVideoRecorder->AddVideoStreamListener", GetErrorMessage(r));
-       }
-       else
-       {
-               r = __pCamera->RemoveVideoStreamFilter(*this);
-               TryCatch(r == E_SUCCESS || r == E_OBJ_NOT_FOUND, ShowError(r, METHOD_FILE_LINENO),"[%s] __pVideoRecorder->RemoveVideoStreamListener", GetErrorMessage(r));
-       }
-
-       r = __pOverlay->GetBackgroundBufferInfo(__bufferInfo);
-       TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pOverlay->GetBackgroundBufferInfo", GetErrorMessage(r));
-
-       r = __pPreviewFrameRateList->GetAt((CAMERA_PRIMARY == __camType) ? __frameRateIndex : __frameRateIndexSec, tempVal);
-       TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pPreviewFrameRateList->GetAt", GetErrorMessage(r));
-
-       tempDimension = *(Dimension*) __pRecordingResolutionList->GetAt((CAMERA_PRIMARY == __camType) ? __resolutionIndex : __resolutionIndexSec);
-
-       r = __pCamera->SetPreviewResolution(tempDimension);
-       TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetPreviewResolution", GetErrorMessage(r));
-
-       r = __pPreviewFormatList->GetAt(__previewFormatIndex, pixFormat);
-       TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO), "[%s] __pPreviewFormatList->GetAt", GetErrorMessage(r));
-
-       r = __pCamera->SetPreviewFormat(pixFormat);
-       TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pCamera->SetPreviewFormat", GetErrorMessage(r));
-
-       r = __pCamera->SetPreviewFrameRate(tempVal);
-       TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetPreviewFrameRate", GetErrorMessage(r));
-
-       if ( __sceneModeIndex == INIT)
-       {
-               __sceneModeValue = __pCamera->GetSceneMode();
-       }
-
-       r = __pCamera->SetSceneMode(__sceneModeValue);
-       TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO),"[%s] __pCamera->SetSceneMode", GetErrorMessage(r));
-
-       r = ReloadAllConfiguration();
-       TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] ReloadAllConfiguration", GetErrorMessage(r));
+       r = LoadDefaultConfiguration();
+       TryCatch((r == E_SUCCESS || r == E_OBJ_ALREADY_EXIST || r == E_OBJ_NOT_FOUND || r == E_UNSUPPORTED_OPERATION), , "[%s] LoadDefaultConfiguration", GetErrorMessage(r));
 
        if (__previewByCallback == 1)
        {
@@ -1661,29 +1407,64 @@ VideoRecorderForm::ResetConfigurationValues(void)
 }
 
 result
-VideoRecorderForm::ReloadAllConfiguration(void)
+VideoRecorderForm::LoadDefaultConfiguration(void)
 {
        result r = E_SUCCESS;
+       CodecType tempAudioCodecType = CODEC_NONE;
+       CodecType tempVideoCodecType = CODEC_NONE;
+       MediaContainerType tempContainerType = MEDIA_CONTAINER_NONE;
 
-       if (__brightnessSliderValue != INIT)
-       {
-               AppLog("SetBrightness __brightnessSliderValue %d",__brightnessSliderValue);
-               r = __pCamera->SetBrightness(__brightnessSliderValue);
-               TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetBrightness", GetErrorMessage(r));
-       }
+       __audioStreamCallbackIndex = DISABLE_AUDIO_STREAM;
+       __isAudioStreamCallback = false;
 
-       if (__contrastSliderValue != INIT)
+       __videoStreamCallbackIndex = DISABLE_AUDIO_STREAM;
+       __isVideoStreamCallback = false;
+
+       if (__isVideoStreamCallback == true)
        {
-               r = __pCamera->SetContrast(__contrastSliderValue);
-               TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetContrast", GetErrorMessage(r));
+               r = __pCamera->AddVideoStreamFilter(*this);
+               TryReturn(r == E_SUCCESS || r == E_OBJ_ALREADY_EXIST, ShowErrorResult(r, METHOD_FILE_LINENO),"[%s] __pVideoRecorder->AddVideoStreamListener", GetErrorMessage(r));
        }
-
-       if (__exposureSliderValue != INIT)
+       else
        {
-               r = __pCamera->SetExposure(__exposureSliderValue);
-               TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetExposure", GetErrorMessage(r));
+               r = __pCamera->RemoveVideoStreamFilter(*this);
+               TryReturn(r == E_SUCCESS || r == E_OBJ_NOT_FOUND, ShowErrorResult(r, METHOD_FILE_LINENO),"[%s] __pVideoRecorder->RemoveVideoStreamListener", GetErrorMessage(r));
        }
 
+       r = __pOverlay->GetBackgroundBufferInfo(__bufferInfo);
+       TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pOverlay->GetBackgroundBufferInfo", GetErrorMessage(r));
+
+       r = __pCamera->SetPreviewResolution(__pCamera->GetPreviewResolution());
+       TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetPreviewResolution", GetErrorMessage(r));
+
+       r = __pCamera->SetPreviewFormat(__pCamera->GetPreviewFormat());
+       TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO),"[%s] __pCamera->SetPreviewFormat", GetErrorMessage(r));
+
+       r = __pCamera->SetPreviewFrameRate(__pCamera->GetPreviewFrameRate());
+       TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetPreviewFrameRate", GetErrorMessage(r));
+
+       r = __pCamera->SetSceneMode(__pCamera->GetSceneMode());
+       TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO),"[%s] __pCamera->SetSceneMode", GetErrorMessage(r));
+
+       __isSceneModeSet = (__pCamera->GetSceneMode() == CAMERA_SCENE_OFF)? false:true;
+
+       r = __pCamera->SetBrightness(__pCamera->GetBrightness());
+       TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetBrightness", GetErrorMessage(r));
+
+       r = __pCamera->SetContrast(__pCamera->GetContrast());
+       TryReturn(r == E_SUCCESS || r == E_UNSUPPORTED_OPERATION, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetContrast", GetErrorMessage(r));
+
+       r = __pCamera->SetExposure(__pCamera->GetExposure());
+       TryReturn(r == E_SUCCESS || r == E_UNSUPPORTED_OPERATION, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->SetExposure", GetErrorMessage(r));
+
+       r = __pVideoRecorder->GetFormat(tempAudioCodecType, tempVideoCodecType, tempContainerType);
+       TryReturn(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pCamera->GetFormat", GetErrorMessage(r));
+
+       __audioCodecIndex = GetIndexFromValue(__pRecorderAudioCodecList, tempAudioCodecType);
+       __videoCodecIndex = GetIndexFromValue(__pRecorderVideoCodecList, tempVideoCodecType);
+       __formatIndex = GetIndexFromValue(__pRecorderVideoContainerList, tempContainerType);
+
+
        return r;
 }
 
@@ -1733,7 +1514,6 @@ VideoRecorderForm::InitCameraRecorder(void)
        bool retVal = true;
        CodecType audioCodec = CODEC_NONE;
        CodecType videoCodec = CODEC_NONE;
-       Tizen::Graphics::Dimension* pResolution = null;
        MediaContainerType container = MEDIA_CONTAINER_NONE;
        String strFileFormat;
        RecordingRotation rotate = RECORDING_ROTATION_NONE;
@@ -1743,10 +1523,7 @@ VideoRecorderForm::InitCameraRecorder(void)
        __filePath.Append(__pConfig->GetString(SECTION_NAME, String(L"filename")));
        __filePath.Append(L".");
 
-       pResolution = static_cast< Dimension* >(__pRecordingResolutionList->GetAt((__camType == CAMERA_PRIMARY) ? __resolutionIndex : __resolutionIndexSec));
-       TryCatch(pResolution != null, ShowErrorResult(E_FAILURE, METHOD_FILE_LINENO), "__pRecordingResolutionList->GetAt failed");
-
-       r = __pVideoRecorder->SetRecordingResolution(*pResolution);
+       r = __pVideoRecorder->SetRecordingResolution(__pVideoRecorder->GetRecordingResolution());
        TryCatch(r == E_SUCCESS, ShowErrorResult(r, METHOD_FILE_LINENO), "[%s] __pVideoRecorder->SetRecordingResolution", GetErrorMessage(r));
 
        r = __pRecorderVideoCodecList->GetAt(__videoCodecIndex, videoCodec);
@@ -1780,7 +1557,7 @@ VideoRecorderForm::InitCameraRecorder(void)
                ReadAudioPreProcessedFile(String(L"PreProcessedAudioPCM"));
        }
 
-       r = __pVideoRecorder->SetQuality(static_cast< RecordingQuality >(__qualityIndex));
+       r = __pVideoRecorder->SetQuality(__pVideoRecorder->GetQuality());
        TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO), "[%s] __pVideoRecorder->SetQuality", GetErrorMessage(r));
 
        __maxRecordingTime = __pConfig->GetInt(DEFAULT_MAXTIME, SECTION_NAME, String(L"maxtime"));
@@ -1811,6 +1588,15 @@ VideoRecorderForm::InitCameraRecorder(void)
                TryCatch(r == E_SUCCESS || r == E_OBJ_NOT_FOUND, ShowError(r, METHOD_FILE_LINENO),"[%s] __pVideoRecorder->RemoveAudioStreamListener", GetErrorMessage(r));
        }
 
+       if (__isVideoStreamCallback == true)
+       {
+               __pCamera->AddVideoStreamFilter(*this);
+       }
+       else
+       {
+               __pCamera->RemoveVideoStreamFilter(*this);
+       }
+
        r = __pVideoRecorder->Record();
        TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO), "[%s] __pVideoRecorder->Record", GetErrorMessage(r));
 
@@ -2622,7 +2408,6 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListViewFrameRate->SetItemChecked", GetErrorMessage(r));
 
                (__camType == CAMERA_PRIMARY) ? __frameRateIndex = index : __frameRateIndexSec = index;
-               (__camType == CAMERA_PRIMARY) ? __pConfig->SetValue(SECTION_NAME, String(L"framerate"), tempVal) : __pConfig->SetValue(SECTION_NAME, String(L"framerateSec"), tempVal); //
        }
        else if (&source == __pListViewRecordingResolution)
        {
@@ -2652,6 +2437,9 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                r = __pCamera->SetPreviewResolution(*pResolution);
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pCamera->SetPreviewResolution", GetErrorMessage(r));
 
+               r = __pVideoRecorder->SetRecordingResolution(*pResolution);
+               TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pVideoRecorder->SetRecordingResolution", GetErrorMessage(r));
+
                r = __pOverlay->GetBackgroundBufferInfo(__bufferInfo);
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pOverlay->GetBackgroundBufferInfo", GetErrorMessage(r));
 
@@ -2670,8 +2458,6 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListViewRecordingResolution->SetItemChecked", GetErrorMessage(r));
 
                (__camType == CAMERA_PRIMARY) ? __resolutionIndex = index : __resolutionIndexSec = index;
-               (__camType == CAMERA_PRIMARY) ? __pConfig->SetValue(SECTION_NAME, String(L"resolutionWidth"), pResolution->width) : __pConfig->SetValue(SECTION_NAME, String(L"resolutionWidthSec"), pResolution->width); //
-               (__camType == CAMERA_PRIMARY) ? __pConfig->SetValue(SECTION_NAME, String(L"resolutionHeight"), pResolution->height) : __pConfig->SetValue(SECTION_NAME, String(L"resolutionHeightSec"), pResolution->height); //
        }
        else if (&source == __pListPreviewFormat)
        {
@@ -2714,7 +2500,6 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListPreviewFormat->SetItemChecked", GetErrorMessage(r));
 
                __previewFormatIndex = index;
-               __pConfig->SetValue(SECTION_NAME, String(L"PreviewFormat"), tempVal);
        }
        else if (&source == __pListViewQuality)
        {
@@ -2731,7 +2516,7 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pListViewQuality->SetItemChecked", GetErrorMessage(r));
 
                __qualityIndex = index;
-               __pConfig->SetValue(SECTION_NAME, String(L"quality"), __qualityIndex);
+               __pVideoRecorder->SetQuality((RecordingQuality) __qualityIndex);
        }
        else if (&source == __pListViewAudioStreamCallback)
        {
@@ -2840,8 +2625,6 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                __videoCodecIndex = index;
                r = __pRecorderVideoCodecList->GetAt(__videoCodecIndex, videoCodec);
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pRecorderVideoCodecList->GetAt", GetErrorMessage(r));
-
-               __pConfig->SetValue(SECTION_NAME, String(L"videocodec"), videoCodec);
        }
        else if (&source == __pListViewAudioCodec)
        {
@@ -2861,8 +2644,6 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                __audioCodecIndex = index;
                r = __pRecorderAudioCodecList->GetAt(__audioCodecIndex, audioCodec);
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pRecorderAudioCodecList->GetAt", GetErrorMessage(r));
-
-               __pConfig->SetValue(SECTION_NAME, String(L"audiocodec"), audioCodec);
        }
        else if (&source == __pListViewFileFormat)
        {
@@ -2882,8 +2663,6 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
                __formatIndex = index;
                r = __pRecorderVideoContainerList->GetAt(__formatIndex, container);
                TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pRecorderVideoContainerList->GetAt", GetErrorMessage(r));
-
-               __pConfig->SetValue(SECTION_NAME, String(L"fileformat"), container);
        }
        else if (&source == __pListViewFlipType)
        {
@@ -3732,12 +3511,15 @@ VideoRecorderForm::CreateRecordingResolution(void)
        ShowPopUp(__pPopupRecordingResolution);
        __pListViewRecordingResolution->Draw();
        __pListViewRecordingResolution->Show();
+       recordingdim = __pVideoRecorder->GetRecordingResolution();
        if (__camType == CAMERA_PRIMARY)
        {
+               __resolutionIndex = GetIndexFromValue(__pRecordingResolutionList, recordingdim);
                __pListViewRecordingResolution->SetItemChecked(__resolutionIndex, true);
        }
        else
        {
+               __resolutionIndexSec = GetIndexFromValue(__pRecordingResolutionList, recordingdim);
                __pListViewRecordingResolution->SetItemChecked(__resolutionIndexSec, true);
        }
        __pListViewRecordingResolution->Draw();
@@ -3807,6 +3589,7 @@ VideoRecorderForm::CreatePreviewFormat(void)
                TryCatch(r == E_SUCCESS, ,"[%s] AddButton - Preview Format", GetErrorMessage(r));
        }
 
+       __previewFormatIndex = GetIndexFromValue(__pPreviewFormatList, __pCamera->GetPreviewFormat());
        TryCatch(__previewFormatIndex != INIT, ,"__previewFormatIndex value is wrong");
 
        ShowPopUp(__pPopupPreviewFormat);
@@ -3902,6 +3685,7 @@ VideoRecorderForm::CreateQuality(void)
                TryCatch(r == E_SUCCESS, ,"[%s] AddButton - Recording Quality", GetErrorMessage(r));
        }
 
+       __qualityIndex = (int) __pVideoRecorder->GetQuality();
        TryCatch(__qualityIndex != INIT, ,"GetIndexFromValue - __qualityIndex");
 
        ShowPopUp(__pPopupRecordingQuality);
@@ -4917,12 +4701,6 @@ VideoRecorderForm::CreateExposureSlider(void)
 
        exposure = __pCamera->GetExposure();
 
-       if (__exposureSliderValue != exposure &&
-               __exposureSliderValue != INIT)
-       {
-               exposure = __exposureSliderValue;
-       }
-
        __pExposureSlider->SetValue(exposure);
        strTemp.Format(50, L"Exposure : %d", exposure);
        __pExposureSlider->SetTitleText(strTemp);
@@ -4968,12 +4746,6 @@ VideoRecorderForm::CreateBrightnessSlider(void)
 
        brightness = __pCamera->GetBrightness();
 
-       if (__brightnessSliderValue != brightness &&
-               __brightnessSliderValue != INIT)
-       {
-               brightness = __brightnessSliderValue;
-       }
-
        __pBrightnessSlider->SetValue(brightness);
        strTemp.Format(50, L"Brightness : %d", brightness);
        __pBrightnessSlider->SetTitleText(strTemp);
@@ -5019,13 +4791,6 @@ VideoRecorderForm::CreateContrastSlider(void)
        }
 
        contrast = __pCamera->GetContrast();
-
-       if (__contrastSliderValue != contrast &&
-               __contrastSliderValue != INIT)
-       {
-               contrast = __contrastSliderValue;
-       }
-
        __pContrastSlider->SetValue(contrast);
        strTemp.Format(50, L"Contrast : %d", contrast);
        __pContrastSlider->SetTitleText(strTemp);
@@ -5851,6 +5616,63 @@ VideoRecorderForm::GetIndexFromValue(Tizen::Base::Collection::IListT< int >* pLi
 }
 
 int
+VideoRecorderForm::GetIndexFromValue(Tizen::Base::Collection::IListT< Tizen::Media::CodecType >* pList, int value) const
+{
+       int count = pList->GetCount();
+       result r = E_SUCCESS;
+       Tizen::Media::CodecType valueInList = CODEC_NONE;
+       for (int index = 0; index < count; index++)
+       {
+               r = pList->GetAt(index, valueInList);
+               if (r == E_SUCCESS && value == valueInList)
+               {
+                       AppLog("matching found at index = %d for value = %d", index, value);
+                       return index;
+               }
+       }
+       AppLog("no matching for value = %d", value);
+       return INIT;
+}
+
+int
+VideoRecorderForm::GetIndexFromValue(Tizen::Base::Collection::IListT< Tizen::Graphics::PixelFormat >* pList, int value) const
+{
+       int count = pList->GetCount();
+       result r = E_SUCCESS;
+       Tizen::Graphics::PixelFormat valueInList = PIXEL_FORMAT_YCbCr420_PLANAR;
+       for (int index = 0; index < count; index++)
+       {
+               r = pList->GetAt(index, valueInList);
+               if (r == E_SUCCESS && value == valueInList)
+               {
+                       AppLog("matching found at index = %d for value = %d", index, value);
+                       return index;
+               }
+       }
+       AppLog("no matching for value = %d", value);
+       return INIT;
+}
+
+int
+VideoRecorderForm::GetIndexFromValue(Tizen::Base::Collection::IListT< Tizen::Media::MediaContainerType >* pList, int value) const
+{
+       int count = pList->GetCount();
+       result r = E_SUCCESS;
+       Tizen::Media::MediaContainerType valueInList = MEDIA_CONTAINER_NONE;
+       for (int index = 0; index < count; index++)
+       {
+               r = pList->GetAt(index, valueInList);
+               if (r == E_SUCCESS && value == valueInList)
+               {
+                       AppLog("matching found at index = %d for value = %d", index, value);
+                       return index;
+               }
+       }
+       AppLog("no matching for value = %d", value);
+       return INIT;
+}
+
+int
 VideoRecorderForm::GetIndexFromValue(Tizen::Base::Collection::IList* pList, Tizen::Graphics::Dimension& value) const
 {
        int count = pList->GetCount();
index 62bc9c9..34ed682 100644 (file)
@@ -178,6 +178,9 @@ private:
        void SetCurrentListViewType(int id);
        int GetIndexFromValue(Tizen::Base::Collection::IListT< int >* pList, int value) const;
        int GetIndexFromValue(Tizen::Base::Collection::IList* pList, Tizen::Graphics::Dimension& value) const;
+       int GetIndexFromValue(Tizen::Base::Collection::IListT< Tizen::Media::CodecType >* pList, int value) const;
+       int GetIndexFromValue(Tizen::Base::Collection::IListT< Tizen::Graphics::PixelFormat >* pList, int value) const;
+       int GetIndexFromValue(Tizen::Base::Collection::IListT< Tizen::Media::MediaContainerType >* pList, int value) const;
        void ShowError(result r, const char* pMethod, const char* pSrcfileName, int lineNo);
        result ShowErrorResult(result r, const char* pMethod, const char* pSrcfileName, int lineNo);
        result CreatePopUp(Popup** pPopupCtrl, String title, Tizen::Graphics::Dimension dimension, bool hasTitle);
@@ -187,7 +190,7 @@ private:
        result AddListView(ListView** pListView, Popup* pPopup, int id);
        void DeletePopup(Popup** pPopup);
        result AddSlider(Slider** pSliderCtrl, int minval, int maxval, String title, Popup* pPopup);
-       result ReloadAllConfiguration(void);
+       result LoadDefaultConfiguration(void);
        void ResetConfigurationValues(void);
        void DeleteAllPopups(void);
        void ResetTimeVariables(void);