1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QT7PLAYERSESSION_H |
|
43 #define QT7PLAYERSESSION_H |
|
44 |
|
45 #include <QtCore/qobject.h> |
|
46 #include <QtCore/qset.h> |
|
47 |
|
48 #include <qmediaplayercontrol.h> |
|
49 #include <qmediaplayer.h> |
|
50 |
|
51 #include <QtGui/qmacdefines_mac.h> |
|
52 |
|
53 QT_BEGIN_NAMESPACE |
|
54 class QT7PlayerControl; |
|
55 class QMediaPlaylist; |
|
56 class QMediaPlaylistNavigator; |
|
57 class QT7VideoOutput; |
|
58 class QT7PlayerSession; |
|
59 class QT7PlayerService; |
|
60 |
|
61 |
|
62 class QT7PlayerSession : public QObject |
|
63 { |
|
64 Q_OBJECT |
|
65 public: |
|
66 QT7PlayerSession(QObject *parent = 0); |
|
67 ~QT7PlayerSession(); |
|
68 |
|
69 void *movie() const; |
|
70 |
|
71 void setControl(QT7PlayerControl *control); |
|
72 |
|
73 void setVideoOutput(QT7VideoOutput *output); |
|
74 |
|
75 QMediaPlayer::State state() const; |
|
76 QMediaPlayer::MediaStatus mediaStatus() const; |
|
77 |
|
78 QMediaContent media() const; |
|
79 const QIODevice *mediaStream() const; |
|
80 void setMedia(const QMediaContent &content, QIODevice *stream); |
|
81 |
|
82 qint64 position() const; |
|
83 qint64 duration() const; |
|
84 |
|
85 int bufferStatus() const; |
|
86 |
|
87 int volume() const; |
|
88 bool isMuted() const; |
|
89 |
|
90 bool isAudioAvailable() const; |
|
91 bool isVideoAvailable() const; |
|
92 |
|
93 bool isSeekable() const; |
|
94 |
|
95 qreal playbackRate() const; |
|
96 |
|
97 public slots: |
|
98 void setPlaybackRate(qreal rate); |
|
99 |
|
100 void setPosition(qint64 pos); |
|
101 |
|
102 void play(); |
|
103 void pause(); |
|
104 void stop(); |
|
105 |
|
106 void setVolume(int volume); |
|
107 void setMuted(bool muted); |
|
108 |
|
109 void processEOS(); |
|
110 void processLoadStateChange(); |
|
111 void processVolumeChange(); |
|
112 void processNaturalSizeChange(); |
|
113 |
|
114 signals: |
|
115 void positionChanged(qint64 position); |
|
116 void durationChanged(qint64 duration); |
|
117 void stateChanged(QMediaPlayer::State newState); |
|
118 void mediaStatusChanged(QMediaPlayer::MediaStatus status); |
|
119 void volumeChanged(int volume); |
|
120 void mutedChanged(bool muted); |
|
121 void audioAvailableChanged(bool audioAvailable); |
|
122 void videoAvailableChanged(bool videoAvailable); |
|
123 void error(int error, const QString &errorString); |
|
124 |
|
125 private: |
|
126 void openMovie(bool tryAsync); |
|
127 |
|
128 void *m_QTMovie; |
|
129 void *m_movieObserver; |
|
130 |
|
131 QMediaPlayer::State m_state; |
|
132 QMediaPlayer::MediaStatus m_mediaStatus; |
|
133 QIODevice *m_mediaStream; |
|
134 QMediaContent m_resources; |
|
135 |
|
136 QT7VideoOutput * m_videoOutput; |
|
137 |
|
138 mutable qint64 m_currentTime; |
|
139 |
|
140 bool m_muted; |
|
141 bool m_tryingAsync; |
|
142 int m_volume; |
|
143 qreal m_rate; |
|
144 |
|
145 qint64 m_duration; |
|
146 bool m_videoAvailable; |
|
147 bool m_audioAvailable; |
|
148 }; |
|
149 |
|
150 QT_END_NAMESPACE |
|
151 |
|
152 #endif |
|