N_SE-39643 N_SE-39627
authorabhismita ghosh <g.abhismita@samsung.com>
Thu, 30 May 2013 15:49:36 +0000 (21:19 +0530)
committerabhismita ghosh <g.abhismita@samsung.com>
Thu, 30 May 2013 15:58:11 +0000 (21:28 +0530)
Change-Id: I897fa61aef53a36d3f0d1e77fa88f808b739a36b

src/VpMainFrame.cpp
src/VpVideoPlayerForm.cpp

index 471bcf8..2541c5f 100755 (executable)
@@ -84,9 +84,11 @@ MainFrame::OnFrameActivated(const Frame& source)
 
        if (pVideoPlayerPresentationModel != null)
        {
-               if (pVideoPlayerPresentationModel->GetState() == PLAYER_STATE_PAUSED
-                       || pVideoPlayerPresentationModel->GetState() == PLAYER_STATE_ENDOFCLIP
-                       || pVideoPlayerPresentationModel->GetState() == PLAYER_STATE_CLOSED)
+               PlayerState playState = PLAYER_STATE_ERROR;
+               playState = pVideoPlayerPresentationModel->GetState();
+
+               if (playState == PLAYER_STATE_PAUSED || playState == PLAYER_STATE_ENDOFCLIP
+                       || playState == PLAYER_STATE_CLOSED || playState == PLAYER_STATE_STOPPED)
                {
                        VideoPlayerForm* pForm = static_cast<VideoPlayerForm*>(GetCurrentForm());
                        if (pForm != null)
@@ -94,6 +96,10 @@ MainFrame::OnFrameActivated(const Frame& source)
                                pForm->ShowControlByFrameActivated();
                        }
                }
+               else
+               {
+                       pVideoPlayerPresentationModel->StartPlay();
+               }
        }
 
        result r = PowerManager::KeepScreenOnState(true, false);
index a3942b1..83d6e90 100755 (executable)
@@ -134,12 +134,26 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode, bool destroyOverlay)
 
        Rectangle clientRect = GetClientAreaBounds();
 
+       RecordingRotation recRotation = RECORDING_ROTATION_NONE;
+       VideoFrameExtractor extractor;
+       r = extractor.Construct(__pVideoPlayerPresentationModel->GetMediaPathName(), MEDIA_PIXEL_FORMAT_RGB565LE);
+       if (r == E_SUCCESS)
+       {
+               recRotation = extractor.GetRecordingRotation();
+       }
+
        switch (mode)
        {
        case SCREEN_MODE_NORMAL:
                {
                        Rectangle rect = Rectangle(X_NORMAL, Y_NORMAL, W_NORMAL, H_NORMAL);
 
+                       if(recRotation == RECORDING_ROTATION_90 || recRotation == RECORDING_ROTATION_270)
+                       {
+                               rect.width = H_NORMAL;
+                               rect.height = W_NORMAL;
+                       }
+
                        if ((clientRect.width - rect.width) <= X_BASE)
                        {
                                rect.x = X_BASE;
@@ -158,7 +172,7 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode, bool destroyOverlay)
                                rect.y = (clientRect.height - rect.height) / DIVIDE_BY_TWO;
                        }
 
-                       AppLogDebug("SCREEN_MODE_NORMAL : [%d][%d][%d][%d]", rect.x, rect.y, rect.width, rect.height);
+                       AppLogDebug("SCREEN_MODE_NORMAL : [%d][%d][%d][%d][rotation:%d]", rect.x, rect.y, rect.width, rect.height, recRotation);
 
                        if (destroyOverlay == true)
                        {
@@ -193,7 +207,7 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode, bool destroyOverlay)
                {
                        Rectangle rect = Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height);
 
-                       AppLogDebug("SCREEN_MODE_FULL : [%d][%d][%d][%d]", rect.x, rect.y, rect.width, rect.height);
+                       AppLogDebug("SCREEN_MODE_FULL : [%d][%d][%d][%d][rotation:%d]", rect.x, rect.y, rect.width, rect.height, recRotation);
 
                        if (destroyOverlay == true)
                        {
@@ -229,9 +243,17 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode, bool destroyOverlay)
 
        case SCREEN_MODE_FIT:
                {
-                       Rectangle rect = __pVideoPlayerPresentationModel->GetVideoInfoN(
+                       Rectangle videoRect = __pVideoPlayerPresentationModel->GetVideoInfoN(
                                        __pVideoPlayerPresentationModel->GetMediaPathName());
 
+                       Rectangle rect(0, 0, videoRect.width, videoRect.height);
+
+                       if(recRotation == RECORDING_ROTATION_90 || recRotation == RECORDING_ROTATION_270)
+                       {
+                               rect.width = videoRect.height;
+                               rect.height = videoRect.width;
+                       }
+
                        if ((clientRect.width - rect.width) <= X_BASE)
                        {
                                rect.x = X_BASE;
@@ -250,7 +272,7 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode, bool destroyOverlay)
                                rect.y = (clientRect.height - rect.height) / DIVIDE_BY_TWO;
                        }
 
-                       AppLogDebug("SCREEN_MODE_FIT : [%d][%d][%d][%d]", rect.x, rect.y, rect.width, rect.height);
+                       AppLogDebug("SCREEN_MODE_FIT : [%d][%d][%d][%d][rotation:%d]", rect.x, rect.y, rect.width, rect.height, recRotation);
 
                        if (destroyOverlay == true)
                        {
@@ -308,12 +330,12 @@ VideoPlayerForm::OnInitializing(void)
        __pAudioRouteManager = AudioRouteManager::GetInstance();
        __pAudioRouteManager->SetAudioRouteEventListener(this);
 
-       r = SetScreenMode(SCREEN_MODE_NORMAL, true);
-       TryCatch(r == E_SUCCESS, , "SetScreenMode() failed:%s", GetErrorMessage(r));
-
        __pVideoPlayerPresentationModel = VideoPlayerPresentationModel::GetInstance();
        TryCatch(__pVideoPlayerPresentationModel != null, r = E_SYSTEM, "__pVideoPlayerPresentationModel is null");
 
+       r = SetScreenMode(SCREEN_MODE_NORMAL, true);
+       TryCatch(r == E_SUCCESS, , "SetScreenMode() failed:%s", GetErrorMessage(r));
+
        __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel);
 
        r = __pVideoPlayerPresentationModel->InitializePlayer();
@@ -509,26 +531,13 @@ VideoPlayerForm::OnTerminating(void)
 void
 VideoPlayerForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
 {
-       result r = E_FAILURE;
-
        AppLogDebug("OnSceneActivatedN");
 
        TryReturnVoid(__pVideoPlayerPresentationModel != null, "__pVideoPlayerPresentationModel is null");
 
-       String totalTime;
-
        CheckCallStatus();
        CheckLowBatteryStatus();
 
-       r = __pVideoPlayerPresentationModel->StartPlay();
-       TryReturnVoid(r == E_SUCCESS, "__pVideoPlayerPresentationModel->StartPlay() failed:%s", GetErrorMessage(r));
-
-       GetTotalTime(totalTime);
-       AppLogDebug("totalTime [%ls]", totalTime.GetPointer());
-
-       __pTotalTimeLabel->SetText(totalTime);
-       __pTotalTimeLabel->Invalidate(true);
-
        SetScreenModeButtonImage();
 }