summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp7
-rw-r--r--core/multimedia/opieplayer/inputDialog.cpp45
-rw-r--r--core/multimedia/opieplayer/inputDialog.h31
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.h6
-rw-r--r--core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp8
-rw-r--r--core/multimedia/opieplayer/libmad/libmadpluginimpl.h4
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h23
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp8
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h4
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp34
-rw-r--r--core/multimedia/opieplayer/main.cpp2
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp65
-rw-r--r--core/multimedia/opieplayer/mediaplayer.h4
-rw-r--r--core/multimedia/opieplayer/mediaplayerplugininterface.h15
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp11
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.h65
-rw-r--r--core/multimedia/opieplayer/mpegplayer.pro7
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp6
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp399
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h12
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp2
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.cpp16
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.h5
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp8
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavpluginimpl.h3
25 files changed, 505 insertions, 285 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 9a10eb4..5fef792 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -184,23 +184,24 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
184} 184}
185 185
186 186
187 187
188 188
189AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { 189AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
190 d = new AudioDevicePrivate; 190 qDebug("creating new audio device");
191 d = new AudioDevicePrivate;
191 d->frequency = f; 192 d->frequency = f;
192 d->channels = chs; 193 d->channels = chs;
193 d->bytesPerSample = bps; 194 d->bytesPerSample = bps;
194// qDebug("%d",bps); 195 qDebug("%d",bps);
195 int format=0; 196 int format=0;
196 if( bps == 8) format = AFMT_U8; 197 if( bps == 8) format = AFMT_U8;
197 else if( bps <= 0) format = AFMT_S16_LE; 198 else if( bps <= 0) format = AFMT_S16_LE;
198 else format = AFMT_S16_LE; 199 else format = AFMT_S16_LE;
199 200
200// qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); 201 qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
201 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); 202 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
202 203
203 204
204 int fragments = 0x10000 * 8 + sound_fragment_shift; 205 int fragments = 0x10000 * 8 + sound_fragment_shift;
205 int capabilities = 0; 206 int capabilities = 0;
206 207
diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp
new file mode 100644
index 0000000..b443747
--- a/dev/null
+++ b/core/multimedia/opieplayer/inputDialog.cpp
@@ -0,0 +1,45 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'inputDialog.ui'
3**
4** Created: Sat Mar 2 07:55:03 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "inputDialog.h"
10
11#include <qlineedit.h>
12#include <qlayout.h>
13#include <qvariant.h>
14#include <qtooltip.h>
15#include <qwhatsthis.h>
16
17/*
18 * Constructs a InputDialog which is a child of 'parent', with the
19 * name 'name' and widget flags set to 'f'
20 *
21 * The dialog will by default be modeless, unless you set 'modal' to
22 * TRUE to construct a modal dialog.
23 */
24InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
25 : QDialog( parent, name, modal, fl )
26{
27 if ( !name )
28 setName( "InputDialog" );
29 resize( 234, 50 );
30 setMaximumSize( QSize( 240, 50 ) );
31 setCaption( tr(name ) );
32
33 LineEdit1 = new QLineEdit( this, "LineEdit1" );
34 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
35}
36
37/*
38 * Destroys the object and frees any allocated resources
39 */
40InputDialog::~InputDialog()
41{
42 inputText= LineEdit1->text();
43
44}
45
diff --git a/core/multimedia/opieplayer/inputDialog.h b/core/multimedia/opieplayer/inputDialog.h
new file mode 100644
index 0000000..26d5cd0
--- a/dev/null
+++ b/core/multimedia/opieplayer/inputDialog.h
@@ -0,0 +1,31 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'inputDialog.ui'
3**
4** Created: Sat Mar 2 07:54:46 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef INPUTDIALOG_H
10#define INPUTDIALOG_H
11
12#include <qvariant.h>
13#include <qdialog.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QLineEdit;
18
19class InputDialog : public QDialog
20{
21 Q_OBJECT
22
23public:
24 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
25 ~InputDialog();
26 QString inputText;
27 QLineEdit* LineEdit1;
28
29};
30
31#endif // INPUTDIALOG_H
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h
index d163458..b240b77 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.h
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.h
@@ -18,14 +18,14 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef LIBMAD_PLUGIN_H 20#ifndef LIBMAD_PLUGIN_H
21#define LIBMAD_PLUGIN_H 21#define LIBMAD_PLUGIN_H
22 22
23#include <qstring.h> 23#include <qstring.h>
24//#include <qpe/mediaplayerplugininterface.h> 24#include <qpe/mediaplayerplugininterface.h>
25#include "../mediaplayerplugininterface.h" 25/* #include "../mediaplayerplugininterface.h" */
26 26
27 27
28// #define OLD_MEDIAPLAYER_API 28// #define OLD_MEDIAPLAYER_API
29 29
30 30
31class LibMadPluginData; 31class LibMadPluginData;
@@ -50,13 +50,13 @@ public:
50 // If decoder doesn't support audio then return 0 here 50 // If decoder doesn't support audio then return 0 here
51 int audioStreams(); 51 int audioStreams();
52 int audioChannels( int stream ); 52 int audioChannels( int stream );
53 int audioFrequency( int stream ); 53 int audioFrequency( int stream );
54 int audioSamples( int stream ); 54 int audioSamples( int stream );
55 bool audioSetSample( long sample, int stream ); 55 bool audioSetSample( long sample, int stream );
56 int audioBitsPerSample(int) {return 0;} 56/* int audioBitsPerSample(int) {return 0;} */
57 long audioGetSample( int stream ); 57 long audioGetSample( int stream );
58#ifdef OLD_MEDIAPLAYER_API 58#ifdef OLD_MEDIAPLAYER_API
59 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); 59 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
60 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); 60 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
61 bool audioReadSamples( short *output, int channel, long samples, int stream ); 61 bool audioReadSamples( short *output, int channel, long samples, int stream );
62 bool audioReReadSamples( short *output, int channel, long samples, int stream ); 62 bool audioReReadSamples( short *output, int channel, long samples, int stream );
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp
index 028c658..67779e8 100644
--- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp
@@ -27,20 +27,20 @@ LibMadPluginImpl::LibMadPluginImpl()
27} 27}
28 28
29 29
30LibMadPluginImpl::~LibMadPluginImpl() 30LibMadPluginImpl::~LibMadPluginImpl()
31{ 31{
32 if ( libmadplugin ) 32 if ( libmadplugin )
33 delete libmadplugin; 33 delete libmadplugin;
34} 34}
35 35
36 36
37MediaPlayerDecoder *LibMadPluginImpl::decoder() 37MediaPlayerDecoder *LibMadPluginImpl::decoder()
38{ 38{
39 if ( !libmadplugin ) 39 if ( !libmadplugin )
40 libmadplugin = new LibMadPlugin; 40 libmadplugin = new LibMadPlugin;
41 return libmadplugin; 41 return libmadplugin;
42} 42}
43 43
44 44
45MediaPlayerEncoder *LibMadPluginImpl::encoder() 45MediaPlayerEncoder *LibMadPluginImpl::encoder()
46{ 46{
@@ -51,14 +51,14 @@ MediaPlayerEncoder *LibMadPluginImpl::encoder()
51#ifndef QT_NO_COMPONENT 51#ifndef QT_NO_COMPONENT
52 52
53 53
54QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 54QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
55{ 55{
56 *iface = 0; 56 *iface = 0;
57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
58 *iface = this, (*iface)->addRef(); 58 *iface = this, (*iface)->addRef();
59 return QS_OK; 59 return QS_OK;
60} 60}
61 61
62 62
63Q_EXPORT_INTERFACE() 63Q_EXPORT_INTERFACE()
64{ 64{
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h
index bc864ee..9b35b90 100644
--- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h
+++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h
@@ -17,14 +17,14 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef LIBMAD_PLUGIN_IMPL_H 20#ifndef LIBMAD_PLUGIN_IMPL_H
21#define LIBMAD_PLUGIN_IMPL_H 21#define LIBMAD_PLUGIN_IMPL_H
22 22
23//#include <qpe/mediaplayerplugininterface.h> 23#include <qpe/mediaplayerplugininterface.h>
24#include "../mediaplayerplugininterface.h" 24//#include "../mediaplayerplugininterface.h"
25 25
26 26
27class LibMadPlugin; 27class LibMadPlugin;
28 28
29 29
30class LibMadPluginImpl : public MediaPlayerPluginInterface 30class LibMadPluginImpl : public MediaPlayerPluginInterface
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
index bd31706..b573e84 100644
--- a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
@@ -21,14 +21,13 @@
21#define LIBMPEG3_PLUGIN_H 21#define LIBMPEG3_PLUGIN_H
22 22
23#include <qstring.h> 23#include <qstring.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include "libmpeg3.h" 25#include "libmpeg3.h"
26#include "mpeg3protos.h" 26#include "mpeg3protos.h"
27//#include <qpe/mediaplayerplugininterface.h> 27#include <qpe/mediaplayerplugininterface.h>
28#include "../mediaplayerplugininterface.h"
29 28
30 29
31// #define OLD_MEDIAPLAYER_API 30// #define OLD_MEDIAPLAYER_API
32 31
33 32
34class LibMpeg3Plugin : public MediaPlayerDecoder { 33class LibMpeg3Plugin : public MediaPlayerDecoder {
@@ -48,13 +47,13 @@ public:
48 const QString &fileInfo() { return strInfo = ""; } 47 const QString &fileInfo() { return strInfo = ""; }
49 48
50 // If decoder doesn't support audio then return 0 here 49 // If decoder doesn't support audio then return 0 here
51 int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; } 50 int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; }
52 int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; } 51 int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; }
53 int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } 52 int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; }
54 int audioBitsPerSample(int) { return 0;} 53/* int audioBitsPerSample(int) { return 0;} */
55 int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } 54 int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; }
56 bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; } 55 bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; }
57 long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; } 56 long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; }
58#ifdef OLD_MEDIAPLAYER_API 57#ifdef OLD_MEDIAPLAYER_API
59 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); 58 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
60 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); 59 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
@@ -71,21 +70,21 @@ public:
71 double videoFrameRate( int stream ) { return file ? mpeg3_frame_rate( file, stream ) : 0.0; } 70 double videoFrameRate( int stream ) { return file ? mpeg3_frame_rate( file, stream ) : 0.0; }
72 int videoFrames( int stream ) 71 int videoFrames( int stream )
73{ return file ? mpeg3_video_frames( file, stream ) : 0; } 72{ return file ? mpeg3_video_frames( file, stream ) : 0; }
74/* 73/*
75{ 74{
76 if ( file ) { 75 if ( file ) {
77 int frames = mpeg3_video_frames( file, stream ); 76 int frames = mpeg3_video_frames( file, stream );
78 if ( frames == 1 ) { 77 if ( frames == 1 ) {
79 int res = mpeg3_seek_percentage( file, 0.99 ); 78 int res = mpeg3_seek_percentage( file, 0.99 );
80 printf("res: %i\n", res ); 79 printf("res: %i\n", res );
81 mpeg3video_seek( file->vtrack[stream]->video ); 80 mpeg3video_seek( file->vtrack[stream]->video );
82 frames = mpeg3_get_frame( file, stream ); 81 frames = mpeg3_get_frame( file, stream );
83 mpeg3_seek_percentage( file, 0.0 ); 82 mpeg3_seek_percentage( file, 0.0 );
84 } 83 }
85 return frames; 84 return frames;
86 } 85 }
87 return 0; 86 return 0;
88} 87}
89*/ 88*/
90 bool videoSetFrame( long frame, int stream ) { return file ? mpeg3_set_frame( file, frame, stream) == 1 : FALSE; } 89 bool videoSetFrame( long frame, int stream ) { return file ? mpeg3_set_frame( file, frame, stream) == 1 : FALSE; }
91 long videoGetFrame( int stream ) { return file ? mpeg3_get_frame( file, stream ) : 0; } 90 long videoGetFrame( int stream ) { return file ? mpeg3_get_frame( file, stream ) : 0; }
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp
index e7216af..bf3f372 100644
--- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp
@@ -27,20 +27,20 @@ LibMpeg3PluginImpl::LibMpeg3PluginImpl()
27} 27}
28 28
29 29
30LibMpeg3PluginImpl::~LibMpeg3PluginImpl() 30LibMpeg3PluginImpl::~LibMpeg3PluginImpl()
31{ 31{
32 if ( libmpeg3plugin ) 32 if ( libmpeg3plugin )
33 delete libmpeg3plugin; 33 delete libmpeg3plugin;
34} 34}
35 35
36 36
37MediaPlayerDecoder *LibMpeg3PluginImpl::decoder() 37MediaPlayerDecoder *LibMpeg3PluginImpl::decoder()
38{ 38{
39 if ( !libmpeg3plugin ) 39 if ( !libmpeg3plugin )
40 libmpeg3plugin = new LibMpeg3Plugin; 40 libmpeg3plugin = new LibMpeg3Plugin;
41 return libmpeg3plugin; 41 return libmpeg3plugin;
42} 42}
43 43
44 44
45MediaPlayerEncoder *LibMpeg3PluginImpl::encoder() 45MediaPlayerEncoder *LibMpeg3PluginImpl::encoder()
46{ 46{
@@ -51,14 +51,14 @@ MediaPlayerEncoder *LibMpeg3PluginImpl::encoder()
51#ifndef QT_NO_COMPONENT 51#ifndef QT_NO_COMPONENT
52 52
53 53
54QRESULT LibMpeg3PluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 54QRESULT LibMpeg3PluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
55{ 55{
56 *iface = 0; 56 *iface = 0;
57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
58 *iface = this, (*iface)->addRef(); 58 *iface = this, (*iface)->addRef();
59 return QS_OK; 59 return QS_OK;
60} 60}
61 61
62 62
63Q_EXPORT_INTERFACE() 63Q_EXPORT_INTERFACE()
64{ 64{
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h
index a2f5211..ef3743e 100644
--- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h
@@ -17,14 +17,14 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef LIBMPEG3_PLUGIN_IMPL_H 20#ifndef LIBMPEG3_PLUGIN_IMPL_H
21#define LIBMPEG3_PLUGIN_IMPL_H 21#define LIBMPEG3_PLUGIN_IMPL_H
22 22
23//#include <qpe/mediaplayerplugininterface.h> 23#include <qpe/mediaplayerplugininterface.h>
24#include "../mediaplayerplugininterface.h" 24//#include "../mediaplayerplugininterface.h"
25 25
26 26
27class LibMpeg3Plugin; 27class LibMpeg3Plugin;
28 28
29 29
30class LibMpeg3PluginImpl : public MediaPlayerPluginInterface 30class LibMpeg3PluginImpl : public MediaPlayerPluginInterface
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 90a7cc6..cb8de8a 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -31,13 +31,13 @@
31#include <pthread.h> 31#include <pthread.h>
32#include <errno.h> 32#include <errno.h>
33#include <unistd.h> 33#include <unistd.h>
34#include "loopcontrol.h" 34#include "loopcontrol.h"
35#include "videowidget.h" 35#include "videowidget.h"
36#include "audiodevice.h" 36#include "audiodevice.h"
37#include "mediaplayerplugininterface.h" 37#include <qpe/mediaplayerplugininterface.h>
38#include "mediaplayerstate.h" 38#include "mediaplayerstate.h"
39 39
40 40
41extern VideoWidget *videoUI; // now only needed to tell it to play a frame 41extern VideoWidget *videoUI; // now only needed to tell it to play a frame
42extern MediaPlayerState *mediaPlayerState; 42extern MediaPlayerState *mediaPlayerState;
43 43
@@ -98,13 +98,13 @@ Mutex *audioMutex;
98 98
99 99
100LoopControl::LoopControl( QObject *parent, const char *name ) 100LoopControl::LoopControl( QObject *parent, const char *name )
101 : QObject( parent, name ) { 101 : QObject( parent, name ) {
102 isMuted = FALSE; 102 isMuted = FALSE;
103 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); 103 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) );
104 104//qDebug("starting loopcontrol");
105 audioMutex = new Mutex; 105 audioMutex = new Mutex;
106 106
107 pthread_attr_init(&audio_attr); 107 pthread_attr_init(&audio_attr);
108#define USE_REALTIME_AUDIO_THREAD 108#define USE_REALTIME_AUDIO_THREAD
109#ifdef USE_REALTIME_AUDIO_THREAD 109#ifdef USE_REALTIME_AUDIO_THREAD
110 // Attempt to set it to real-time round robin 110 // Attempt to set it to real-time round robin
@@ -115,12 +115,13 @@ LoopControl::LoopControl( QObject *parent, const char *name )
115 } else { 115 } else {
116 qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); 116 qDebug( "Error setting up a realtime thread, reverting to using a normal thread." );
117 pthread_attr_destroy(&audio_attr); 117 pthread_attr_destroy(&audio_attr);
118 pthread_attr_init(&audio_attr); 118 pthread_attr_init(&audio_attr);
119 } 119 }
120#endif 120#endif
121//qDebug("create audio thread");
121 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); 122 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this);
122} 123}
123 124
124 125
125LoopControl::~LoopControl() { 126LoopControl::~LoopControl() {
126 stop(); 127 stop();
@@ -217,14 +218,14 @@ void LoopControl::startVideo() {
217 } 218 }
218} 219}
219 220
220 221
221void LoopControl::startAudio() { 222void LoopControl::startAudio() {
222 223
224//qDebug("start audio");
223 audioMutex->lock(); 225 audioMutex->lock();
224
225 if ( moreAudio ) { 226 if ( moreAudio ) {
226 227
227 if ( !isMuted && mediaPlayerState->curDecoder() ) { 228 if ( !isMuted && mediaPlayerState->curDecoder() ) {
228 229
229 currentSample = audioSampleCounter + 1; 230 currentSample = audioSampleCounter + 1;
230 231
@@ -233,20 +234,20 @@ void LoopControl::startAudio() {
233 234
234 long samplesRead = 0; 235 long samplesRead = 0;
235 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); 236 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
236 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; 237 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
237 long sampleWaitTime = currentSample - sampleWeShouldBeAt; 238 long sampleWaitTime = currentSample - sampleWeShouldBeAt;
238 239
239 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { 240// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
240 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); 241// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
241 } 242// }
242 else if ( sampleWaitTime <= -5000 ) { 243// else if ( sampleWaitTime <= -5000 ) {
243 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 244// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
244 //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 245// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
245 currentSample = sampleWeShouldBeAt; 246// currentSample = sampleWeShouldBeAt;
246 } 247// }
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
@@ -388,14 +389,19 @@ bool LoopControl::init( const QString& filename ) {
388 mediaPlayerState->setLength( total_audio_samples ); 389 mediaPlayerState->setLength( total_audio_samples );
389 390
390 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 391 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
391 qDebug( "LC- frequency = %d", freq ); 392 qDebug( "LC- frequency = %d", freq );
392 393
393 audioSampleCounter = 0; 394 audioSampleCounter = 0;
394 395 int bits_per_sample;
395 int bits_per_sample = mediaPlayerState->curDecoder()->audioBitsPerSample( astream); 396 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) {
397 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
398 qDebug("using stupid hack");
399 } else {
400 bits_per_sample=0;
401 }
396 402
397 audioDevice = new AudioDevice( freq, channels, bits_per_sample); 403 audioDevice = new AudioDevice( freq, channels, bits_per_sample);
398 audioBuffer = new char[ audioDevice->bufferSize() ]; 404 audioBuffer = new char[ audioDevice->bufferSize() ];
399 channels = audioDevice->channels(); 405 channels = audioDevice->channels();
400 406
401 //### must check which frequency is actually used. 407 //### must check which frequency is actually used.
@@ -434,13 +440,13 @@ bool LoopControl::init( const QString& filename ) {
434 440
435 return TRUE; 441 return TRUE;
436} 442}
437 443
438 444
439void LoopControl::play() { 445void LoopControl::play() {
440 446 qDebug("LC- play");
441#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 447#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
442 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) { 448 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) {
443 disabledSuspendScreenSaver = TRUE; 449 disabledSuspendScreenSaver = TRUE;
444 previousSuspendMode = hasVideoChannel; 450 previousSuspendMode = hasVideoChannel;
445 // Stop the screen from blanking and power saving state 451 // Stop the screen from blanking and power saving state
446 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 452 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp
index 720a1ca..4f43ff6 100644
--- a/core/multimedia/opieplayer/main.cpp
+++ b/core/multimedia/opieplayer/main.cpp
@@ -44,13 +44,13 @@ int main(int argc, char **argv) {
44 VideoWidget vw( 0, "videoUI" ); 44 VideoWidget vw( 0, "videoUI" );
45 videoUI = &vw; 45 videoUI = &vw;
46 LoopControl lc( 0, "loopControl" ); 46 LoopControl lc( 0, "loopControl" );
47 loopControl = &lc; 47 loopControl = &lc;
48 MediaPlayer mp( 0, "mediaPlayer" ); 48 MediaPlayer mp( 0, "mediaPlayer" );
49 49
50 pl.setCaption( MediaPlayer::tr("Media Player") ); 50 pl.setCaption( MediaPlayer::tr("OpiePlayer") );
51 a.showMainDocumentWidget(&pl); 51 a.showMainDocumentWidget(&pl);
52 52
53 return a.exec(); 53 return a.exec();
54} 54}
55 55
56 56
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index ce42c2c..c971a3c 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -45,14 +45,14 @@ extern MediaPlayerState *mediaPlayerState;
45 45
46MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 46MediaPlayer::MediaPlayer( QObject *parent, const char *name )
47 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 47 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
48 48
49 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 49 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
50 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 50 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
51 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 51 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
52 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 52 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
53 53
54 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 54 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
55 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 55 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
56 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 56 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
57 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 57 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
58} 58}
@@ -62,99 +62,94 @@ MediaPlayer::~MediaPlayer() {
62} 62}
63 63
64 64
65void MediaPlayer::pauseCheck( bool b ) { 65void MediaPlayer::pauseCheck( bool b ) {
66 // Only pause if playing 66 // Only pause if playing
67 if ( b && !mediaPlayerState->playing() ) 67 if ( b && !mediaPlayerState->playing() )
68 mediaPlayerState->setPaused( FALSE ); 68 mediaPlayerState->setPaused( FALSE );
69} 69}
70 70
71 71
72void MediaPlayer::play() { 72void MediaPlayer::play() {
73 mediaPlayerState->setPlaying( FALSE ); 73 mediaPlayerState->setPlaying( FALSE );
74 mediaPlayerState->setPlaying( TRUE ); 74 mediaPlayerState->setPlaying( TRUE );
75} 75}
76 76
77 77
78void MediaPlayer::setPlaying( bool play ) { 78void MediaPlayer::setPlaying( bool play ) {
79
80 if ( !play ) { 79 if ( !play ) {
81 mediaPlayerState->setPaused( FALSE ); 80 mediaPlayerState->setPaused( FALSE );
82 loopControl->stop( FALSE ); 81 loopControl->stop( FALSE );
83 return; 82 return;
84 } 83 }
85 84
86 if ( mediaPlayerState->paused() ) { 85 if ( mediaPlayerState->paused() ) {
87 mediaPlayerState->setPaused( FALSE ); 86 mediaPlayerState->setPaused( FALSE );
88 return; 87 return;
89 } 88 }
90 89
91 const DocLnk *playListCurrent = playList->current(); 90 const DocLnk *playListCurrent = playList->current();
92
93 if ( playListCurrent != NULL ) { 91 if ( playListCurrent != NULL ) {
94 loopControl->stop( TRUE ); 92 loopControl->stop( TRUE );
95 currentFile = playListCurrent; 93 currentFile = playListCurrent;
96 } 94 }
97
98 if ( currentFile == NULL ) { 95 if ( currentFile == NULL ) {
99 QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) ); 96 QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) );
100 mediaPlayerState->setPlaying( FALSE ); 97 mediaPlayerState->setPlaying( FALSE );
101 return; 98 return;
102 } 99 }
103
104 if ( !QFile::exists( currentFile->file() ) ) { 100 if ( !QFile::exists( currentFile->file() ) ) {
105 QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); 101 QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" );
106 mediaPlayerState->setPlaying( FALSE ); 102 mediaPlayerState->setPlaying( FALSE );
107 return; 103 return;
108 } 104 }
109 105
110 if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { 106 if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) {
111 QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); 107 QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" );
112 mediaPlayerState->setPlaying( FALSE ); 108 mediaPlayerState->setPlaying( FALSE );
113 return; 109 return;
114 } 110 }
115 111
116 if ( !loopControl->init( currentFile->file() ) ) { 112 if ( !loopControl->init( currentFile->file() ) ) {
117 QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); 113 QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" );
118 mediaPlayerState->setPlaying( FALSE ); 114 mediaPlayerState->setPlaying( FALSE );
119 return; 115 return;
120 } 116 }
121
122 long seconds = loopControl->totalPlaytime(); 117 long seconds = loopControl->totalPlaytime();
123 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 118 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
124 QString tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 119 QString tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
125 QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); 120 QString fileInfo = mediaPlayerState->curDecoder()->fileInfo();
126 if ( !fileInfo.isEmpty() ) 121 if ( !fileInfo.isEmpty() )
127 tickerText += ", " + fileInfo; 122 tickerText += ", " + fileInfo;
128 audioUI->setTickerText( tickerText + "." ); 123 audioUI->setTickerText( tickerText + "." );
129 124
130 loopControl->play(); 125 loopControl->play();
131 126
132 mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' ); 127 mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' );
133} 128}
134 129
135 130
136void MediaPlayer::prev() { 131void MediaPlayer::prev() {
137 if ( playList->prev() ) 132 if ( playList->prev() )
138 play(); 133 play();
139 else if ( mediaPlayerState->looping() ) { 134 else if ( mediaPlayerState->looping() ) {
140 if ( playList->last() ) 135 if ( playList->last() )
141 play(); 136 play();
142 } else 137 } else
143 mediaPlayerState->setList(); 138 mediaPlayerState->setList();
144} 139}
145 140
146 141
147void MediaPlayer::next() { 142void MediaPlayer::next() {
148 if ( playList->next() ) 143 if ( playList->next() )
149 play(); 144 play();
150 else if ( mediaPlayerState->looping() ) { 145 else if ( mediaPlayerState->looping() ) {
151 if ( playList->first() ) 146 if ( playList->first() )
152 play(); 147 play();
153 } else 148 } else
154 mediaPlayerState->setList(); 149 mediaPlayerState->setList();
155} 150}
156 151
157 152
158void MediaPlayer::startDecreasingVolume() { 153void MediaPlayer::startDecreasingVolume() {
159 volumeDirection = -1; 154 volumeDirection = -1;
160 startTimer( 100 ); 155 startTimer( 100 );
@@ -173,11 +168,11 @@ void MediaPlayer::stopChangingVolume() {
173 killTimers(); 168 killTimers();
174} 169}
175 170
176 171
177void MediaPlayer::timerEvent( QTimerEvent * ) { 172void MediaPlayer::timerEvent( QTimerEvent * ) {
178 if ( volumeDirection == +1 ) 173 if ( volumeDirection == +1 )
179 AudioDevice::increaseVolume(); 174 AudioDevice::increaseVolume();
180 else if ( volumeDirection == -1 ) 175 else if ( volumeDirection == -1 )
181 AudioDevice::decreaseVolume(); 176 AudioDevice::decreaseVolume();
182} 177}
183 178
diff --git a/core/multimedia/opieplayer/mediaplayer.h b/core/multimedia/opieplayer/mediaplayer.h
index 73f8124..d6e90cb 100644
--- a/core/multimedia/opieplayer/mediaplayer.h
+++ b/core/multimedia/opieplayer/mediaplayer.h
@@ -46,13 +46,13 @@ private slots:
46 void stopChangingVolume(); 46 void stopChangingVolume();
47 47
48protected: 48protected:
49 void timerEvent( QTimerEvent *e ); 49 void timerEvent( QTimerEvent *e );
50 50
51private: 51private:
52 int volumeDirection; 52 int volumeDirection;
53 const DocLnk*currentFile; 53 const DocLnk *currentFile;
54}; 54};
55 55
56 56
57#endif // MEDIA_PLAYER_H 57#endif // MEDIA_PLAYER_H
58 58
diff --git a/core/multimedia/opieplayer/mediaplayerplugininterface.h b/core/multimedia/opieplayer/mediaplayerplugininterface.h
index 339b2e4..97e4066 100644
--- a/core/multimedia/opieplayer/mediaplayerplugininterface.h
+++ b/core/multimedia/opieplayer/mediaplayerplugininterface.h
@@ -20,14 +20,18 @@
20#ifndef MEDIA_PLAYER_PLUGIN_INTERFACE_H 20#ifndef MEDIA_PLAYER_PLUGIN_INTERFACE_H
21#define MEDIA_PLAYER_PLUGIN_INTERFACE_H 21#define MEDIA_PLAYER_PLUGIN_INTERFACE_H
22 22
23#include <qpe/qcom.h> 23#include <qpe/qcom.h>
24 24
25#ifndef QT_NO_COMPONENT 25#ifndef QT_NO_COMPONENT
26// {c0093632-b44c-4cf7-a279-d82fe8a8890c} 26# ifndef IID_OpiePlayerPlugin
27// {F56F6CE0-1333-41FD-9B46-C0AF44D0B006}
28# define IID_OpiePlayerPlugin QUuid( 0xF56F6CE0, 0x1333, 0x41FD, 0x9B, 0x46, 0xC0, 0xAF, 0x44, 0xD0, 0xB0, 0x06);
29# endif
27# ifndef IID_MediaPlayerPlugin 30# ifndef IID_MediaPlayerPlugin
31// {c0093632-b44c-4cf7-a279-d82fe8a8890c}
28# define IID_MediaPlayerPlugin QUuid( 0xc0093632, 0xb44c, 0x4cf7, 0xa2, 0x79, 0xd8, 0x2f, 0xe8, 0xa8, 0x89, 0x0c ) 32# define IID_MediaPlayerPlugin QUuid( 0xc0093632, 0xb44c, 0x4cf7, 0xa2, 0x79, 0xd8, 0x2f, 0xe8, 0xa8, 0x89, 0x0c )
29# endif 33# endif
30#endif 34#endif
31 35
32 36
33enum ColorFormat { 37enum ColorFormat {
@@ -90,22 +94,31 @@ public:
90 virtual bool supportsSMP() = 0; 94 virtual bool supportsSMP() = 0;
91 virtual bool supportsStereo() = 0; 95 virtual bool supportsStereo() = 0;
92 virtual bool supportsScaling() = 0; 96 virtual bool supportsScaling() = 0;
93 97
94 // File Properies 98 // File Properies
95 virtual long getPlayTime() { return -1; } 99 virtual long getPlayTime() { return -1; }
100#ifdef IID_OpiePlayerPlugin
96 virtual int audioBitsPerSample( int stream ) = 0; 101 virtual int audioBitsPerSample( int stream ) = 0;
102#endif
97}; 103};
98 104
99 105
100class MediaPlayerEncoder; 106class MediaPlayerEncoder;
101 107
102 108
103struct MediaPlayerPluginInterface : public QUnknownInterface 109struct MediaPlayerPluginInterface : public QUnknownInterface
104{ 110{
105 virtual MediaPlayerDecoder *decoder() = 0; 111 virtual MediaPlayerDecoder *decoder() = 0;
106 virtual MediaPlayerEncoder *encoder() = 0; 112 virtual MediaPlayerEncoder *encoder() = 0;
107}; 113};
108 114
115#ifdef IID_OpiePlayerPlugin
116struct OpiePlayerPluginInterface : public QUnknownInterface
117{
118 virtual MediaPlayerDecoder *decoder() = 0;
119 virtual MediaPlayerEncoder *encoder() = 0;
120};
121#endif
109 122
110#endif 123#endif
111 124
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index 13741f6..a960c49 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -20,16 +20,17 @@
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/qlibrary.h> 21#include <qpe/qlibrary.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qvaluelist.h> 23#include <qvaluelist.h>
24#include <qobject.h> 24#include <qobject.h>
25#include <qdir.h> 25#include <qdir.h>
26#include "mediaplayerplugininterface.h" 26#include <qpe/mediaplayerplugininterface.h>
27#include "mediaplayerstate.h" 27#include "mediaplayerstate.h"
28 28
29 29
30
30#ifdef QT_NO_COMPONENT 31#ifdef QT_NO_COMPONENT
31// Plugins which are compiled in when no plugin architecture available 32// Plugins which are compiled in when no plugin architecture available
32#include "libmad/libmadpluginimpl.h" 33#include "libmad/libmadpluginimpl.h"
33#include "libmpeg3/libmpeg3pluginimpl.h" 34#include "libmpeg3/libmpeg3pluginimpl.h"
34#include "wavplugin/wavpluginimpl.h" 35#include "wavplugin/wavpluginimpl.h"
35#endif 36#endif
@@ -57,12 +58,13 @@ void MediaPlayerState::readConfig( Config& cfg ) {
57 cfg.setGroup("Options"); 58 cfg.setGroup("Options");
58 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 59 isFullscreen = cfg.readBoolEntry( "FullScreen" );
59 isScaled = cfg.readBoolEntry( "Scaling" ); 60 isScaled = cfg.readBoolEntry( "Scaling" );
60 isLooping = cfg.readBoolEntry( "Looping" ); 61 isLooping = cfg.readBoolEntry( "Looping" );
61 isShuffled = cfg.readBoolEntry( "Shuffle" ); 62 isShuffled = cfg.readBoolEntry( "Shuffle" );
62 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 63 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
64 usePlaylist = TRUE;
63 isPlaying = FALSE; 65 isPlaying = FALSE;
64 isPaused = FALSE; 66 isPaused = FALSE;
65 curPosition = 0; 67 curPosition = 0;
66 curLength = 0; 68 curLength = 0;
67 curView = 'l'; 69 curView = 'l';
68} 70}
@@ -118,13 +120,13 @@ MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
118// ### hack to get true sample count 120// ### hack to get true sample count
119// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { 121// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
120// return libwavdecoder; 122// return libwavdecoder;
121// } 123// }
122 124
123void MediaPlayerState::loadPlugins() { 125void MediaPlayerState::loadPlugins() {
124 126 qDebug("load plugins");
125#ifndef QT_NO_COMPONENT 127#ifndef QT_NO_COMPONENT
126 QValueList<MediaPlayerPlugin>::Iterator mit; 128 QValueList<MediaPlayerPlugin>::Iterator mit;
127 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 129 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
128 (*mit).iface->release(); 130 (*mit).iface->release();
129 (*mit).library->unload(); 131 (*mit).library->unload();
130 delete (*mit).library; 132 delete (*mit).library;
@@ -135,18 +137,17 @@ void MediaPlayerState::loadPlugins() {
135 QDir dir( path, "lib*.so" ); 137 QDir dir( path, "lib*.so" );
136 QStringList list = dir.entryList(); 138 QStringList list = dir.entryList();
137 QStringList::Iterator it; 139 QStringList::Iterator it;
138 for ( it = list.begin(); it != list.end(); ++it ) { 140 for ( it = list.begin(); it != list.end(); ++it ) {
139 MediaPlayerPluginInterface *iface = 0; 141 MediaPlayerPluginInterface *iface = 0;
140 QLibrary *lib = new QLibrary( path + "/" + *it ); 142 QLibrary *lib = new QLibrary( path + "/" + *it );
141 143// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
142 MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() ));
143 144
144 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { 145 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
145 146
146 MediaPlayerDebug(( "loading: %s", QString( path + "/" + *it ).latin1() )); 147// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
147 148
148 MediaPlayerPlugin plugin; 149 MediaPlayerPlugin plugin;
149 plugin.library = lib; 150 plugin.library = lib;
150 plugin.iface = iface; 151 plugin.iface = iface;
151 plugin.decoder = plugin.iface->decoder(); 152 plugin.decoder = plugin.iface->decoder();
152 plugin.encoder = plugin.iface->encoder(); 153 plugin.encoder = plugin.iface->encoder();
diff --git a/core/multimedia/opieplayer/mediaplayerstate.h b/core/multimedia/opieplayer/mediaplayerstate.h
index e82c263..ad273f1 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.h
+++ b/core/multimedia/opieplayer/mediaplayerstate.h
@@ -1,10 +1,10 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
@@ -17,12 +17,13 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef MEDIA_PLAYER_STATE_H 20#ifndef MEDIA_PLAYER_STATE_H
21#define MEDIA_PLAYER_STATE_H 21#define MEDIA_PLAYER_STATE_H
22 22
23
23#include <qobject.h> 24#include <qobject.h>
24 25
25 26
26class MediaPlayerDecoder; 27class MediaPlayerDecoder;
27class Config; 28class Config;
28 29
@@ -30,53 +31,54 @@ class Config;
30class MediaPlayerState : public QObject { 31class MediaPlayerState : public QObject {
31Q_OBJECT 32Q_OBJECT
32public: 33public:
33 MediaPlayerState( QObject *parent, const char *name ); 34 MediaPlayerState( QObject *parent, const char *name );
34 ~MediaPlayerState(); 35 ~MediaPlayerState();
35 36
36 bool fullscreen() { return isFullscreen; } 37
37 bool scaled() { return isScaled; } 38 bool fullscreen() { return isFullscreen; }
38 bool looping() { return isLooping; } 39 bool scaled() { return isScaled; }
39 bool shuffled() { return isShuffled; } 40 bool looping() { return isLooping; }
40 bool playlist() { return usePlaylist; } 41 bool shuffled() { return isShuffled; }
41 bool paused() { return isPaused; } 42 bool playlist() { return usePlaylist; }
42 bool playing() { return isPlaying; } 43 bool paused() { return isPaused; }
43 long position() { return curPosition; } 44 bool playing() { return isPlaying; }
44 long length() { return curLength; } 45 long position() { return curPosition; }
45 char view() { return curView; } 46 long length() { return curLength; }
47 char view() { return curView; }
46 48
47 MediaPlayerDecoder *newDecoder( const QString& file ); 49 MediaPlayerDecoder *newDecoder( const QString& file );
48 MediaPlayerDecoder *curDecoder(); 50 MediaPlayerDecoder *curDecoder();
49 MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the 51 MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the
50 // number of audio samples if we are using the libmad plugin 52 // number of audio samples if we are using the libmad plugin
51public slots: 53public slots:
52 void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); } 54 void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); }
53 void setScaled( bool b ) { if ( isScaled == b ) return; isScaled = b; emit scaledToggled(b); } 55 void setScaled( bool b ) { if ( isScaled == b ) return; isScaled = b; emit scaledToggled(b); }
54 void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); } 56 void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); }
55 void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); } 57 void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); }
56 void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } 58 void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); }
57 void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } 59 void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); }
58 void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } 60 void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); }
59 void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); } 61 void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); }
60 void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); } 62 void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); }
61 void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); } 63 void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); }
62 void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); } 64 void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); }
63 65
64 void setPrev() { emit prev(); } 66 void setPrev() { emit prev(); }
65 void setNext() { emit next(); } 67 void setNext() { emit next(); }
66 void setList() { setPlaying( FALSE ); setView('l'); } 68 void setList() { setPlaying( FALSE ); setView('l'); }
67 void setVideo() { setView('v'); } 69 void setVideo() { setView('v'); }
68 void setAudio() { setView('a'); } 70 void setAudio() { setView('a'); }
69 71
70 void toggleFullscreen() { setFullscreen( !isFullscreen ); } 72 void toggleFullscreen() { setFullscreen( !isFullscreen ); }
71 void toggleScaled() { setScaled( !isScaled); } 73 void toggleScaled() { setScaled( !isScaled); }
72 void toggleLooping() { setLooping( !isLooping); } 74 void toggleLooping() { setLooping( !isLooping); }
73 void toggleShuffled() { setShuffled( !isShuffled); } 75 void toggleShuffled() { setShuffled( !isShuffled); }
74 void togglePlaylist() { setPlaylist( !usePlaylist); } 76 void togglePlaylist() { setPlaylist( !usePlaylist); }
75 void togglePaused() { setPaused( !isPaused); } 77 void togglePaused() { setPaused( !isPaused); }
76 void togglePlaying() { setPlaying( !isPlaying); } 78 void togglePlaying() { setPlaying( !isPlaying); }
77 79
78signals: 80signals:
79 void fullscreenToggled( bool ); 81 void fullscreenToggled( bool );
80 void scaledToggled( bool ); 82 void scaledToggled( bool );
81 void loopingToggled( bool ); 83 void loopingToggled( bool );
82 void shuffledToggled( bool ); 84 void shuffledToggled( bool );
@@ -102,12 +104,13 @@ private:
102 long curPosition; 104 long curPosition;
103 long curLength; 105 long curLength;
104 char curView; 106 char curView;
105 107
106 MediaPlayerDecoder *decoder; 108 MediaPlayerDecoder *decoder;
107 MediaPlayerDecoder *libmpeg3decoder; 109 MediaPlayerDecoder *libmpeg3decoder;
110// MediaPlayerDecoder *libwavdecoder;
108 111
109 void loadPlugins(); 112 void loadPlugins();
110 void readConfig( Config& cfg ); 113 void readConfig( Config& cfg );
111 void writeConfig( Config& cfg ) const; 114 void writeConfig( Config& cfg ) const;
112}; 115};
113 116
diff --git a/core/multimedia/opieplayer/mpegplayer.pro b/core/multimedia/opieplayer/mpegplayer.pro
index 41f2de0..5bea541 100644
--- a/core/multimedia/opieplayer/mpegplayer.pro
+++ b/core/multimedia/opieplayer/mpegplayer.pro
@@ -1,22 +1,25 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3#release 3#release
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = loopcontrol.h mediaplayerplugininterface.h playlistselection.h mediaplayerstate.h \ 5HEADERS = loopcontrol.h mediaplayerplugininterface.h playlistselection.h mediaplayerstate.h \
6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h 6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h inputDialog.h
7SOURCES = main.cpp \ 7SOURCES = main.cpp \
8 loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ 8 loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \
9 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp 9 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp inputDialog.cpp
10TARGET = mpegplayer 10TARGET = mpegplayer
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += $(OPIEDIR)/include 12DEPENDPATH += $(OPIEDIR)/include
13LIBS += -lqpe -lpthread 13LIBS += -lqpe -lpthread
14 14
15# INTERFACES = 15# INTERFACES =
16# INCLUDEPATH += $(OPIEDIR)/include 16# INCLUDEPATH += $(OPIEDIR)/include
17# CONFIG+=static 17# CONFIG+=static
18# TMAKE_CXXFLAGS += -DQPIM_STANDALONE 18# TMAKE_CXXFLAGS += -DQPIM_STANDALONE
19# LIBS += libmpeg3/libmpeg3.a -lpthread 19# LIBS += libmpeg3/libmpeg3.a -lpthread
20# LIBS += $(OPIEDIR)/plugins/codecs/liblibmadplugin.so 20# LIBS += $(OPIEDIR)/plugins/codecs/liblibmadplugin.so
21 21
22INCLUDEPATH += $(OPIEDIR)/include
23DEPENDPATH += $(OPIEDIR)/include
24
22TRANSLATIONS = ../i18n/de/mpegplayer.ts 25TRANSLATIONS = ../i18n/de/mpegplayer.ts
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index 2c62e86..d70df51 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -52,15 +52,15 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
52{ 52{
53// #ifdef USE_PLAYLIST_BACKGROUND 53// #ifdef USE_PLAYLIST_BACKGROUND
54 setStaticBackground( TRUE ); 54 setStaticBackground( TRUE );
55// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); 55// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) );
56 setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) ); 56 setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) );
57// #endif 57// #endif
58 addColumn("Title",236); 58// addColumn("Title",236);
59 setAllColumnsShowFocus( TRUE ); 59// setAllColumnsShowFocus( TRUE );
60 addColumn( tr( "Playlist Selection" ) ); 60 addColumn( tr( "Playlist Selection" ) );
61 header()->hide(); 61 header()->hide();
62 setSorting( -1, FALSE ); 62 setSorting( -1, FALSE );
63} 63}
64 64
65 65
66PlayListSelection::~PlayListSelection() { 66PlayListSelection::~PlayListSelection() {
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 202f351..7862d8d 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -14,12 +14,13 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// code added by L. J. Potter Sat 03-02-2002 06:17:54
20 21
21#include <qpe/qpemenubar.h> 22#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 23#include <qpe/qpetoolbar.h>
23#include <qpe/fileselector.h> 24#include <qpe/fileselector.h>
24#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
25 26
@@ -37,18 +38,24 @@
37#include <qmainwindow.h> 38#include <qmainwindow.h>
38#include <qmessagebox.h> 39#include <qmessagebox.h>
39#include <qtoolbutton.h> 40#include <qtoolbutton.h>
40#include <qtabwidget.h> 41#include <qtabwidget.h>
41#include <qlistview.h> 42#include <qlistview.h>
42#include <qpoint.h> 43#include <qpoint.h>
44#include <qlineedit.h>
45#include <qpushbutton.h>
46
43//#include <qtimer.h> 47//#include <qtimer.h>
44 48
45#include "playlistselection.h" 49#include "playlistselection.h"
46#include "playlistwidget.h" 50#include "playlistwidget.h"
47#include "mediaplayerstate.h" 51#include "mediaplayerstate.h"
48 52
53#include "fileBrowser.h"
54#include "inputDialog.h"
55
49#include <stdlib.h> 56#include <stdlib.h>
50 57
51#define BUTTONS_ON_TOOLBAR 58#define BUTTONS_ON_TOOLBAR
52#define SIDE_BUTTONS 59#define SIDE_BUTTONS
53#define CAN_SAVE_LOAD_PLAYLISTS 60#define CAN_SAVE_LOAD_PLAYLISTS
54 61
@@ -116,26 +123,40 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
116 // Create Menubar 123 // Create Menubar
117 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 124 QPEMenuBar *menu = new QPEMenuBar( toolbar );
118 menu->setMargin( 0 ); 125 menu->setMargin( 0 );
119 126
120 QPEToolBar *bar = new QPEToolBar( this ); 127 QPEToolBar *bar = new QPEToolBar( this );
121 bar->setLabel( tr( "Play Operations" ) ); 128 bar->setLabel( tr( "Play Operations" ) );
122 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),"mpegplayer/add_to_playlist",this , SLOT(addSelected()) ); 129// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list",
123 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", this , SLOT(removeSelected()) ); 130// this , SLOT( addSelected()) );
124 d->tbPlay = new ToolButton( bar, tr( "Play" ),"mpegplayer/play", mediaPlayerState, SLOT( setPlaying(bool)), TRUE ); 131 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("close"),"",bar,"close");
125 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 132 tbDeletePlaylist->setFlat(TRUE);
126 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 133 tbDeletePlaylist->setFixedSize(20,20);
134 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
135
136 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist",
137 this , SLOT(addSelected()) );
138 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist",
139 this , SLOT(removeSelected()) );
140// d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
141 d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play",
142 this , SLOT( btnPlay(bool) ), TRUE );
143 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle",
144 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
145 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop",
146 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
147 tbDeletePlaylist->hide();
127 148
128 QPopupMenu *pmPlayList = new QPopupMenu( this ); 149 QPopupMenu *pmPlayList = new QPopupMenu( this );
129 menu->insertItem( tr( "File" ), pmPlayList ); 150 menu->insertItem( tr( "File" ), pmPlayList );
130 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 151 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
131 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 152 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
132 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 153 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
133 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 154 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
134 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 155 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
135 new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); 156 // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) );
136 157
137 QPopupMenu *pmView = new QPopupMenu( this ); 158 QPopupMenu *pmView = new QPopupMenu( this );
138 menu->insertItem( tr( "View" ), pmView ); 159 menu->insertItem( tr( "View" ), pmView );
139 160
140 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 161 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
141 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 162 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
@@ -148,13 +169,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
148 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 169 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
149 170
150 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 171 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
151 172
152 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 173 tabWidget = new QTabWidget( hbox6, "tabWidget" );
153 tabWidget->setTabShape(QTabWidget::Triangular); 174 tabWidget->setTabShape(QTabWidget::Triangular);
154 175
155 QWidget *pTab; 176 QWidget *pTab;
156 pTab = new QWidget( tabWidget, "pTab" ); 177 pTab = new QWidget( tabWidget, "pTab" );
157 playlistView = new QListView( pTab, "Videoview" ); 178 playlistView = new QListView( pTab, "Videoview" );
158 playlistView->setMinimumSize(236,260); 179 playlistView->setMinimumSize(236,260);
159 tabWidget->insertTab( pTab,"Playlist"); 180 tabWidget->insertTab( pTab,"Playlist");
160 181
@@ -225,41 +246,45 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
225 QListViewItem * newItem; 246 QListViewItem * newItem;
226 if ( QFile( Vdit.current()->file()).exists() ) { 247 if ( QFile( Vdit.current()->file()).exists() ) {
227 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); 248 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
228 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); 249 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" ));
229 } 250 }
230 } 251 }
231 // add the library area
232 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
233 252
234// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 253//playlists list
235// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 254 QWidget *LTab;
255 LTab = new QWidget( tabWidget, "LTab" );
256 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
257 playLists->setMinimumSize(233,260);;
258 tabWidget->insertTab(LTab,"Lists");
259 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
260// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
236 261
237 connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
238 connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
239 262
240 connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), 263// add the library area
241 this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); 264 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
242 connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ),
243 this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) );
244 265
245 266
246 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 267 connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
247 // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); 268 this, SLOT( fauxPlay( QListViewItem *) ) );
248 // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); 269 connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
249 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 270 this, SLOT( fauxPlay( QListViewItem *)) );
250 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
251 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
252 271
253// connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); 272// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
254// connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); 273// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
255// connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) );
256 274
257 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 275 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
276 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
258 277
259 connect( d->selectedFiles, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 278 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
279 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
280 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
281 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
282 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
283
284 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
260// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); 285// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
261 286
262 setCentralWidget( vbox5 ); 287 setCentralWidget( vbox5 );
263 288
264 Config cfg( "MediaPlayer" ); 289 Config cfg( "MediaPlayer" );
265 readConfig( cfg ); 290 readConfig( cfg );
@@ -284,28 +309,30 @@ void PlayListWidget::initializeStates() {
284 d->tbLoop->setOn( mediaPlayerState->looping() ); 309 d->tbLoop->setOn( mediaPlayerState->looping() );
285 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 310 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
286// d->tbFull->setOn( mediaPlayerState->fullscreen() ); 311// d->tbFull->setOn( mediaPlayerState->fullscreen() );
287// d->tbScale->setOn( mediaPlayerState->scaled() ); 312// d->tbScale->setOn( mediaPlayerState->scaled() );
288// d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); 313// d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
289// setPlaylist( mediaPlayerState->playlist() ); 314// setPlaylist( mediaPlayerState->playlist() );
315 setPlaylist( true);
316 d->selectedFiles->first();
317
290} 318}
291 319
292 320
293void PlayListWidget::readConfig( Config& cfg ) { 321void PlayListWidget::readConfig( Config& cfg ) {
294 cfg.setGroup("PlayList"); 322 cfg.setGroup("PlayList");
295 323
296 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 324 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
297 325
298 for ( int i = 0; i < noOfFiles; i++ ) { 326 for ( int i = 0; i < noOfFiles; i++ ) {
299 QString entryName; 327 QString entryName;
300 entryName.sprintf( "File%i", i + 1 ); 328 entryName.sprintf( "File%i", i + 1 );
301 QString linkFile = cfg.readEntry( entryName ); 329 QString linkFile = cfg.readEntry( entryName );
302 DocLnk lnk( linkFile ); 330 DocLnk lnk( linkFile );
303 if ( lnk.isValid() ) 331 if ( lnk.isValid() )
304 d->selectedFiles->addToSelection( lnk ); 332 d->selectedFiles->addToSelection( lnk );
305
306 } 333 }
307} 334}
308 335
309 336
310void PlayListWidget::writeConfig( Config& cfg ) const { 337void PlayListWidget::writeConfig( Config& cfg ) const {
311 cfg.setGroup("PlayList"); 338 cfg.setGroup("PlayList");
@@ -331,39 +358,32 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
331 "Your playlist " 358 "Your playlist "
332 "may be missing some entries\n" 359 "may be missing some entries\n"
333 "the next time you start it." ) 360 "the next time you start it." )
334 ); 361 );
335 } 362 }
336 } 363 }
337 noOfFiles++; 364 noOfFiles++;
338 } 365 }
339 } while ( d->selectedFiles->next() ); 366 } while ( d->selectedFiles->next() );
340 367
341 cfg.writeEntry("NumberOfFiles", noOfFiles ); 368 cfg.writeEntry("NumberOfFiles", noOfFiles );
369
370
342} 371}
343 372
344 373
345void PlayListWidget::addToSelection( const DocLnk& lnk ) { 374void PlayListWidget::addToSelection( const DocLnk& lnk ) {
346 d->setDocumentUsed = FALSE; 375 qDebug("add");
376 d->setDocumentUsed = FALSE;
347 if ( mediaPlayerState->playlist() ) 377 if ( mediaPlayerState->playlist() )
348 d->selectedFiles->addToSelection( lnk ); 378 d->selectedFiles->addToSelection( lnk );
349 else 379 else
350 mediaPlayerState->setPlaying( TRUE ); 380 mediaPlayerState->setPlaying( TRUE );
351} 381}
352 382
353 383
354void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) {
355 qDebug("add");
356// d->selectedFiles->addToSelection( lnk );
357 // }
358// else
359// mediaPlayerState->setPlaying( TRUE );
360//
361}
362
363
364void PlayListWidget::clearList() { 384void PlayListWidget::clearList() {
365 while ( first() ) 385 while ( first() )
366 d->selectedFiles->removeSelected(); 386 d->selectedFiles->removeSelected();
367} 387}
368 388
369 389
@@ -393,22 +413,22 @@ void PlayListWidget::addAllVideoToList() {
393 d->selectedFiles->addToSelection( **dit ); 413 d->selectedFiles->addToSelection( **dit );
394} 414}
395 415
396 416
397void PlayListWidget::setDocument(const QString& fileref) { 417void PlayListWidget::setDocument(const QString& fileref) {
398 if ( fileref.isNull() ) { 418 if ( fileref.isNull() ) {
399 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 419 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
400 return; 420 return;
401 } 421 }
402 if ( mediaPlayerState->playlist() ) 422 if ( mediaPlayerState->playlist() )
403 addToSelection( DocLnk( fileref ) ); 423 addToSelection( DocLnk( fileref ) );
404 else { 424 else {
405 d->setDocumentUsed = TRUE; 425 d->setDocumentUsed = TRUE;
406 if ( d->current ) 426 if ( d->current )
407 delete d->current; 427 delete d->current;
408 d->current = new DocLnk( fileref ); 428 d->current = new DocLnk( fileref );
409 } 429 }
410 mediaPlayerState->setPlaying( FALSE ); 430 mediaPlayerState->setPlaying( FALSE );
411 mediaPlayerState->setPlaying( TRUE ); 431 mediaPlayerState->setPlaying( TRUE );
412} 432}
413 433
414 434
@@ -423,18 +443,22 @@ void PlayListWidget::setActiveWindow() {
423void PlayListWidget::useSelectedDocument() { 443void PlayListWidget::useSelectedDocument() {
424 d->setDocumentUsed = FALSE; 444 d->setDocumentUsed = FALSE;
425} 445}
426 446
427 447
428const DocLnk *PlayListWidget::current() { 448const DocLnk *PlayListWidget::current() {
429 if ( mediaPlayerState->playlist() ) 449
430 return d->selectedFiles->current(); 450// qDebug("in Playlist widget ::current");
451 if ( mediaPlayerState->playlist() ) {
452 return d->selectedFiles->current();
453 }
431 else if ( d->setDocumentUsed && d->current ) { 454 else if ( d->setDocumentUsed && d->current ) {
432 return d->current; 455 return d->current;
433 } else 456 } else {
434 return d->files->selected(); 457 return d->files->selected();
458 }
435} 459}
436 460
437 461
438bool PlayListWidget::prev() { 462bool PlayListWidget::prev() {
439 if ( mediaPlayerState->playlist() ) { 463 if ( mediaPlayerState->playlist() ) {
440 if ( mediaPlayerState->shuffled() ) { 464 if ( mediaPlayerState->shuffled() ) {
@@ -498,26 +522,54 @@ bool PlayListWidget::last() {
498 else 522 else
499 return mediaPlayerState->looping(); 523 return mediaPlayerState->looping();
500} 524}
501 525
502 526
503void PlayListWidget::saveList() { 527void PlayListWidget::saveList() {
528
504 QString filename; 529 QString filename;
505// pseudo code 530 InputDialog *fileDlg;
506// filename = QLineEdit->getText(); 531 fileDlg=new InputDialog(this,"Save Playlist",TRUE, 0);
507 Config cfg( filename + ".playlist" ); 532 fileDlg->exec();
508 writeConfig( cfg ); 533 if( fileDlg->result() == 1 ) {
534 filename = fileDlg->LineEdit1->text();//+".playlist";
535 qDebug("saving playlist "+filename+".playlist");
536
537// DocLnk *lnk;
538// lnk.setName( filename); //sets file name
539// // lnk.setComment(title);
540// lnk.setFile( filename+".playlist"); //sets File property
541// lnk.setType("player/plain");// hey is this a REGISTERED mime type?!?!? ;D
542// lnk.setIcon("MPEGPlayer");
543// if(!lnk.writeLink())
544// qDebug("Writing doclink did not work");
545
546 Config cfg( filename +".playlist");
547 writeConfig( cfg );
548 }
549 DocLnk lnk;
550 lnk.setName( filename); //sets file name
551// lnk.setComment(title);
552 lnk.setFile(QPEApplication::qpeDir()+"Settings/"+filename+".playlist.conf"); //sets File property
553 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
554 lnk.setIcon("MPEGPlayer");
555 if(!lnk.writeLink())
556 qDebug("Writing doclink did not work");
557
558 if(fileDlg)
559 delete fileDlg;
509} 560}
510 561
511 562
512void PlayListWidget::loadList() { 563void PlayListWidget::loadList( const DocLnk & lnk) {
513 QString filename; 564
514// pseudo code 565 clearList();
515// filename = FileSelector->openFile( "*.playlist" ); 566 Config cfg( lnk.file());
516 Config cfg( filename + ".playlist" ); 567 readConfig(cfg);
517 readConfig( cfg ); 568 tabWidget->setCurrentPage(0);
569 setCaption("OpiePlayer: "+lnk.name());
518} 570}
519 571
520 572
521void PlayListWidget::setPlaylist( bool shown ) { 573void PlayListWidget::setPlaylist( bool shown ) {
522 if ( shown ) 574 if ( shown )
523 d->playListFrame->show(); 575 d->playListFrame->show();
@@ -531,119 +583,180 @@ void PlayListWidget::setView( char view ) {
531 showMaximized(); 583 showMaximized();
532 else 584 else
533 hide(); 585 hide();
534} 586}
535 587
536void PlayListWidget::addSelected() { 588void PlayListWidget::addSelected() {
537// QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here"); 589
538 int tabPage=tabWidget->currentPageIndex(); 590 switch (tabWidget->currentPageIndex()) {
539 switch (tabPage) { 591 case 0: //playlist
540 case 0: //playlist
541 break; 592 break;
542 case 1: { //audio 593 case 1: { //audio
543 addToSelection( audioView->selectedItem() ); 594 addToSelection( audioView->selectedItem() );
544 } 595 }
545 break; 596 break;
546 case 2: { // video 597 case 2: { // video
547 addToSelection( videoView->selectedItem() ); 598 addToSelection( videoView->selectedItem() );
548 } 599 }
549 break; 600 break;
550 }; 601 };
551} 602}
552 603
553void PlayListWidget::removeSelected() { 604void PlayListWidget::removeSelected() {
554 d->selectedFiles->removeSelected( ); 605 d->selectedFiles->removeSelected( );
555} 606}
556 607
557 608
558void PlayListWidget::playIt( QListViewItem *it) { 609void PlayListWidget::playIt( QListViewItem *it) {
559// d->setDocumentUsed = FALSE; 610// d->setDocumentUsed = FALSE;
560 mediaPlayerState->setPlaying(true); 611 mediaPlayerState->setPlaying(TRUE);
561} 612}
562 613
563void PlayListWidget::addToSelection( QListViewItem *it) { 614void PlayListWidget::addToSelection( QListViewItem *it) {
564 d->setDocumentUsed = FALSE; 615 d->setDocumentUsed = FALSE;
565 616
566 if(it) { 617 if(it) {
567 qDebug("add to selection"); 618// qDebug("add to selection");
568 int tabPage=tabWidget->currentPageIndex(); 619 switch (tabWidget->currentPageIndex()) {
569 switch (tabPage) { 620 case 1: {
570 case 1: { 621// qDebug("case 1");
622 QListIterator<DocLnk> dit( files.children() );
623 for ( ; dit.current(); ++dit ) {
624// qDebug(dit.current()->name());
625 if( dit.current()->name() == it->text(0)) {
626 d->selectedFiles->addToSelection( **dit );
627 }
628 }
629 }
630 break;
631 case 2: {
632// qDebug("case 2");
633 QListIterator<DocLnk> dit( vFiles.children() );
634 for ( ; dit.current(); ++dit ) {
635// qDebug(dit.current()->name());
636 if( dit.current()->name() == it->text(0)) {
637 d->selectedFiles->addToSelection( **dit );
638 }
639 }
640 }
641 break;
642 case 0:
643 break;
644 };
645 tabWidget->setCurrentPage(0);
646// mediaPlayerState->setPlaying( TRUE );
647 }
648}
649
650void PlayListWidget::tabChanged(QWidget *widg) {
651
652 switch ( tabWidget->currentPageIndex()) {
653 case 0:
654 {
655 if( !tbDeletePlaylist->isHidden())
656 tbDeletePlaylist->hide();
657 d->tbRemoveFromList->setEnabled(TRUE);
658 d->tbAddToList->setEnabled(FALSE);
659 }
660 break;
661 case 1:
662 {
663 if( !tbDeletePlaylist->isHidden())
664 tbDeletePlaylist->hide();
665 d->tbRemoveFromList->setEnabled(FALSE);
666 d->tbAddToList->setEnabled(TRUE);
667 }
668 break;
669 case 2:
670 {
671 if( !tbDeletePlaylist->isHidden())
672 tbDeletePlaylist->hide();
673 d->tbRemoveFromList->setEnabled(FALSE);
674 d->tbAddToList->setEnabled(TRUE);
675 }
676 break;
677 case 3:
678 {
679 if( tbDeletePlaylist->isHidden())
680 tbDeletePlaylist->show();
681 playLists->reread();
682 }
683 break;
684 };
685}
686
687/*
688 list is right clicked*/
689void PlayListWidget::fauxPlay(QListViewItem *it) {
690
691 switch (tabWidget->currentPageIndex()) {
692 case 0: //playlist
693 break;
694 case 1: { //audio
571 QListIterator<DocLnk> dit( files.children() ); 695 QListIterator<DocLnk> dit( files.children() );
572 for ( ; dit.current(); ++dit ) { 696 for ( ; dit.current(); ++dit ) {
697// qDebug(dit.current()->name());
573 if( dit.current()->name() == it->text(0)) { 698 if( dit.current()->name() == it->text(0)) {
574 d->selectedFiles->addToSelection( **dit ); 699 d->selectedFiles->addToSelection( **dit );
575 } 700 }
576 } 701 }
577 } 702 }
578 break; 703 break;
579 case 2: { 704 case 2: { // video
580 QListIterator<DocLnk> dit( vFiles.children() ); 705 QListIterator<DocLnk> dit( vFiles.children() );
581 for ( ; dit.current(); ++dit ) { 706 for ( ; dit.current(); ++dit ) {
582 qDebug(dit.current()->name()); 707// qDebug(dit.current()->name());
583 if( dit.current()->name() == it->text(0)) { 708 if( dit.current()->name() == it->text(0)) {
584 d->selectedFiles->addToSelection( **dit ); 709 d->selectedFiles->addToSelection( **dit );
585 } 710 }
586 } 711 }
587 } 712 }
588 break; 713 break;
589 case 0:
590 break;
591 }; 714 };
592 tabWidget->setCurrentPage(0); 715 mediaPlayerState->setPlaying( TRUE );
593// mediaPlayerState->setPlaying( TRUE ); 716// tabWidget->setCurrentPage(0);
594 } 717 d->selectedFiles->removeSelected();
595} 718}
596 719
597void PlayListWidget::tabChanged(QWidget *widg) { 720/*
598 721 play button is pressed*/
599 int tabPage=tabWidget->currentPageIndex(); 722void PlayListWidget::btnPlay(bool b) { // this is fugly
600 switch (tabPage) { 723 switch ( tabWidget->currentPageIndex()) {
601 case 0: 724 case 0:
602 { 725 {
603 d->tbRemoveFromList->setEnabled(TRUE); 726 mediaPlayerState->setPlaying(b);
604 d->tbAddToList->setEnabled(FALSE);
605 } 727 }
606 break; 728 break;
607 case 1: 729 case 1:
608 { 730 {
609 d->tbRemoveFromList->setEnabled(FALSE); 731 addToSelection( audioView->selectedItem() );
610 d->tbAddToList->setEnabled(TRUE); 732 mediaPlayerState->setPlaying(b);
611 } 733 d->selectedFiles->removeSelected( );
612 break; 734 tabWidget->setCurrentPage(1);
613 case 2: 735 }
614 { 736 break;
615 d->tbRemoveFromList->setEnabled(FALSE); 737 case 2:
616 d->tbAddToList->setEnabled(TRUE); 738 {
617 } 739 addToSelection( videoView->selectedItem() );
618 break; 740 mediaPlayerState->setPlaying(b);
619 }; 741 d->selectedFiles->removeSelected( );
620} 742 tabWidget->setCurrentPage(2);
621 743 }
622// void PlayListWidget::cancelMenuTimer() { 744 break;
623// if( menuTimer->isActive() ) 745 };
624// menuTimer->stop();
625// }
626
627// void PlayListWidget::showFileMenu() {
628
629// }
630
631// void PlayListWidget::contentsMousePressEvent( QMouseEvent * e )
632// {
633// // QListView::contentsMousePressEvent( e );
634// menuTimer->start( 750, TRUE );
635// }
636 746
747}
637 748
638// void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) 749void PlayListWidget::deletePlaylist() {
639// { 750 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
640// // QListView::contentsMouseReleaseEvent( e ); 751 (tr("You really want to delete\nthis playlist?")),
641// menuTimer->stop(); 752 (tr("Yes")), (tr("No")), 0 )){
642// } 753 case 0: // Yes clicked,
643// // void PlayListWidget::setFullScreen() { 754 QFile().remove(playLists->selected()->file());
644// mediaPlayerState->toggleFullscreen( ); 755 QFile().remove(playLists->selected()->linkFile());
645// } 756 playLists->reread();
757 break;
758 case 1: // Cancel
759 break;
760 };
646 761
647// void PlayListWidget::setScaled() { 762}
648// mediaPlayerState->toggleScaled();
649// }
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 5b05f11..46272a0 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -20,12 +20,15 @@
20#ifndef PLAY_LIST_WIDGET_H 20#ifndef PLAY_LIST_WIDGET_H
21#define PLAY_LIST_WIDGET_H 21#define PLAY_LIST_WIDGET_H
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qtabwidget.h> 25#include <qtabwidget.h>
26#include <fileselector.h>
27#include <qpushbutton.h>
28
26/* #include <qtimer.h> */ 29/* #include <qtimer.h> */
27 30
28 31
29class PlayListWidgetPrivate; 32class PlayListWidgetPrivate;
30class Config; 33class Config;
31class QListViewItem; 34class QListViewItem;
@@ -46,28 +49,31 @@ public:
46 QListView *audioView, *videoView, *playlistView; 49 QListView *audioView, *videoView, *playlistView;
47 QLabel *libString; 50 QLabel *libString;
48 // retrieve the current playlist entry (media file link) 51 // retrieve the current playlist entry (media file link)
49 const DocLnk *current(); 52 const DocLnk *current();
50 void useSelectedDocument(); 53 void useSelectedDocument();
51/* QTimer * menuTimer; */ 54/* QTimer * menuTimer; */
52 55 FileSelector* playLists;
56 QPushButton *tbDeletePlaylist;
53public slots: 57public slots:
54 void setDocument( const QString& fileref ); 58 void setDocument( const QString& fileref );
55 void addToSelection( const DocLnk& ); // Add a media file to the playlist 59 void addToSelection( const DocLnk& ); // Add a media file to the playlist
56 void addToSelection( QListViewItem* ); // Add a media file to the playlist 60 void addToSelection( QListViewItem* ); // Add a media file to the playlist
57 void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist
58 void setActiveWindow(); // need to handle this to show the right view 61 void setActiveWindow(); // need to handle this to show the right view
59 void setPlaylist( bool ); // Show/Hide the playlist 62 void setPlaylist( bool ); // Show/Hide the playlist
60 void setView( char ); 63 void setView( char );
61 void clearList(); 64 void clearList();
62 void addAllToList(); 65 void addAllToList();
63 void addAllMusicToList(); 66 void addAllMusicToList();
64 void addAllVideoToList(); 67 void addAllVideoToList();
65 void saveList(); // Save the playlist 68 void saveList(); // Save the playlist
66 void loadList(); // Load a playlist 69 void loadList( const DocLnk &); // Load a playlist
67 void playIt( QListViewItem *); 70 void playIt( QListViewItem *);
71 void fauxPlay(QListViewItem *);
72 void btnPlay(bool);
73 void deletePlaylist();
68 bool first(); 74 bool first();
69 bool last(); 75 bool last();
70 bool next(); 76 bool next();
71 bool prev(); 77 bool prev();
72 void addSelected(); 78 void addSelected();
73 void removeSelected(); 79 void removeSelected();
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 1f128a4..be838c4 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -15,13 +15,13 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include "mediaplayerplugininterface.h" 21#include <qpe/mediaplayerplugininterface.h>
22#include <qwidget.h> 22#include <qwidget.h>
23#include <qpainter.h> 23#include <qpainter.h>
24#include <qpixmap.h> 24#include <qpixmap.h>
25#include <qslider.h> 25#include <qslider.h>
26#include <qdrawutil.h> 26#include <qdrawutil.h>
27#include "videowidget.h" 27#include "videowidget.h"
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
index 7ac63c0..4a0da16 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
@@ -67,13 +67,13 @@ public:
67 max = out = sound_buffer_size; 67 max = out = sound_buffer_size;
68 wavedata_remaining = 0; 68 wavedata_remaining = 0;
69 samples_due = 0; 69 samples_due = 0;
70 samples = -1; 70 samples = -1;
71 } 71 }
72 72
73 // expands out samples to the frequency of 44kHz 73 // expands out samples to the frequency of 44kHz //not any more
74 bool add( short *output, long count, long& done, bool stereo ) 74 bool add( short *output, long count, long& done, bool stereo )
75 { 75 {
76 done = 0; 76 done = 0;
77 qApp->processEvents(); 77 qApp->processEvents();
78 78
79 if ( input == 0 ) { 79 if ( input == 0 ) {
@@ -85,12 +85,14 @@ public:
85 int l,r; 85 int l,r;
86 if ( getSample(l, r) == FALSE ) { 86 if ( getSample(l, r) == FALSE ) {
87 qDebug("didn't get sample"); 87 qDebug("didn't get sample");
88 return FALSE; 88 return FALSE;
89 } 89 }
90 samples_due += chunkdata.samplesPerSec; 90 samples_due += chunkdata.samplesPerSec;
91 printf("samples due %d\r", samples_due);
92 fflush(stdout);
91 while ( count && (samples_due > chunkdata.samplesPerSec) ) { 93 while ( count && (samples_due > chunkdata.samplesPerSec) ) {
92 *output++ = l; 94 *output++ = l;
93 if ( stereo ) 95 if ( stereo )
94 *output++ = r; 96 *output++ = r;
95 samples_due -= chunkdata.samplesPerSec; 97 samples_due -= chunkdata.samplesPerSec;
96 count--; 98 count--;
@@ -325,16 +327,16 @@ bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& sampl
325bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { 327bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) {
326// qDebug( "WavPlugin::audioReadSamples" ); 328// qDebug( "WavPlugin::audioReadSamples" );
327 return d->add( output, samples, samplesMade, channels != 1 ); 329 return d->add( output, samples, samplesMade, channels != 1 );
328} 330}
329 331
330double WavPlugin::getTime() { 332double WavPlugin::getTime() {
331// qDebug( "WavPlugin::getTime" ); 333// qDebug( "WavPlugin::getTime" ); //this is a stupid hack here!!
332 return 0.0; 334 return d->chunkdata.wBitsPerSample; /*0.0*/;
333} 335}
334 336
335int WavPlugin::audioBitsPerSample( int ) { 337// int WavPlugin::audioBitsPerSample( int ) {
336// qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample ); 338// // qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample );
337 return d->chunkdata.wBitsPerSample; // 339// return d->chunkdata.wBitsPerSample; //
338} 340// }
339 341
340 342
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.h b/core/multimedia/opieplayer/wavplugin/wavplugin.h
index 6ae6e06..1c8ba14 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.h
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.h
@@ -21,13 +21,14 @@
21 21
22#ifndef WAV_PLUGIN_H 22#ifndef WAV_PLUGIN_H
23#define WAV_PLUGIN_H 23#define WAV_PLUGIN_H
24 24
25#include <qstring.h> 25#include <qstring.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include "../mediaplayerplugininterface.h" 27/* #include "../mediaplayerplugininterface.h" */
28#include <qpe/mediaplayerplugininterface.h>
28 29
29 30
30// #define OLD_MEDIAPLAYER_API 31// #define OLD_MEDIAPLAYER_API
31 32
32 33
33class WavPluginData; 34class WavPluginData;
@@ -50,13 +51,13 @@ public:
50 const QString &fileInfo() { return strInfo = ""; } 51 const QString &fileInfo() { return strInfo = ""; }
51 52
52 // If decoder doesn't support audio then return 0 here 53 // If decoder doesn't support audio then return 0 here
53 int audioStreams(); 54 int audioStreams();
54 int audioChannels( int stream ); 55 int audioChannels( int stream );
55 int audioFrequency( int stream ); 56 int audioFrequency( int stream );
56 int audioBitsPerSample( int stream ); 57/* int audioBitsPerSample( int stream ); */
57 int audioSamples( int stream ); 58 int audioSamples( int stream );
58 bool audioSetSample( long sample, int stream ); 59 bool audioSetSample( long sample, int stream );
59 long audioGetSample( int stream ); 60 long audioGetSample( int stream );
60#ifdef OLD_MEDIAPLAYER_API 61#ifdef OLD_MEDIAPLAYER_API
61 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); 62 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
62 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); 63 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
index 2923180..c232d7b 100644
--- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
@@ -26,20 +26,20 @@ WavPluginImpl::WavPluginImpl()
26} 26}
27 27
28 28
29WavPluginImpl::~WavPluginImpl() 29WavPluginImpl::~WavPluginImpl()
30{ 30{
31 if ( libmadplugin ) 31 if ( libmadplugin )
32 delete libmadplugin; 32 delete libmadplugin;
33} 33}
34 34
35 35
36MediaPlayerDecoder *WavPluginImpl::decoder() 36MediaPlayerDecoder *WavPluginImpl::decoder()
37{ 37{
38 if ( !libmadplugin ) 38 if ( !libmadplugin )
39 libmadplugin = new WavPlugin; 39 libmadplugin = new WavPlugin;
40 return libmadplugin; 40 return libmadplugin;
41} 41}
42 42
43 43
44MediaPlayerEncoder *WavPluginImpl::encoder() 44MediaPlayerEncoder *WavPluginImpl::encoder()
45{ 45{
@@ -50,14 +50,14 @@ MediaPlayerEncoder *WavPluginImpl::encoder()
50#ifndef QT_NO_COMPONENT 50#ifndef QT_NO_COMPONENT
51 51
52 52
53QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 53QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
54{ 54{
55 *iface = 0; 55 *iface = 0;
56 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 56 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
57 *iface = this, (*iface)->addRef(); 57 *iface = this, (*iface)->addRef();
58 return QS_OK; 58 return QS_OK;
59} 59}
60 60
61 61
62Q_EXPORT_INTERFACE() 62Q_EXPORT_INTERFACE()
63{ 63{
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
index 10f9305..fb1fa73 100644
--- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
+++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
@@ -17,13 +17,14 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef WAV_PLUGIN_IMPL_H 20#ifndef WAV_PLUGIN_IMPL_H
21#define WAV_PLUGIN_IMPL_H 21#define WAV_PLUGIN_IMPL_H
22 22
23#include "../mediaplayerplugininterface.h" 23
24/* #include "../mediaplayerplugininterface.h" */
24 25
25 26
26class WavPlugin; 27class WavPlugin;
27 28
28 29
29class WavPluginImpl : public MediaPlayerPluginInterface 30class WavPluginImpl : public MediaPlayerPluginInterface