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 PresentationModel 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 SetOverlayRegion(Tizen::Ui::Controls::OverlayRegion* pOverlay);
59 void SetPlayerBuffer(const Tizen::Graphics::BufferInfo& bufferInfo);
60 Tizen::Base::String GetMediaPathName(void) const;
61 int GetMediaCount(void) const;
62 int GetCurrentMediaIndex(void) const;
63 int GetPreviousMediaIndex(void) const;
65 result InitializePlayer(void);
66 result ConstructPlayerInstanceWithBufferInfo(void);
67 void SetRenderingBuffer(void);
69 virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
71 virtual void OnPlayerAudioFocusChanged(void);
72 virtual void OnPlayerOpened(result r);
73 virtual void OnPlayerEndOfClip(void);
74 virtual void OnPlayerBuffering(int percent);
75 virtual void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r);
76 virtual void OnPlayerInterrupted(void);
77 virtual void OnPlayerReleased(void);
78 virtual void OnPlayerSeekCompleted(result r);
81 VideoPlayerPresentationModel(void);
82 virtual ~VideoPlayerPresentationModel(void);
83 VideoPlayerPresentationModel(const VideoPlayerPresentationModel&);
84 VideoPlayerPresentationModel& operator = (const VideoPlayerPresentationModel&);
86 result Construct(void);
87 static void CreateInstance(void);
88 static void DestroyInstance(void);
91 void DeleteTimer(void);
93 void CallOnPlayContentChanged(const Tizen::Base::String& fileName);
94 void CallOnPlayTimeChanged(int currentProgressPos, Tizen::Base::String& currentPlayTime);
95 void CallOnPlayStateChanged(Tizen::Media::PlayerState playState);
97 friend void DestroyPresentationModelInstance(void);
100 static VideoPlayerPresentationModel* __pVideoPlayerPresentationModel;
101 Tizen::Media::Player* __pPlayer;
102 IVideoPlayerEventListener* __pVideoPlayerEventListener;
103 Tizen::Ui::Controls::OverlayRegion* __pOverlayRegion;
104 Tizen::Base::Collection::ArrayList* __pMediaPathArrayList;
105 Tizen::Base::Runtime::Timer* __pTimer;
106 Tizen::Base::Runtime::Timer* __pFastForwardTimer;
107 Tizen::Base::Runtime::Timer* __pFastRewindTimer;
108 Tizen::Base::String __mediaPathName;
109 bool __playerSeekCompleted;
110 bool __playerLastSeekCompleted;
111 bool __playAfterSeek;
114 int __currentMediaIndex;
115 int __nextMediaIndex;
116 int __previousMediaIndex;
119 #endif // _VP_VIDEO_PLAYER_PRESENTATION_MODEL_H_