37 * <a href="http://wiki.forum.nokia.com/index.php/How_to_play_a_video_file_using_CVideoPlayerUtility">How to |
37 * <a href="http://wiki.forum.nokia.com/index.php/How_to_play_a_video_file_using_CVideoPlayerUtility">How to |
38 * play a video file using CVideoPlayerUtility</a> |
38 * play a video file using CVideoPlayerUtility</a> |
39 */ |
39 */ |
40 class VideoPlayer : public AbstractMediaPlayer |
40 class VideoPlayer : public AbstractMediaPlayer |
41 , public MVideoPlayerUtilityObserver |
41 , public MVideoPlayerUtilityObserver |
|
42 , public MVideoLoadingObserver |
42 { |
43 { |
43 Q_OBJECT |
44 Q_OBJECT |
44 |
45 |
45 public: |
46 public: |
46 VideoPlayer(); |
47 VideoPlayer(MediaObject *parent = 0, const AbstractPlayer *player = 0); |
47 explicit VideoPlayer(const AbstractPlayer& player); |
|
48 virtual ~VideoPlayer(); |
48 virtual ~VideoPlayer(); |
|
49 |
|
50 typedef CVideoPlayerUtility NativePlayer; |
|
51 NativePlayer *nativePlayer() const; |
49 |
52 |
50 // AbstractPlayer |
53 // AbstractPlayer |
51 virtual void doPlay(); |
54 virtual void doPlay(); |
52 virtual void doPause(); |
55 virtual void doPause(); |
53 virtual void doStop(); |
56 virtual void doStop(); |
54 virtual void doSeek(qint64 milliseconds); |
57 virtual void doSeek(qint64 milliseconds); |
55 virtual int setDeviceVolume(int mmfVolume); |
58 virtual int setDeviceVolume(int mmfVolume); |
56 virtual int openFile(RFile& file); |
59 virtual int openFile(RFile& file); |
|
60 virtual int openUrl(const QString& url); |
|
61 virtual int bufferStatus() const; |
57 virtual void close(); |
62 virtual void close(); |
58 |
63 |
59 // MediaObjectInterface |
64 // MediaObjectInterface |
60 virtual bool hasVideo() const; |
65 virtual bool hasVideo() const; |
61 virtual qint64 currentTime() const; |
66 virtual qint64 currentTime() const; |
62 virtual qint64 totalTime() const; |
67 virtual qint64 totalTime() const; |
63 |
68 |
64 // MVideoPlayerUtilityObserver |
69 // AbstractPlayer |
65 virtual void MvpuoOpenComplete(TInt aError); |
70 virtual void videoOutputChanged(); |
66 virtual void MvpuoPrepareComplete(TInt aError); |
71 |
67 virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError); |
72 // AbstractMediaPlayer |
68 virtual void MvpuoPlayComplete(TInt aError); |
73 virtual int numberOfMetaDataEntries() const; |
69 virtual void MvpuoEvent(const TMMFEvent &aEvent); |
74 virtual QPair<QString, QString> metaDataEntry(int index) const; |
70 |
75 |
71 public Q_SLOTS: |
76 public Q_SLOTS: |
72 void videoWindowChanged(); |
77 void videoWindowChanged(); |
73 void aspectRatioChanged(); |
78 void aspectRatioChanged(); |
74 void scaleModeChanged(); |
79 void scaleModeChanged(); |
78 private: |
83 private: |
79 void construct(); |
84 void construct(); |
80 |
85 |
81 void doPrepareCompleteL(TInt aError); |
86 void doPrepareCompleteL(TInt aError); |
82 |
87 |
83 // AbstractPlayer |
|
84 virtual void videoOutputChanged(); |
|
85 |
|
86 void getVideoWindow(); |
88 void getVideoWindow(); |
87 void initVideoOutput(); |
89 void initVideoOutput(); |
88 |
|
89 void updateVideoRect(); |
90 void updateVideoRect(); |
90 |
91 |
91 void applyPendingChanges(); |
92 void applyPendingChanges(); |
92 void applyVideoWindowChange(); |
93 void applyVideoWindowChange(); |
93 |
94 |
94 void startDirectScreenAccess(); |
95 void startDirectScreenAccess(); |
95 bool stopDirectScreenAccess(); |
96 bool stopDirectScreenAccess(); |
96 |
97 |
97 // AbstractMediaPlayer |
98 private: |
98 virtual int numberOfMetaDataEntries() const; |
99 // MVideoPlayerUtilityObserver |
99 virtual QPair<QString, QString> metaDataEntry(int index) const; |
100 virtual void MvpuoOpenComplete(TInt aError); |
|
101 virtual void MvpuoPrepareComplete(TInt aError); |
|
102 virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError); |
|
103 virtual void MvpuoPlayComplete(TInt aError); |
|
104 virtual void MvpuoEvent(const TMMFEvent &aEvent); |
|
105 |
|
106 // MVideoLoadingObserver |
|
107 virtual void MvloLoadingStarted(); |
|
108 virtual void MvloLoadingComplete(); |
100 |
109 |
101 private: |
110 private: |
102 QScopedPointer<CVideoPlayerUtility> m_player; |
111 QScopedPointer<NativePlayer> m_player; |
103 |
112 |
104 // Not owned |
113 // Not owned |
105 RWsSession& m_wsSession; |
114 RWsSession& m_wsSession; |
106 CWsScreenDevice& m_screenDevice; |
115 CWsScreenDevice& m_screenDevice; |
107 RWindowBase* m_window; |
116 RWindowBase* m_window; |