summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-25 00:26:33 (UTC)
committer llornkcor <llornkcor>2002-02-25 00:26:33 (UTC)
commitc0446b55fc32b7fdea9f58db06e40da703f5e8ff (patch) (side-by-side diff)
treeb84cbcdf9d2687bb3e8672981a6e62577c98becb
parent146ed85c70bf6a288294e91baceb9af9ec5b8611 (diff)
downloadopie-c0446b55fc32b7fdea9f58db06e40da703f5e8ff.zip
opie-c0446b55fc32b7fdea9f58db06e40da703f5e8ff.tar.gz
opie-c0446b55fc32b7fdea9f58db06e40da703f5e8ff.tar.bz2
*** empty log message ***
Diffstat (more/less context) (show 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
@@ -106,13 +106,13 @@ void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume
formatData.nBlockAlign = 4;
formatData.nChannels = 2;
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
int mixerHandle = open( "/dev/mixer", O_RDWR );
if ( mixerHandle >= 0 ) {
@@ -148,13 +148,13 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
formatData.nChannels = 2;
formatData.nSamplesPerSec = 44000;
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;
# if 0
@@ -189,19 +189,19 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
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;
int capabilities = 0;
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
@@ -232,20 +232,20 @@ void LoopControl::startAudio() {
long samplesRead = 0;
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;
moreAudio = readOk && (audioSampleCounter <= total_audio_samples);
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
@@ -36,13 +36,13 @@
#include <qmainwindow.h>
#include <qmessagebox.h>
#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"
#include <stdlib.h>
@@ -95,14 +95,14 @@ public:
PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, 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") );
setIcon( Resource::loadPixmap( "MPEGPlayer" ) );
@@ -201,18 +201,20 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
Global::findDocuments(&files, "audio/*");
QListIterator<DocLnk> dit( files.children() );
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;
vTab = new QWidget( tabWidget, "vTab" );
videoView = new QListView( vTab, "Videoview" );
videoView->setMinimumSize(233,260);
@@ -226,18 +228,21 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
tabWidget->insertTab( vTab,"Video");
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 );
// d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
// add the library area
@@ -660,34 +665,34 @@ void PlayListWidget::tabChanged(QWidget *widg) {
d->tbAddToList->setEnabled(TRUE);
}
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() {
// mediaPlayerState->toggleScaled();
// }
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
@@ -21,13 +21,13 @@
#define PLAY_LIST_WIDGET_H
#include <qmainwindow.h>
#include <qpe/applnk.h>
#include <qtabwidget.h>
-#include <qtimer.h>
+/* #include <qtimer.h> */
class PlayListWidgetPrivate;
class Config;
class QListViewItem;
class QListView;
@@ -46,13 +46,13 @@ public:
DocLnkSet vFiles;
QListView *audioView, *videoView, *playlistView;
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
void addToSelection( QListViewItem* ); // Add a media file to the playlist
void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist
@@ -73,24 +73,24 @@ public slots:
void addSelected();
void removeSelected();
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(); */
};
#endif // PLAY_LIST_WIDGET_H