summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp8
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp16
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp47
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h12
4 files changed, 44 insertions, 39 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 59136af..11fd9e8 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -108,9 +108,9 @@ void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume
formatData.nSamplesPerSec = 44000;
formatData.wBitsPerSample = 16;
waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL);
if ( waveOutGetVolume( handle, (LPDWORD)&volume ) )
- qDebug( "get volume of audio device failed" );
+// qDebug( "get volume of audio device failed" );
waveOutClose( handle );
leftVolume = volume & 0xFFFF;
rightVolume = volume >> 16;
#else
@@ -150,9 +150,9 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
formatData.wBitsPerSample = 16;
waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL);
unsigned int volume = (rightVolume << 16) | leftVolume;
if ( waveOutSetVolume( handle, volume ) )
- qDebug( "set volume of audio device failed" );
+// qDebug( "set volume of audio device failed" );
waveOutClose( handle );
#else
// Volume can be from 0 to 100 which is 101 distinct values
unsigned int rV = (rightVolume * 101) >> 16;
@@ -191,15 +191,15 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
d = new AudioDevicePrivate;
d->frequency = f;
d->channels = chs;
d->bytesPerSample = bps;
- qDebug("%d",bps);
+// qDebug("%d",bps);
int format=0;
if( bps == 8) format = AFMT_U8;
else if( bps <= 0) format = AFMT_S16_LE;
else format = AFMT_S16_LE;
- qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
+// qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
int fragments = 0x10000 * 8 + sound_fragment_shift;
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 859a67a..1ae0059 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -234,16 +234,16 @@ void LoopControl::startAudio() {
bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
long sampleWaitTime = currentSample - sampleWeShouldBeAt;
-// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 5000 ) ) {
-// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
-// }
-// else if ( sampleWaitTime <= -5000 ) {
-// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
-// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
-// currentSample = sampleWeShouldBeAt;
-// }
+ if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
+ usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
+ }
+ else if ( sampleWaitTime <= -5000 ) {
+ qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
+ //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
+ currentSample = sampleWeShouldBeAt;
+ }
audioDevice->write( audioBuffer, samplesRead * 2 * channels );
audioSampleCounter = currentSample + samplesRead - 1;
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 4e1543e..269aed8 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -38,9 +38,9 @@
#include <qtoolbutton.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <qpoint.h>
-#include <qtimer.h>
+//#include <qtimer.h>
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
@@ -97,10 +97,10 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
d = new PlayListWidgetPrivate;
d->setDocumentUsed = FALSE;
d->current = NULL;
- menuTimer = new QTimer( this ,"menu timer"),
- connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
+// menuTimer = new QTimer( this ,"menu timer"),
+// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
setBackgroundMode( PaletteButton );
setCaption( tr("OpiePlayer") );
@@ -203,13 +203,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
QString storage;
for ( ; dit.current(); ++dit ) {
QListViewItem * newItem;
if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF";
+ else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF";
else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD";
else storage="RAM";
-
+ if ( QFile( dit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" ));
+ }
}
// videowidget
QWidget *vTab;
@@ -228,13 +230,16 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
Global::findDocuments(&vFiles, "video/*");
QListIterator<DocLnk> Vdit( vFiles.children() );
for ( ; Vdit.current(); ++Vdit ) {
if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF";
+ else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF";
else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD";
else storage="RAM";
QListViewItem * newItem;
+ if ( QFile( Vdit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" ));
+ }
}
// d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE );
@@ -662,30 +667,30 @@ void PlayListWidget::tabChanged(QWidget *widg) {
break;
};
}
-void PlayListWidget::cancelMenuTimer() {
- if( menuTimer->isActive() )
- menuTimer->stop();
-}
+// void PlayListWidget::cancelMenuTimer() {
+// if( menuTimer->isActive() )
+// menuTimer->stop();
+// }
-void PlayListWidget::showFileMenu() {
+// void PlayListWidget::showFileMenu() {
-}
+// }
-void PlayListWidget::contentsMousePressEvent( QMouseEvent * e )
-{
-// QListView::contentsMousePressEvent( e );
- menuTimer->start( 750, TRUE );
-}
+// void PlayListWidget::contentsMousePressEvent( QMouseEvent * e )
+// {
+// // QListView::contentsMousePressEvent( e );
+// menuTimer->start( 750, TRUE );
+// }
-void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e )
-{
-// QListView::contentsMouseReleaseEvent( e );
- menuTimer->stop();
-}
-// void PlayListWidget::setFullScreen() {
+// void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e )
+// {
+// // QListView::contentsMouseReleaseEvent( e );
+// menuTimer->stop();
+// }
+// // void PlayListWidget::setFullScreen() {
// mediaPlayerState->toggleFullscreen( );
// }
// void PlayListWidget::setScaled() {
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 3a52dd5..6fe2211 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -23,9 +23,9 @@
#include <qmainwindow.h>
#include <qpe/applnk.h>
#include <qtabwidget.h>
-#include <qtimer.h>
+/* #include <qtimer.h> */
class PlayListWidgetPrivate;
class Config;
@@ -48,9 +48,9 @@ public:
QLabel *libString;
// retrieve the current playlist entry (media file link)
const DocLnk *current();
void useSelectedDocument();
- QTimer * menuTimer;
+/* QTimer * menuTimer; */
public slots:
void setDocument( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist
@@ -75,20 +75,20 @@ public slots:
void tabChanged(QWidget*);
/* void setFullScreen(); */
/* void setScaled(); */
protected:
- void contentsMousePressEvent( QMouseEvent * e );
- void contentsMouseReleaseEvent( QMouseEvent * e );
+/* void contentsMousePressEvent( QMouseEvent * e ); */
+/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
private:
void initializeStates();
void readConfig( Config& cfg );
void writeConfig( Config& cfg ) const;
PlayListWidgetPrivate *d; // Private implementation data
protected slots:
- void cancelMenuTimer();
- void showFileMenu();
+/* void cancelMenuTimer(); */
+/* void showFileMenu(); */
};