SAMCK changes
authorravi.n2 <ravi.n2@samsung.com>
Wed, 15 May 2013 01:25:17 +0000 (06:55 +0530)
committerravi.n2 <ravi.n2@samsung.com>
Wed, 15 May 2013 01:47:33 +0000 (07:17 +0530)
Change-Id: I251fac2a41c098ee28d7c28698878b7cf3a7eb47

inc/CmCameraPresentationModel.h
src/CmCameraPresentationModel.cpp

index 4f2e02a..083396c 100644 (file)
@@ -40,6 +40,7 @@ class CameraPresentationModel
        : public Tizen::Media::ICameraEventListener
        , public Tizen::Media::IVideoRecorderEventListener
        , public Tizen::System::IDeviceEventListener
+        ,public Tizen::Content::IContentScanListener
 {
 public:
        enum CameraMode
@@ -212,6 +213,8 @@ public:
        virtual void OnVideoRecorderStopped(result r);
 
        virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);
+       virtual void OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r);
+
 
 private:
        CameraPresentationModel(void);
@@ -249,6 +252,7 @@ private:
        Tizen::Graphics::Bitmap* __pBitmap;
        Tizen::Base::String __lastestContentName;
        Tizen::Base::String __errorResult;
+       Tizen::Base::String __CurrentVideoFileName;
        int __appControlRequestType;
        Tizen::Ui::OrientationStatus __dir;
        int __cameraMode;
index b4f843d..e276e21 100644 (file)
@@ -291,7 +291,9 @@ CreateThumbnailN(Tizen::Base::String& pFilename, ContentType contentType)
        result r = E_SUCCESS;
 
        contentSearch.Construct(contentType);
+       AppLogDebug("Createthumbnail file name is %ls",pFilename.GetPointer());
        strQuery = MakeQuerybyContentFileName(pFilename);
+       AppLogDebug("strQuery is %ls",strQuery.GetPointer());
 
        pSearchResultList = contentSearch.SearchN(page, MAX_CONTENTSEARCH_COUNTPERPAGE, totalPage, totalCount, strQuery, sortColumn, SORT_ORDER_NONE);
        TryCatch(pSearchResultList != null, r = E_SYSTEM, "pSearchResultList is null");
@@ -533,6 +535,7 @@ CameraPresentationModel::CreateThumbnail(int currentCameraMode)
        __pBitmap = null;
 
        r = GetLatestContentName(currentCameraMode, latestContentName);
+       AppLogDebug("latest content name is %ls",latestContentName.GetPointer());
        TryCatch(r == E_SUCCESS, , "GetLatestContentName() fail[%s]", GetErrorMessage(r));
 
        if (currentCameraMode == CAMERA_MODE_SNAPSHOT)
@@ -546,7 +549,7 @@ CameraPresentationModel::CreateThumbnail(int currentCameraMode)
        }
        else
        {
-               __pBitmap = CreateThumbnailN(latestContentName, CONTENT_TYPE_VIDEO);
+               __pBitmap = CreateThumbnailN(__CurrentVideoFileName,CONTENT_TYPE_VIDEO);
 
                if (latestContentName == L"")
                {
@@ -2344,7 +2347,9 @@ CameraPresentationModel::StartRecord(void)
        r = __pVideoRecorder->SetRecordingRotation(rotate);
        TryCatch(r == E_SUCCESS, , "VideoRecorder::SetRecordingRotation() fail[%s]", GetErrorMessage(r));
 
-       r = __pVideoRecorder->CreateVideoFile(camcorderTemporaryFilePath, true);
+       AppLogDebug("latest file name is %ls",__lastestContentName.GetPointer());
+       r = __pVideoRecorder->CreateVideoFile(__lastestContentName, true);
+       AppLogDebug("create video file result is %ls",GetErrorMessage(r));
        TryCatch(r == E_SUCCESS, , "VideoRecorder::CreateVideoFile() fail[%s]", GetErrorMessage(r));
 
        r = __pVideoRecorder->Record();
@@ -3453,8 +3458,8 @@ CameraPresentationModel::OnVideoRecorderClosed(result r)
 {
        AppLogDebug("ENTER");
        ContentManager* pContentManager = null;
-       VideoContentInfo* videoContentInfo = null;
        ContentId contentId;
+       String replaceFilePath;
        String camcorderTemporaryFilePath;
        int storageType;
        result ret = E_SUCCESS;
@@ -3501,17 +3506,16 @@ CameraPresentationModel::OnVideoRecorderClosed(result r)
                ret = pContentManager->Construct();
                TryCatch(ret == E_SUCCESS, , "ContentManager->Construct() failed(%s)", GetErrorMessage(r));
 
-               contentId = pContentManager->CreateContent(camcorderTemporaryFilePath, __lastestContentName, true);
-               TryCatch(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
-
-               videoContentInfo = static_cast<VideoContentInfo*>(pContentManager->GetContentInfoN(contentId));
-               TryCatch(videoContentInfo != null, , "videoContentInfo is null");
+               r = ContentManager::ScanFile(__lastestContentName);
+               __CurrentVideoFileName = __lastestContentName;
+               replaceFilePath =  Environment::GetMediaPath();
+               replaceFilePath.Append(STRING_CAMERA_FOLDER_NAME);
+               replaceFilePath.Append("/");
+               AppLogDebug("Replace filepath is %ls",replaceFilePath.GetPointer());
+               __CurrentVideoFileName.Replace(replaceFilePath,"");
+               AppLogDebug("__CurrentVideoFileName path is %ls",__CurrentVideoFileName.GetPointer());
 
-               delete __pBitmap;
-               __pBitmap = null;
-
-               __pBitmap = videoContentInfo->GetThumbnailN();
-               TryCatch(__pBitmap != null, , "__pBitmap is null");
+               __pBitmap = CreateThumbnailN(__CurrentVideoFileName,CONTENT_TYPE_VIDEO);
 
                SetAppControlRequestType(APP_CONTROL_REQUEST_TYPE_SUCCEEDED);
 
@@ -3536,8 +3540,8 @@ CATCH:
        delete pContentManager;
        pContentManager = null;
 
-       delete videoContentInfo;
-       videoContentInfo = null;
+       //delete videoContentInfo;
+       //videoContentInfo = null;
 
        delete __pBitmap;
        __pBitmap = null;
@@ -3993,3 +3997,13 @@ CameraPresentationModel::GetRecordingRotation(void)
        AppLogDebug("EXIT");
        return rotate;
 }
+
+void
+CameraPresentationModel::OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r)
+{
+ AppLogDebug("Enter");
+ AppLogDebug("Exit");
+}
+
+
+