-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 23 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 18 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 2 |
5 files changed, 42 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 99d5de6..20fd1e2 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -69,9 +69,11 @@ extern "C" { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( XineVideoWidget* widget ) { | 73 | Lib::Lib( XineVideoWidget* widget ) |
74 | { | ||
75 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
74 | m_initialized = false; | 76 | m_initialized = false; |
75 | m_video = false; | 77 | m_video = false; |
76 | m_wid = widget; | 78 | m_wid = widget; |
77 | printf("Lib"); | 79 | printf("Lib"); |
@@ -86,8 +88,13 @@ Lib::Lib( XineVideoWidget* widget ) { | |||
86 | ts << "misc.memcpy_method:glibc\n"; | 88 | ts << "misc.memcpy_method:glibc\n"; |
87 | f.close(); | 89 | f.close(); |
88 | } | 90 | } |
89 | 91 | ||
92 | start(); | ||
93 | } | ||
94 | |||
95 | void Lib::run() | ||
96 | { | ||
90 | initialize(); | 97 | initialize(); |
91 | } | 98 | } |
92 | 99 | ||
93 | void Lib::initialize() | 100 | void Lib::initialize() |
@@ -123,9 +130,12 @@ void Lib::initialize() | |||
123 | m_queue = xine_event_new_queue (m_stream); | 130 | m_queue = xine_event_new_queue (m_stream); |
124 | 131 | ||
125 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 132 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
126 | 133 | ||
134 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
127 | m_initialized = true; | 135 | m_initialized = true; |
136 | |||
137 | send( new ThreadUtil::ChannelMessage( InitializationMessageType ), OneWay ); | ||
128 | } | 138 | } |
129 | 139 | ||
130 | Lib::~Lib() { | 140 | Lib::~Lib() { |
131 | ThreadUtil::AutoLock lock( m_initGuard ); | 141 | ThreadUtil::AutoLock lock( m_initGuard ); |
@@ -283,14 +293,21 @@ int Lib::error() const { | |||
283 | 293 | ||
284 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 294 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
285 | { | 295 | { |
286 | assert( sendType == ThreadUtil::Channel::OneWay ); | 296 | assert( sendType == ThreadUtil::Channel::OneWay ); |
287 | handleXineEvent( msg->type() ); | 297 | switch ( msg->type() ) { |
298 | case XineMessageType: | ||
299 | handleXineEvent( static_cast<XineMessage *>( msg )->xineEvent ); | ||
300 | break; | ||
301 | case InitializationMessageType: | ||
302 | emit initialized(); | ||
303 | break; | ||
304 | } | ||
288 | delete msg; | 305 | delete msg; |
289 | } | 306 | } |
290 | 307 | ||
291 | void Lib::handleXineEvent( const xine_event_t* t ) { | 308 | void Lib::handleXineEvent( const xine_event_t* t ) { |
292 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); | 309 | send( new XineMessage( t->type ), OneWay ); |
293 | } | 310 | } |
294 | 311 | ||
295 | void Lib::handleXineEvent( int type ) { | 312 | void Lib::handleXineEvent( int type ) { |
296 | assertInitialized(); | 313 | assertInitialized(); |
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 4b8dc81..34b85b9 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -54,9 +54,10 @@ namespace XINE { | |||
54 | * It supports playing, pausing, info, | 54 | * It supports playing, pausing, info, |
55 | * stooping, seeking. | 55 | * stooping, seeking. |
56 | */ | 56 | */ |
57 | class Frame; | 57 | class Frame; |
58 | class Lib : public ThreadUtil::Channel { | 58 | class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread |
59 | { | ||
59 | Q_OBJECT | 60 | Q_OBJECT |
60 | public: | 61 | public: |
61 | Lib(XineVideoWidget* = 0); | 62 | Lib(XineVideoWidget* = 0); |
62 | ~Lib(); | 63 | ~Lib(); |
@@ -176,16 +177,31 @@ namespace XINE { | |||
176 | signals: | 177 | signals: |
177 | 178 | ||
178 | void stopped(); | 179 | void stopped(); |
179 | 180 | ||
181 | void initialized(); | ||
182 | |||
180 | protected: | 183 | protected: |
181 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 184 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
182 | 185 | ||
186 | virtual void run(); | ||
187 | |||
183 | private: | 188 | private: |
184 | void initialize(); | 189 | void initialize(); |
185 | 190 | ||
186 | void assertInitialized() const; | 191 | void assertInitialized() const; |
187 | 192 | ||
193 | enum { XineMessageType = 1, InitializationMessageType }; | ||
194 | |||
195 | struct XineMessage : public ThreadUtil::ChannelMessage | ||
196 | { | ||
197 | XineMessage( int _xineEvent ) : ThreadUtil::ChannelMessage( XineMessageType ), | ||
198 | xineEvent( _xineEvent ) | ||
199 | {} | ||
200 | |||
201 | int xineEvent; | ||
202 | }; | ||
203 | |||
188 | mutable ThreadUtil::Mutex m_initGuard; | 204 | mutable ThreadUtil::Mutex m_initGuard; |
189 | bool m_initialized : 1; | 205 | bool m_initialized : 1; |
190 | 206 | ||
191 | int m_bytes_per_pixel; | 207 | int m_bytes_per_pixel; |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 5e91561..0d9a5b8 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -364,9 +364,10 @@ void MediaPlayer::recreateAudioAndVideoWidgets() | |||
364 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 364 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
365 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 365 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
366 | 366 | ||
367 | xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); | 367 | xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); |
368 | mediaPlayerState.setBackendInitialized(); | 368 | connect( xineControl, SIGNAL( initialized() ), |
369 | &mediaPlayerState, SLOT( setBackendInitialized() ) ); | ||
369 | } | 370 | } |
370 | 371 | ||
371 | void MediaPlayer::reloadSkins() | 372 | void MediaPlayer::reloadSkins() |
372 | { | 373 | { |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 0e81fa2..14e71d9 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -54,8 +54,9 @@ XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWi | |||
54 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 54 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
55 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 55 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
56 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 56 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
58 | connect( libXine, SIGNAL( initialized() ), this, SIGNAL( initialized() ) ); | ||
58 | 59 | ||
59 | disabledSuspendScreenSaver = FALSE; | 60 | disabledSuspendScreenSaver = FALSE; |
60 | } | 61 | } |
61 | 62 | ||
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 69a594f..000529c 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h | |||
@@ -113,8 +113,10 @@ private: | |||
113 | MediaPlayerState &mediaPlayerState; | 113 | MediaPlayerState &mediaPlayerState; |
114 | 114 | ||
115 | signals: | 115 | signals: |
116 | void positionChanged( long ); | 116 | void positionChanged( long ); |
117 | |||
118 | void initialized(); | ||
117 | }; | 119 | }; |
118 | 120 | ||
119 | 121 | ||
120 | #endif | 122 | #endif |