18 #ifndef Phonon_QT7_QUICKTIMEVIDEOPLAYER_H |
18 #ifndef Phonon_QT7_QUICKTIMEVIDEOPLAYER_H |
19 #define Phonon_QT7_QUICKTIMEVIDEOPLAYER_H |
19 #define Phonon_QT7_QUICKTIMEVIDEOPLAYER_H |
20 |
20 |
21 #include "backendheader.h" |
21 #include "backendheader.h" |
22 |
22 |
23 #include <QtGui/qmacdefines_mac.h> |
|
24 #import <QTKit/QTDataReference.h> |
23 #import <QTKit/QTDataReference.h> |
25 #import <QTKit/QTMovie.h> |
24 #import <QTKit/QTMovie.h> |
26 |
25 |
27 #include <phonon/mediasource.h> |
26 #include <phonon/mediasource.h> |
28 #include <Carbon/Carbon.h> |
27 #include <Carbon/Carbon.h> |
55 QuickTimeVideoPlayer(); |
53 QuickTimeVideoPlayer(); |
56 virtual ~QuickTimeVideoPlayer(); |
54 virtual ~QuickTimeVideoPlayer(); |
57 |
55 |
58 void setMediaSource(const MediaSource &source); |
56 void setMediaSource(const MediaSource &source); |
59 MediaSource mediaSource() const; |
57 MediaSource mediaSource() const; |
60 void unsetCurrentMediaSource(); |
58 void unsetVideo(); |
61 |
59 |
62 void play(); |
60 void play(); |
63 void pause(); |
61 void pause(); |
64 void seek(quint64 milliseconds); |
62 void seek(quint64 milliseconds); |
65 |
63 |
66 bool videoFrameChanged(); |
64 bool videoFrameChanged(); |
67 CVOpenGLTextureRef currentFrameAsCVTexture(); |
65 CVOpenGLTextureRef currentFrameAsCVTexture(); |
68 GLuint currentFrameAsGLTexture(); |
66 GLuint currentFrameAsGLTexture(); |
69 void *currentFrameAsCIImage(); |
67 void *currentFrameAsCIImage(); |
70 QImage currentFrameAsQImage(); |
68 QImage currentFrameAsQImage(); |
71 void releaseImageCache(); |
|
72 QRect videoRect() const; |
69 QRect videoRect() const; |
73 |
70 |
74 quint64 duration() const; |
71 quint64 duration() const; |
75 quint64 currentTime() const; |
72 quint64 currentTime() const; |
76 long timeScale() const; |
73 long timeScale() const; |
77 float staticFps(); |
|
78 QString currentTimeString(); |
74 QString currentTimeString(); |
79 |
75 |
80 void setColors(qreal brightness = 0, qreal contrast = 1, qreal hue = 0, qreal saturation = 1); |
76 void setColors(qreal brightness = 0, qreal contrast = 1, qreal hue = 0, qreal saturation = 1); |
81 void setMasterVolume(float volume); |
77 void setMasterVolume(float volume); |
82 void setRelativeVolume(float volume); |
78 void setRelativeVolume(float volume); |
85 void enableAudio(bool enable); |
81 void enableAudio(bool enable); |
86 bool audioEnabled(); |
82 bool audioEnabled(); |
87 bool setAudioDevice(int id); |
83 bool setAudioDevice(int id); |
88 void setPlaybackRate(float rate); |
84 void setPlaybackRate(float rate); |
89 QTMovie *qtMovie() const; |
85 QTMovie *qtMovie() const; |
90 QMultiMap<QString, QString> metaData(); |
|
91 |
86 |
92 float playbackRate() const; |
87 float playbackRate() const; |
93 float prefferedPlaybackRate() const; |
88 float prefferedPlaybackRate() const; |
94 |
89 |
95 QuickTimeVideoPlayer::State state() const; |
90 QuickTimeVideoPlayer::State state() const; |
105 |
100 |
106 bool preRollMovie(qint64 startTime = 0); |
101 bool preRollMovie(qint64 startTime = 0); |
107 float percentageLoaded(); |
102 float percentageLoaded(); |
108 quint64 timeLoaded(); |
103 quint64 timeLoaded(); |
109 |
104 |
110 int trackCount() const; |
|
111 int currentTrack() const; |
|
112 void setCurrentTrack(int track); |
|
113 QString movieCompactDiscPath() const; |
|
114 QString currentTrackPath() const; |
|
115 |
|
116 static QString timeToString(quint64 ms); |
105 static QString timeToString(quint64 ms); |
117 |
106 |
118 // Help functions when drawing to more that one widget in cocoa 64: |
107 // Help functions when drawing to more that one widget in cocoa 64: |
119 void *m_primaryRenderingTarget; |
108 void *m_primaryRenderingTarget; |
120 void setPrimaryRenderingTarget(NSObject *target); |
109 void setPrimaryRenderingTarget(NSObject *target); |
124 |
113 |
125 private: |
114 private: |
126 QTMovie *m_QTMovie; |
115 QTMovie *m_QTMovie; |
127 State m_state; |
116 State m_state; |
128 QGLPixelBuffer *m_QImagePixelBuffer; |
117 QGLPixelBuffer *m_QImagePixelBuffer; |
129 QuickTimeMetaData *m_metaData; |
|
130 |
|
131 CVOpenGLTextureRef m_cachedCVTextureRef; |
|
132 QImage m_cachedQImage; |
|
133 |
118 |
134 bool m_playbackRateSat; |
119 bool m_playbackRateSat; |
135 bool m_isDrmProtected; |
120 bool m_isDrmProtected; |
136 bool m_isDrmAuthorized; |
121 bool m_isDrmAuthorized; |
137 bool m_mute; |
122 bool m_mute; |
138 bool m_audioEnabled; |
123 bool m_audioEnabled; |
139 bool m_hasVideo; |
124 bool m_hasVideo; |
140 float m_masterVolume; |
125 float m_masterVolume; |
141 float m_relativeVolume; |
126 float m_relativeVolume; |
142 float m_playbackRate; |
127 float m_playbackRate; |
143 float m_staticFps; |
|
144 quint64 m_currentTime; |
128 quint64 m_currentTime; |
145 MediaSource m_mediaSource; |
129 MediaSource m_mediaSource; |
146 |
|
147 void *m_primaryRenderingCIImage; |
130 void *m_primaryRenderingCIImage; |
148 qreal m_brightness; |
131 qreal m_brightness; |
149 qreal m_contrast; |
132 qreal m_contrast; |
150 qreal m_hue; |
133 qreal m_hue; |
151 qreal m_saturation; |
134 qreal m_saturation; |
152 NSArray *m_folderTracks; |
|
153 int m_currentTrack; |
|
154 QString m_movieCompactDiscPath; |
|
155 |
135 |
156 #ifdef QUICKTIME_C_API_AVAILABLE |
136 #ifdef QUICKTIME_C_API_AVAILABLE |
157 QTVisualContextRef m_visualContext; |
137 QTVisualContextRef m_visualContext; |
158 #endif |
138 #endif |
159 VideoFrame m_currentFrame; |
139 VideoFrame m_currentFrame; |
160 QuickTimeStreamReader *m_streamReader; |
140 QuickTimeStreamReader *m_streamReader; |
161 |
141 |
162 void prepareCurrentMovieForPlayback(); |
|
163 void createVisualContext(); |
142 void createVisualContext(); |
164 void openMovieFromCurrentMediaSource(); |
143 void openMovieFromCurrentMediaSource(); |
165 void openMovieFromDataRef(QTDataReference *dataRef); |
144 void openMovieFromDataRef(QTDataReference *dataRef); |
166 void openMovieFromFile(); |
145 void openMovieFromFile(); |
167 void openMovieFromUrl(); |
146 void openMovieFromUrl(); |
168 void openMovieFromStream(); |
147 void openMovieFromStream(); |
169 void openMovieFromCompactDisc(); |
|
170 void openMovieFromData(QByteArray *data, char *fileType); |
148 void openMovieFromData(QByteArray *data, char *fileType); |
171 void openMovieFromDataGuessType(QByteArray *data); |
149 void openMovieFromDataGuessType(QByteArray *data); |
172 QString mediaSourcePath(); |
150 QString mediaSourcePath(); |
173 bool codecExistsAccordingToSuffix(const QString &fileName); |
151 bool codecExistsAccordingToSuffix(const QString &fileName); |
174 NSString* pathToCompactDisc(); |
|
175 bool isCompactDisc(NSString *path); |
|
176 NSArray* scanFolder(NSString *path); |
|
177 |
152 |
178 void setError(NSError *error); |
153 void setError(NSError *error); |
179 bool errorOccured(); |
154 bool errorOccured(); |
180 void readProtection(); |
155 void readProtection(); |
181 void calculateStaticFps(); |
|
182 void checkIfVideoAwailable(); |
156 void checkIfVideoAwailable(); |
183 bool movieNotLoaded(); |
157 bool movieNotLoaded(); |
184 void waitStatePlayable(); |
158 void waitStatePlayable(); |
185 }; |
159 }; |
186 |
160 |