From 1830ae3069a3ca35df678ce6d1700bf31d968a5c Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 13 Dec 2002 23:15:53 +0000 Subject: - allow delayed assignment of the widget on the XINE::Lib object - make use of that API in XineControl and MediaPlayer --- 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 @@ -128,10 +128,7 @@ 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(); + setWidget( m_wid ); } m_queue = xine_event_new_queue (m_stream); @@ -294,6 +291,14 @@ void Lib::ensureInitialized() 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 ); @@ -381,5 +386,8 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 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 @@ -179,6 +179,8 @@ namespace XINE { void ensureInitialized(); + void setWidget( XineVideoWidget *widget ); + signals: void stopped(); 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 @@ -15,6 +15,7 @@ #include "audiowidget.h" #include "videowidget.h" #include "volumecontrol.h" +#include "lib.h" #include "mediaplayerstate.h" @@ -370,7 +371,8 @@ void MediaPlayer::recreateAudioAndVideoWidgets() const 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 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 @@ -57,6 +57,8 @@ XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, { xine->ensureInitialized(); + xine->setWidget( xineWidget ); + init(); } -- cgit v0.9.0.2