author | simon <simon> | 2002-12-02 11:21:24 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 11:21:24 (UTC) |
commit | 5a7c8386e4d526558becf2553912eb42a42107ee (patch) (unidiff) | |
tree | be3ebf33bf8cff012c25883adeda9427f4787698 | |
parent | b2532533a8a28680db967a45090a3ba1dd53ed73 (diff) | |
download | opie-5a7c8386e4d526558becf2553912eb42a42107ee.zip opie-5a7c8386e4d526558becf2553912eb42a42107ee.tar.gz opie-5a7c8386e4d526558becf2553912eb42a42107ee.tar.bz2 |
- made the version functions static and some other functions constant that
are constant by design
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 56 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 38 |
2 files changed, 49 insertions, 45 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 1ac9809..77dab9a 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -136,24 +136,27 @@ QCString Lib::version() { | |||
136 | // QCString str( xine_get_str_version() ); | 136 | // QCString str( xine_get_str_version() ); |
137 | // return str; | 137 | // return str; |
138 | return "test"; | 138 | return "test"; |
139 | } | 139 | } |
140 | 140 | ||
141 | int Lib::majorVersion() { | 141 | int Lib::majorVersion() { |
142 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); | 142 | int major, minor, sub; |
143 | return m_major_version; | 143 | xine_get_version ( &major, &minor, &sub ); |
144 | return major; | ||
144 | } | 145 | } |
145 | 146 | ||
146 | int Lib::minorVersion() { | 147 | int Lib::minorVersion() { |
147 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); | 148 | int major, minor, sub; |
148 | return m_minor_version; | 149 | xine_get_version ( &major, &minor, &sub ); |
150 | return minor; | ||
149 | } | 151 | } |
150 | 152 | ||
151 | int Lib::subVersion() { | 153 | int Lib::subVersion() { |
152 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); | 154 | int major, minor, sub; |
153 | return m_sub_version; | 155 | xine_get_version ( &major, &minor, &sub ); |
156 | return sub; | ||
154 | } | 157 | } |
155 | 158 | ||
156 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 159 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
157 | QString str = fileName.stripWhiteSpace(); | 160 | QString str = fileName.stripWhiteSpace(); |
158 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { | 161 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { |
159 | return 0; | 162 | return 0; |
@@ -167,60 +170,63 @@ void Lib::stop() { | |||
167 | } | 170 | } |
168 | 171 | ||
169 | void Lib::pause() { | 172 | void Lib::pause() { |
170 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | 173 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
171 | } | 174 | } |
172 | 175 | ||
173 | int Lib::speed() { | 176 | int Lib::speed() const { |
174 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); | 177 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
175 | } | 178 | } |
176 | 179 | ||
177 | void Lib::setSpeed( int speed ) { | 180 | void Lib::setSpeed( int speed ) { |
178 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); | 181 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
179 | } | 182 | } |
180 | 183 | ||
181 | int Lib::status() { | 184 | int Lib::status() const { |
182 | return xine_get_status( m_stream ); | 185 | return xine_get_status( m_stream ); |
183 | } | 186 | } |
184 | 187 | ||
185 | int Lib::currentPosition() { | 188 | int Lib::currentPosition() const { |
186 | xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); | 189 | int pos, time, length; |
187 | return m_pos; | 190 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
191 | return pos; | ||
188 | } | 192 | } |
189 | 193 | ||
190 | int Lib::currentTime() { | 194 | int Lib::currentTime() const { |
191 | xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); | 195 | int pos, time, length; |
192 | return m_time/1000; | 196 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
197 | return time/1000; | ||
193 | } | 198 | } |
194 | 199 | ||
195 | int Lib::length() { | 200 | int Lib::length() const { |
196 | xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); | 201 | int pos, time, length; |
197 | return m_length/1000; | 202 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
203 | return length/1000; | ||
198 | } | 204 | } |
199 | 205 | ||
200 | bool Lib::isSeekable() { | 206 | bool Lib::isSeekable() const { |
201 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); | 207 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
202 | } | 208 | } |
203 | 209 | ||
204 | void Lib::seekTo( int time ) { | 210 | void Lib::seekTo( int time ) { |
205 | //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( | 211 | //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( |
206 | // since its now milliseconds we need *1000 | 212 | // since its now milliseconds we need *1000 |
207 | xine_play( m_stream, 0, time*1000 ); | 213 | xine_play( m_stream, 0, time*1000 ); |
208 | } | 214 | } |
209 | 215 | ||
210 | 216 | ||
211 | Frame Lib::currentFrame() { | 217 | Frame Lib::currentFrame() const { |
212 | Frame frame; | 218 | Frame frame; |
213 | return frame; | 219 | return frame; |
214 | }; | 220 | }; |
215 | 221 | ||
216 | QString Lib::metaInfo( int number) { | 222 | QString Lib::metaInfo( int number) const { |
217 | return xine_get_meta_info( m_stream, number ); | 223 | return xine_get_meta_info( m_stream, number ); |
218 | } | 224 | } |
219 | 225 | ||
220 | int Lib::error() { | 226 | int Lib::error() const { |
221 | return xine_get_error( m_stream ); | 227 | return xine_get_error( m_stream ); |
222 | }; | 228 | }; |
223 | 229 | ||
224 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 230 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
225 | { | 231 | { |
226 | assert( sendType == ThreadUtil::Channel::OneWay ); | 232 | assert( sendType == ThreadUtil::Channel::OneWay ); |
@@ -241,25 +247,25 @@ void Lib::handleXineEvent( int type ) { | |||
241 | 247 | ||
242 | void Lib::setShowVideo( bool video ) { | 248 | void Lib::setShowVideo( bool video ) { |
243 | m_video = video; | 249 | m_video = video; |
244 | ::null_set_show_video( m_videoOutput, video ); | 250 | ::null_set_show_video( m_videoOutput, video ); |
245 | } | 251 | } |
246 | 252 | ||
247 | bool Lib::isShowingVideo() { | 253 | bool Lib::isShowingVideo() const { |
248 | return ::null_is_showing_video( m_videoOutput ); | 254 | return ::null_is_showing_video( m_videoOutput ); |
249 | } | 255 | } |
250 | 256 | ||
251 | bool Lib::hasVideo() { | 257 | bool Lib::hasVideo() const { |
252 | return xine_get_stream_info( m_stream, 18 ); | 258 | return xine_get_stream_info( m_stream, 18 ); |
253 | } | 259 | } |
254 | 260 | ||
255 | void Lib::showVideoFullScreen( bool fullScreen ) { | 261 | void Lib::showVideoFullScreen( bool fullScreen ) { |
256 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 262 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
257 | } | 263 | } |
258 | 264 | ||
259 | bool Lib::isVideoFullScreen() { | 265 | bool Lib::isVideoFullScreen() const { |
260 | return ::null_is_fullscreen( m_videoOutput ); | 266 | return ::null_is_fullscreen( m_videoOutput ); |
261 | } | 267 | } |
262 | 268 | ||
263 | void Lib::setScaling( bool scale ) { | 269 | void Lib::setScaling( bool scale ) { |
264 | ::null_set_scaling( m_videoOutput, scale ); | 270 | ::null_set_scaling( m_videoOutput, scale ); |
265 | } | 271 | } |
@@ -267,13 +273,13 @@ void Lib::setScaling( bool scale ) { | |||
267 | void Lib::setGamma( int value ) { | 273 | void Lib::setGamma( int value ) { |
268 | //qDebug( QString( "%1").arg(value) ); | 274 | //qDebug( QString( "%1").arg(value) ); |
269 | /* int gammaValue = ( 100 + value ); */ | 275 | /* int gammaValue = ( 100 + value ); */ |
270 | ::null_set_videoGamma( m_videoOutput, value ); | 276 | ::null_set_videoGamma( m_videoOutput, value ); |
271 | } | 277 | } |
272 | 278 | ||
273 | bool Lib::isScaling() { | 279 | bool Lib::isScaling() const { |
274 | return ::null_is_scaling( m_videoOutput ); | 280 | return ::null_is_scaling( m_videoOutput ); |
275 | } | 281 | } |
276 | 282 | ||
277 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { | 283 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { |
278 | ( (Lib*)user_data)->handleXineEvent( t ); | 284 | ( (Lib*)user_data)->handleXineEvent( t ); |
279 | } | 285 | } |
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 75b9f12..a7e51fb 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -58,67 +58,67 @@ namespace XINE { | |||
58 | class Lib : public ThreadUtil::Channel { | 58 | class Lib : public ThreadUtil::Channel { |
59 | Q_OBJECT | 59 | Q_OBJECT |
60 | public: | 60 | public: |
61 | Lib(XineVideoWidget* = 0); | 61 | Lib(XineVideoWidget* = 0); |
62 | ~Lib(); | 62 | ~Lib(); |
63 | QCString version(); | 63 | QCString version(); |
64 | int majorVersion()/*const*/; | 64 | static int majorVersion(); |
65 | int minorVersion()/*const*/; | 65 | static int minorVersion(); |
66 | int subVersion()/*const*/; | 66 | static int subVersion(); |
67 | 67 | ||
68 | 68 | ||
69 | void resize ( const QSize &s ); | 69 | void resize ( const QSize &s ); |
70 | 70 | ||
71 | int play( const QString& fileName, | 71 | int play( const QString& fileName, |
72 | int startPos = 0, | 72 | int startPos = 0, |
73 | int start_time = 0 ); | 73 | int start_time = 0 ); |
74 | void stop() /*const*/; | 74 | void stop(); |
75 | void pause()/*const*/; | 75 | void pause(); |
76 | 76 | ||
77 | int speed() /*const*/; | 77 | int speed() const; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Set the speed of the stream, if codec supports it | 80 | * Set the speed of the stream, if codec supports it |
81 | * XINE_SPEED_PAUSE 0 | 81 | * XINE_SPEED_PAUSE 0 |
82 | * XINE_SPEED_SLOW_4 1 | 82 | * XINE_SPEED_SLOW_4 1 |
83 | * XINE_SPEED_SLOW_2 2 | 83 | * XINE_SPEED_SLOW_2 2 |
84 | * XINE_SPEED_NORMAL 4 | 84 | * XINE_SPEED_NORMAL 4 |
85 | * XINE_SPEED_FAST_2 8 | 85 | * XINE_SPEED_FAST_2 8 |
86 | *XINE_SPEED_FAST_4 16 | 86 | *XINE_SPEED_FAST_4 16 |
87 | */ | 87 | */ |
88 | void setSpeed( int speed = XINE_SPEED_PAUSE ); | 88 | void setSpeed( int speed = XINE_SPEED_PAUSE ); |
89 | 89 | ||
90 | int status() /*const*/; | 90 | int status() const; |
91 | 91 | ||
92 | int currentPosition()/*const*/; | 92 | int currentPosition()const; |
93 | //in seconds | 93 | //in seconds |
94 | int currentTime()/*const*/; | 94 | int currentTime()const; |
95 | 95 | ||
96 | int length() /*const*/; | 96 | int length() const; |
97 | 97 | ||
98 | bool isSeekable()/*const*/; | 98 | bool isSeekable()const; |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Whether or not to show video output | 101 | * Whether or not to show video output |
102 | */ | 102 | */ |
103 | void setShowVideo(bool video); | 103 | void setShowVideo(bool video); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * is we show video | 106 | * is we show video |
107 | */ | 107 | */ |
108 | bool isShowingVideo() /*const*/; | 108 | bool isShowingVideo() const; |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * | 111 | * |
112 | */ | 112 | */ |
113 | void showVideoFullScreen( bool fullScreen ); | 113 | void showVideoFullScreen( bool fullScreen ); |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * | 116 | * |
117 | */ | 117 | */ |
118 | bool isVideoFullScreen()/*const*/ ; | 118 | bool isVideoFullScreen() const; |
119 | 119 | ||
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Get the meta info (like author etc) from the stream | 122 | * Get the meta info (like author etc) from the stream |
123 | * XINE_META_INFO_TITLE 0 | 123 | * XINE_META_INFO_TITLE 0 |
124 | * XINE_META_INFO_COMMENT 1 | 124 | * XINE_META_INFO_COMMENT 1 |
@@ -128,29 +128,29 @@ namespace XINE { | |||
128 | * XINE_META_INFO_YEAR 5 | 128 | * XINE_META_INFO_YEAR 5 |
129 | * XINE_META_INFO_VIDEOCODEC 6 | 129 | * XINE_META_INFO_VIDEOCODEC 6 |
130 | * XINE_META_INFO_AUDIOCODEC 7 | 130 | * XINE_META_INFO_AUDIOCODEC 7 |
131 | * XINE_META_INFO_SYSTEMLAYER 8 | 131 | * XINE_META_INFO_SYSTEMLAYER 8 |
132 | * XINE_META_INFO_INPUT_PLUGIN 9 | 132 | * XINE_META_INFO_INPUT_PLUGIN 9 |
133 | */ | 133 | */ |
134 | QString metaInfo( int number ); | 134 | QString metaInfo( int number ) const; |
135 | 135 | ||
136 | /** | 136 | /** |
137 | * | 137 | * |
138 | */ | 138 | */ |
139 | bool isScaling(); | 139 | bool isScaling() const; |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * seek to a position | 142 | * seek to a position |
143 | */ | 143 | */ |
144 | void seekTo( int time ); | 144 | void seekTo( int time ); |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * | 147 | * |
148 | * @return is media stream has video | 148 | * @return is media stream has video |
149 | */ | 149 | */ |
150 | bool hasVideo(); | 150 | bool hasVideo() const; |
151 | 151 | ||
152 | /** | 152 | /** |
153 | * | 153 | * |
154 | */ | 154 | */ |
155 | void setScaling( bool ); | 155 | void setScaling( bool ); |
156 | 156 | ||
@@ -160,34 +160,32 @@ namespace XINE { | |||
160 | */ | 160 | */ |
161 | void setGamma( int ); | 161 | void setGamma( int ); |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * test | 164 | * test |
165 | */ | 165 | */ |
166 | Frame currentFrame()/*const*/; | 166 | Frame currentFrame() const; |
167 | 167 | ||
168 | /** | 168 | /** |
169 | * Returns the error code | 169 | * Returns the error code |
170 | * XINE_ERROR_NONE 0 | 170 | * XINE_ERROR_NONE 0 |
171 | * XINE_ERROR_NO_INPUT_PLUGIN 1 | 171 | * XINE_ERROR_NO_INPUT_PLUGIN 1 |
172 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 | 172 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 |
173 | * XINE_ERROR_DEMUXER_FAILED 3 | 173 | * XINE_ERROR_DEMUXER_FAILED 3 |
174 | */ | 174 | */ |
175 | int error() /*const*/; | 175 | int error() const; |
176 | 176 | ||
177 | signals: | 177 | signals: |
178 | 178 | ||
179 | void stopped(); | 179 | void stopped(); |
180 | 180 | ||
181 | protected: | 181 | protected: |
182 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 182 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
183 | 183 | ||
184 | private: | 184 | private: |
185 | int m_bytes_per_pixel; | 185 | int m_bytes_per_pixel; |
186 | int m_length, m_pos, m_time; | ||
187 | int m_major_version, m_minor_version, m_sub_version; | ||
188 | bool m_video:1; | 186 | bool m_video:1; |
189 | XineVideoWidget *m_wid; | 187 | XineVideoWidget *m_wid; |
190 | xine_t *m_xine; | 188 | xine_t *m_xine; |
191 | xine_stream_t *m_stream; | 189 | xine_stream_t *m_stream; |
192 | xine_cfg_entry_t *m_config; | 190 | xine_cfg_entry_t *m_config; |
193 | xine_vo_driver_t *m_videoOutput; | 191 | xine_vo_driver_t *m_videoOutput; |