summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/lib.h18
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h2
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
@@ -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 ) {
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
@@ -46,25 +46,26 @@
class XineVideoWidget;
namespace XINE {
/**
* Lib wrapps the simple interface
* of libxine for easy every day use
* This will become a full C++ Wrapper
* It supports playing, pausing, info,
* stooping, seeking.
*/
class Frame;
- class Lib : public ThreadUtil::Channel {
+ class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread
+ {
Q_OBJECT
public:
Lib(XineVideoWidget* = 0);
~Lib();
static int majorVersion();
static int minorVersion();
static int subVersion();
void resize ( const QSize &s );
int play( const QString& fileName,
@@ -168,32 +169,47 @@ namespace XINE {
* Returns the error code
* XINE_ERROR_NONE 0
* XINE_ERROR_NO_INPUT_PLUGIN 1
* XINE_ERROR_NO_DEMUXER_PLUGIN 2
* XINE_ERROR_DEMUXER_FAILED 3
*/
int error() const;
signals:
void stopped();
+ void initialized();
+
protected:
virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
+ virtual void run();
+
private:
void initialize();
void assertInitialized() const;
+ enum { XineMessageType = 1, InitializationMessageType };
+
+ struct XineMessage : public ThreadUtil::ChannelMessage
+ {
+ XineMessage( int _xineEvent ) : ThreadUtil::ChannelMessage( XineMessageType ),
+ xineEvent( _xineEvent )
+ {}
+
+ int xineEvent;
+ };
+
mutable ThreadUtil::Mutex m_initGuard;
bool m_initialized : 1;
int m_bytes_per_pixel;
bool m_video:1;
XineVideoWidget *m_wid;
xine_t *m_xine;
xine_stream_t *m_stream;
xine_cfg_entry_t *m_config;
xine_vo_driver_t *m_videoOutput;
xine_ao_driver_t* m_audioOutput;
xine_event_queue_t *m_queue;
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
@@ -356,21 +356,22 @@ void MediaPlayer::recreateAudioAndVideoWidgets()
connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState );
- mediaPlayerState.setBackendInitialized();
+ connect( xineControl, SIGNAL( initialized() ),
+ &mediaPlayerState, SLOT( setBackendInitialized() ) );
}
void MediaPlayer::reloadSkins()
{
audioUI->loadSkin();
videoUI->loadSkin();
}
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
@@ -46,24 +46,25 @@ XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWi
{
libXine = new XINE::Lib( xineWidget );
connect ( videoContainerWidget, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) );
connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
+ connect( libXine, SIGNAL( initialized() ), this, SIGNAL( initialized() ) );
disabledSuspendScreenSaver = FALSE;
}
XineControl::~XineControl() {
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
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
@@ -105,16 +105,18 @@ private:
XINE::Lib *libXine;
long m_currentTime;
long m_position;
int m_length;
QString m_fileName;
bool disabledSuspendScreenSaver : 1;
bool hasVideoChannel : 1;
bool hasAudioChannel : 1;
MediaPlayerState &mediaPlayerState;
signals:
void positionChanged( long );
+
+ void initialized();
};
#endif