summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayer.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index d6fbb53..0ec6fad 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -32,12 +32,13 @@
32MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 32MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
33 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { 33 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
34 34
35 m_audioUI = 0; 35 m_audioUI = 0;
36 m_videoUI = 0; 36 m_videoUI = 0;
37 m_xineControl = 0; 37 m_xineControl = 0;
38 xine = new XINE::Lib( XINE::Lib::InitializeInThread );
38 39
39 fd=-1;fl=-1; 40 fd=-1;fl=-1;
40 playList.setCaption( tr( "OpiePlayer: Initializating" ) ); 41 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
41 42
42 qApp->processEvents(); 43 qApp->processEvents();
43 // QPEApplication::grabKeyboard(); // EVIL 44 // QPEApplication::grabKeyboard(); // EVIL
@@ -62,12 +63,17 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
62 m_skinLoader->schedule( AudioWidget::guiInfo() ); 63 m_skinLoader->schedule( AudioWidget::guiInfo() );
63 m_skinLoader->schedule( VideoWidget::guiInfo() ); 64 m_skinLoader->schedule( VideoWidget::guiInfo() );
64 m_skinLoader->start(); 65 m_skinLoader->start();
65} 66}
66 67
67MediaPlayer::~MediaPlayer() { 68MediaPlayer::~MediaPlayer() {
69 // this shold never happen, but one never knows...
70 if ( xine ) {
71 xine->ensureInitialized();
72 delete xine;
73 }
68 delete m_xineControl; 74 delete m_xineControl;
69 delete m_audioUI; 75 delete m_audioUI;
70 delete m_videoUI; 76 delete m_videoUI;
71 delete volControl; 77 delete volControl;
72} 78}
73 79
@@ -368,14 +374,18 @@ void MediaPlayer::recreateAudioAndVideoWidgets() const
368 374
369 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 375 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
370 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 376 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
371 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 377 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
372 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 378 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
373 379
374 XINE::Lib *xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); 380 if ( !xine )
381 xine = new XINE::Lib( XINE::Lib::InitializeImmediately );
382
375 m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); 383 m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState );
384
385 xine = 0;
376} 386}
377 387
378AudioWidget *MediaPlayer::audioUI() const 388AudioWidget *MediaPlayer::audioUI() const
379{ 389{
380 if ( !m_audioUI ) 390 if ( !m_audioUI )
381 recreateAudioAndVideoWidgets(); 391 recreateAudioAndVideoWidgets();