summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-10 15:09:09 (UTC)
committer harlekin <harlekin>2002-11-10 15:09:09 (UTC)
commit91932ca42cee5568477b1e49532a0b9e4d9bcf96 (patch) (side-by-side diff)
treef134612cf7aa15787077b0a76c34aab30d72cae3
parentb6b57412a12c06d07f22060b7a165d71e5eddb84 (diff)
downloadopie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.zip
opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.gz
opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.bz2
besser seekable handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp33
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h4
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp7
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
@@ -180,40 +180,38 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
slider.setMinValue( 0 );
slider.setMaxValue( 1 );
slider.setFocusPolicy( QWidget::NoFocus );
slider.setBackgroundPixmap( *pixBg );
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() );
}
AudioWidget::~AudioWidget() {
for ( int i = 0; i < 10; i++ ) {
@@ -299,49 +297,52 @@ void AudioWidget::setPosition( long i ) {
// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
updateSlider( i, mediaPlayerState->length() );
}
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 );
}
void AudioWidget::updateSlider( long i, long max ) {
time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
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
@@ -85,24 +85,25 @@ public:
AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
~AudioWidget();
void setTickerText( const QString &text ) { songInfo.setText( text ); }
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();
void backClicked();
void forwardReleased();
void backReleased();
void sliderMoved(long);
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
@@ -292,25 +292,25 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
} else {
p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
}
}
}
}
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);
}
#else
ioctl( fd, FBIOBLANK, 3 );
#endif
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
@@ -43,24 +43,25 @@
//#define MediaPlayerDebug(x) qDebug x
#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 ) {
cfg.setGroup("Options");
isFullscreen = cfg.readBoolEntry( "FullScreen" );
isScaled = cfg.readBoolEntry( "Scaling" );
isLooping = cfg.readBoolEntry( "Looping" );
@@ -86,42 +87,46 @@ void MediaPlayerState::writeConfig( Config& cfg ) const {
cfg.writeEntry( "UsePlayList", usePlaylist );
cfg.writeEntry( "VideoGamma", videoGamma );
}
// public stuff
bool MediaPlayerState::streaming() {
return isStreaming;
}
+bool MediaPlayerState::seekable() {
+ return isSeekable;
+}
+
bool MediaPlayerState::fullscreen() {
return isFullscreen;
}
bool MediaPlayerState::scaled() {
return isScaled;
}
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() {
return isPlaying;
}
bool MediaPlayerState::stop() {
@@ -140,24 +145,33 @@ char MediaPlayerState::view() {
return curView;
}
// slots
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);
}
void MediaPlayerState::setBlanked( bool b ) {
if ( isBlanked == 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
@@ -45,38 +45,40 @@ class Config;
class MediaPlayerState : public QObject {
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 );
void setPosition( long p );
void updatePosition( long p );
void setLength( long l );
void setView( char v );
@@ -104,31 +106,33 @@ signals:
void fullscreenToggled( bool );
void scaledToggled( bool );
void loopingToggled( bool );
void shuffledToggled( bool );
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;
char curView;
int videoGamma;
void readConfig( Config& cfg );
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
@@ -488,25 +488,25 @@ xine_vo_driver_t* init_video_out_plugin( config_values_t* conf,
vo->yuv2rgb_cmap);
return ( xine_vo_driver_t*) vo;
}
#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
@@ -375,41 +375,40 @@ void VideoWidget::showEvent( QShowEvent* ) {
void VideoWidget::backToNormal() {
mediaPlayerState->setFullscreen( FALSE );
makeVisible();
}
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
@@ -66,49 +66,50 @@ XineControl::~XineControl() {
// Re-enable the suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
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;
// qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
if ( !libXine->hasVideo() ) {
whichGui = 'a';
qDebug("HAS AUDIO");
libXine->setShowVideo( false );
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)" )
<< ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
}
#endif