2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file VpVideoPlayerPresentationModel.h
19 * @brief This is the header file for VideoPlayerPresentationModel class.
22 #ifndef _VP_VIDEO_PLAYER_PRESENTATION_MODEL_H_
23 #define _VP_VIDEO_PLAYER_PRESENTATION_MODEL_H_
27 #include <FGraphics.h>
30 #include "VpIVideoPlayerEventListener.h"
32 class VideoPlayerPresentationModel
33 : public Tizen::Base::Runtime::ITimerEventListener
34 , public Tizen::Media::IPlayerEventListener
37 static VideoPlayerPresentationModel* GetInstance(void);
40 result StartPlay(void);
41 result StopPlay(void);
42 result PausePlay(void);
43 result ClosePlay(void);
47 void FastForward(bool playAfterSeek);
48 void FastRewind(bool playAfterSeek);
49 void StopFastForwardRewind(void);
51 Tizen::Graphics::Rectangle GetVideoInfoN(const Tizen::Base::String& mediaLocalPath);
52 Tizen::Media::PlayerState GetState(void) const;
53 long GetDuration(void) const;
54 long GetPosition(void) const;
55 result SeekTo(long msTime);
57 void SetVideoPlayerEventListener(IVideoPlayerEventListener* pPlayerListener);
58 void SetOverlayPanel(Tizen::Ui::Controls::OverlayPanel* pOverlay);
60 void SetPlayerBuffer(const Tizen::Graphics::BufferInfo& bufferInfo);
61 Tizen::Base::String GetMediaPathName(void) const;
62 int GetMediaCount(void) const;
63 int GetCurrentMediaIndex(void) const;
64 int GetPreviousMediaIndex(void) const;
66 result InitializePlayer(void);
67 result ConstructPlayerInstanceWithBufferInfo(void);
68 void SetRenderingBuffer(void);
70 virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
72 virtual void OnPlayerAudioFocusChanged(void);
73 virtual void OnPlayerOpened(result r);
74 virtual void OnPlayerEndOfClip(void);
75 virtual void OnPlayerBuffering(int percent);
76 virtual void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r);
77 virtual void OnPlayerInterrupted(void);
78 virtual void OnPlayerReleased(void);
79 virtual void OnPlayerSeekCompleted(result r);
82 VideoPlayerPresentationModel(void);
83 virtual ~VideoPlayerPresentationModel(void);
84 VideoPlayerPresentationModel(const VideoPlayerPresentationModel&);
85 VideoPlayerPresentationModel& operator = (const VideoPlayerPresentationModel&);
87 result Construct(void);
88 static void CreateInstance(void);
89 static void DestroyInstance(void);
92 void DeleteTimer(void);
94 void CallOnPlayContentChanged(const Tizen::Base::String& fileName);
95 void CallOnPlayTimeChanged(int currentProgressPos, Tizen::Base::String& currentPlayTime);
96 void CallOnPlayStateChanged(Tizen::Media::PlayerState playState);
98 friend void DestroyPresentationModelInstance(void);
101 static VideoPlayerPresentationModel* __pVideoPlayerPresentationModel;
102 Tizen::Media::Player* __pPlayer;
103 IVideoPlayerEventListener* __pVideoPlayerEventListener;
104 Tizen::Ui::Controls::OverlayPanel* __pOverlayPanel;
106 Tizen::Base::Collection::ArrayList* __pMediaPathArrayList;
107 Tizen::Base::Runtime::Timer* __pTimer;
108 Tizen::Base::Runtime::Timer* __pFastForwardTimer;
109 Tizen::Base::Runtime::Timer* __pFastRewindTimer;
110 Tizen::Base::String __mediaPathName;
111 bool __playerSeekCompleted;
112 bool __playerLastSeekCompleted;
113 bool __playAfterSeek;
116 int __currentMediaIndex;
117 int __nextMediaIndex;
118 int __previousMediaIndex;
121 #endif // _VP_VIDEO_PLAYER_PRESENTATION_MODEL_H_