-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 2 |
4 files changed, 19 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 84194b7..299239b 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -107,52 +107,49 @@ void Lib::initialize() { m_duringInitialization = true; m_xine = xine_new( ); QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; xine_config_load( m_xine, QFile::encodeName( configPath ) ); xine_init( m_xine ); // allocate oss for sound // and fb for framebuffer m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); // null_display_handler( m_videoOutput, xine_display_frame, this ); m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 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(); + setWidget( m_wid ); } m_queue = xine_event_new_queue (m_stream); xine_event_create_listener_thread (m_queue, xine_event_handler, this); m_duringInitialization = false; } Lib::~Lib() { assert( isRunning() == false ); assert( m_initialized ); // free( m_config ); xine_close( m_stream ); xine_event_dispose_queue( m_queue ); xine_dispose( m_stream ); xine_exit( m_xine ); /* FIXME either free or delete but valgrind bitches against both */ //free( m_videoOutput ); //delete m_audioOutput; @@ -273,48 +270,56 @@ Frame Lib::currentFrame() const { }; QString Lib::metaInfo( int number) const { assert( m_initialized ); return xine_get_meta_info( m_stream, number ); } int Lib::error() const { assert( m_initialized ); return xine_get_error( m_stream ); }; void Lib::ensureInitialized() { if ( m_initialized ) return; qDebug( "waiting for initialization thread to finish" ); wait(); qDebug( "initialization thread finished!" ); } +void Lib::setWidget( XineVideoWidget *widget ) +{ + m_wid = widget; + resize ( m_wid-> size ( ) ); + ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); + m_wid->repaint(); +} + void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) { assert( sendType == ThreadUtil::Channel::OneWay ); handleXineEvent( msg->type() ); delete msg; } void Lib::handleXineEvent( const xine_event_t* t ) { send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); } void Lib::handleXineEvent( int type ) { assert( m_initialized ); if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { emit stopped(); } } void Lib::setShowVideo( bool video ) { assert( m_initialized ); m_video = video; @@ -360,26 +365,29 @@ void Lib::setGamma( int value ) { } bool Lib::isScaling() const { assert( m_initialized ); return ::null_is_scaling( m_videoOutput ); } void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { ( (Lib*)user_data)->handleXineEvent( t ); } void Lib::xine_display_frame( void* user_data, uint8_t *frame, int width, int height, int bytes ) { ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); } void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { assert( m_initialized ); if ( !m_video ) { qWarning("not showing video now"); return; } + + assert( m_wid ); + m_wid-> setVideoFrame ( frame, width, height, bytes ); } diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 6b67f67..181735c 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h @@ -158,48 +158,50 @@ namespace XINE { void setScaling( bool ); /** * Set the Gamma value for video output * @param int the value between -100 and 100, 0 is original */ void setGamma( int ); /** * test */ Frame currentFrame() const; /** * 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; void ensureInitialized(); + void setWidget( XineVideoWidget *widget ); + signals: void stopped(); void initialized(); protected: virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); virtual void run(); private: void initialize(); int m_bytes_per_pixel; bool m_initialized:1; bool m_duringInitialization:1; 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; diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 963e783..d6fbb53 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -1,41 +1,42 @@ #include <qpe/qpeapplication.h> #include <qpe/qlibrary.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qfileinfo.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qwidgetstack.h> #include <qfile.h> #include "mediaplayer.h" #include "playlistwidget.h" #include "audiowidget.h" #include "videowidget.h" #include "volumecontrol.h" +#include "lib.h" #include "mediaplayerstate.h" // for setBacklight() #include <linux/fb.h> #include <sys/file.h> #include <sys/ioctl.h> #define FBIOBLANK 0x4611 MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { m_audioUI = 0; m_videoUI = 0; m_xineControl = 0; fd=-1;fl=-1; playList.setCaption( tr( "OpiePlayer: Initializating" ) ); qApp->processEvents(); @@ -349,49 +350,50 @@ void MediaPlayer::cleanUp() {// this happens on closing // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); } void MediaPlayer::recreateAudioAndVideoWidgets() const { delete m_skinLoader; delete m_xineControl; delete m_audioUI; delete m_videoUI; m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); - m_xineControl = new XineControl( m_videoUI->vidWidget(), mediaPlayerState ); + XINE::Lib *xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); + m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); } AudioWidget *MediaPlayer::audioUI() const { if ( !m_audioUI ) recreateAudioAndVideoWidgets(); return m_audioUI; } VideoWidget *MediaPlayer::videoUI() const { if ( !m_videoUI ) recreateAudioAndVideoWidgets(); return m_videoUI; } XineControl *MediaPlayer::xineControl() const { if ( !m_xineControl ) recreateAudioAndVideoWidgets(); return m_xineControl; } void MediaPlayer::reloadSkins() diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 7c54499..1c489e3 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -36,48 +36,50 @@ #include <qmessagebox.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include "xinecontrol.h" #include "mediaplayerstate.h" #include "xinevideowidget.h" XineControl::XineControl( XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); init(); } XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { xine->ensureInitialized(); + xine->setWidget( xineWidget ); + init(); } void XineControl::init() { 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( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 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; } |