summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h6
3 files changed, 20 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 299239b..8896cfe 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -91,19 +91,21 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
if ( initMode == InitializeImmediately ) {
initialize();
m_initialized = true;
}
else
- assert( false );
+ start();
}
void Lib::run()
{
+ qDebug( "Lib::run() started" );
initialize();
m_initialized = true;
+ qDebug( "Lib::run() finished" );
}
void Lib::initialize()
{
m_duringInitialization = true;
m_xine = xine_new( );
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 @@
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
@@ -62,12 +63,17 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
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;
}
@@ -368,14 +374,18 @@ void MediaPlayer::recreateAudioAndVideoWidgets() const
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();
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 351c884..cbe4d86 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -45,12 +45,17 @@
class DocLnk;
class VolumeControl;
class MediaPlayerState;
class AudioWidget;
class VideoWidget;
+namespace XINE
+{
+ class Lib;
+};
+
class MediaPlayer : public QObject {
Q_OBJECT
public:
MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
~MediaPlayer();
@@ -87,12 +92,13 @@ private:
void recreateAudioAndVideoWidgets() const;
mutable XineControl *m_xineControl;
mutable AudioWidget *m_audioUI;
mutable VideoWidget *m_videoUI;
+ mutable XINE::Lib *xine;
QGuardedPtr<SkinLoader> m_skinLoader;
};
#endif // MEDIA_PLAYER_H