-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 39 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 50 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 29 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 43 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 15 |
8 files changed, 55 insertions, 130 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 248221b..8afb318 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -132,17 +132,9 @@ void Lib::initialize() - -//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" ); + if (m_wid != 0 ) setWidget( m_wid ); - } - m_queue = xine_event_new_queue (m_stream); + m_queue = xine_event_new_queue (m_stream); xine_event_create_listener_thread (m_queue, xine_event_handler, this); @@ -161,8 +153,6 @@ Lib::~Lib() { 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 */ @@ -201,5 +191,2 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { assert( m_initialized ); - // FIXME actually a hack imho. Should not be needed to dispose the whole stream - // but without we get wrong media length reads from libxine for the second media - //xine_dispose ( m_stream ); @@ -207,8 +194,5 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { - //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); - //m_queue = xine_event_new_queue (m_stream); - //xine_event_create_listener_thread (m_queue, xine_event_handler, this); - if ( !xine_open( m_stream, str.utf8().data() ) ) { - return 0; + if ( !xine_open( m_stream, str.utf8().data() ) ) { + return 0; } @@ -219,4 +203,2 @@ void Lib::stop() { assert( m_initialized ); - - odebug << "<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>" << oendl; xine_stop( m_stream ); @@ -260,8 +242,8 @@ int Lib::currentTime() const { int pos, time, length; - xine_get_pos_length( m_stream, &pos, &time, &length ); - if ( time > 0 ) { + pos = time = length = 0; + + if ( xine_get_pos_length( m_stream, &pos, &time, &length ) ) return time/1000; - } else { + else return 0; - } } @@ -302,4 +284,2 @@ void Lib::seekTo( int time ) { - //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( - // since its now milliseconds we need *1000 xine_play( m_stream, 0, time*1000 ); @@ -427,3 +407,2 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { if ( !m_video ) { - owarn << "not showing video now" << oendl; return; diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index e6afbd8..b8023ca 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -7,2 +7,3 @@ #include <opie2/odebug.h> +#include <opie2/odevice.h> #include <qpe/qpeapplication.h> @@ -36,6 +37,2 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); - -// What is pauseCheck good for? (Simon) -// connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) ); - connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); @@ -156,3 +153,3 @@ void MediaPlayer::next() { } else { //if playing from file list, let's just stop - odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl; + odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl; mediaPlayerState.setPlaying(false); @@ -283,38 +280,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { void MediaPlayer::blank( bool b ) { -#ifdef QT_QWS_DEVFS - fd=open("/dev/fb/0",O_RDWR); -#else - fd=open("/dev/fb0",O_RDWR); -#endif -#ifdef QT_QWS_SL5XXX - fl= open( "/dev/fl", O_RDWR ); -#endif - if (fd != -1) { - if ( b ) { - odebug << "do blanking" << oendl; -#ifdef QT_QWS_SL5XXX - ioctl( fd, FBIOBLANK, 1 ); - if(fl !=-1) { - ioctl( fl, 2 ); - ::close(fl); - } -#else - ioctl( fd, FBIOBLANK, 3 ); -#endif - isBlanked = TRUE; - } else { - odebug << "do unblanking" << oendl; - ioctl( fd, FBIOBLANK, 0); -#ifdef QT_QWS_SL5XXX - if(fl != -1) { - ioctl( fl, 1); - ::close(fl); - } -#endif - isBlanked = FALSE; - } - close( fd ); - } else { - odebug << "<< /dev/fb0 could not be opened >>" << oendl; - } + Opie::Core::ODevice::inst()->setDisplayStatus( b ); } @@ -333,3 +295,3 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { case Key_F12: //home - odebug << "Blank here" << oendl; + odebug << "Blank here" << oendl; // mediaPlayerState->toggleBlank(); @@ -337,3 +299,3 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { case Key_F13: //mail - odebug << "Blank here" << oendl; + odebug << "Blank here" << oendl; // mediaPlayerState->toggleBlank(); @@ -348,4 +310,2 @@ void MediaPlayer::cleanUp() {// this happens on closing -// QPEApplication::grabKeyboard(); -// QPEApplication::ungrabKeyboard(); } diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 563ccf5..880b295 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -50,3 +50,2 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount buttons.clear(); - buttons.reserve( buttonCount ); @@ -54,3 +53,3 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount Button button = setupButton( skinInfo[ i ], skin ); - buttons.push_back( button ); + buttons.append( button ); } @@ -89,3 +88,3 @@ void MediaWidget::closeEvent( QCloseEvent * ) -void MediaWidget::paintEvent( QPaintEvent *pe ) +void MediaWidget::paintEvent( QPaintEvent * ) { @@ -93,8 +92,2 @@ void MediaWidget::paintEvent( QPaintEvent *pe ) - if ( mediaPlayerState.isFullscreen() ) { - // Clear the background - p.setBrush( QBrush( Qt::black ) ); - return; - } - QPixmap buffer( size() ); @@ -111,3 +104,3 @@ void MediaWidget::resizeEvent( QResizeEvent *e ) - for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { + for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it ) { Button &button = *it; @@ -131,4 +124,4 @@ MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); - for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) - if ( it->command + 1 == pixelIdx ) + for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it ) + if ( (*it).command + 1 == pixelIdx ) return &( *it ); @@ -195,5 +188,5 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const { - return ( position.x() > 0 && position.y() > 0 && - position.x() < buttonMask.width() && - position.y() < buttonMask.height() && + return ( position.x() > 0 && position.y() > 0 && + position.x() < buttonMask.width() && + position.y() < buttonMask.height() && buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); @@ -203,3 +196,3 @@ void MediaWidget::paintAllButtons( QPainter &p ) { - for ( ButtonVector::const_iterator it = buttons.begin(); + for ( ButtonVector::ConstIterator it = buttons.begin(); it != buttons.end(); ++it ) @@ -224,4 +217,4 @@ void MediaWidget::setToggleButton( Command command, bool down ) { - for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) - if ( it->command == command ) { + for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it ) + if ( (*it).command == command ) { setToggleButton( *it, down ); diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 8c3a467..d885150 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -31,5 +31,2 @@ -#include <vector> -#include <memory> - class Skin; @@ -56,3 +53,3 @@ public: }; - typedef std::vector<Button> ButtonVector; + typedef QValueList<Button> ButtonVector; diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 36f77be..d73f0cd 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -186,4 +186,3 @@ void PlayListWidget::writeDefaultPlaylist() { if( currentString == filename) { - Om3u *m3uList; - // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl; + Om3u *m3uList; if( d->selectedFiles->first() ) { @@ -191,3 +190,2 @@ void PlayListWidget::writeDefaultPlaylist() { do { - // odebug << d->selectedFiles->current()->file() << oendl; m3uList->add( d->selectedFiles->current()->file() ); @@ -210,3 +208,2 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { } -// writeCurrentM3u(); } @@ -330,6 +327,6 @@ void PlayListWidget::addAllVideoToList() { void PlayListWidget::setDocument( const QString& _fileref ) { - // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; + // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; QString fileref = _fileref; fromSetDocument = TRUE; - + DocLnk lnk(_fileref); @@ -337,3 +334,3 @@ void PlayListWidget::setDocument( const QString& _fileref ) { fileref = lnk.file(); - + QFileInfo fileInfo(fileref); @@ -412,3 +409,3 @@ bool PlayListWidget::prev() { bool PlayListWidget::next() { -//odebug << "<<<<<<<<<<<<next()" << oendl; +//odebug << "<<<<<<<<<<<<next()" << oendl; if ( mediaPlayerState->isShuffled() ) { @@ -623,3 +620,3 @@ void PlayListWidget::openURL() { filename = fileDlg->text(); - odebug << "Selected filename is " + filename << oendl; + odebug << "Selected filename is " + filename << oendl; // Om3u *m3uList; @@ -699,3 +696,3 @@ void PlayListWidget::openFile() { - odebug << "Selected filename is " + str << oendl; + odebug << "Selected filename is " + str << oendl; filename = str; @@ -717,3 +714,3 @@ void PlayListWidget::openFile() { void PlayListWidget::readListFromFile( const QString &filename ) { - odebug << "read list filename " + filename << oendl; + odebug << "read list filename " + filename << oendl; QFileInfo fi(filename); @@ -730,3 +727,3 @@ void PlayListWidget::readListFromFile( const QString &filename ) { s = *it; - // odebug << s << oendl; + // odebug << s << oendl; if(s.left(4)=="http") { @@ -764,3 +761,3 @@ void PlayListWidget::readListFromFile( const QString &filename ) { void PlayListWidget::writeCurrentM3u() { - odebug << "writing to current m3u" << oendl; + odebug << "writing to current m3u" << oendl; Config cfg( "OpiePlayer" ); @@ -774,3 +771,3 @@ void PlayListWidget::readListFromFile( const QString &filename ) { do { - // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; + // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; m3uList->add( d->selectedFiles->current()->file() ); @@ -778,3 +775,3 @@ void PlayListWidget::readListFromFile( const QString &filename ) { while ( d->selectedFiles->next() ); - // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; + // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; m3uList->write(); @@ -823,3 +820,3 @@ void PlayListWidget::writem3u() { // name = fileDlg->text(); -// odebug << filename << oendl; +// odebug << filename << oendl; if( name.find("/",0,true) != -1) {// assume they specify a file path @@ -841,3 +838,3 @@ void PlayListWidget::writem3u() { while ( d->selectedFiles->next() ); - // odebug << list << oendl; + // odebug << list << oendl; m3uList->write(); @@ -853,3 +850,3 @@ void PlayListWidget::writem3u() { - // odebug << filename << oendl; + // odebug << filename << oendl; Config config( "OpiePlayer" ); @@ -861,3 +858,3 @@ void PlayListWidget::writem3u() { if(!lnk.writeLink()) { - odebug << "Writing doclink did not work" << oendl; + odebug << "Writing doclink did not work" << oendl; } @@ -895,3 +892,3 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { // case Key_P: //play - // odebug << "Play" << oendl; + // odebug << "Play" << oendl; // playSelected(); @@ -925,3 +922,3 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { void PlayListWidget::pmViewActivated(int index) { -// odebug << "" << index << "" << oendl; +// odebug << "" << index << "" << oendl; switch(index) { @@ -955,3 +952,3 @@ void PlayListWidget::populateSkinsMenu() { skinName = fi->fileName(); -// odebug << fi->fileName() << oendl; +// odebug << fi->fileName() << oendl; if( skinName != "." && skinName != ".." && skinName !="CVS" ) { @@ -1011,3 +1008,3 @@ QString PlayListWidget::currentFileListPathName() const { void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { - odebug << "qcop message "+msg << oendl; + odebug << "qcop message "+msg << oendl; QDataStream stream ( data, IO_ReadOnly ); diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 922f9d7..c3c1282 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp @@ -185,3 +185,2 @@ void PlayListWidgetGui::setView( char view ) { void PlayListWidgetGui::setActiveWindow() { - // odebug << "SETTING active window" << oendl; // When we get raised we need to ensure that it switches views diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 0625376..2b44701 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -147,2 +147,3 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) scaledHeight = 0; + videoFrame->hide(); hide(); @@ -196,2 +197,3 @@ void VideoWidget::backToNormal() { void VideoWidget::makeVisible() { + videoFrame->show(); if ( mediaPlayerState.isFullscreen() ) { @@ -206,3 +208,2 @@ void VideoWidget::makeVisible() { disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); - } else { diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 9f944d7..e1816c8 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -83,3 +83,3 @@ void XineControl::init() XineControl::~XineControl() { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) if ( disabledSuspendScreenSaver ) { @@ -99,3 +99,3 @@ void XineControl::play( const QString& fileName ) { - odebug << "<<FILENAME: " + fileName + ">>>>" << oendl; + odebug << "<<FILENAME: " + fileName + ">>>>" << oendl; @@ -112,3 +112,2 @@ void XineControl::play( const QString& fileName ) { displayType = MediaPlayerState::Audio; - odebug << "HAS AUDIO" << oendl; libXine->setShowVideo( false ); @@ -117,3 +116,2 @@ void XineControl::play( const QString& fileName ) { displayType = MediaPlayerState::Video; - odebug << "HAS VIDEO" << oendl; libXine->setShowVideo( true ); @@ -152,3 +150,3 @@ void XineControl::stop( bool isSet ) { -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#if !defined(QT_NO_COP) if ( disabledSuspendScreenSaver ) { @@ -178,3 +176,2 @@ long XineControl::currentTime() { return m_currentTime; - QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); } @@ -249,3 +246,3 @@ QString XineControl::getErrorCode() { - odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl; + odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl; @@ -254,3 +251,3 @@ QString XineControl::getErrorCode() { } else if ( errorCode == 2 ) { - return tr( "No demux plugin found for this media type" ); + return tr( "No demux plugin found for this media type" ); } else if ( errorCode == 3 ) { @@ -259,2 +256,4 @@ QString XineControl::getErrorCode() { return tr( "Malformed MRL" ); + } else if ( errorCode == 5 ) { + return tr( "Input failed" ); } else { |