-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 2 |
4 files changed, 19 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 84194b7..299239b 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -123,20 +123,17 @@ void Lib::initialize() | |||
123 | 123 | ||
124 | 124 | ||
125 | // null_display_handler( m_videoOutput, xine_display_frame, this ); | 125 | // null_display_handler( m_videoOutput, xine_display_frame, this ); |
126 | 126 | ||
127 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 127 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
128 | 128 | ||
129 | if (m_wid != 0 ) { | 129 | if (m_wid != 0 ) { |
130 | printf( "!0\n" ); | 130 | printf( "!0\n" ); |
131 | resize ( m_wid-> size ( ) ); | 131 | setWidget( m_wid ); |
132 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | ||
133 | |||
134 | // m_wid->repaint(); | ||
135 | } | 132 | } |
136 | 133 | ||
137 | m_queue = xine_event_new_queue (m_stream); | 134 | m_queue = xine_event_new_queue (m_stream); |
138 | 135 | ||
139 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 136 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
140 | m_duringInitialization = false; | 137 | m_duringInitialization = false; |
141 | } | 138 | } |
142 | 139 | ||
@@ -289,16 +286,24 @@ void Lib::ensureInitialized() | |||
289 | if ( m_initialized ) | 286 | if ( m_initialized ) |
290 | return; | 287 | return; |
291 | 288 | ||
292 | qDebug( "waiting for initialization thread to finish" ); | 289 | qDebug( "waiting for initialization thread to finish" ); |
293 | wait(); | 290 | wait(); |
294 | qDebug( "initialization thread finished!" ); | 291 | qDebug( "initialization thread finished!" ); |
295 | } | 292 | } |
296 | 293 | ||
294 | void Lib::setWidget( XineVideoWidget *widget ) | ||
295 | { | ||
296 | m_wid = widget; | ||
297 | resize ( m_wid-> size ( ) ); | ||
298 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | ||
299 | m_wid->repaint(); | ||
300 | } | ||
301 | |||
297 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 302 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
298 | { | 303 | { |
299 | assert( sendType == ThreadUtil::Channel::OneWay ); | 304 | assert( sendType == ThreadUtil::Channel::OneWay ); |
300 | handleXineEvent( msg->type() ); | 305 | handleXineEvent( msg->type() ); |
301 | delete msg; | 306 | delete msg; |
302 | } | 307 | } |
303 | 308 | ||
304 | void Lib::handleXineEvent( const xine_event_t* t ) { | 309 | void Lib::handleXineEvent( const xine_event_t* t ) { |
@@ -376,10 +381,13 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame, | |||
376 | 381 | ||
377 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 382 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
378 | assert( m_initialized ); | 383 | assert( m_initialized ); |
379 | 384 | ||
380 | if ( !m_video ) { | 385 | if ( !m_video ) { |
381 | qWarning("not showing video now"); | 386 | qWarning("not showing video now"); |
382 | return; | 387 | return; |
383 | } | 388 | } |
389 | |||
390 | assert( m_wid ); | ||
391 | |||
384 | m_wid-> setVideoFrame ( frame, width, height, bytes ); | 392 | m_wid-> setVideoFrame ( frame, width, height, bytes ); |
385 | } | 393 | } |
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 6b67f67..181735c 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -174,16 +174,18 @@ namespace XINE { | |||
174 | * XINE_ERROR_NO_INPUT_PLUGIN 1 | 174 | * XINE_ERROR_NO_INPUT_PLUGIN 1 |
175 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 | 175 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 |
176 | * XINE_ERROR_DEMUXER_FAILED 3 | 176 | * XINE_ERROR_DEMUXER_FAILED 3 |
177 | */ | 177 | */ |
178 | int error() const; | 178 | int error() const; |
179 | 179 | ||
180 | void ensureInitialized(); | 180 | void ensureInitialized(); |
181 | 181 | ||
182 | void setWidget( XineVideoWidget *widget ); | ||
183 | |||
182 | signals: | 184 | signals: |
183 | 185 | ||
184 | void stopped(); | 186 | void stopped(); |
185 | 187 | ||
186 | void initialized(); | 188 | void initialized(); |
187 | 189 | ||
188 | protected: | 190 | protected: |
189 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 191 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 963e783..d6fbb53 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -10,16 +10,17 @@ | |||
10 | #include <qwidgetstack.h> | 10 | #include <qwidgetstack.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | 12 | ||
13 | #include "mediaplayer.h" | 13 | #include "mediaplayer.h" |
14 | #include "playlistwidget.h" | 14 | #include "playlistwidget.h" |
15 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
16 | #include "videowidget.h" | 16 | #include "videowidget.h" |
17 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
18 | #include "lib.h" | ||
18 | 19 | ||
19 | #include "mediaplayerstate.h" | 20 | #include "mediaplayerstate.h" |
20 | 21 | ||
21 | // for setBacklight() | 22 | // for setBacklight() |
22 | #include <linux/fb.h> | 23 | #include <linux/fb.h> |
23 | #include <sys/file.h> | 24 | #include <sys/file.h> |
24 | #include <sys/ioctl.h> | 25 | #include <sys/ioctl.h> |
25 | 26 | ||
@@ -365,17 +366,18 @@ void MediaPlayer::recreateAudioAndVideoWidgets() const | |||
365 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 366 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
366 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 367 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
367 | 368 | ||
368 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 369 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
369 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 370 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
370 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 371 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
371 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 372 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
372 | 373 | ||
373 | m_xineControl = new XineControl( m_videoUI->vidWidget(), mediaPlayerState ); | 374 | XINE::Lib *xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); |
375 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); | ||
374 | } | 376 | } |
375 | 377 | ||
376 | AudioWidget *MediaPlayer::audioUI() const | 378 | AudioWidget *MediaPlayer::audioUI() const |
377 | { | 379 | { |
378 | if ( !m_audioUI ) | 380 | if ( !m_audioUI ) |
379 | recreateAudioAndVideoWidgets(); | 381 | recreateAudioAndVideoWidgets(); |
380 | return m_audioUI; | 382 | return m_audioUI; |
381 | } | 383 | } |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 7c54499..1c489e3 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -52,16 +52,18 @@ XineControl::XineControl( XineVideoWidget *xineWidget, | |||
52 | 52 | ||
53 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, | 53 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, |
54 | MediaPlayerState &_mediaPlayerState, | 54 | MediaPlayerState &_mediaPlayerState, |
55 | QObject *parent, const char *name ) | 55 | QObject *parent, const char *name ) |
56 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) | 56 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) |
57 | { | 57 | { |
58 | xine->ensureInitialized(); | 58 | xine->ensureInitialized(); |
59 | 59 | ||
60 | xine->setWidget( xineWidget ); | ||
61 | |||
60 | init(); | 62 | init(); |
61 | } | 63 | } |
62 | 64 | ||
63 | void XineControl::init() | 65 | void XineControl::init() |
64 | { | 66 | { |
65 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); | 67 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); |
66 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); | 68 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); |
67 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 69 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |