Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 92 |
1 files changed, 2 insertions, 90 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 20fd1e2..1e0dc21 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -74,4 +74,2 @@ Lib::Lib( XineVideoWidget* widget ) | |||
74 | { | 74 | { |
75 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
76 | m_initialized = false; | ||
77 | m_video = false; | 75 | m_video = false; |
@@ -91,15 +89,4 @@ Lib::Lib( XineVideoWidget* widget ) | |||
91 | 89 | ||
92 | start(); | ||
93 | } | ||
94 | |||
95 | void Lib::run() | ||
96 | { | ||
97 | initialize(); | ||
98 | } | ||
99 | |||
100 | void Lib::initialize() | ||
101 | { | ||
102 | m_xine = xine_new( ); | 90 | m_xine = xine_new( ); |
103 | 91 | ||
104 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | ||
105 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 92 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
@@ -132,7 +119,2 @@ void Lib::initialize() | |||
132 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 119 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
133 | |||
134 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
135 | m_initialized = true; | ||
136 | |||
137 | send( new ThreadUtil::ChannelMessage( InitializationMessageType ), OneWay ); | ||
138 | } | 120 | } |
@@ -140,6 +122,2 @@ void Lib::initialize() | |||
140 | Lib::~Lib() { | 122 | Lib::~Lib() { |
141 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
142 | |||
143 | assert( m_initialized ); | ||
144 | |||
145 | // free( m_config ); | 123 | // free( m_config ); |
@@ -158,13 +136,2 @@ Lib::~Lib() { | |||
158 | 136 | ||
159 | void Lib::assertInitialized() const | ||
160 | { | ||
161 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
162 | |||
163 | if ( m_initialized ) | ||
164 | return; | ||
165 | |||
166 | qDebug( "LibXine: xine function called while not being initialized, yet! Fix the caller!" ); | ||
167 | assert( m_initialized ); | ||
168 | } | ||
169 | |||
170 | void Lib::resize ( const QSize &s ) { | 137 | void Lib::resize ( const QSize &s ) { |
@@ -195,4 +162,2 @@ int Lib::subVersion() { | |||
195 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 162 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
196 | assertInitialized(); | ||
197 | |||
198 | QString str = fileName.stripWhiteSpace(); | 163 | QString str = fileName.stripWhiteSpace(); |
@@ -205,4 +170,2 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { | |||
205 | void Lib::stop() { | 170 | void Lib::stop() { |
206 | assertInitialized(); | ||
207 | |||
208 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | 171 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); |
@@ -212,4 +175,2 @@ void Lib::stop() { | |||
212 | void Lib::pause( bool toggle ) { | 175 | void Lib::pause( bool toggle ) { |
213 | assertInitialized(); | ||
214 | |||
215 | xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); | 176 | xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); |
@@ -218,4 +179,2 @@ void Lib::pause( bool toggle ) { | |||
218 | int Lib::speed() const { | 179 | int Lib::speed() const { |
219 | assertInitialized(); | ||
220 | |||
221 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); | 180 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
@@ -224,4 +183,2 @@ int Lib::speed() const { | |||
224 | void Lib::setSpeed( int speed ) { | 183 | void Lib::setSpeed( int speed ) { |
225 | assertInitialized(); | ||
226 | |||
227 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); | 184 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
@@ -230,4 +187,2 @@ void Lib::setSpeed( int speed ) { | |||
230 | int Lib::status() const { | 187 | int Lib::status() const { |
231 | assertInitialized(); | ||
232 | |||
233 | return xine_get_status( m_stream ); | 188 | return xine_get_status( m_stream ); |
@@ -236,4 +191,2 @@ int Lib::status() const { | |||
236 | int Lib::currentPosition() const { | 191 | int Lib::currentPosition() const { |
237 | assertInitialized(); | ||
238 | |||
239 | int pos, time, length; | 192 | int pos, time, length; |
@@ -244,4 +197,2 @@ int Lib::currentPosition() const { | |||
244 | int Lib::currentTime() const { | 197 | int Lib::currentTime() const { |
245 | assertInitialized(); | ||
246 | |||
247 | int pos, time, length; | 198 | int pos, time, length; |
@@ -252,4 +203,2 @@ int Lib::currentTime() const { | |||
252 | int Lib::length() const { | 203 | int Lib::length() const { |
253 | assertInitialized(); | ||
254 | |||
255 | int pos, time, length; | 204 | int pos, time, length; |
@@ -260,4 +209,2 @@ int Lib::length() const { | |||
260 | bool Lib::isSeekable() const { | 209 | bool Lib::isSeekable() const { |
261 | assertInitialized(); | ||
262 | |||
263 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); | 210 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
@@ -266,4 +213,2 @@ bool Lib::isSeekable() const { | |||
266 | void Lib::seekTo( int time ) { | 213 | void Lib::seekTo( int time ) { |
267 | assertInitialized(); | ||
268 | |||
269 | //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( | 214 | //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( |
@@ -275,4 +220,2 @@ void Lib::seekTo( int time ) { | |||
275 | Frame Lib::currentFrame() const { | 220 | Frame Lib::currentFrame() const { |
276 | assertInitialized(); | ||
277 | |||
278 | Frame frame; | 221 | Frame frame; |
@@ -282,4 +225,2 @@ Frame Lib::currentFrame() const { | |||
282 | QString Lib::metaInfo( int number) const { | 225 | QString Lib::metaInfo( int number) const { |
283 | assertInitialized(); | ||
284 | |||
285 | return xine_get_meta_info( m_stream, number ); | 226 | return xine_get_meta_info( m_stream, number ); |
@@ -288,4 +229,2 @@ QString Lib::metaInfo( int number) const { | |||
288 | int Lib::error() const { | 229 | int Lib::error() const { |
289 | assertInitialized(); | ||
290 | |||
291 | return xine_get_error( m_stream ); | 230 | return xine_get_error( m_stream ); |
@@ -296,10 +235,3 @@ void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | |||
296 | assert( sendType == ThreadUtil::Channel::OneWay ); | 235 | assert( sendType == ThreadUtil::Channel::OneWay ); |
297 | switch ( msg->type() ) { | 236 | handleXineEvent( msg->type() ); |
298 | case XineMessageType: | ||
299 | handleXineEvent( static_cast<XineMessage *>( msg )->xineEvent ); | ||
300 | break; | ||
301 | case InitializationMessageType: | ||
302 | emit initialized(); | ||
303 | break; | ||
304 | } | ||
305 | delete msg; | 237 | delete msg; |
@@ -308,3 +240,3 @@ void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | |||
308 | void Lib::handleXineEvent( const xine_event_t* t ) { | 240 | void Lib::handleXineEvent( const xine_event_t* t ) { |
309 | send( new XineMessage( t->type ), OneWay ); | 241 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); |
310 | } | 242 | } |
@@ -312,4 +244,2 @@ void Lib::handleXineEvent( const xine_event_t* t ) { | |||
312 | void Lib::handleXineEvent( int type ) { | 244 | void Lib::handleXineEvent( int type ) { |
313 | assertInitialized(); | ||
314 | |||
315 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { | 245 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { |
@@ -321,4 +251,2 @@ void Lib::handleXineEvent( int type ) { | |||
321 | void Lib::setShowVideo( bool video ) { | 251 | void Lib::setShowVideo( bool video ) { |
322 | assertInitialized(); | ||
323 | |||
324 | m_video = video; | 252 | m_video = video; |
@@ -328,4 +256,2 @@ void Lib::setShowVideo( bool video ) { | |||
328 | bool Lib::isShowingVideo() const { | 256 | bool Lib::isShowingVideo() const { |
329 | assertInitialized(); | ||
330 | |||
331 | return ::null_is_showing_video( m_videoOutput ); | 257 | return ::null_is_showing_video( m_videoOutput ); |
@@ -334,4 +260,2 @@ bool Lib::isShowingVideo() const { | |||
334 | bool Lib::hasVideo() const { | 260 | bool Lib::hasVideo() const { |
335 | assertInitialized(); | ||
336 | |||
337 | return xine_get_stream_info( m_stream, 18 ); | 261 | return xine_get_stream_info( m_stream, 18 ); |
@@ -340,4 +264,2 @@ bool Lib::hasVideo() const { | |||
340 | void Lib::showVideoFullScreen( bool fullScreen ) { | 264 | void Lib::showVideoFullScreen( bool fullScreen ) { |
341 | assertInitialized(); | ||
342 | |||
343 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 265 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
@@ -346,4 +268,2 @@ void Lib::showVideoFullScreen( bool fullScreen ) { | |||
346 | bool Lib::isVideoFullScreen() const { | 268 | bool Lib::isVideoFullScreen() const { |
347 | assertInitialized(); | ||
348 | |||
349 | return ::null_is_fullscreen( m_videoOutput ); | 269 | return ::null_is_fullscreen( m_videoOutput ); |
@@ -352,4 +272,2 @@ bool Lib::isVideoFullScreen() const { | |||
352 | void Lib::setScaling( bool scale ) { | 272 | void Lib::setScaling( bool scale ) { |
353 | assertInitialized(); | ||
354 | |||
355 | ::null_set_scaling( m_videoOutput, scale ); | 273 | ::null_set_scaling( m_videoOutput, scale ); |
@@ -358,4 +276,2 @@ void Lib::setScaling( bool scale ) { | |||
358 | void Lib::setGamma( int value ) { | 276 | void Lib::setGamma( int value ) { |
359 | assertInitialized(); | ||
360 | |||
361 | //qDebug( QString( "%1").arg(value) ); | 277 | //qDebug( QString( "%1").arg(value) ); |
@@ -366,4 +282,2 @@ void Lib::setGamma( int value ) { | |||
366 | bool Lib::isScaling() const { | 282 | bool Lib::isScaling() const { |
367 | assertInitialized(); | ||
368 | |||
369 | return ::null_is_scaling( m_videoOutput ); | 283 | return ::null_is_scaling( m_videoOutput ); |
@@ -381,4 +295,2 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame, | |||
381 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 295 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
382 | assertInitialized(); | ||
383 | |||
384 | if ( !m_video ) { | 296 | if ( !m_video ) { |