summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show 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
@@ -61,41 +61,48 @@ extern "C" {
void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
int null_is_scaling( const xine_vo_driver_t* self );
void null_set_scaling( const xine_vo_driver_t* self, int scale );
void null_set_gui_width( const xine_vo_driver_t* self, int width );
void null_set_gui_height( const xine_vo_driver_t* self, int height );
void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
void null_set_videoGamma( const xine_vo_driver_t* self , int value );
void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
}
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;
printf("Lib");
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
// get the configuration
// not really OO, should be an extra class, later
if ( !QFile::exists(configPath) ) {
QFile f(configPath);
f.open(IO_WriteOnly);
QTextStream ts( &f );
ts << "misc.memcpy_method:glibc\n";
f.close();
}
+ start();
+}
+
+void Lib::run()
+{
initialize();
}
void Lib::initialize()
{
m_xine = xine_new( );
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
xine_config_load( m_xine, QFile::encodeName( configPath ) );
xine_init( m_xine );
@@ -115,25 +122,28 @@ void Lib::initialize()
if (m_wid != 0 ) {
printf( "!0\n" );
resize ( m_wid-> size ( ) );
::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
// m_wid->repaint();
}
m_queue = xine_event_new_queue (m_stream);
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() {
ThreadUtil::AutoLock lock( m_initGuard );
assert( m_initialized );
// free( m_config );
xine_close( m_stream );
xine_event_dispose_queue( m_queue );
@@ -275,30 +285,37 @@ QString Lib::metaInfo( int number) const {
return xine_get_meta_info( m_stream, number );
}
int Lib::error() const {
assertInitialized();
return xine_get_error( m_stream );
};
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 ) {
assertInitialized();
if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
emit stopped();
}
}
void Lib::setShowVideo( bool video ) {