-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 7 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 20 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 18 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayerstate.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 1 |
5 files changed, 28 insertions, 20 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 3212001..20345b7 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -79,31 +79,34 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
79 | slider->setFixedWidth( 220 ); | 79 | slider->setFixedWidth( 220 ); |
80 | slider->setFixedHeight( 20 ); | 80 | slider->setFixedHeight( 20 ); |
81 | slider->setMinValue( 0 ); | 81 | slider->setMinValue( 0 ); |
82 | slider->setMaxValue( 1 ); | 82 | slider->setMaxValue( 1 ); |
83 | slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); | 83 | slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); |
84 | slider->setFocusPolicy( QWidget::NoFocus ); | 84 | slider->setFocusPolicy( QWidget::NoFocus ); |
85 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); | 85 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); |
86 | 86 | ||
87 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 87 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
88 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 88 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
89 | 89 | ||
90 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 90 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
91 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
92 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
93 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 91 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
94 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 92 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
95 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 93 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
96 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 94 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
97 | 95 | ||
96 | if( !mediaPlayerState->isStreaming) { // this stops the slider from being moved, thus | ||
97 | // does not stop stream when it reaches the end | ||
98 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
99 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
100 | } | ||
98 | // Intialise state | 101 | // Intialise state |
99 | setLength( mediaPlayerState->length() ); | 102 | setLength( mediaPlayerState->length() ); |
100 | setPosition( mediaPlayerState->position() ); | 103 | setPosition( mediaPlayerState->position() ); |
101 | setLooping( mediaPlayerState->fullscreen() ); | 104 | setLooping( mediaPlayerState->fullscreen() ); |
102 | setPaused( mediaPlayerState->paused() ); | 105 | setPaused( mediaPlayerState->paused() ); |
103 | setPlaying( mediaPlayerState->playing() ); | 106 | setPlaying( mediaPlayerState->playing() ); |
104 | 107 | ||
105 | } | 108 | } |
106 | 109 | ||
107 | 110 | ||
108 | AudioWidget::~AudioWidget() { | 111 | AudioWidget::~AudioWidget() { |
109 | for ( int i = 0; i < 4; i++ ) | 112 | for ( int i = 0; i < 4; i++ ) |
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index d1d72b6..4ffd167 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h | |||
@@ -44,36 +44,36 @@ enum AudioButtons { | |||
44 | AudioLoop, | 44 | AudioLoop, |
45 | AudioPlayList | 45 | AudioPlayList |
46 | }; | 46 | }; |
47 | 47 | ||
48 | 48 | ||
49 | #define USE_DBLBUF | 49 | #define USE_DBLBUF |
50 | 50 | ||
51 | 51 | ||
52 | class Ticker : public QFrame { | 52 | class Ticker : public QFrame { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | Ticker( QWidget* parent=0 ) : QFrame( parent ) { | 55 | Ticker( QWidget* parent=0 ) : QFrame( parent ) { |
56 | setFrameStyle( WinPanel | Sunken ); | 56 | setFrameStyle( WinPanel | Sunken ); |
57 | setText( "No Song" ); | 57 | setText( "No Song" ); |
58 | } | 58 | } |
59 | ~Ticker() { } | 59 | ~Ticker() { } |
60 | void setText( const QString& text ) { | 60 | void setText( const QString& text ) { |
61 | pos = 0; // reset it everytime the text is changed | 61 | pos = 0; // reset it everytime the text is changed |
62 | scrollText = text; | 62 | scrollText = text; |
63 | pixelLen = fontMetrics().width( scrollText ); | 63 | pixelLen = fontMetrics().width( scrollText ); |
64 | killTimers(); | 64 | killTimers(); |
65 | if ( pixelLen > width() ) | 65 | if ( pixelLen > width() ) |
66 | startTimer( 50 ); | 66 | startTimer( 50 ); |
67 | update(); | 67 | update(); |
68 | } | 68 | } |
69 | protected: | 69 | protected: |
70 | void timerEvent( QTimerEvent * ) { | 70 | void timerEvent( QTimerEvent * ) { |
71 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | 71 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; |
72 | #ifndef USE_DBLBUF | 72 | #ifndef USE_DBLBUF |
73 | scroll( -1, 0, contentsRect() ); | 73 | scroll( -1, 0, contentsRect() ); |
74 | #else | 74 | #else |
75 | repaint( FALSE ); | 75 | repaint( FALSE ); |
76 | #endif | 76 | #endif |
77 | } | 77 | } |
78 | void drawContents( QPainter *p ) { | 78 | void drawContents( QPainter *p ) { |
79 | #ifndef USE_DBLBUF | 79 | #ifndef USE_DBLBUF |
@@ -93,25 +93,25 @@ protected: | |||
93 | private: | 93 | private: |
94 | QString scrollText; | 94 | QString scrollText; |
95 | int pos, pixelLen; | 95 | int pos, pixelLen; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | 98 | ||
99 | class AudioWidget : public QWidget { | 99 | class AudioWidget : public QWidget { |
100 | Q_OBJECT | 100 | Q_OBJECT |
101 | public: | 101 | public: |
102 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 102 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
103 | ~AudioWidget(); | 103 | ~AudioWidget(); |
104 | void setTickerText( const QString &text ) { songInfo->setText( text ); } | 104 | void setTickerText( const QString &text ) { songInfo->setText( text ); } |
105 | 105 | bool isStreaming; | |
106 | public slots: | 106 | public slots: |
107 | void updateSlider( long, long ); | 107 | void updateSlider( long, long ); |
108 | void sliderPressed( ); | 108 | void sliderPressed( ); |
109 | void sliderReleased( ); | 109 | void sliderReleased( ); |
110 | void setPaused( bool b) { setToggleButton( AudioPause, b ); } | 110 | void setPaused( bool b) { setToggleButton( AudioPause, b ); } |
111 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 111 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
112 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | 112 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } |
113 | void setPosition( long ); | 113 | void setPosition( long ); |
114 | void setLength( long ); | 114 | void setLength( long ); |
115 | void setView( char ); | 115 | void setView( char ); |
116 | 116 | ||
117 | signals: | 117 | signals: |
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index b9f96de..45c2d3e 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -227,32 +227,33 @@ void LoopControl::startAudio() { | |||
227 | if ( !isMuted && mediaPlayerState->curDecoder() ) { | 227 | if ( !isMuted && mediaPlayerState->curDecoder() ) { |
228 | 228 | ||
229 | currentSample = audioSampleCounter + 1; | 229 | currentSample = audioSampleCounter + 1; |
230 | 230 | ||
231 | if ( currentSample != audioSampleCounter + 1 ) | 231 | if ( currentSample != audioSampleCounter + 1 ) |
232 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); | 232 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); |
233 | 233 | ||
234 | long samplesRead = 0; | 234 | long samplesRead = 0; |
235 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); | 235 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); |
236 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; | 236 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; |
237 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; | 237 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; |
238 | 238 | ||
239 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { | 239 | // this causes drop outs not sure why its even here |
240 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | 240 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { |
241 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | ||
242 | // } | ||
243 | // else if ( sampleWaitTime <= -5000 ) { | ||
244 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | ||
245 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | ||
246 | // currentSample = sampleWeShouldBeAt; | ||
241 | // } | 247 | // } |
242 | // else if ( sampleWaitTime <= -5000 ) { | ||
243 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | ||
244 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | ||
245 | // currentSample = sampleWeShouldBeAt; | ||
246 | // } | ||
247 | 248 | ||
248 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); | 249 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); |
249 | audioSampleCounter = currentSample + samplesRead - 1; | 250 | audioSampleCounter = currentSample + samplesRead - 1; |
250 | 251 | ||
251 | moreAudio = readOk && (audioSampleCounter <= total_audio_samples); | 252 | moreAudio = readOk && (audioSampleCounter <= total_audio_samples); |
252 | 253 | ||
253 | } else { | 254 | } else { |
254 | 255 | ||
255 | moreAudio = FALSE; | 256 | moreAudio = FALSE; |
256 | 257 | ||
257 | } | 258 | } |
258 | 259 | ||
@@ -423,24 +424,27 @@ bool LoopControl::init( const QString& filename ) { | |||
423 | framerate = 25; | 424 | framerate = 25; |
424 | } | 425 | } |
425 | 426 | ||
426 | if ( total_video_frames == 1 ) { | 427 | if ( total_video_frames == 1 ) { |
427 | DecodeLoopDebug(( "Cannot seek to frame" )); | 428 | DecodeLoopDebug(( "Cannot seek to frame" )); |
428 | } | 429 | } |
429 | 430 | ||
430 | } | 431 | } |
431 | 432 | ||
432 | current_frame = 0; | 433 | current_frame = 0; |
433 | prev_frame = -1; | 434 | prev_frame = -1; |
434 | 435 | ||
436 | if( fileName.left(7) == "http://") | ||
437 | mediaPlayerState->isStreaming = TRUE; | ||
438 | |||
435 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); | 439 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); |
436 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); | 440 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); |
437 | 441 | ||
438 | audioMutex->unlock(); | 442 | audioMutex->unlock(); |
439 | 443 | ||
440 | return TRUE; | 444 | return TRUE; |
441 | } | 445 | } |
442 | 446 | ||
443 | 447 | ||
444 | void LoopControl::play() { | 448 | void LoopControl::play() { |
445 | qDebug("LC- play"); | 449 | qDebug("LC- play"); |
446 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 450 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
diff --git a/core/multimedia/opieplayer/mediaplayerstate.h b/core/multimedia/opieplayer/mediaplayerstate.h index ad273f1..06c5556 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.h +++ b/core/multimedia/opieplayer/mediaplayerstate.h | |||
@@ -25,25 +25,25 @@ | |||
25 | 25 | ||
26 | 26 | ||
27 | class MediaPlayerDecoder; | 27 | class MediaPlayerDecoder; |
28 | class Config; | 28 | class Config; |
29 | 29 | ||
30 | 30 | ||
31 | class MediaPlayerState : public QObject { | 31 | class MediaPlayerState : public QObject { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
34 | MediaPlayerState( QObject *parent, const char *name ); | 34 | MediaPlayerState( QObject *parent, const char *name ); |
35 | ~MediaPlayerState(); | 35 | ~MediaPlayerState(); |
36 | 36 | ||
37 | 37 | bool isStreaming; | |
38 | bool fullscreen() { return isFullscreen; } | 38 | bool fullscreen() { return isFullscreen; } |
39 | bool scaled() { return isScaled; } | 39 | bool scaled() { return isScaled; } |
40 | bool looping() { return isLooping; } | 40 | bool looping() { return isLooping; } |
41 | bool shuffled() { return isShuffled; } | 41 | bool shuffled() { return isShuffled; } |
42 | bool playlist() { return usePlaylist; } | 42 | bool playlist() { return usePlaylist; } |
43 | bool paused() { return isPaused; } | 43 | bool paused() { return isPaused; } |
44 | bool playing() { return isPlaying; } | 44 | bool playing() { return isPlaying; } |
45 | long position() { return curPosition; } | 45 | long position() { return curPosition; } |
46 | long length() { return curLength; } | 46 | long length() { return curLength; } |
47 | char view() { return curView; } | 47 | char view() { return curView; } |
48 | 48 | ||
49 | MediaPlayerDecoder *newDecoder( const QString& file ); | 49 | MediaPlayerDecoder *newDecoder( const QString& file ); |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 250645c..ff156f8 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -984,24 +984,25 @@ void PlayListWidget::openFile() { | |||
984 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 984 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
985 | fileDlg->exec(); | 985 | fileDlg->exec(); |
986 | if( fileDlg->result() == 1 ) { | 986 | if( fileDlg->result() == 1 ) { |
987 | filename = fileDlg->LineEdit1->text(); | 987 | filename = fileDlg->LineEdit1->text(); |
988 | 988 | ||
989 | // InputDialog *fileDlg2; | 989 | // InputDialog *fileDlg2; |
990 | // fileDlg2 = new InputDialog(this,tr("Name"),TRUE, 0); | 990 | // fileDlg2 = new InputDialog(this,tr("Name"),TRUE, 0); |
991 | // fileDlg2->exec(); | 991 | // fileDlg2->exec(); |
992 | // if( fileDlg2->result() == 1 ) { | 992 | // if( fileDlg2->result() == 1 ) { |
993 | // name = fileDlg2->LineEdit1->text(); | 993 | // name = fileDlg2->LineEdit1->text(); |
994 | // } | 994 | // } |
995 | //http://205.188.234.129:8030 | 995 | //http://205.188.234.129:8030 |
996 | // http://66.28.68.70:8000 | ||
996 | qDebug(filename); | 997 | qDebug(filename); |
997 | DocLnk lnk; | 998 | DocLnk lnk; |
998 | // if(filename.left(7) == "http://") | 999 | // if(filename.left(7) == "http://") |
999 | // name= filename.right(filename.length()-filename.find("http://")-7); | 1000 | // name= filename.right(filename.length()-filename.find("http://")-7); |
1000 | // else name = filename; | 1001 | // else name = filename; |
1001 | // qDebug("name is "+name); | 1002 | // qDebug("name is "+name); |
1002 | // lnk.setComment(filename); | 1003 | // lnk.setComment(filename); |
1003 | lnk.setName(filename); //sets file name | 1004 | lnk.setName(filename); //sets file name |
1004 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") | 1005 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") |
1005 | filename += "/"; | 1006 | filename += "/"; |
1006 | lnk.setFile(filename); //sets File property | 1007 | lnk.setFile(filename); //sets File property |
1007 | 1008 | ||