-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 6 |
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 | |||
@@ -85,31 +85,33 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | |||
85 | QFile f(configPath); | 85 | QFile f(configPath); |
86 | f.open(IO_WriteOnly); | 86 | f.open(IO_WriteOnly); |
87 | QTextStream ts( &f ); | 87 | QTextStream ts( &f ); |
88 | ts << "misc.memcpy_method:glibc\n"; | 88 | ts << "misc.memcpy_method:glibc\n"; |
89 | f.close(); | 89 | f.close(); |
90 | } | 90 | } |
91 | 91 | ||
92 | if ( initMode == InitializeImmediately ) { | 92 | if ( initMode == InitializeImmediately ) { |
93 | initialize(); | 93 | initialize(); |
94 | m_initialized = true; | 94 | m_initialized = true; |
95 | } | 95 | } |
96 | else | 96 | else |
97 | assert( false ); | 97 | start(); |
98 | } | 98 | } |
99 | 99 | ||
100 | void Lib::run() | 100 | void Lib::run() |
101 | { | 101 | { |
102 | qDebug( "Lib::run() started" ); | ||
102 | initialize(); | 103 | initialize(); |
103 | m_initialized = true; | 104 | m_initialized = true; |
105 | qDebug( "Lib::run() finished" ); | ||
104 | } | 106 | } |
105 | 107 | ||
106 | void Lib::initialize() | 108 | void Lib::initialize() |
107 | { | 109 | { |
108 | m_duringInitialization = true; | 110 | m_duringInitialization = true; |
109 | m_xine = xine_new( ); | 111 | m_xine = xine_new( ); |
110 | 112 | ||
111 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 113 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
112 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 114 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
113 | 115 | ||
114 | xine_init( m_xine ); | 116 | xine_init( m_xine ); |
115 | 117 | ||
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 @@ | |||
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | #define FBIOBLANK 0x4611 | 30 | #define FBIOBLANK 0x4611 |
31 | 31 | ||
32 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 32 | MediaPlayer::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 |
44 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 45 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
45 | 46 | ||
46 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 47 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
47 | 48 | ||
48 | // What is pauseCheck good for? (Simon) | 49 | // What is pauseCheck good for? (Simon) |
49 | // connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 50 | // connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
@@ -56,24 +57,29 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla | |||
56 | Config cfg( "OpiePlayer" ); | 57 | Config cfg( "OpiePlayer" ); |
57 | cfg.setGroup("PlayList"); | 58 | cfg.setGroup("PlayList"); |
58 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 59 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
59 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 60 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
60 | 61 | ||
61 | m_skinLoader = new SkinLoader; | 62 | m_skinLoader = new SkinLoader; |
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 | ||
67 | MediaPlayer::~MediaPlayer() { | 68 | MediaPlayer::~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 | ||
74 | void MediaPlayer::pauseCheck( bool b ) { | 80 | void MediaPlayer::pauseCheck( bool b ) { |
75 | if ( b && !mediaPlayerState.isPlaying() ) { | 81 | if ( b && !mediaPlayerState.isPlaying() ) { |
76 | mediaPlayerState.setPaused( FALSE ); | 82 | mediaPlayerState.setPaused( FALSE ); |
77 | } | 83 | } |
78 | } | 84 | } |
79 | 85 | ||
@@ -362,26 +368,30 @@ void MediaPlayer::recreateAudioAndVideoWidgets() const | |||
362 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); | 368 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); |
363 | 369 | ||
364 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 370 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
365 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 371 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
366 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 372 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
367 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 373 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
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 | ||
378 | AudioWidget *MediaPlayer::audioUI() const | 388 | AudioWidget *MediaPlayer::audioUI() const |
379 | { | 389 | { |
380 | if ( !m_audioUI ) | 390 | if ( !m_audioUI ) |
381 | recreateAudioAndVideoWidgets(); | 391 | recreateAudioAndVideoWidgets(); |
382 | return m_audioUI; | 392 | return m_audioUI; |
383 | } | 393 | } |
384 | 394 | ||
385 | VideoWidget *MediaPlayer::videoUI() const | 395 | VideoWidget *MediaPlayer::videoUI() const |
386 | { | 396 | { |
387 | if ( !m_videoUI ) | 397 | if ( !m_videoUI ) |
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 | |||
@@ -39,24 +39,29 @@ | |||
39 | 39 | ||
40 | #include "xinecontrol.h" | 40 | #include "xinecontrol.h" |
41 | 41 | ||
42 | #include "playlistwidget.h" | 42 | #include "playlistwidget.h" |
43 | #include "skin.h" | 43 | #include "skin.h" |
44 | 44 | ||
45 | class DocLnk; | 45 | class DocLnk; |
46 | class VolumeControl; | 46 | class VolumeControl; |
47 | class MediaPlayerState; | 47 | class MediaPlayerState; |
48 | class AudioWidget; | 48 | class AudioWidget; |
49 | class VideoWidget; | 49 | class VideoWidget; |
50 | 50 | ||
51 | namespace XINE | ||
52 | { | ||
53 | class Lib; | ||
54 | }; | ||
55 | |||
51 | class MediaPlayer : public QObject { | 56 | class MediaPlayer : public QObject { |
52 | Q_OBJECT | 57 | Q_OBJECT |
53 | public: | 58 | public: |
54 | MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); | 59 | MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); |
55 | ~MediaPlayer(); | 60 | ~MediaPlayer(); |
56 | 61 | ||
57 | public slots: | 62 | public slots: |
58 | void reloadSkins(); | 63 | void reloadSkins(); |
59 | 64 | ||
60 | private slots: | 65 | private slots: |
61 | void setPlaying( bool ); | 66 | void setPlaying( bool ); |
62 | void pauseCheck( bool ); | 67 | void pauseCheck( bool ); |
@@ -81,19 +86,20 @@ private: | |||
81 | bool isBlanked, l, r; | 86 | bool isBlanked, l, r; |
82 | int fd, fl; | 87 | int fd, fl; |
83 | int volumeDirection; | 88 | int volumeDirection; |
84 | VolumeControl *volControl; | 89 | VolumeControl *volControl; |
85 | MediaPlayerState &mediaPlayerState; | 90 | MediaPlayerState &mediaPlayerState; |
86 | PlayListWidget &playList; | 91 | PlayListWidget &playList; |
87 | 92 | ||
88 | void recreateAudioAndVideoWidgets() const; | 93 | void recreateAudioAndVideoWidgets() const; |
89 | 94 | ||
90 | mutable XineControl *m_xineControl; | 95 | mutable XineControl *m_xineControl; |
91 | mutable AudioWidget *m_audioUI; | 96 | mutable AudioWidget *m_audioUI; |
92 | mutable VideoWidget *m_videoUI; | 97 | mutable VideoWidget *m_videoUI; |
98 | mutable XINE::Lib *xine; | ||
93 | 99 | ||
94 | QGuardedPtr<SkinLoader> m_skinLoader; | 100 | QGuardedPtr<SkinLoader> m_skinLoader; |
95 | }; | 101 | }; |
96 | 102 | ||
97 | 103 | ||
98 | #endif // MEDIA_PLAYER_H | 104 | #endif // MEDIA_PLAYER_H |
99 | 105 | ||