Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 641cbca..99d5de6 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -73,2 +73,3 @@ using namespace XINE; | |||
73 | Lib::Lib( XineVideoWidget* widget ) { | 73 | Lib::Lib( XineVideoWidget* widget ) { |
74 | m_initialized = false; | ||
74 | m_video = false; | 75 | m_video = false; |
@@ -118,3 +119,3 @@ void Lib::initialize() | |||
118 | 119 | ||
119 | m_wid->repaint(); | 120 | // m_wid->repaint(); |
120 | } | 121 | } |
@@ -125,2 +126,3 @@ void Lib::initialize() | |||
125 | 126 | ||
127 | m_initialized = true; | ||
126 | } | 128 | } |
@@ -128,2 +130,6 @@ void Lib::initialize() | |||
128 | Lib::~Lib() { | 130 | Lib::~Lib() { |
131 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
132 | |||
133 | assert( m_initialized ); | ||
134 | |||
129 | // free( m_config ); | 135 | // free( m_config ); |
@@ -142,2 +148,13 @@ Lib::~Lib() { | |||
142 | 148 | ||
149 | void Lib::assertInitialized() const | ||
150 | { | ||
151 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
152 | |||
153 | if ( m_initialized ) | ||
154 | return; | ||
155 | |||
156 | qDebug( "LibXine: xine function called while not being initialized, yet! Fix the caller!" ); | ||
157 | assert( m_initialized ); | ||
158 | } | ||
159 | |||
143 | void Lib::resize ( const QSize &s ) { | 160 | void Lib::resize ( const QSize &s ) { |
@@ -168,2 +185,4 @@ int Lib::subVersion() { | |||
168 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 185 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
186 | assertInitialized(); | ||
187 | |||
169 | QString str = fileName.stripWhiteSpace(); | 188 | QString str = fileName.stripWhiteSpace(); |
@@ -176,2 +195,4 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { | |||
176 | void Lib::stop() { | 195 | void Lib::stop() { |
196 | assertInitialized(); | ||
197 | |||
177 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | 198 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); |
@@ -181,2 +202,4 @@ void Lib::stop() { | |||
181 | void Lib::pause( bool toggle ) { | 202 | void Lib::pause( bool toggle ) { |
203 | assertInitialized(); | ||
204 | |||
182 | xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); | 205 | xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); |
@@ -185,2 +208,4 @@ void Lib::pause( bool toggle ) { | |||
185 | int Lib::speed() const { | 208 | int Lib::speed() const { |
209 | assertInitialized(); | ||
210 | |||
186 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); | 211 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
@@ -189,2 +214,4 @@ int Lib::speed() const { | |||
189 | void Lib::setSpeed( int speed ) { | 214 | void Lib::setSpeed( int speed ) { |
215 | assertInitialized(); | ||
216 | |||
190 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); | 217 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
@@ -193,2 +220,4 @@ void Lib::setSpeed( int speed ) { | |||
193 | int Lib::status() const { | 220 | int Lib::status() const { |
221 | assertInitialized(); | ||
222 | |||
194 | return xine_get_status( m_stream ); | 223 | return xine_get_status( m_stream ); |
@@ -197,2 +226,4 @@ int Lib::status() const { | |||
197 | int Lib::currentPosition() const { | 226 | int Lib::currentPosition() const { |
227 | assertInitialized(); | ||
228 | |||
198 | int pos, time, length; | 229 | int pos, time, length; |
@@ -203,2 +234,4 @@ int Lib::currentPosition() const { | |||
203 | int Lib::currentTime() const { | 234 | int Lib::currentTime() const { |
235 | assertInitialized(); | ||
236 | |||
204 | int pos, time, length; | 237 | int pos, time, length; |
@@ -209,2 +242,4 @@ int Lib::currentTime() const { | |||
209 | int Lib::length() const { | 242 | int Lib::length() const { |
243 | assertInitialized(); | ||
244 | |||
210 | int pos, time, length; | 245 | int pos, time, length; |
@@ -215,2 +250,4 @@ int Lib::length() const { | |||
215 | bool Lib::isSeekable() const { | 250 | bool Lib::isSeekable() const { |
251 | assertInitialized(); | ||
252 | |||
216 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); | 253 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
@@ -219,2 +256,4 @@ bool Lib::isSeekable() const { | |||
219 | void Lib::seekTo( int time ) { | 256 | void Lib::seekTo( int time ) { |
257 | assertInitialized(); | ||
258 | |||
220 | //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( | 259 | //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( |
@@ -226,2 +265,4 @@ void Lib::seekTo( int time ) { | |||
226 | Frame Lib::currentFrame() const { | 265 | Frame Lib::currentFrame() const { |
266 | assertInitialized(); | ||
267 | |||
227 | Frame frame; | 268 | Frame frame; |
@@ -231,2 +272,4 @@ Frame Lib::currentFrame() const { | |||
231 | QString Lib::metaInfo( int number) const { | 272 | QString Lib::metaInfo( int number) const { |
273 | assertInitialized(); | ||
274 | |||
232 | return xine_get_meta_info( m_stream, number ); | 275 | return xine_get_meta_info( m_stream, number ); |
@@ -235,2 +278,4 @@ QString Lib::metaInfo( int number) const { | |||
235 | int Lib::error() const { | 278 | int Lib::error() const { |
279 | assertInitialized(); | ||
280 | |||
236 | return xine_get_error( m_stream ); | 281 | return xine_get_error( m_stream ); |
@@ -250,2 +295,4 @@ void Lib::handleXineEvent( const xine_event_t* t ) { | |||
250 | void Lib::handleXineEvent( int type ) { | 295 | void Lib::handleXineEvent( int type ) { |
296 | assertInitialized(); | ||
297 | |||
251 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { | 298 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { |
@@ -257,2 +304,4 @@ void Lib::handleXineEvent( int type ) { | |||
257 | void Lib::setShowVideo( bool video ) { | 304 | void Lib::setShowVideo( bool video ) { |
305 | assertInitialized(); | ||
306 | |||
258 | m_video = video; | 307 | m_video = video; |
@@ -262,2 +311,4 @@ void Lib::setShowVideo( bool video ) { | |||
262 | bool Lib::isShowingVideo() const { | 311 | bool Lib::isShowingVideo() const { |
312 | assertInitialized(); | ||
313 | |||
263 | return ::null_is_showing_video( m_videoOutput ); | 314 | return ::null_is_showing_video( m_videoOutput ); |
@@ -266,2 +317,4 @@ bool Lib::isShowingVideo() const { | |||
266 | bool Lib::hasVideo() const { | 317 | bool Lib::hasVideo() const { |
318 | assertInitialized(); | ||
319 | |||
267 | return xine_get_stream_info( m_stream, 18 ); | 320 | return xine_get_stream_info( m_stream, 18 ); |
@@ -270,2 +323,4 @@ bool Lib::hasVideo() const { | |||
270 | void Lib::showVideoFullScreen( bool fullScreen ) { | 323 | void Lib::showVideoFullScreen( bool fullScreen ) { |
324 | assertInitialized(); | ||
325 | |||
271 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 326 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
@@ -274,2 +329,4 @@ void Lib::showVideoFullScreen( bool fullScreen ) { | |||
274 | bool Lib::isVideoFullScreen() const { | 329 | bool Lib::isVideoFullScreen() const { |
330 | assertInitialized(); | ||
331 | |||
275 | return ::null_is_fullscreen( m_videoOutput ); | 332 | return ::null_is_fullscreen( m_videoOutput ); |
@@ -278,2 +335,4 @@ bool Lib::isVideoFullScreen() const { | |||
278 | void Lib::setScaling( bool scale ) { | 335 | void Lib::setScaling( bool scale ) { |
336 | assertInitialized(); | ||
337 | |||
279 | ::null_set_scaling( m_videoOutput, scale ); | 338 | ::null_set_scaling( m_videoOutput, scale ); |
@@ -282,2 +341,4 @@ void Lib::setScaling( bool scale ) { | |||
282 | void Lib::setGamma( int value ) { | 341 | void Lib::setGamma( int value ) { |
342 | assertInitialized(); | ||
343 | |||
283 | //qDebug( QString( "%1").arg(value) ); | 344 | //qDebug( QString( "%1").arg(value) ); |
@@ -288,2 +349,4 @@ void Lib::setGamma( int value ) { | |||
288 | bool Lib::isScaling() const { | 349 | bool Lib::isScaling() const { |
350 | assertInitialized(); | ||
351 | |||
289 | return ::null_is_scaling( m_videoOutput ); | 352 | return ::null_is_scaling( m_videoOutput ); |
@@ -301,2 +364,4 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame, | |||
301 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 364 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
365 | assertInitialized(); | ||
366 | |||
302 | if ( !m_video ) { | 367 | if ( !m_video ) { |