summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
authorsimon <simon>2002-12-11 00:29:22 (UTC)
committer simon <simon>2002-12-11 00:29:22 (UTC)
commit7d5782ef4fd19498a141ed68c23145dcc6128146 (patch) (side-by-side diff)
tree8cdbd360962b3fa161823fa88b43e9584b23a464 /noncore/multimedia/opieplayer2/lib.cpp
parent6c71f5ccd9506234a317d9ff3d119613c457e769 (diff)
downloadopie-7d5782ef4fd19498a141ed68c23145dcc6128146.zip
opie-7d5782ef4fd19498a141ed68c23145dcc6128146.tar.gz
opie-7d5782ef4fd19498a141ed68c23145dcc6128146.tar.bz2
- initialized xine in a background thread. much time is still spend in
skin loading though.
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp23
1 files changed, 20 insertions, 3 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
@@ -70,7 +70,9 @@ extern "C" {
using namespace XINE;
-Lib::Lib( XineVideoWidget* widget ) {
+Lib::Lib( XineVideoWidget* widget )
+{
+ ThreadUtil::AutoLock lock( m_initGuard );
m_initialized = false;
m_video = false;
m_wid = widget;
@@ -87,6 +89,11 @@ Lib::Lib( XineVideoWidget* widget ) {
f.close();
}
+ start();
+}
+
+void Lib::run()
+{
initialize();
}
@@ -124,7 +131,10 @@ void Lib::initialize()
xine_event_create_listener_thread (m_queue, xine_event_handler, this);
+ ThreadUtil::AutoLock lock( m_initGuard );
m_initialized = true;
+
+ send( new ThreadUtil::ChannelMessage( InitializationMessageType ), OneWay );
}
Lib::~Lib() {
@@ -284,12 +294,19 @@ int Lib::error() const {
void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
{
assert( sendType == ThreadUtil::Channel::OneWay );
- handleXineEvent( msg->type() );
+ switch ( msg->type() ) {
+ case XineMessageType:
+ handleXineEvent( static_cast<XineMessage *>( msg )->xineEvent );
+ break;
+ case InitializationMessageType:
+ emit initialized();
+ break;
+ }
delete msg;
}
void Lib::handleXineEvent( const xine_event_t* t ) {
- send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
+ send( new XineMessage( t->type ), OneWay );
}
void Lib::handleXineEvent( int type ) {