From 1b71f63c22ee4b5112bd77e5bec05f6981b153e0 Mon Sep 17 00:00:00 2001 From: HyukSoon Choi Date: Mon, 18 Mar 2013 14:38:57 +0900 Subject: [PATCH] Merge with master Change-Id: I868af3e17d8a28977b42b72ca1b02da7ab3caaa5 Signed-off-by: HyukSoon Choi --- inc/VpVideoPlayerForm.h | 5 +- inc/VpVideoPlayerPresentationModel.h | 10 +- res/screen-size-normal/IDL_MAIN_FORM.xml | 20 +- src/VpSoundPathPopup.cpp | 4 +- src/VpTypes.cpp | 8 +- src/VpVideoPlayerForm.cpp | 700 ++++++++++++++++--------------- src/VpVideoPlayerPresentationModel.cpp | 41 +- 7 files changed, 424 insertions(+), 364 deletions(-) diff --git a/inc/VpVideoPlayerForm.h b/inc/VpVideoPlayerForm.h index f1e899e..93def11 100644 --- a/inc/VpVideoPlayerForm.h +++ b/inc/VpVideoPlayerForm.h @@ -139,8 +139,7 @@ private: }; friend void DestroyPresentationModelInstance(void); - result SetScreenMode(const ScreenMode mode); - Tizen::Ui::Controls::OverlayRegion* GetOverlayRegion(void); + result SetScreenMode(const ScreenMode mode, bool destroyOverlay); void UpdateProgressBar(const int currentPlayTime); void InitTimer(void); void ChangedControlPos(void); @@ -157,7 +156,7 @@ private: void InitAudioRouteList(void); private: - Tizen::Ui::Controls::OverlayRegion* __pOverlayRegion; + Tizen::Ui::Controls::OverlayPanel* __pOverlayPanel; ScreenMode __screenMode; SoundPathPopup* __pSoundPathPopup; Tizen::Base::Runtime::Timer* __pUiControlTimer; diff --git a/inc/VpVideoPlayerPresentationModel.h b/inc/VpVideoPlayerPresentationModel.h index 66e37d3..a9aa12d 100644 --- a/inc/VpVideoPlayerPresentationModel.h +++ b/inc/VpVideoPlayerPresentationModel.h @@ -1,4 +1,4 @@ -// +// // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Flora License, Version 1.0 (the License); @@ -16,7 +16,7 @@ /** * @file VpVideoPlayerPresentationModel.h - * @brief This is the header file for PresentationModel class. + * @brief This is the header file for VideoPlayerPresentationModel class. */ #ifndef _VP_VIDEO_PLAYER_PRESENTATION_MODEL_H_ @@ -55,7 +55,8 @@ public: result SeekTo(long msTime); void SetVideoPlayerEventListener(IVideoPlayerEventListener* pPlayerListener); - void SetOverlayRegion(Tizen::Ui::Controls::OverlayRegion* pOverlay); + void SetOverlayPanel(Tizen::Ui::Controls::OverlayPanel* pOverlay); + void SetPlayerBuffer(const Tizen::Graphics::BufferInfo& bufferInfo); Tizen::Base::String GetMediaPathName(void) const; int GetMediaCount(void) const; @@ -100,7 +101,8 @@ private: static VideoPlayerPresentationModel* __pVideoPlayerPresentationModel; Tizen::Media::Player* __pPlayer; IVideoPlayerEventListener* __pVideoPlayerEventListener; - Tizen::Ui::Controls::OverlayRegion* __pOverlayRegion; + Tizen::Ui::Controls::OverlayPanel* __pOverlayPanel; + Tizen::Base::Collection::ArrayList* __pMediaPathArrayList; Tizen::Base::Runtime::Timer* __pTimer; Tizen::Base::Runtime::Timer* __pFastForwardTimer; diff --git a/res/screen-size-normal/IDL_MAIN_FORM.xml b/res/screen-size-normal/IDL_MAIN_FORM.xml index 6328f13..710bd6a 100644 --- a/res/screen-size-normal/IDL_MAIN_FORM.xml +++ b/res/screen-size-normal/IDL_MAIN_FORM.xml @@ -18,7 +18,7 @@ - - + + diff --git a/src/VpSoundPathPopup.cpp b/src/VpSoundPathPopup.cpp index e8b76bc..6ad276d 100644 --- a/src/VpSoundPathPopup.cpp +++ b/src/VpSoundPathPopup.cpp @@ -1,4 +1,4 @@ -// +// // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Flora License, Version 1.0 (the License); @@ -16,7 +16,7 @@ /** * @file VpSoundPathPopup.cpp - * @brief This is the header file for SoundPathPopup class. + * @brief This is the implementation file for SoundPathPopup class. */ #include "VpSoundPathPopup.h" diff --git a/src/VpTypes.cpp b/src/VpTypes.cpp index 1aeb03b..196c77b 100644 --- a/src/VpTypes.cpp +++ b/src/VpTypes.cpp @@ -1,4 +1,4 @@ -// +// // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Flora License, Version 1.0 (the License); @@ -15,8 +15,8 @@ // /** - * @file VpTypes.cpp - * @brief This is the header file for Types definition. + * @file VpTypes.cpp + * @brief This is the implementation file for Types definition. */ #include "VpTypes.h" @@ -37,4 +37,4 @@ const wchar_t* IDS_COM_OPT_SPEAKER_ABB = L"IDS_COM_OPT_SPEAKER_ABB"; const wchar_t* IDS_COM_OPT_HEADPHONES_ABB = L"IDS_COM_OPT_HEADPHONES_ABB"; const wchar_t* IDS_COM_POP_CLOSE = L"IDS_COM_POP_CLOSE"; const wchar_t* IDS_COM_POP_UNSUPPORTED_FILE_TYPE = L"IDS_COM_POP_UNSUPPORTED_FILE_TYPE"; -const wchar_t* IDS_VPL_POP_UNABLE_TO_PLAY_VIDEO_ERROR_OCCURRED = L"IDS_VPL_POP_UNABLE_TO_PLAY_VIDEO_ERROR_OCCURRED"; +const wchar_t* IDS_VPL_POP_UNABLE_TO_PLAY_VIDEO_ERROR_OCCURRED = L"IDS_VPL_POP_UNABLE_TO_PLAY_VIDEO_ERROR_OCCURRED"; \ No newline at end of file diff --git a/src/VpVideoPlayerForm.cpp b/src/VpVideoPlayerForm.cpp index bbfb1f3..e7db4ac 100644 --- a/src/VpVideoPlayerForm.cpp +++ b/src/VpVideoPlayerForm.cpp @@ -1,4 +1,4 @@ -// +// // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Flora License, Version 1.0 (the License); @@ -16,7 +16,7 @@ /** * @file VpVideoPlayerForm.cpp - * @brief This is the implementation file for VideoPlayerMainForm class. + * @brief This is the implementation file for VideoPlayerForm class. */ #include @@ -53,23 +53,193 @@ static const int X_BASE = 0; static const int Y_BASE = 0; static const int DIVIDE_BY_TWO = 2; -static const int MARGIN_PORTRAIT_SLIDER = 42; -static const int MARGIN_LANDSCAPE_SLIDER = 40; - static const int X_NORMAL = 0; static const int Y_NORMAL = 310; static const int W_NORMAL = 720; static const int H_NORMAL = 432; -static const int WVGA_W_FULL = 1200; -static const int WVGA_X_FASTREWIND_BTN = 216; -static const int WVGA_X_PLAYPAUSE_BTN = 532; -static const int WVGA_X_BACK_BTN = 1049; -static const int WVGA_X_CURRENT_TIME_LABEL = 10; -static const int WVGA_X_TOTAL_TIME_LABEL = 1068; -static const int WVGA_X_SLIDER = 124; -static const int WVGA_X_VERTICAL_LEFT_LINE = 182; -static const int WVGA_X_VERTICAL_RIGHT_LINE = 1036; +static const int W_WVGA_PORTRAIT_HEIGHT = 1200; +static const int W_WVGA_LANDSCAPE_WIDTH = 1200; + +static const int X_WVGA_PORTRAIT_CONTROLLER = 0; +static const int Y_WVGA_PORTRAIT_CONTROLLER = 974; +static const int W_WVGA_PORTRAIT_CONTROLLER = 720; +static const int H_WVGA_PORTRAIT_CONTROLLER = 226; +static const int X_WVGA_PORTRAIT_FIRST_LINE = 0; +static const int Y_WVGA_PORTRAIT_FIRST_LINE = 973; +static const int W_WVGA_PORTRAIT_FIRST_LINE = 720; +static const int H_WVGA_PORTRAIT_FIRST_LINE = 1; +static const int X_WVGA_PORTRAIT_CURRENT_TIME = 10; +static const int Y_WVGA_PORTRAIT_CURRENT_TIME = 1016; +static const int W_WVGA_PORTRAIT_CURRENT_TIME = 130; +static const int H_WVGA_PORTRAIT_CURRENT_TIME = 28; +static const int X_WVGA_PORTRAIT_SLIDER = 136; +static const int Y_WVGA_PORTRAIT_SLIDER = 974; +static const int W_WVGA_PORTRAIT_SLIDER = 460; +static const int H_WVGA_PORTRAIT_SLIDER = 112; +static const int X_WVGA_PORTRAIT_TOTAL_TIME = 580; +static const int Y_WVGA_PORTRAIT_TOTAL_TIME = 1016; +static const int W_WVGA_PORTRAIT_TOTAL_TIME = 130; +static const int H_WVGA_PORTRAIT_TOTAL_TIME = 28; +static const int X_WVGA_PORTRAIT_VERTICAL_LEFT_LINE = 136; +static const int Y_WVGA_PORTRAIT_VERTICAL_LEFT_LINE = 1086; +static const int W_WVGA_PORTRAIT_VERTICAL_LEFT_LINE = 1; +static const int H_WVGA_PORTRAIT_VERTICAL_LEFT_LINE = 114; +static const int X_WVGA_PORTRAIT_FASTREWIND_BTN = 148; +static const int Y_WVGA_PORTRAIT_FASTREWIND_BTN = 1086; +static const int W_WVGA_PORTRAIT_FASTREWIND_BTN = 136; +static const int H_WVGA_PORTRAIT_FASTREWIND_BTN = 114; +static const int X_WVGA_PORTRAIT_PLAYPAUSE_BTN = 292; +static const int Y_WVGA_PORTRAIT_PLAYPAUSE_BTN = 1086; +static const int W_WVGA_PORTRAIT_PLAYPAUSE_BTN = 136; +static const int H_WVGA_PORTRAIT_PLAYPAUSE_BTN = 114; +static const int X_WVGA_PORTRAIT_FASTFORWARD_BTN = 436; +static const int Y_WVGA_PORTRAIT_FASTFORWARD_BTN = 1086; +static const int W_WVGA_PORTRAIT_FASTFORWARD_BTN = 136; +static const int H_WVGA_PORTRAIT_FASTFORWARD_BTN = 114; +static const int X_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 584; +static const int Y_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 1086; +static const int W_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 1; +static const int H_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 114; +static const int X_WVGA_PORTRAIT_BACK_BTN = 584; +static const int Y_WVGA_PORTRAIT_BACK_BTN = 1086; +static const int W_WVGA_PORTRAIT_BACK_BTN = 136; +static const int H_WVGA_PORTRAIT_BACK_BTN = 114; + +static const int X_WVGA_LANDSCAPE_CONTROLLER = 0; +static const int Y_WVGA_LANDSCAPE_CONTROLLER = 494; +static const int W_WVGA_LANDSCAPE_CONTROLLER = 1200; +static const int H_WVGA_LANDSCAPE_CONTROLLER = 226; +static const int X_WVGA_LANDSCAPE_FIRST_LINE = 0; +static const int Y_WVGA_LANDSCAPE_FIRST_LINE = 493; +static const int W_WVGA_LANDSCAPE_FIRST_LINE = 1200; +static const int H_WVGA_LANDSCAPE_FIRST_LINE = 1; +static const int X_WVGA_LANDSCAPE_CURRENT_TIME = 20; +static const int Y_WVGA_LANDSCAPE_CURRENT_TIME = 537; +static const int W_WVGA_LANDSCAPE_CURRENT_TIME = 130; +static const int H_WVGA_LANDSCAPE_CURRENT_TIME = 26; +static const int X_WVGA_LANDSCAPE_SLIDER = 140; +static const int Y_WVGA_LANDSCAPE_SLIDER = 494; +static const int W_WVGA_LANDSCAPE_SLIDER = 940; +static const int H_WVGA_LANDSCAPE_SLIDER = 112; +static const int X_WVGA_LANDSCAPE_TOTAL_TIME = 1060; +static const int Y_WVGA_LANDSCAPE_TOTAL_TIME = 537; +static const int W_WVGA_LANDSCAPE_TOTAL_TIME = 130; +static const int H_WVGA_LANDSCAPE_TOTAL_TIME = 26; +static const int X_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 212; +static const int Y_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 606; +static const int W_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 2; +static const int H_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 114; +static const int X_WVGA_LANDSCAPE_FASTREWIND_BTN = 236; +static const int Y_WVGA_LANDSCAPE_FASTREWIND_BTN = 606; +static const int W_WVGA_LANDSCAPE_FASTREWIND_BTN = 136; +static const int H_WVGA_LANDSCAPE_FASTREWIND_BTN = 114; +static const int X_WVGA_LANDSCAPE_PLAYPAUSE_BTN = 552; +static const int Y_WVGA_LANDSCAPE_PLAYPAUSE_BTN = 606; +static const int W_WVGA_LANDSCAPE_PLAYPAUSE_BTN = 136; +static const int H_WVGA_LANDSCAPE_PLAYPAUSE_BTN = 114; +static const int X_WVGA_LANDSCAPE_FASTFORWARD_BTN = 858; +static const int Y_WVGA_LANDSCAPE_FASTFORWARD_BTN = 606; +static const int W_WVGA_LANDSCAPE_FASTFORWARD_BTN = 136; +static const int H_WVGA_LANDSCAPE_FASTFORWARD_BTN = 114; +static const int X_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 1016; +static const int Y_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 606; +static const int W_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 2; +static const int H_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 114; +static const int X_WVGA_LANDSCAPE_BACK_BTN = 1064; +static const int Y_WVGA_LANDSCAPE_BACK_BTN = 606; +static const int W_WVGA_LANDSCAPE_BACK_BTN = 136; +static const int H_WVGA_LANDSCAPE_BACK_BTN = 114; + +static const int X_HVGA_PORTRAIT_CONTROLLER = 0; +static const int Y_HVGA_PORTRAIT_CONTROLLER = 1054; +static const int W_HVGA_PORTRAIT_CONTROLLER = 720; +static const int H_HVGA_PORTRAIT_CONTROLLER = 226; +static const int X_HVGA_PORTRAIT_FIRST_LINE = 0; +static const int Y_HVGA_PORTRAIT_FIRST_LINE = 1053; +static const int W_HVGA_PORTRAIT_FIRST_LINE = 720; +static const int H_HVGA_PORTRAIT_FIRST_LINE = 1; +static const int X_HVGA_PORTRAIT_CURRENT_TIME = 10; +static const int Y_HVGA_PORTRAIT_CURRENT_TIME = 1096; +static const int W_HVGA_PORTRAIT_CURRENT_TIME = 130; +static const int H_HVGA_PORTRAIT_CURRENT_TIME = 28; +static const int X_HVGA_PORTRAIT_SLIDER = 136; +static const int Y_HVGA_PORTRAIT_SLIDER = 1054; +static const int W_HVGA_PORTRAIT_SLIDER = 460; +static const int H_HVGA_PORTRAIT_SLIDER = 112; +static const int X_HVGA_PORTRAIT_TOTAL_TIME = 580; +static const int Y_HVGA_PORTRAIT_TOTAL_TIME = 1096; +static const int W_HVGA_PORTRAIT_TOTAL_TIME = 130; +static const int H_HVGA_PORTRAIT_TOTAL_TIME = 28; +static const int X_HVGA_PORTRAIT_VERTICAL_LEFT_LINE = 136; +static const int Y_HVGA_PORTRAIT_VERTICAL_LEFT_LINE = 1166; +static const int W_HVGA_PORTRAIT_VERTICAL_LEFT_LINE = 1; +static const int H_HVGA_PORTRAIT_VERTICAL_LEFT_LINE = 114; +static const int X_HVGA_PORTRAIT_FASTREWIND_BTN = 148; +static const int Y_HVGA_PORTRAIT_FASTREWIND_BTN = 1166; +static const int W_HVGA_PORTRAIT_FASTREWIND_BTN = 136; +static const int H_HVGA_PORTRAIT_FASTREWIND_BTN = 114; +static const int X_HVGA_PORTRAIT_PLAYPAUSE_BTN = 292; +static const int Y_HVGA_PORTRAIT_PLAYPAUSE_BTN = 1166; +static const int W_HVGA_PORTRAIT_PLAYPAUSE_BTN = 136; +static const int H_HVGA_PORTRAIT_PLAYPAUSE_BTN = 114; +static const int X_HVGA_PORTRAIT_FASTFORWARD_BTN = 436; +static const int Y_HVGA_PORTRAIT_FASTFORWARD_BTN = 1166; +static const int W_HVGA_PORTRAIT_FASTFORWARD_BTN = 136; +static const int H_HVGA_PORTRAIT_FASTFORWARD_BTN = 114; +static const int X_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 584; +static const int Y_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 1166; +static const int W_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 1; +static const int H_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE = 114; +static const int X_HVGA_PORTRAIT_BACK_BTN = 584; +static const int Y_HVGA_PORTRAIT_BACK_BTN = 1166; +static const int W_HVGA_PORTRAIT_BACK_BTN = 136; +static const int H_HVGA_PORTRAIT_BACK_BTN = 114; + +static const int X_HVGA_LANDSCAPE_CONTROLLER = 0; +static const int Y_HVGA_LANDSCAPE_CONTROLLER = 494; +static const int W_HVGA_LANDSCAPE_CONTROLLER = 1280; +static const int H_HVGA_LANDSCAPE_CONTROLLER = 226; +static const int X_HVGA_LANDSCAPE_FIRST_LINE = 0; +static const int Y_HVGA_LANDSCAPE_FIRST_LINE = 493; +static const int W_HVGA_LANDSCAPE_FIRST_LINE = 1280; +static const int H_HVGA_LANDSCAPE_FIRST_LINE = 1; +static const int X_HVGA_LANDSCAPE_CURRENT_TIME = 20; +static const int Y_HVGA_LANDSCAPE_CURRENT_TIME = 537; +static const int W_HVGA_LANDSCAPE_CURRENT_TIME = 130; +static const int H_HVGA_LANDSCAPE_CURRENT_TIME = 26; +static const int X_HVGA_LANDSCAPE_SLIDER = 160; +static const int Y_HVGA_LANDSCAPE_SLIDER = 494; +static const int W_HVGA_LANDSCAPE_SLIDER = 960; +static const int H_HVGA_LANDSCAPE_SLIDER = 112; +static const int X_HVGA_LANDSCAPE_TOTAL_TIME = 1130; +static const int Y_HVGA_LANDSCAPE_TOTAL_TIME = 537; +static const int W_HVGA_LANDSCAPE_TOTAL_TIME = 130; +static const int H_HVGA_LANDSCAPE_TOTAL_TIME = 26; +static const int X_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 212; +static const int Y_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 606; +static const int W_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 2; +static const int H_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE = 114; +static const int X_HVGA_LANDSCAPE_FASTREWIND_BTN = 286; +static const int Y_HVGA_LANDSCAPE_FASTREWIND_BTN = 606; +static const int W_HVGA_LANDSCAPE_FASTREWIND_BTN = 136; +static const int H_HVGA_LANDSCAPE_FASTREWIND_BTN = 114; +static const int X_HVGA_LANDSCAPE_PLAYPAUSE_BTN = 572; +static const int Y_HVGA_LANDSCAPE_PLAYPAUSE_BTN = 606; +static const int W_HVGA_LANDSCAPE_PLAYPAUSE_BTN = 136; +static const int H_HVGA_LANDSCAPE_PLAYPAUSE_BTN = 114; +static const int X_HVGA_LANDSCAPE_FASTFORWARD_BTN = 858; +static const int Y_HVGA_LANDSCAPE_FASTFORWARD_BTN = 606; +static const int W_HVGA_LANDSCAPE_FASTFORWARD_BTN = 136; +static const int H_HVGA_LANDSCAPE_FASTFORWARD_BTN = 114; +static const int X_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 1066; +static const int Y_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 606; +static const int W_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 2; +static const int H_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE = 114; +static const int X_HVGA_LANDSCAPE_BACK_BTN = 1144; +static const int Y_HVGA_LANDSCAPE_BACK_BTN = 606; +static const int W_HVGA_LANDSCAPE_BACK_BTN = 136; +static const int H_HVGA_LANDSCAPE_BACK_BTN = 114; static const int COLOR_THUMB_RED = 0; static const int COLOR_THUMB_GREEN = 0; @@ -91,7 +261,7 @@ void DestroyPresentationModelInstance(void) } VideoPlayerForm::VideoPlayerForm(void) - : __pOverlayRegion(null) + : __pOverlayPanel(null) , __screenMode(SCREEN_MODE_NORMAL) , __pSoundPathPopup(null) , __pUiControlTimer(null) @@ -134,15 +304,12 @@ VideoPlayerForm::Initialize(void) } result -VideoPlayerForm::SetScreenMode(const ScreenMode mode) +VideoPlayerForm::SetScreenMode(const ScreenMode mode, bool destroyOverlay) { result r = E_SUCCESS; Rectangle clientRect = GetClientAreaBounds(); - delete __pOverlayRegion; - __pOverlayRegion = null; - switch (mode) { case SCREEN_MODE_NORMAL: @@ -169,12 +336,33 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode) rect.y = (clientRect.height - rect.height) / DIVIDE_BY_TWO; } - __pOverlayRegion->EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, rect, modified); + if (destroyOverlay == true) + { + if (__pOverlayPanel != null) + { + __pOverlayPanel->RemoveTouchEventListener(*this); + RemoveControl(*__pOverlayPanel); + __pOverlayPanel = null; + } + + __pOverlayPanel = new (std::nothrow) OverlayPanel(); + r = __pOverlayPanel->Construct(rect); + TryCatch(r == E_SUCCESS, , "__pOverlayPanel->Construct() failed:%s", GetErrorMessage(r)); - AppLogDebug("SetScreenMode [%d] [%d]", rect.height, rect.width); + r = AddControl(*__pOverlayPanel); + TryCatch(r == E_SUCCESS, , "AddControl(*__pOverlayPanel) failed:%s", GetErrorMessage(r)); - __pOverlayRegion = GetOverlayRegionN(rect, OVERLAY_REGION_TYPE_NORMAL); - TryCatch(__pOverlayRegion != null, r = E_SYSTEM, "__pOverlayRegion is null"); + __pOverlayPanel->AddTouchEventListener(*this); + } + else + { + __pOverlayPanel->SetBounds(rect); + } + + OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, rect, modified); + AppLogDebug("SCREEN_MODE_NORMAL : [%d][%d][%d][%d]", rect.x, rect.y, rect.width, rect.height); + + SetControlAlwaysAtBottom(*__pOverlayPanel, true); __screenMode = SCREEN_MODE_NORMAL; } @@ -185,13 +373,35 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode) bool modified = false; Rectangle rect = Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height); + AppLogDebug("SetScreenMode [%d] [%d]", rect.height, rect.width); - __pOverlayRegion->EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, rect, modified); + if (destroyOverlay == true) + { + if (__pOverlayPanel != null) + { + __pOverlayPanel->RemoveTouchEventListener(*this); + RemoveControl(*__pOverlayPanel); + __pOverlayPanel = null; + } - AppLogDebug("SetScreenMode [%d] [%d]", rect.height, rect.width); + __pOverlayPanel = new (std::nothrow) OverlayPanel(); + r = __pOverlayPanel->Construct(rect); + TryCatch(r == E_SUCCESS, , "__pOverlayPanel->Construct() failed:%s", GetErrorMessage(r)); + + r = AddControl(*__pOverlayPanel); + TryCatch(r == E_SUCCESS, , "AddControl(*__pOverlayPanel) failed:%s", GetErrorMessage(r)); - __pOverlayRegion = GetOverlayRegionN(rect, OVERLAY_REGION_TYPE_NORMAL); - TryCatch(__pOverlayRegion != null, r = E_SYSTEM, "__pOverlayRegion is null"); + __pOverlayPanel->AddTouchEventListener(*this); + } + else + { + __pOverlayPanel->SetBounds(rect); + } + + OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, rect, modified); + AppLogDebug("SCREEN_MODE_FULL : [%d][%d][%d][%d]", rect.x, rect.y, rect.width, rect.height); + + SetControlAlwaysAtBottom(*__pOverlayPanel, true); __screenMode = SCREEN_MODE_FULL; } @@ -222,12 +432,33 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode) rect.y = (clientRect.height - rect.height) / DIVIDE_BY_TWO; } - __pOverlayRegion->EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, rect, modified); + if (destroyOverlay == true) + { + if (__pOverlayPanel != null) + { + __pOverlayPanel->RemoveTouchEventListener(*this); + RemoveControl(*__pOverlayPanel); + __pOverlayPanel = null; + } - AppLogDebug("SetScreenMode [%d] [%d]", rect.height, rect.width); + __pOverlayPanel = new (std::nothrow) OverlayPanel(); + r = __pOverlayPanel->Construct(rect); + TryCatch(r == E_SUCCESS, , "__pOverlayPanel->Construct() failed:%s", GetErrorMessage(r)); - __pOverlayRegion = GetOverlayRegionN(rect, OVERLAY_REGION_TYPE_NORMAL); - TryCatch(__pOverlayRegion != null, r = E_SYSTEM, "__pOverlayRegion is null"); + r = AddControl(*__pOverlayPanel); + TryCatch(r == E_SUCCESS, , "AddControl(*__pOverlayPanel) failed:%s", GetErrorMessage(r)); + + __pOverlayPanel->AddTouchEventListener(*this); + } + else + { + __pOverlayPanel->SetBounds(rect); + } + + OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, rect, modified); + AppLogDebug("SCREEN_MODE_FULL : [%d][%d][%d][%d]", rect.x, rect.y, rect.width, rect.height); + + SetControlAlwaysAtBottom(*__pOverlayPanel, true); __screenMode = SCREEN_MODE_FIT; } @@ -240,8 +471,8 @@ VideoPlayerForm::SetScreenMode(const ScreenMode mode) return r; CATCH: - delete __pOverlayRegion; - __pOverlayRegion = null; + RemoveControl(*__pOverlayPanel); + __pOverlayPanel = null; __screenMode = SCREEN_MODE_NORMAL; return r; @@ -272,12 +503,12 @@ VideoPlayerForm::OnInitializing(void) __pAudioRouteManager = AudioRouteManager::GetInstance(); __pAudioRouteManager->SetAudioRouteEventListener(this); - SetScreenMode(SCREEN_MODE_NORMAL); + SetScreenMode(SCREEN_MODE_NORMAL, true); __pVideoPlayerPresentationModel = VideoPlayerPresentationModel::GetInstance(); TryCatch(__pVideoPlayerPresentationModel != null, r = E_SYSTEM, "__pVideoPlayerPresentationModel is null"); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); __pVideoPlayerPresentationModel->InitializePlayer(); __pVideoPlayerPresentationModel->SetVideoPlayerEventListener(this); @@ -439,8 +670,8 @@ VideoPlayerForm::OnTerminating(void) delete __pButtonRightItem; __pButtonRightItem = null; - delete __pOverlayRegion; - __pOverlayRegion = null; + RemoveControl(*__pOverlayPanel); + __pOverlayPanel = null; delete __pSoundPathPopup; __pSoundPathPopup = null; @@ -575,8 +806,8 @@ VideoPlayerForm::OnPlayEndOfClip(bool playNextContent) if (playNextContent == true) { - SetScreenMode(SCREEN_MODE_NORMAL); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + SetScreenMode(SCREEN_MODE_NORMAL, true); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); __pVideoPlayerPresentationModel->InitializePlayer(); if (__audioRouteMode == AUDIO_ROUTE_SPEAKER_ONLY) @@ -694,12 +925,6 @@ VideoPlayerForm::OnPlayReleased(void) AppLogDebug("OnPlayReleased"); } -OverlayRegion* -VideoPlayerForm::GetOverlayRegion(void) -{ - return __pOverlayRegion; -} - void VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) { @@ -707,7 +932,7 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) String currentTime; String totalTime; - + Rectangle rect; Bitmap* pBitmapScreenMode = null; PlayerState playState = PLAYER_STATE_ERROR; @@ -718,8 +943,6 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) playState = __pVideoPlayerPresentationModel->GetState(); Rectangle clientRect = GetClientAreaBounds(); - Rectangle rect = __pVideoPlayerPresentationModel->GetVideoInfoN( - __pVideoPlayerPresentationModel->GetMediaPathName()); switch (actionId) { @@ -731,8 +954,8 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) { if (__pVideoPlayerPresentationModel->GetCurrentMediaIndex() != __pVideoPlayerPresentationModel->GetPreviousMediaIndex()) { - SetScreenMode(SCREEN_MODE_NORMAL); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + SetScreenMode(SCREEN_MODE_NORMAL, true); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); } __pVideoPlayerPresentationModel->InitializePlayer(); } @@ -743,6 +966,9 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) __pSlider->SetEnabled(true); + rect = __pVideoPlayerPresentationModel->GetVideoInfoN( + __pVideoPlayerPresentationModel->GetMediaPathName()); + if (__audioRouteMode == AUDIO_ROUTE_SPEAKER_ONLY) { if (rect.width > W_NORMAL || rect.height > W_NORMAL) @@ -850,25 +1076,27 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) case IDA_BUTTON_FULLSCREEN: { - if (playState != PLAYER_STATE_PLAYING) - { - return; - } - if (playState == PLAYER_STATE_PLAYING) { __pUiControlTimer->Cancel(); __pUiControlTimer->Start(SHOW_CONTROL_DURATION); } + else + { + return; + } + + rect = __pVideoPlayerPresentationModel->GetVideoInfoN( + __pVideoPlayerPresentationModel->GetMediaPathName()); switch (__screenMode) { case SCREEN_MODE_FIT: { - r = SetScreenMode(SCREEN_MODE_FULL); + r = SetScreenMode(SCREEN_MODE_FULL, true); TryCatch(r == E_SUCCESS, , "SetScreenMode() failed:%s", GetErrorMessage(r)); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); __pVideoPlayerPresentationModel->SetRenderingBuffer(); pBitmapScreenMode = pAppResource->GetBitmapN(L"T01_icon_title_screenmode02.png"); @@ -897,10 +1125,10 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) { if (rect.width > W_NORMAL || rect.height > W_NORMAL) { - r = SetScreenMode(SCREEN_MODE_NORMAL); + r = SetScreenMode(SCREEN_MODE_NORMAL, true); TryCatch(r == E_SUCCESS, , "SetScreenMode() failed:%s", GetErrorMessage(r)); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); __pVideoPlayerPresentationModel->SetRenderingBuffer(); pBitmapScreenMode = pAppResource->GetBitmapN(L"T01_icon_title_screenmode03.png"); @@ -924,10 +1152,10 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) } else { - r = SetScreenMode(SCREEN_MODE_NORMAL); + r = SetScreenMode(SCREEN_MODE_NORMAL, true); TryCatch(r == E_SUCCESS, , "SetScreenMode() failed:%s", GetErrorMessage(r)); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); __pVideoPlayerPresentationModel->SetRenderingBuffer(); pBitmapScreenMode = pAppResource->GetBitmapN(L"T01_icon_title_screenmode01.png"); @@ -959,10 +1187,10 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) { if (rect.width > W_NORMAL || rect.height > W_NORMAL) { - r = SetScreenMode(SCREEN_MODE_FULL); + r = SetScreenMode(SCREEN_MODE_FULL, true); TryCatch(r == E_SUCCESS, , "SetScreenMode() failed:%s", GetErrorMessage(r)); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); __pVideoPlayerPresentationModel->SetRenderingBuffer(); pBitmapScreenMode = pAppResource->GetBitmapN(L"T01_icon_title_screenmode02.png"); @@ -986,10 +1214,10 @@ VideoPlayerForm::OnActionPerformed(const Control& source, int actionId) } else { - r = SetScreenMode(SCREEN_MODE_FIT); + r = SetScreenMode(SCREEN_MODE_FIT, true); TryCatch(r == E_SUCCESS, , "SetScreenMode() failed:%s", GetErrorMessage(r)); - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); + __pVideoPlayerPresentationModel->SetOverlayPanel(__pOverlayPanel); __pVideoPlayerPresentationModel->SetRenderingBuffer(); pBitmapScreenMode = pAppResource->GetBitmapN(L"T01_icon_title_screenmode03.png"); @@ -1119,7 +1347,8 @@ VideoPlayerForm::OnTouchReleased(const Control& source, const Point& currentPosi if (playState != PLAYER_STATE_PAUSED) { - if (source.GetName() == L"IDL_MAIN_FORM" && playState == PLAYER_STATE_PLAYING) + if ((source.GetName() == L"IDL_MAIN_FORM" || source.GetHashCode() == __pOverlayPanel->GetHashCode()) + && playState == PLAYER_STATE_PLAYING) { if (__isControlVisibleState == true) { @@ -1334,10 +1563,7 @@ VideoPlayerForm::OnOrientationChanged(const Control& source, OrientationStatus o { AppLogDebug("OnOrientationChanged"); - SetScreenMode(__screenMode); - - __pVideoPlayerPresentationModel->SetOverlayRegion(__pOverlayRegion); - __pVideoPlayerPresentationModel->SetRenderingBuffer(); + SetScreenMode(__screenMode, false); switch (orientationStatus) { @@ -1431,272 +1657,88 @@ VideoPlayerForm::ShowControl(bool setShow) void VideoPlayerForm::ChangedControlPos(void) { - Rectangle controlRect(0, 0, 0, 0); - Rectangle posRect(0, 0, 0, 0); - - result r = E_FAILURE; - AppLogDebug("ChangedControlPos"); - if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT) + switch (GetOrientationStatus()) { - controlRect = __pControlLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pControlLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pControlLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pFastRewindButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFastRewindButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFastRewindButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pPlayPauseButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pPlayPauseButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pPlayPauseButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pFastForwardButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFastForwardButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFastForwardButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pBackButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pBackButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pBackButton->SetBounds() failed:%s", GetErrorMessage(r)); - - Rectangle controlLabelRect = __pControlLabel->GetBounds(); - controlRect = __pFirstLineLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFirstLineLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFirstLineLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pCurrenTimeLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height + MARGIN_PORTRAIT_SLIDER; - controlRect.y = posRect.y; - - r = __pCurrenTimeLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pCurrenTimeLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pTotalTimeLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height + MARGIN_PORTRAIT_SLIDER; - controlRect.y = posRect.y; - - r = __pTotalTimeLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pTotalTimeLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pSlider->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height; - controlRect.y = posRect.y; - - r = __pSlider->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pSlider->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pVerticalLeftLine->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pVerticalLeftLine->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pVerticalLeftLine->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pVerticalRightLine->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pVerticalRightLine->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pVerticalRightLine->SetBounds() failed:%s", GetErrorMessage(r)); - } - else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE - || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) - { - if (GetClientAreaBounds().width <= WVGA_W_FULL) + case ORIENTATION_STATUS_PORTRAIT: { - controlRect = __pControlLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pControlLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pControlLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pFastRewindButton->GetBounds(); - posRect.x = WVGA_X_FASTREWIND_BTN; - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pFastRewindButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFastRewindButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pPlayPauseButton->GetBounds(); - posRect.x = WVGA_X_PLAYPAUSE_BTN; - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pPlayPauseButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pPlayPauseButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pFastForwardButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFastForwardButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFastForwardButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pBackButton->GetBounds(); - posRect.x = WVGA_X_BACK_BTN; - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pBackButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pBackButton->SetBounds() failed:%s", GetErrorMessage(r)); - - Rectangle controlLabelRect = __pControlLabel->GetBounds(); - controlRect = __pFirstLineLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFirstLineLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFirstLineLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pCurrenTimeLabel->GetBounds(); - posRect.x = WVGA_X_CURRENT_TIME_LABEL; - posRect.y = GetClientAreaBounds().height - controlLabelRect.height + MARGIN_LANDSCAPE_SLIDER; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pCurrenTimeLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pCurrenTimeLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pTotalTimeLabel->GetBounds(); - posRect.x = WVGA_X_TOTAL_TIME_LABEL; - posRect.y = GetClientAreaBounds().height - controlLabelRect.height + MARGIN_LANDSCAPE_SLIDER; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pTotalTimeLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pTotalTimeLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pSlider->GetBounds(); - posRect.x = WVGA_X_SLIDER; - posRect.y = GetClientAreaBounds().height - controlLabelRect.height; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pSlider->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pSlider->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pVerticalLeftLine->GetBounds(); - posRect.x = WVGA_X_VERTICAL_LEFT_LINE; - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pVerticalLeftLine->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pVerticalLeftLine->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pVerticalRightLine->GetBounds(); - posRect.x = WVGA_X_VERTICAL_RIGHT_LINE; - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.x = posRect.x; - controlRect.y = posRect.y; - - r = __pVerticalRightLine->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pVerticalRightLine->SetBounds() failed:%s", GetErrorMessage(r)); + if (GetClientAreaBounds().height <= W_WVGA_PORTRAIT_HEIGHT) + { + __pControlLabel->SetBounds(X_WVGA_PORTRAIT_CONTROLLER, Y_WVGA_PORTRAIT_CONTROLLER, W_WVGA_PORTRAIT_CONTROLLER, H_WVGA_PORTRAIT_CONTROLLER); + __pFirstLineLabel->SetBounds(X_WVGA_PORTRAIT_FIRST_LINE, Y_WVGA_PORTRAIT_FIRST_LINE, W_WVGA_PORTRAIT_FIRST_LINE, H_WVGA_PORTRAIT_FIRST_LINE); + + __pCurrenTimeLabel->SetBounds(X_WVGA_PORTRAIT_CURRENT_TIME, Y_WVGA_PORTRAIT_CURRENT_TIME, W_WVGA_PORTRAIT_CURRENT_TIME, H_WVGA_PORTRAIT_CURRENT_TIME); + __pSlider->SetBounds(X_WVGA_PORTRAIT_SLIDER, Y_WVGA_PORTRAIT_SLIDER, W_WVGA_PORTRAIT_SLIDER, H_WVGA_PORTRAIT_SLIDER); + __pTotalTimeLabel->SetBounds(X_WVGA_PORTRAIT_TOTAL_TIME, Y_WVGA_PORTRAIT_TOTAL_TIME, W_WVGA_PORTRAIT_TOTAL_TIME, H_WVGA_PORTRAIT_TOTAL_TIME); + + __pVerticalLeftLine->SetBounds(X_WVGA_PORTRAIT_VERTICAL_LEFT_LINE, Y_WVGA_PORTRAIT_VERTICAL_LEFT_LINE, W_WVGA_PORTRAIT_VERTICAL_LEFT_LINE,H_WVGA_PORTRAIT_VERTICAL_LEFT_LINE); + __pFastRewindButton->SetBounds(X_WVGA_PORTRAIT_FASTREWIND_BTN, Y_WVGA_PORTRAIT_FASTREWIND_BTN, W_WVGA_PORTRAIT_FASTREWIND_BTN, H_WVGA_PORTRAIT_FASTREWIND_BTN); + __pPlayPauseButton->SetBounds(X_WVGA_PORTRAIT_PLAYPAUSE_BTN, Y_WVGA_PORTRAIT_PLAYPAUSE_BTN, W_WVGA_PORTRAIT_PLAYPAUSE_BTN, H_WVGA_PORTRAIT_PLAYPAUSE_BTN); + __pFastForwardButton->SetBounds(X_WVGA_PORTRAIT_FASTFORWARD_BTN, Y_WVGA_PORTRAIT_FASTFORWARD_BTN, W_WVGA_PORTRAIT_FASTFORWARD_BTN, H_WVGA_PORTRAIT_FASTFORWARD_BTN); + __pVerticalRightLine->SetBounds(X_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE, Y_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE, W_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE, H_WVGA_PORTRAIT_VERTICAL_RIGHT_LINE); + __pBackButton->SetBounds(X_WVGA_PORTRAIT_BACK_BTN, Y_WVGA_PORTRAIT_BACK_BTN, W_WVGA_PORTRAIT_BACK_BTN, H_WVGA_PORTRAIT_BACK_BTN); + } + else + { + __pControlLabel->SetBounds(X_HVGA_PORTRAIT_CONTROLLER, Y_HVGA_PORTRAIT_CONTROLLER, W_HVGA_PORTRAIT_CONTROLLER, H_HVGA_PORTRAIT_CONTROLLER); + __pFirstLineLabel->SetBounds(X_HVGA_PORTRAIT_FIRST_LINE, Y_HVGA_PORTRAIT_FIRST_LINE, W_HVGA_PORTRAIT_FIRST_LINE, H_HVGA_PORTRAIT_FIRST_LINE); + + __pCurrenTimeLabel->SetBounds(X_HVGA_PORTRAIT_CURRENT_TIME, Y_HVGA_PORTRAIT_CURRENT_TIME, W_HVGA_PORTRAIT_CURRENT_TIME, H_HVGA_PORTRAIT_CURRENT_TIME); + __pSlider->SetBounds(X_HVGA_PORTRAIT_SLIDER, Y_HVGA_PORTRAIT_SLIDER, W_HVGA_PORTRAIT_SLIDER, H_HVGA_PORTRAIT_SLIDER); + __pTotalTimeLabel->SetBounds(X_HVGA_PORTRAIT_TOTAL_TIME, Y_HVGA_PORTRAIT_TOTAL_TIME, W_HVGA_PORTRAIT_TOTAL_TIME, H_HVGA_PORTRAIT_TOTAL_TIME); + + __pVerticalLeftLine->SetBounds(X_HVGA_PORTRAIT_VERTICAL_LEFT_LINE, Y_HVGA_PORTRAIT_VERTICAL_LEFT_LINE, W_HVGA_PORTRAIT_VERTICAL_LEFT_LINE, H_HVGA_PORTRAIT_VERTICAL_LEFT_LINE); + __pFastRewindButton->SetBounds(X_HVGA_PORTRAIT_FASTREWIND_BTN, Y_HVGA_PORTRAIT_FASTREWIND_BTN, W_HVGA_PORTRAIT_FASTREWIND_BTN, H_HVGA_PORTRAIT_FASTREWIND_BTN); + __pPlayPauseButton->SetBounds(X_HVGA_PORTRAIT_PLAYPAUSE_BTN, Y_HVGA_PORTRAIT_PLAYPAUSE_BTN, W_HVGA_PORTRAIT_PLAYPAUSE_BTN, H_HVGA_PORTRAIT_PLAYPAUSE_BTN); + __pFastForwardButton->SetBounds(X_HVGA_PORTRAIT_FASTFORWARD_BTN, Y_HVGA_PORTRAIT_FASTFORWARD_BTN, W_HVGA_PORTRAIT_FASTFORWARD_BTN, H_HVGA_PORTRAIT_FASTFORWARD_BTN); + __pVerticalRightLine->SetBounds(X_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE, Y_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE, W_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE, H_HVGA_PORTRAIT_VERTICAL_RIGHT_LINE); + __pBackButton->SetBounds(X_HVGA_PORTRAIT_BACK_BTN, Y_HVGA_PORTRAIT_BACK_BTN, W_HVGA_PORTRAIT_BACK_BTN, H_HVGA_PORTRAIT_BACK_BTN); + } } - else - { - controlRect = __pControlLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pControlLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pControlLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pFastRewindButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFastRewindButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFastRewindButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pPlayPauseButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pPlayPauseButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pPlayPauseButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pFastForwardButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFastForwardButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFastForwardButton->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pBackButton->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pBackButton->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pBackButton->SetBounds() failed:%s", GetErrorMessage(r)); - - Rectangle controlLabelRect = __pControlLabel->GetBounds(); - controlRect = __pFirstLineLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height - controlRect.height; - controlRect.y = posRect.y; - - r = __pFirstLineLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pFirstLineLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pCurrenTimeLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height + MARGIN_LANDSCAPE_SLIDER; - controlRect.y = posRect.y; - - r = __pCurrenTimeLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pCurrenTimeLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pTotalTimeLabel->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height + MARGIN_LANDSCAPE_SLIDER; - controlRect.y = posRect.y; - - r = __pTotalTimeLabel->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pTotalTimeLabel->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pSlider->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlLabelRect.height; - controlRect.y = posRect.y; - - r = __pSlider->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pSlider->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pVerticalLeftLine->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; - - r = __pVerticalLeftLine->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pVerticalLeftLine->SetBounds() failed:%s", GetErrorMessage(r)); - - controlRect = __pVerticalRightLine->GetBounds(); - posRect.y = GetClientAreaBounds().height - controlRect.height; - controlRect.y = posRect.y; + break; - r = __pVerticalRightLine->SetBounds(controlRect); - TryReturnVoid(r == E_SUCCESS, "__pVerticalRightLine->SetBounds() failed:%s", GetErrorMessage(r)); + case ORIENTATION_STATUS_LANDSCAPE: + // fall throuth + case ORIENTATION_STATUS_LANDSCAPE_REVERSE: + { + if (GetClientAreaBounds().width <= W_WVGA_LANDSCAPE_WIDTH) + { + __pControlLabel->SetBounds(X_WVGA_LANDSCAPE_CONTROLLER, Y_WVGA_LANDSCAPE_CONTROLLER, W_WVGA_LANDSCAPE_CONTROLLER, H_WVGA_LANDSCAPE_CONTROLLER); + __pFirstLineLabel->SetBounds(X_WVGA_LANDSCAPE_FIRST_LINE, Y_WVGA_LANDSCAPE_FIRST_LINE, W_WVGA_LANDSCAPE_FIRST_LINE, H_WVGA_LANDSCAPE_FIRST_LINE); + + __pCurrenTimeLabel->SetBounds(X_WVGA_LANDSCAPE_CURRENT_TIME, Y_WVGA_LANDSCAPE_CURRENT_TIME, W_WVGA_LANDSCAPE_CURRENT_TIME, H_WVGA_LANDSCAPE_CURRENT_TIME); + __pSlider->SetBounds(X_WVGA_LANDSCAPE_SLIDER, Y_WVGA_LANDSCAPE_SLIDER, W_WVGA_LANDSCAPE_SLIDER, H_WVGA_LANDSCAPE_SLIDER); + __pTotalTimeLabel->SetBounds(X_WVGA_LANDSCAPE_TOTAL_TIME, Y_WVGA_LANDSCAPE_TOTAL_TIME, W_WVGA_LANDSCAPE_TOTAL_TIME, H_WVGA_LANDSCAPE_TOTAL_TIME); + + __pVerticalLeftLine->SetBounds(X_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE, Y_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE, W_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE, H_WVGA_LANDSCAPE_VERTICAL_LEFT_LINE); + __pFastRewindButton->SetBounds(X_WVGA_LANDSCAPE_FASTREWIND_BTN, Y_WVGA_LANDSCAPE_FASTREWIND_BTN, W_WVGA_LANDSCAPE_FASTREWIND_BTN, H_WVGA_LANDSCAPE_FASTREWIND_BTN); + __pPlayPauseButton->SetBounds(X_WVGA_LANDSCAPE_PLAYPAUSE_BTN, Y_WVGA_LANDSCAPE_PLAYPAUSE_BTN, W_WVGA_LANDSCAPE_PLAYPAUSE_BTN, H_WVGA_LANDSCAPE_PLAYPAUSE_BTN); + __pFastForwardButton->SetBounds(X_WVGA_LANDSCAPE_FASTFORWARD_BTN, Y_WVGA_LANDSCAPE_FASTFORWARD_BTN, W_WVGA_LANDSCAPE_FASTFORWARD_BTN, H_WVGA_LANDSCAPE_FASTFORWARD_BTN); + __pVerticalRightLine->SetBounds(X_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE, Y_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE, W_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE, H_WVGA_LANDSCAPE_VERTICAL_RIGHT_LINE); + __pBackButton->SetBounds(X_WVGA_LANDSCAPE_BACK_BTN, Y_WVGA_LANDSCAPE_BACK_BTN, W_WVGA_LANDSCAPE_BACK_BTN, H_WVGA_LANDSCAPE_BACK_BTN); + } + else + { + __pControlLabel->SetBounds(X_HVGA_LANDSCAPE_CONTROLLER, Y_HVGA_LANDSCAPE_CONTROLLER, W_HVGA_LANDSCAPE_CONTROLLER, H_HVGA_LANDSCAPE_CONTROLLER); + __pFirstLineLabel->SetBounds(X_HVGA_LANDSCAPE_FIRST_LINE, Y_HVGA_LANDSCAPE_FIRST_LINE, W_HVGA_LANDSCAPE_FIRST_LINE, H_HVGA_LANDSCAPE_FIRST_LINE); + + __pCurrenTimeLabel->SetBounds(X_HVGA_LANDSCAPE_CURRENT_TIME, Y_HVGA_LANDSCAPE_CURRENT_TIME, W_HVGA_LANDSCAPE_CURRENT_TIME, H_HVGA_LANDSCAPE_CURRENT_TIME); + __pSlider->SetBounds(X_HVGA_LANDSCAPE_SLIDER, Y_HVGA_LANDSCAPE_SLIDER, W_HVGA_LANDSCAPE_SLIDER, H_HVGA_LANDSCAPE_SLIDER); + __pTotalTimeLabel->SetBounds(X_HVGA_LANDSCAPE_TOTAL_TIME, Y_HVGA_LANDSCAPE_TOTAL_TIME, W_HVGA_LANDSCAPE_TOTAL_TIME, H_HVGA_LANDSCAPE_TOTAL_TIME); + + __pVerticalLeftLine->SetBounds(X_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE, Y_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE, W_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE, H_HVGA_LANDSCAPE_VERTICAL_LEFT_LINE); + __pFastRewindButton->SetBounds(X_HVGA_LANDSCAPE_FASTREWIND_BTN, Y_HVGA_LANDSCAPE_FASTREWIND_BTN, W_HVGA_LANDSCAPE_FASTREWIND_BTN, H_HVGA_LANDSCAPE_FASTREWIND_BTN); + __pPlayPauseButton->SetBounds(X_HVGA_LANDSCAPE_PLAYPAUSE_BTN, Y_HVGA_LANDSCAPE_PLAYPAUSE_BTN, W_HVGA_LANDSCAPE_PLAYPAUSE_BTN, H_HVGA_LANDSCAPE_PLAYPAUSE_BTN); + __pFastForwardButton->SetBounds(X_HVGA_LANDSCAPE_FASTFORWARD_BTN, Y_HVGA_LANDSCAPE_FASTFORWARD_BTN, W_HVGA_LANDSCAPE_FASTFORWARD_BTN, H_HVGA_LANDSCAPE_FASTFORWARD_BTN); + __pVerticalRightLine->SetBounds(X_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE, Y_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE, W_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE, H_HVGA_LANDSCAPE_VERTICAL_RIGHT_LINE); + __pBackButton->SetBounds(X_HVGA_LANDSCAPE_BACK_BTN, Y_HVGA_LANDSCAPE_BACK_BTN, W_HVGA_LANDSCAPE_BACK_BTN, H_HVGA_LANDSCAPE_BACK_BTN); + } } + break; + + default: + break; } } diff --git a/src/VpVideoPlayerPresentationModel.cpp b/src/VpVideoPlayerPresentationModel.cpp index 7075ef8..a93424c 100644 --- a/src/VpVideoPlayerPresentationModel.cpp +++ b/src/VpVideoPlayerPresentationModel.cpp @@ -16,7 +16,7 @@ /** * @file VpVideoPlayerPresentationModel.cpp - * @brief This is the implementation file for PresentationModel class. + * @brief This is the implementation file for VideoPlayerPresentationModel class. */ #include @@ -54,7 +54,7 @@ VideoPlayerPresentationModel::__pVideoPlayerPresentationModel = null; VideoPlayerPresentationModel::VideoPlayerPresentationModel(void) : __pPlayer(null) , __pVideoPlayerEventListener(null) - , __pOverlayRegion(null) + , __pOverlayPanel(null) , __pMediaPathArrayList(null) , __pTimer(null) , __pFastForwardTimer(null) @@ -207,6 +207,7 @@ Rectangle VideoPlayerPresentationModel::GetVideoInfoN(const String& mediaLocalPath) { Rectangle rect; + result r = E_FAILURE; const IList* pInfoList = null; const VideoStreamInfo* pInfo = null; @@ -215,9 +216,22 @@ VideoPlayerPresentationModel::GetVideoInfoN(const String& mediaLocalPath) if (__pPlayer->GetState() == PLAYER_STATE_PLAYING) { pStreamInfo = __pPlayer->GetCurrentMediaStreamInfoN(); + if (pStreamInfo == null) + { + TryCatch(pStreamInfo != null, r = E_FAILURE, "__pPlayer->GetCurrentMediaStreamInfoN() is null"); + } + pInfoList = pStreamInfo->GetVideoStreamInfoList(); + if (pInfoList == null) + { + TryCatch(pInfoList != null, r = E_FAILURE, "pStreamInfo->GetVideoStreamInfoList() is null"); + } pInfo = (const VideoStreamInfo*)pInfoList->GetAt(0); + if (pInfo == null) + { + TryCatch(pInfo != null, r = E_FAILURE, "pInfoList->GetAt() is null"); + } rect.width = pInfo->GetWidth(); rect.height = pInfo->GetHeight(); @@ -234,6 +248,14 @@ VideoPlayerPresentationModel::GetVideoInfoN(const String& mediaLocalPath) } return rect; + +CATCH: + delete pStreamInfo; + + rect.width = __mediaWidth; + rect.height = __mediaHeight; + + return rect; } result @@ -242,7 +264,7 @@ VideoPlayerPresentationModel::ConstructPlayerInstanceWithBufferInfo(void) result r = E_FAILURE; BufferInfo bufferInfo; - r = __pOverlayRegion->GetBackgroundBufferInfo(bufferInfo); + r = __pOverlayPanel->GetBackgroundBufferInfo(bufferInfo); TryCatch(r == E_SUCCESS, , "__pOverlayRegion->GetBackgroundBufferInfo() failed:%s", GetErrorMessage(r)); delete __pPlayer; @@ -513,9 +535,9 @@ VideoPlayerPresentationModel::SetVideoPlayerEventListener(IVideoPlayerEventListe } void -VideoPlayerPresentationModel::SetOverlayRegion(OverlayRegion* pOverlay) +VideoPlayerPresentationModel::SetOverlayPanel(OverlayPanel* pOverlay) { - __pOverlayRegion = pOverlay; + __pOverlayPanel = pOverlay; } void @@ -523,13 +545,8 @@ VideoPlayerPresentationModel::SetRenderingBuffer(void) { BufferInfo bufferInfo; - __pOverlayRegion->GetBackgroundBufferInfo(bufferInfo); + __pOverlayPanel->GetBackgroundBufferInfo(bufferInfo); __pPlayer->SetRenderingBuffer(bufferInfo); - - if (__pPlayer->GetState() == PLAYER_STATE_PAUSED) - { - __pPlayer->SeekTo(__pPlayer->GetPosition()); - } } void @@ -986,7 +1003,7 @@ VideoPlayerPresentationModel::InitializePlayer(void) AppLogDebug("InitializePlayer"); delete __pPlayer; - __pOverlayRegion->GetBackgroundBufferInfo(bufferInfo); + __pOverlayPanel->GetBackgroundBufferInfo(bufferInfo); __pPlayer = new (std::nothrow) Player(); result r = __pPlayer->Construct(*this, &bufferInfo); -- 2.7.4