author | harlekin <harlekin> | 2002-11-10 15:09:09 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-11-10 15:09:09 (UTC) |
commit | 91932ca42cee5568477b1e49532a0b9e4d9bcf96 (patch) (side-by-side diff) | |
tree | f134612cf7aa15787077b0a76c34aab30d72cae3 | |
parent | b6b57412a12c06d07f22060b7a165d71e5eddb84 (diff) | |
download | opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.zip opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.gz opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.bz2 |
besser seekable handling
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 33 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 7 |
8 files changed, 46 insertions, 26 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index a6fd334..00d516c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -184,32 +184,30 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); time.setFrame(FALSE); changeTextColor( &time ); resizeEvent( NULL ); - connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); - connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); + connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); + connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); - // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); + connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); - - // Intialise state setLength( mediaPlayerState->length() ); setPosition( mediaPlayerState->position() ); setLooping( mediaPlayerState->fullscreen() ); // setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState->playing() ); } @@ -303,41 +301,44 @@ void AudioWidget::setPosition( long i ) { void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState->position(), max ); } void AudioWidget::setView( char view ) { - // this isnt working for some reason +if ( view == 'a' ) { + // startTimer( 150 ); + showMaximized(); + } else { + killTimers(); + hide(); + } + // qApp->processEvents(); +} + + +void AudioWidget::setSeekable( bool isSeekable ) { - if ( mediaPlayerState->streaming() ) { + if ( isSeekable ) { qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); if( !slider.isHidden()) { slider.hide(); } disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } else { // this stops the slider from being moved, thus // does not stop stream when it reaches the end slider.show(); + qDebug( " CONNECT SET POSTION " ); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } - - if ( view == 'a' ) { - // startTimer( 150 ); - showMaximized(); - } else { - killTimers(); - hide(); - } - // qApp->processEvents(); } static QString timeAsString( long length ) { int minutes = length / 60; int seconds = length % 60; return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); } diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index c544882..09dc19b 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -89,16 +89,17 @@ public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); // void setPaused( bool b) { setToggleButton( AudioPause, b ); } void setLooping( bool b) { setToggleButton( AudioLoop, b ); } void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } void setPosition( long ); void setLength( long ); + void setSeekable( bool ); void setView( char ); signals: void moreClicked(); void lessClicked(); void moreReleased(); void lessReleased(); void forwardClicked(); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index f0a01a1..8b0f501 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -296,17 +296,17 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { } } void MediaPlayer::blank( bool b ) { fd=open("/dev/fb0",O_RDWR); #ifdef QT_QWS_EBX fl= open( "/dev/fl", O_RDWR ); -#endif +#endif if (fd != -1) { if ( b ) { qDebug("do blanking"); #ifdef QT_QWS_EBX ioctl( fd, FBIOBLANK, 1 ); if(fl !=-1) { ioctl( fl, 2 ); ::close(fl); diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 4ec5989..0b33dfd 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -47,16 +47,17 @@ #define MediaPlayerDebug(x) MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) : QObject( parent, name ) { Config cfg( "OpiePlayer" ); readConfig( cfg ); isStreaming = false; + isSeekable = true; } MediaPlayerState::~MediaPlayerState() { } void MediaPlayerState::readConfig( Config& cfg ) { @@ -90,16 +91,20 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { // public stuff bool MediaPlayerState::streaming() { return isStreaming; } +bool MediaPlayerState::seekable() { + return isSeekable; +} + bool MediaPlayerState::fullscreen() { return isFullscreen; } bool MediaPlayerState::scaled() { return isScaled; } @@ -107,17 +112,17 @@ bool MediaPlayerState::looping() { return isLooping; } bool MediaPlayerState::shuffled() { return isShuffled; } -bool MediaPlayerState:: playlist() { +bool MediaPlayerState::playlist() { return usePlaylist; } bool MediaPlayerState::paused() { return isPaused; } bool MediaPlayerState::playing() { @@ -144,16 +149,25 @@ char MediaPlayerState::view() { void MediaPlayerState::setIsStreaming( bool b ) { if ( isStreaming == b ) { return; } isStreaming = b; } +void MediaPlayerState::setIsSeekable( bool b ) { + + //if ( isSeekable == b ) { + // return; + // } + isSeekable = b; + emit isSeekableToggled(b); +} + void MediaPlayerState::setFullscreen( bool b ) { if ( isFullscreen == b ) { return; } isFullscreen = b; emit fullscreenToggled(b); } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 4fef8e0..8c4e09e 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h @@ -49,30 +49,32 @@ Q_OBJECT public: MediaPlayerState( QObject *parent, const char *name ); ~MediaPlayerState(); bool isPaused; bool isPlaying; bool isStoped; bool streaming(); + bool seekable(); bool fullscreen(); bool scaled(); bool looping(); bool shuffled(); bool playlist(); bool paused(); bool playing(); bool stop(); long position(); long length(); char view(); public slots: void setIsStreaming( bool b ); + void setIsSeekable( bool b ); void setFullscreen( bool b ); void setScaled( bool b ); void setLooping( bool b ); void setShuffled( bool b ); void setPlaylist( bool b ); void setPaused( bool b ); void setPlaying( bool b ); void setStop( bool b ); @@ -108,23 +110,25 @@ signals: void playlistToggled( bool ); void pausedToggled( bool ); void playingToggled( bool ); void stopToggled( bool ); void positionChanged( long ); // When the slider is moved void positionUpdated( long ); // When the media file progresses void lengthChanged( long ); void viewChanged( char ); + void isSeekableToggled( bool ); void blankToggled( bool ); void videoGammaChanged( int ); void prev(); void next(); private: bool isStreaming; + bool isSeekable; bool isFullscreen; bool isScaled; bool isBlanked; bool isLooping; bool isShuffled; bool usePlaylist; long curPosition; long curLength; diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index b1f4811..707efeb 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c @@ -492,17 +492,17 @@ xine_vo_driver_t* init_video_out_plugin( config_values_t* conf, #if 0 static vo_info_t vo_info_null = { 5, XINE_VISUAL_TYPE_FB }; vo_info_t *get_video_out_plugin_info(){ - vo_info_null.description = _("xine video output plugin using null device"); + vo_info_null.description = ("xine video output plugin using null device"); return &vo_info_null; } #endif /* this is special for this device */ /** * We know that we will be controled by the XINE LIB++ diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 7b8ad7a..7d71d09 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -379,33 +379,32 @@ void VideoWidget::showEvent( QShowEvent* ) { void VideoWidget::makeVisible() { if ( mediaPlayerState->fullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); resize( qApp->desktop()->size() ); slider->hide(); videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); -// qApp->processEvents(); } else { showNormal(); showMaximized(); setBackgroundPixmap( *pixBg ); - if ( mediaPlayerState->streaming() ) { + if ( mediaPlayerState->seekable() ) { slider->hide(); disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } else { slider->show(); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } QWidget *d = QApplication::desktop(); - int w=d->width(); - int h=d->height(); + int w = d->width(); + int h = d->height(); if(w>h) { int newW=(w/2)-(246/2); //this will only work with 320x240 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); } else videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); // qApp->processEvents(); diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 03176b3..65ac127 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -70,19 +70,19 @@ XineControl::~XineControl() { delete libXine; } void XineControl::play( const QString& fileName ) { hasVideoChannel = FALSE; hasAudioChannel = FALSE; m_fileName = fileName; - //qDebug("<<FILENAME: " + fileName + ">>>>"); + qDebug("<<FILENAME: " + fileName + ">>>>"); - if ( !libXine->play( fileName ) ) { + if ( !libXine->play( fileName, 0, 0 ) ) { QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); // toggle stop so the the play button is reset mediaPlayerState->setPlaying( false ); return; } mediaPlayerState->setPlaying( true ); char whichGui; @@ -94,17 +94,18 @@ void XineControl::play( const QString& fileName ) { hasAudioChannel = TRUE; } else { whichGui = 'v'; qDebug("HAS VIDEO"); libXine->setShowVideo( true ); hasVideoChannel = TRUE; } // determine if slider is shown - mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); + mediaPlayerState->setIsSeekable( !libXine->isSeekable() ); + // which gui (video / audio) mediaPlayerState->setView( whichGui ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = TRUE; // Stop the screen from blanking and power saving state QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |