summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayer.cpp
Side-by-side diff
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
@@ -26,24 +26,25 @@
#define FBIOBLANK 0x4611
MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
: QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
m_audioUI = 0;
m_videoUI = 0;
m_xineControl = 0;
+ xine = new XINE::Lib( XINE::Lib::InitializeInThread );
fd=-1;fl=-1;
playList.setCaption( tr( "OpiePlayer: Initializating" ) );
qApp->processEvents();
// QPEApplication::grabKeyboard(); // EVIL
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
// What is pauseCheck good for? (Simon)
// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
@@ -56,24 +57,29 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
m_skinLoader = new SkinLoader;
m_skinLoader->schedule( AudioWidget::guiInfo() );
m_skinLoader->schedule( VideoWidget::guiInfo() );
m_skinLoader->start();
}
MediaPlayer::~MediaPlayer() {
+ // this shold never happen, but one never knows...
+ if ( xine ) {
+ xine->ensureInitialized();
+ delete xine;
+ }
delete m_xineControl;
delete m_audioUI;
delete m_videoUI;
delete volControl;
}
void MediaPlayer::pauseCheck( bool b ) {
if ( b && !mediaPlayerState.isPlaying() ) {
mediaPlayerState.setPaused( FALSE );
}
}
@@ -362,26 +368,30 @@ void MediaPlayer::recreateAudioAndVideoWidgets() const
m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
- XINE::Lib *xine = new XINE::Lib( XINE::Lib::InitializeImmediately );
+ if ( !xine )
+ xine = new XINE::Lib( XINE::Lib::InitializeImmediately );
+
m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState );
+
+ xine = 0;
}
AudioWidget *MediaPlayer::audioUI() const
{
if ( !m_audioUI )
recreateAudioAndVideoWidgets();
return m_audioUI;
}
VideoWidget *MediaPlayer::videoUI() const
{
if ( !m_videoUI )