author | llornkcor <llornkcor> | 2002-02-24 21:51:51 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-24 21:51:51 (UTC) |
commit | 36b768c465c6ecddceb57ff1d7a5087e9848c897 (patch) (unidiff) | |
tree | 4ddde589e2393ca136e24cda4fc456612149ae72 | |
parent | ade25ac278169f0e0c9ee0771e754adb46cf7ce2 (diff) | |
download | opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.zip opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.tar.gz opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.tar.bz2 |
changed mediaplayerplugininterface.h location
29 files changed, 508 insertions, 172 deletions
diff --git a/core/multimedia/opieplayer/Makefile.in b/core/multimedia/opieplayer/Makefile.in index 1b0307a..8d33fb4 100644 --- a/core/multimedia/opieplayer/Makefile.in +++ b/core/multimedia/opieplayer/Makefile.in | |||
@@ -136,6 +136,8 @@ REQUIRES= | |||
136 | 136 | ||
137 | main.o: main.cpp \ | 137 | main.o: main.cpp \ |
138 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 138 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
139 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
140 | $(OPIEDIR)/include/timestring.h \ | ||
139 | mediaplayerstate.h \ | 141 | mediaplayerstate.h \ |
140 | playlistwidget.h \ | 142 | playlistwidget.h \ |
141 | $(OPIEDIR)/include/qpe/applnk.h \ | 143 | $(OPIEDIR)/include/qpe/applnk.h \ |
@@ -146,11 +148,12 @@ main.o: main.cpp \ | |||
146 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 148 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
147 | $(OPIEDIR)/include/qpe/qcom.h \ | 149 | $(OPIEDIR)/include/qpe/qcom.h \ |
148 | $(OPIEDIR)/include/qpe/quuid.h \ | 150 | $(OPIEDIR)/include/qpe/quuid.h \ |
149 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h | 151 | mediaplayerplugininterface.h |
150 | 152 | ||
151 | loopcontrol.o: loopcontrol.cpp \ | 153 | loopcontrol.o: loopcontrol.cpp \ |
152 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 154 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
153 | $(OPIEDIR)/include/qpe/qcopenvelope_qws.h \ | 155 | $(OPIEDIR)/include/qpedecoration_qws.h \ |
156 | $(OPIEDIR)/include/timestring.h \ | ||
154 | loopcontrol.h \ | 157 | loopcontrol.h \ |
155 | videowidget.h \ | 158 | videowidget.h \ |
156 | audiodevice.h \ | 159 | audiodevice.h \ |
@@ -166,11 +169,13 @@ playlistselection.o: playlistselection.cpp \ | |||
166 | 169 | ||
167 | mediaplayerstate.o: mediaplayerstate.cpp \ | 170 | mediaplayerstate.o: mediaplayerstate.cpp \ |
168 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 171 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
172 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
173 | $(OPIEDIR)/include/timestring.h \ | ||
169 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 174 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
170 | $(OPIEDIR)/include/qpe/qcom.h \ | 175 | $(OPIEDIR)/include/qpe/qcom.h \ |
171 | $(OPIEDIR)/include/qpe/quuid.h \ | 176 | $(OPIEDIR)/include/qpe/quuid.h \ |
172 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h \ | ||
173 | $(OPIEDIR)/include/qpe/config.h \ | 177 | $(OPIEDIR)/include/qpe/config.h \ |
178 | mediaplayerplugininterface.h \ | ||
174 | mediaplayerstate.h \ | 179 | mediaplayerstate.h \ |
175 | libmad/libmadpluginimpl.h \ | 180 | libmad/libmadpluginimpl.h \ |
176 | libmpeg3/libmpeg3pluginimpl.h \ | 181 | libmpeg3/libmpeg3pluginimpl.h \ |
@@ -178,7 +183,7 @@ mediaplayerstate.o: mediaplayerstate.cpp \ | |||
178 | 183 | ||
179 | videowidget.o: videowidget.cpp \ | 184 | videowidget.o: videowidget.cpp \ |
180 | $(OPIEDIR)/include/qpe/resource.h \ | 185 | $(OPIEDIR)/include/qpe/resource.h \ |
181 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h \ | 186 | mediaplayerplugininterface.h \ |
182 | $(OPIEDIR)/include/qpe/qcom.h \ | 187 | $(OPIEDIR)/include/qpe/qcom.h \ |
183 | $(OPIEDIR)/include/qpe/quuid.h \ | 188 | $(OPIEDIR)/include/qpe/quuid.h \ |
184 | videowidget.h \ | 189 | videowidget.h \ |
@@ -193,6 +198,11 @@ playlistwidget.o: playlistwidget.cpp \ | |||
193 | $(OPIEDIR)/include/qpe/qpemenubar.h \ | 198 | $(OPIEDIR)/include/qpe/qpemenubar.h \ |
194 | $(OPIEDIR)/include/qpe/qpetoolbar.h \ | 199 | $(OPIEDIR)/include/qpe/qpetoolbar.h \ |
195 | $(OPIEDIR)/include/qpe/fileselector.h \ | 200 | $(OPIEDIR)/include/qpe/fileselector.h \ |
201 | $(OPIEDIR)/include/filemanager.h \ | ||
202 | $(OPIEDIR)/include/applnk.h \ | ||
203 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | ||
204 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
205 | $(OPIEDIR)/include/timestring.h \ | ||
196 | $(OPIEDIR)/include/qpe/applnk.h \ | 206 | $(OPIEDIR)/include/qpe/applnk.h \ |
197 | $(OPIEDIR)/include/qpe/config.h \ | 207 | $(OPIEDIR)/include/qpe/config.h \ |
198 | $(OPIEDIR)/include/qpe/global.h \ | 208 | $(OPIEDIR)/include/qpe/global.h \ |
@@ -203,13 +213,15 @@ playlistwidget.o: playlistwidget.cpp \ | |||
203 | 213 | ||
204 | mediaplayer.o: mediaplayer.cpp \ | 214 | mediaplayer.o: mediaplayer.cpp \ |
205 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 215 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
216 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
217 | $(OPIEDIR)/include/timestring.h \ | ||
206 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 218 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
207 | $(OPIEDIR)/include/qpe/qcom.h \ | 219 | $(OPIEDIR)/include/qpe/qcom.h \ |
208 | $(OPIEDIR)/include/qpe/quuid.h \ | 220 | $(OPIEDIR)/include/qpe/quuid.h \ |
209 | $(OPIEDIR)/include/qpe/resource.h \ | 221 | $(OPIEDIR)/include/qpe/resource.h \ |
210 | $(OPIEDIR)/include/qpe/config.h \ | 222 | $(OPIEDIR)/include/qpe/config.h \ |
211 | mediaplayer.h \ | 223 | mediaplayer.h \ |
212 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h \ | 224 | mediaplayerplugininterface.h \ |
213 | playlistwidget.h \ | 225 | playlistwidget.h \ |
214 | $(OPIEDIR)/include/qpe/applnk.h \ | 226 | $(OPIEDIR)/include/qpe/applnk.h \ |
215 | audiowidget.h \ | 227 | audiowidget.h \ |
@@ -219,9 +231,10 @@ mediaplayer.o: mediaplayer.cpp \ | |||
219 | 231 | ||
220 | audiodevice.o: audiodevice.cpp \ | 232 | audiodevice.o: audiodevice.cpp \ |
221 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 233 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
234 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
235 | $(OPIEDIR)/include/timestring.h \ | ||
222 | $(OPIEDIR)/include/qpe/config.h \ | 236 | $(OPIEDIR)/include/qpe/config.h \ |
223 | audiodevice.h \ | 237 | audiodevice.h |
224 | $(OPIEDIR)/include/qpe/qcopenvelope_qws.h | ||
225 | 238 | ||
226 | moc_loopcontrol.o: moc_loopcontrol.cpp \ | 239 | moc_loopcontrol.o: moc_loopcontrol.cpp \ |
227 | loopcontrol.h | 240 | loopcontrol.h |
@@ -248,7 +261,7 @@ moc_mediaplayer.o: moc_mediaplayer.cpp \ | |||
248 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 261 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
249 | $(OPIEDIR)/include/qpe/qcom.h \ | 262 | $(OPIEDIR)/include/qpe/qcom.h \ |
250 | $(OPIEDIR)/include/qpe/quuid.h \ | 263 | $(OPIEDIR)/include/qpe/quuid.h \ |
251 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h | 264 | mediaplayerplugininterface.h |
252 | 265 | ||
253 | moc_audiodevice.o: moc_audiodevice.cpp \ | 266 | moc_audiodevice.o: moc_audiodevice.cpp \ |
254 | audiodevice.h | 267 | audiodevice.h |
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 8861015..59136af 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp | |||
@@ -17,7 +17,11 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added better error code Fri 02-15-2002 14:37:47 | ||
21 | |||
22 | |||
20 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <stdio.h> | ||
21 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
23 | #include "audiodevice.h" | 27 | #include "audiodevice.h" |
@@ -112,10 +116,11 @@ void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume | |||
112 | #else | 116 | #else |
113 | int mixerHandle = open( "/dev/mixer", O_RDWR ); | 117 | int mixerHandle = open( "/dev/mixer", O_RDWR ); |
114 | if ( mixerHandle >= 0 ) { | 118 | if ( mixerHandle >= 0 ) { |
115 | ioctl( mixerHandle, MIXER_READ(0), &volume ); | 119 | if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1) |
120 | perror("ioctl(\"MIXER_READ\")"); | ||
116 | close( mixerHandle ); | 121 | close( mixerHandle ); |
117 | } else | 122 | } else |
118 | qDebug( "get volume of audio device failed" ); | 123 | perror("open(\"/dev/mixer\")"); |
119 | leftVolume = ((volume & 0x00FF) << 16) / 101; | 124 | leftVolume = ((volume & 0x00FF) << 16) / 101; |
120 | rightVolume = ((volume & 0xFF00) << 8) / 101; | 125 | rightVolume = ((volume & 0xFF00) << 8) / 101; |
121 | #endif | 126 | #endif |
@@ -157,10 +162,12 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
157 | unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); | 162 | unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); |
158 | int mixerHandle = 0; | 163 | int mixerHandle = 0; |
159 | if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 164 | if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
160 | ioctl( mixerHandle, MIXER_WRITE(0), &volume ); | 165 | if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) |
166 | perror("ioctl(\"MIXER_WRITE\")"); | ||
161 | close( mixerHandle ); | 167 | close( mixerHandle ); |
162 | } else | 168 | } else |
163 | qDebug( "set volume of audio device failed" ); | 169 | perror("open(\"/dev/mixer\")"); |
170 | |||
164 | # else | 171 | # else |
165 | // This is the way this has to be done now I guess, doesn't allow for | 172 | // This is the way this has to be done now I guess, doesn't allow for |
166 | // independant right and left channel setting, or setting for different outputs | 173 | // independant right and left channel setting, or setting for different outputs |
@@ -185,52 +192,24 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
185 | d->frequency = f; | 192 | d->frequency = f; |
186 | d->channels = chs; | 193 | d->channels = chs; |
187 | d->bytesPerSample = bps; | 194 | d->bytesPerSample = bps; |
195 | qDebug("%d",bps); | ||
196 | int format=0; | ||
197 | if( bps == 8) format = AFMT_U8; | ||
198 | else if( bps <= 0) format = AFMT_S16_LE; | ||
199 | else format = AFMT_S16_LE; | ||
188 | 200 | ||
201 | qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); | ||
189 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 202 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
190 | 203 | ||
191 | #ifdef Q_OS_WIN32 | ||
192 | UINT result; | ||
193 | WAVEFORMATEX formatData; | ||
194 | formatData.cbSize = sizeof(WAVEFORMATEX); | ||
195 | /* | ||
196 | // Other possible formats windows supports | ||
197 | formatData.wFormatTag = WAVE_FORMAT_MPEG; | ||
198 | formatData.wFormatTag = WAVE_FORMAT_MPEGLAYER3; | ||
199 | formatData.wFormatTag = WAVE_FORMAT_ADPCM; | ||
200 | */ | ||
201 | formatData.wFormatTag = WAVE_FORMAT_PCM; | ||
202 | formatData.nAvgBytesPerSec = bps * chs * f; | ||
203 | formatData.nBlockAlign = bps * chs; | ||
204 | formatData.nChannels = chs; | ||
205 | formatData.nSamplesPerSec = f; | ||
206 | formatData.wBitsPerSample = bps * 8; | ||
207 | // Open a waveform device for output | ||
208 | if (result = waveOutOpen((LPHWAVEOUT)&d->handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL)) { | ||
209 | QString errorMsg = "error opening audio device.\nReason: %i - "; | ||
210 | switch (result) { | ||
211 | case MMSYSERR_ALLOCATED:errorMsg += "Specified resource is already allocated."; break; | ||
212 | case MMSYSERR_BADDEVICEID:errorMsg += "Specified device identifier is out of range."; break; | ||
213 | case MMSYSERR_NODRIVER:errorMsg += "No device driver is present."; break; | ||
214 | case MMSYSERR_NOMEM:errorMsg += "Unable to allocate or lock memory."; break; | ||
215 | case WAVERR_BADFORMAT:errorMsg += "Attempted to open with an unsupported waveform-audio format."; break; | ||
216 | case WAVERR_SYNC: errorMsg += "The device is synchronous but waveOutOpen was called without using the WAVE_ALLOWSYNC flag."; break; | ||
217 | default: errorMsg += "Undefined error"; break; | ||
218 | } | ||
219 | qDebug( errorMsg, result ); | ||
220 | } | ||
221 | |||
222 | d->bufferSize = sound_fragment_bytes; | ||
223 | #else | ||
224 | 204 | ||
225 | int fragments = 0x10000 * 8 + sound_fragment_shift; | 205 | int fragments = 0x10000 * 8 + sound_fragment_shift; |
226 | int format = AFMT_S16_LE; | ||
227 | int capabilities = 0; | 206 | int capabilities = 0; |
228 | 207 | ||
229 | #ifdef KEEP_DEVICE_OPEN | 208 | #ifdef KEEP_DEVICE_OPEN |
230 | if ( AudioDevicePrivate::dspFd == 0 ) { | 209 | if ( AudioDevicePrivate::dspFd == 0 ) { |
231 | #endif | 210 | #endif |
232 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { | 211 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { |
233 | qDebug( "error opening audio device /dev/dsp, sending data to /dev/null instead" ); | 212 | perror("open(\"/dev/dsp\") sending to /dev/null instead"); |
234 | d->handle = ::open( "/dev/null", O_WRONLY ); | 213 | d->handle = ::open( "/dev/null", O_WRONLY ); |
235 | } | 214 | } |
236 | #ifdef KEEP_DEVICE_OPEN | 215 | #ifdef KEEP_DEVICE_OPEN |
@@ -240,13 +219,20 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
240 | } | 219 | } |
241 | #endif | 220 | #endif |
242 | 221 | ||
243 | ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities ); | 222 | if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1) |
244 | ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments ); | 223 | perror("ioctl(\"SNDCTL_DSP_GETCAPS\")"); |
245 | ioctl( d->handle, SNDCTL_DSP_SETFMT, &format ); | 224 | if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1) |
246 | ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency ); | 225 | perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); |
226 | if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1) | ||
227 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); | ||
228 | qDebug("freq %d", d->frequency); | ||
229 | if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) | ||
230 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); | ||
231 | qDebug("channels %d",d->channels); | ||
247 | if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { | 232 | if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { |
248 | d->channels = ( d->channels == 1 ) ? 2 : d->channels; | 233 | d->channels = ( d->channels == 1 ) ? 2 : d->channels; |
249 | ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ); | 234 | if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) |
235 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); | ||
250 | } | 236 | } |
251 | 237 | ||
252 | d->bufferSize = sound_fragment_bytes; | 238 | d->bufferSize = sound_fragment_bytes; |
@@ -260,7 +246,6 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
260 | //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); | 246 | //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); |
261 | //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); | 247 | //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); |
262 | //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); | 248 | //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); |
263 | #endif | ||
264 | } | 249 | } |
265 | 250 | ||
266 | 251 | ||
diff --git a/core/multimedia/opieplayer/audiodevice.h b/core/multimedia/opieplayer/audiodevice.h index 928f134..dcd79fe 100644 --- a/core/multimedia/opieplayer/audiodevice.h +++ b/core/multimedia/opieplayer/audiodevice.h | |||
@@ -17,11 +17,15 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
22 | |||
20 | #ifndef AUDIODEVICE_H | 23 | #ifndef AUDIODEVICE_H |
21 | #define AUDIODEVICE_H | 24 | #define AUDIODEVICE_H |
22 | 25 | ||
23 | 26 | ||
24 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <sys/soundcard.h> | ||
25 | 29 | ||
26 | 30 | ||
27 | class AudioDevicePrivate; | 31 | class AudioDevicePrivate; |
@@ -30,7 +34,7 @@ class AudioDevicePrivate; | |||
30 | class AudioDevice : public QObject { | 34 | class AudioDevice : public QObject { |
31 | Q_OBJECT | 35 | Q_OBJECT |
32 | public: | 36 | public: |
33 | AudioDevice( unsigned int freq = 44000, unsigned int channels = 2, unsigned int bytesPerSample = 2 ); | 37 | AudioDevice( unsigned int freq = 44000, unsigned int channels = 2, unsigned int bytesPerSample = AFMT_S16_LE ); |
34 | ~AudioDevice(); | 38 | ~AudioDevice(); |
35 | 39 | ||
36 | unsigned int canWrite() const; | 40 | unsigned int canWrite() const; |
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 243c58c..0d88591 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -61,7 +61,7 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | |||
61 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 61 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
62 | QWidget( parent, name, f ) | 62 | QWidget( parent, name, f ) |
63 | { | 63 | { |
64 | setCaption( tr("MediaPlayer") ); | 64 | setCaption( tr("OpiePlayer") ); |
65 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 65 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
66 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); | 66 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); |
67 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) ); | 67 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) ); |
diff --git a/core/multimedia/opieplayer/libflash/libflashplugin.h b/core/multimedia/opieplayer/libflash/libflashplugin.h index 532bca2..a2f1c42 100644 --- a/core/multimedia/opieplayer/libflash/libflashplugin.h +++ b/core/multimedia/opieplayer/libflash/libflashplugin.h | |||
@@ -24,7 +24,8 @@ | |||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | #include "flash.h" | 26 | #include "flash.h" |
27 | #include "mediaplayerplugininterface.h" | 27 | //#include <qpe/mediaplayerplugininterface.h> |
28 | #include "../mediaplayerplugininterface.h" | ||
28 | 29 | ||
29 | 30 | ||
30 | class LibFlashPlugin : public MediaPlayerDecoder { | 31 | class LibFlashPlugin : public MediaPlayerDecoder { |
@@ -48,6 +49,7 @@ public: | |||
48 | int audioChannels( int /*stream*/ ) { return 2; } | 49 | int audioChannels( int /*stream*/ ) { return 2; } |
49 | int audioFrequency( int /*stream*/ ) { return 44100; } | 50 | int audioFrequency( int /*stream*/ ) { return 44100; } |
50 | int audioSamples( int /*stream*/ ) { return 1000000; } | 51 | int audioSamples( int /*stream*/ ) { return 1000000; } |
52 | int audioBitsPerSample(int) { return 0;} | ||
51 | bool audioSetSample( long sample, int stream ); | 53 | bool audioSetSample( long sample, int stream ); |
52 | long audioGetSample( int stream ); | 54 | long audioGetSample( int stream ); |
53 | //bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 55 | //bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
diff --git a/core/multimedia/opieplayer/libflash/libflashpluginimpl.h b/core/multimedia/opieplayer/libflash/libflashpluginimpl.h index b5cc869..cb8d959 100644 --- a/core/multimedia/opieplayer/libflash/libflashpluginimpl.h +++ b/core/multimedia/opieplayer/libflash/libflashpluginimpl.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define LIBFLASH_PLUGIN_IMPL_H | 21 | #define LIBFLASH_PLUGIN_IMPL_H |
22 | 22 | ||
23 | 23 | ||
24 | //#include <qpe/mediaplayerplugininterface.h> | ||
24 | #include "../mediaplayerplugininterface.h" | 25 | #include "../mediaplayerplugininterface.h" |
25 | 26 | ||
26 | 27 | ||
diff --git a/core/multimedia/opieplayer/libflash/swf.h b/core/multimedia/opieplayer/libflash/swf.h index 5f5e4f7..48986cc 100644 --- a/core/multimedia/opieplayer/libflash/swf.h +++ b/core/multimedia/opieplayer/libflash/swf.h | |||
@@ -208,7 +208,7 @@ extern "C" { | |||
208 | }; | 208 | }; |
209 | extern "C" { | 209 | extern "C" { |
210 | //#include "zlib.h" | 210 | //#include "zlib.h" |
211 | #include "../src/3rdparty/zlib/zlib.h" | 211 | #include "/opt/qt-2.3.2-embedded/src/3rdparty/zlib/zlib.h" |
212 | }; | 212 | }; |
213 | 213 | ||
214 | #include "graphic.h" | 214 | #include "graphic.h" |
diff --git a/core/multimedia/opieplayer/libmad/Makefile.in b/core/multimedia/opieplayer/libmad/Makefile.in index e9f74e7..552043c 100644 --- a/core/multimedia/opieplayer/libmad/Makefile.in +++ b/core/multimedia/opieplayer/libmad/Makefile.in | |||
@@ -214,10 +214,12 @@ huffman.o: huffman.c \ | |||
214 | 214 | ||
215 | libmadplugin.o: libmadplugin.cpp \ | 215 | libmadplugin.o: libmadplugin.cpp \ |
216 | libmadplugin.h \ | 216 | libmadplugin.h \ |
217 | ../mediaplayerplugininterface.h \ | ||
217 | mad.h | 218 | mad.h |
218 | 219 | ||
219 | libmadpluginimpl.o: libmadpluginimpl.cpp \ | 220 | libmadpluginimpl.o: libmadpluginimpl.cpp \ |
220 | libmadplugin.h \ | 221 | libmadplugin.h \ |
222 | ../mediaplayerplugininterface.h \ | ||
221 | libmadpluginimpl.h | 223 | libmadpluginimpl.h |
222 | 224 | ||
223 | 225 | ||
diff --git a/core/multimedia/opieplayer/libmad/libmad.pro b/core/multimedia/opieplayer/libmad/libmad.pro index 6c40a15..b54ca6b 100644 --- a/core/multimedia/opieplayer/libmad/libmad.pro +++ b/core/multimedia/opieplayer/libmad/libmad.pro | |||
@@ -8,5 +8,7 @@ TARGET = madplugin | |||
8 | DESTDIR = ../../plugins/codecs | 8 | DESTDIR = ../../plugins/codecs |
9 | INCLUDEPATH += $(OPIEDIR)/include .. | 9 | INCLUDEPATH += $(OPIEDIR)/include .. |
10 | DEPENDPATH += ../$(OPIEDIR)/include .. | 10 | DEPENDPATH += ../$(OPIEDIR)/include .. |
11 | TMAKE_CFLAGS += -DFPM_64BIT | ||
12 | TMAKE_CXXFLAGS += -DFPM_64BIT | ||
11 | LIBS += -lqpe -lm | 13 | LIBS += -lqpe -lm |
12 | VERSION = 1.0.0 | 14 | VERSION = 1.0.0 |
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h index 88647ae..ff84c27 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.h +++ b/core/multimedia/opieplayer/libmad/libmadplugin.h | |||
@@ -22,7 +22,11 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include "mediaplayerplugininterface.h" | 25 | //#include <qpe/mediaplayerplugininterface.h> |
26 | #include "../mediaplayerplugininterface.h" | ||
27 | |||
28 | |||
29 | // #define OLD_MEDIAPLAYER_API | ||
26 | 30 | ||
27 | 31 | ||
28 | class LibMadPluginData; | 32 | class LibMadPluginData; |
@@ -50,12 +54,16 @@ public: | |||
50 | int audioFrequency( int stream ); | 54 | int audioFrequency( int stream ); |
51 | int audioSamples( int stream ); | 55 | int audioSamples( int stream ); |
52 | bool audioSetSample( long sample, int stream ); | 56 | bool audioSetSample( long sample, int stream ); |
57 | int audioBitsPerSample(int) {return 0;} | ||
53 | long audioGetSample( int stream ); | 58 | long audioGetSample( int stream ); |
54 | // bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 59 | #ifdef OLD_MEDIAPLAYER_API |
55 | // bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | 60 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
61 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | ||
62 | bool audioReadSamples( short *output, int channel, long samples, int stream ); | ||
63 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
64 | #else | ||
56 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); | 65 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); |
57 | // bool audioReadSamples( short *output, int channel, long samples, int stream ); | 66 | #endif |
58 | // bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
59 | 67 | ||
60 | 68 | ||
61 | bool read(); | 69 | bool read(); |
@@ -91,6 +99,8 @@ public: | |||
91 | bool supportsStereo() { return TRUE; } | 99 | bool supportsStereo() { return TRUE; } |
92 | bool supportsScaling() { return FALSE; } | 100 | bool supportsScaling() { return FALSE; } |
93 | 101 | ||
102 | long getPlayTime() { return -1; } | ||
103 | |||
94 | private: | 104 | private: |
95 | LibMadPluginData *d; | 105 | LibMadPluginData *d; |
96 | QString info; | 106 | QString info; |
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h index a26b421..8ad4956 100644 --- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h +++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define LIBMAD_PLUGIN_IMPL_H | 21 | #define LIBMAD_PLUGIN_IMPL_H |
22 | 22 | ||
23 | 23 | ||
24 | //#include <qpe/mediaplayerplugininterface.h> | ||
24 | #include "../mediaplayerplugininterface.h" | 25 | #include "../mediaplayerplugininterface.h" |
25 | 26 | ||
26 | 27 | ||
@@ -42,7 +43,6 @@ public: | |||
42 | 43 | ||
43 | virtual MediaPlayerDecoder *decoder(); | 44 | virtual MediaPlayerDecoder *decoder(); |
44 | virtual MediaPlayerEncoder *encoder(); | 45 | virtual MediaPlayerEncoder *encoder(); |
45 | |||
46 | private: | 46 | private: |
47 | LibMadPlugin *libmadplugin; | 47 | LibMadPlugin *libmadplugin; |
48 | ulong ref; | 48 | ulong ref; |
diff --git a/core/multimedia/opieplayer/libmad/version.c b/core/multimedia/opieplayer/libmad/version.c index 413d54b..1baba26 100644 --- a/core/multimedia/opieplayer/libmad/version.c +++ b/core/multimedia/opieplayer/libmad/version.c | |||
diff --git a/core/multimedia/opieplayer/libmpeg3/Makefile.in b/core/multimedia/opieplayer/libmpeg3/Makefile.in index 154f85d..d255e4f 100644 --- a/core/multimedia/opieplayer/libmpeg3/Makefile.in +++ b/core/multimedia/opieplayer/libmpeg3/Makefile.in | |||
@@ -176,7 +176,8 @@ libmpeg3plugin.o: libmpeg3plugin.cpp \ | |||
176 | audio/mpeg3audio.h \ | 176 | audio/mpeg3audio.h \ |
177 | mpeg3vtrack.h \ | 177 | mpeg3vtrack.h \ |
178 | video/mpeg3video.h \ | 178 | video/mpeg3video.h \ |
179 | mpeg3protos.h | 179 | mpeg3protos.h \ |
180 | ../mediaplayerplugininterface.h | ||
180 | 181 | ||
181 | libmpeg3pluginimpl.o: libmpeg3pluginimpl.cpp \ | 182 | libmpeg3pluginimpl.o: libmpeg3pluginimpl.cpp \ |
182 | libmpeg3plugin.h \ | 183 | libmpeg3plugin.h \ |
@@ -192,6 +193,7 @@ libmpeg3pluginimpl.o: libmpeg3pluginimpl.cpp \ | |||
192 | mpeg3vtrack.h \ | 193 | mpeg3vtrack.h \ |
193 | video/mpeg3video.h \ | 194 | video/mpeg3video.h \ |
194 | mpeg3protos.h \ | 195 | mpeg3protos.h \ |
196 | ../mediaplayerplugininterface.h \ | ||
195 | libmpeg3pluginimpl.h | 197 | libmpeg3pluginimpl.h |
196 | 198 | ||
197 | bitstream.o: bitstream.c \ | 199 | bitstream.o: bitstream.c \ |
@@ -414,7 +416,7 @@ audio/layer2.o: audio/layer2.c \ | |||
414 | audio/tables.h | 416 | audio/tables.h |
415 | 417 | ||
416 | audio/layer3.o: audio/layer3.c \ | 418 | audio/layer3.o: audio/layer3.c \ |
417 | audio/huffman.h \ | 419 | huffman.h \ |
418 | audio/mpeg3audio.h \ | 420 | audio/mpeg3audio.h \ |
419 | audio/ac3.h \ | 421 | audio/ac3.h \ |
420 | audio/mpeg3real.h \ | 422 | audio/mpeg3real.h \ |
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h index 0a06264..54f259b 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h | |||
@@ -25,7 +25,11 @@ | |||
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | #include "libmpeg3.h" | 26 | #include "libmpeg3.h" |
27 | #include "mpeg3protos.h" | 27 | #include "mpeg3protos.h" |
28 | #include "mediaplayerplugininterface.h" | 28 | //#include <qpe/mediaplayerplugininterface.h> |
29 | #include "../mediaplayerplugininterface.h" | ||
30 | |||
31 | |||
32 | // #define OLD_MEDIAPLAYER_API | ||
29 | 33 | ||
30 | 34 | ||
31 | class LibMpeg3Plugin : public MediaPlayerDecoder { | 35 | class LibMpeg3Plugin : public MediaPlayerDecoder { |
@@ -42,20 +46,24 @@ public: | |||
42 | bool open( const QString& fileName ) { file = mpeg3_open( (char *)fileName.latin1() ); return file != NULL; } | 46 | bool open( const QString& fileName ) { file = mpeg3_open( (char *)fileName.latin1() ); return file != NULL; } |
43 | bool close() { if ( file ) { int r = mpeg3_close( file ); file = NULL; return r == 1; } return FALSE; } | 47 | bool close() { if ( file ) { int r = mpeg3_close( file ); file = NULL; return r == 1; } return FALSE; } |
44 | bool isOpen() { return file != NULL; } | 48 | bool isOpen() { return file != NULL; } |
45 | const QString &fileInfo() { return strInfo = QString( "" ); } | 49 | const QString &fileInfo() { return strInfo = ""; } |
46 | 50 | ||
47 | // If decoder doesn't support audio then return 0 here | 51 | // If decoder doesn't support audio then return 0 here |
48 | int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; } | 52 | int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; } |
49 | int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; } | 53 | int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; } |
50 | int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } | 54 | int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } |
55 | int audioBitsPerSample(int) { return 0;} | ||
51 | int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } | 56 | int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } |
52 | bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; } | 57 | bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; } |
53 | long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; } | 58 | long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; } |
54 | // bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 59 | #ifdef OLD_MEDIAPLAYER_API |
55 | // bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | 60 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
61 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | ||
62 | bool audioReadSamples( short *output, int channel, long samples, int stream ); | ||
63 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
64 | #else | ||
56 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); | 65 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); |
57 | // bool audioReadSamples( short *output, int channel, long samples, int stream ); | 66 | #endif |
58 | // bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
59 | 67 | ||
60 | // If decoder doesn't support video then return 0 here | 68 | // If decoder doesn't support video then return 0 here |
61 | int videoStreams() { return file ? mpeg3_total_vstreams( file ) : 0; } | 69 | int videoStreams() { return file ? mpeg3_total_vstreams( file ) : 0; } |
@@ -102,6 +110,8 @@ public: | |||
102 | bool supportsStereo() { return TRUE; } | 110 | bool supportsStereo() { return TRUE; } |
103 | bool supportsScaling() { return TRUE; } | 111 | bool supportsScaling() { return TRUE; } |
104 | 112 | ||
113 | long getPlayTime() { return -1; } | ||
114 | |||
105 | private: | 115 | private: |
106 | mpeg3_t *file; | 116 | mpeg3_t *file; |
107 | QString strInfo; | 117 | QString strInfo; |
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h index 29ec6ba..89abf97 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define LIBMPEG3_PLUGIN_IMPL_H | 21 | #define LIBMPEG3_PLUGIN_IMPL_H |
22 | 22 | ||
23 | 23 | ||
24 | //#include <qpe/mediaplayerplugininterface.h> | ||
24 | #include "../mediaplayerplugininterface.h" | 25 | #include "../mediaplayerplugininterface.h" |
25 | 26 | ||
26 | 27 | ||
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 6dfd057..859a67a 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -17,7 +17,10 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
20 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | |||
21 | #ifdef Q_WS_QWS | 24 | #ifdef Q_WS_QWS |
22 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
23 | #endif | 26 | #endif |
@@ -232,13 +235,14 @@ void LoopControl::startAudio() { | |||
232 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; | 235 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; |
233 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; | 236 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; |
234 | 237 | ||
235 | if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { | 238 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 5000 ) ) { |
236 | usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | 239 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); |
237 | } else if ( sampleWaitTime <= -5000 ) { | 240 | // } |
238 | qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | 241 | // else if ( sampleWaitTime <= -5000 ) { |
239 | //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | 242 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); |
240 | currentSample = sampleWeShouldBeAt; | 243 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); |
241 | } | 244 | // currentSample = sampleWeShouldBeAt; |
245 | // } | ||
242 | 246 | ||
243 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); | 247 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); |
244 | audioSampleCounter = currentSample + samplesRead - 1; | 248 | audioSampleCounter = currentSample + samplesRead - 1; |
@@ -373,23 +377,23 @@ bool LoopControl::init( const QString& filename ) { | |||
373 | int astream = 0; | 377 | int astream = 0; |
374 | 378 | ||
375 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); | 379 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); |
376 | DecodeLoopDebug(( "channels = %d\n", channels )); | 380 | qDebug( "LC- channels = %d", channels ); |
377 | 381 | ||
378 | if ( !total_audio_samples ) | 382 | if ( !total_audio_samples ) |
379 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); | 383 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); |
380 | 384 | ||
381 | total_audio_samples += 1000; | 385 | // total_audio_samples += 1000; |
382 | 386 | ||
383 | mediaPlayerState->setLength( total_audio_samples ); | 387 | mediaPlayerState->setLength( total_audio_samples ); |
384 | 388 | ||
385 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); | 389 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); |
386 | DecodeLoopDebug(( "frequency = %d\n", freq )); | 390 | qDebug( "LC- frequency = %d", freq ); |
387 | 391 | ||
388 | audioSampleCounter = 0; | 392 | audioSampleCounter = 0; |
389 | 393 | ||
390 | static const int bytes_per_sample = 2; //16 bit | 394 | int bits_per_sample = mediaPlayerState->curDecoder()->audioBitsPerSample( astream); |
391 | 395 | ||
392 | audioDevice = new AudioDevice( freq, channels, bytes_per_sample ); | 396 | audioDevice = new AudioDevice( freq, channels, bits_per_sample); |
393 | audioBuffer = new char[ audioDevice->bufferSize() ]; | 397 | audioBuffer = new char[ audioDevice->bufferSize() ]; |
394 | channels = audioDevice->channels(); | 398 | channels = audioDevice->channels(); |
395 | 399 | ||
diff --git a/core/multimedia/opieplayer/loopcontrol.h b/core/multimedia/opieplayer/loopcontrol.h index 967ee25..fc7d316 100644 --- a/core/multimedia/opieplayer/loopcontrol.h +++ b/core/multimedia/opieplayer/loopcontrol.h | |||
@@ -17,6 +17,8 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
20 | #ifndef MPEGVIEW_H | 22 | #ifndef MPEGVIEW_H |
21 | #define MPEGVIEW_H | 23 | #define MPEGVIEW_H |
22 | 24 | ||
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp index 2ec4a48..2e49bb7 100644 --- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp +++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp | |||
@@ -26,6 +26,7 @@ | |||
26 | #ifdef Q_WS_QWS | 26 | #ifdef Q_WS_QWS |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #endif | 28 | #endif |
29 | #include "mediaplayerplugininterface.h" | ||
29 | #include <stdio.h> | 30 | #include <stdio.h> |
30 | #include <stdlib.h> | 31 | #include <stdlib.h> |
31 | #include <string.h> | 32 | #include <string.h> |
@@ -36,7 +37,6 @@ | |||
36 | #include "audiodevice.h" | 37 | #include "audiodevice.h" |
37 | #include "videowidget.h" | 38 | #include "videowidget.h" |
38 | #include "audiowidget.h" | 39 | #include "audiowidget.h" |
39 | #include "mediaplayerplugininterface.h" | ||
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | 41 | ||
42 | 42 | ||
diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp index 5246e40..9f7ef73 100644 --- a/core/multimedia/opieplayer/main.cpp +++ b/core/multimedia/opieplayer/main.cpp | |||
@@ -48,7 +48,7 @@ int main(int argc, char **argv) { | |||
48 | loopControl = &lc; | 48 | loopControl = &lc; |
49 | MediaPlayer mp( 0, "mediaPlayer" ); | 49 | MediaPlayer mp( 0, "mediaPlayer" ); |
50 | 50 | ||
51 | pl.setCaption( MediaPlayer::tr("Media Player") ); | 51 | pl.setCaption( MediaPlayer::tr("Opie Player") ); |
52 | a.showMainDocumentWidget(&pl); | 52 | a.showMainDocumentWidget(&pl); |
53 | 53 | ||
54 | return a.exec(); | 54 | return a.exec(); |
diff --git a/core/multimedia/opieplayer/mediaplayerplugininterface.h b/core/multimedia/opieplayer/mediaplayerplugininterface.h index 24d5a80..339b2e4 100644 --- a/core/multimedia/opieplayer/mediaplayerplugininterface.h +++ b/core/multimedia/opieplayer/mediaplayerplugininterface.h | |||
@@ -61,12 +61,7 @@ public: | |||
61 | virtual int audioSamples( int stream ) = 0; | 61 | virtual int audioSamples( int stream ) = 0; |
62 | virtual bool audioSetSample( long sample, int stream ) = 0; | 62 | virtual bool audioSetSample( long sample, int stream ) = 0; |
63 | virtual long audioGetSample( int stream ) = 0; | 63 | virtual long audioGetSample( int stream ) = 0; |
64 | // virtual bool audioReadMonoSamples( short *samples, long samples, long& samplesRead, int stream ) = 0; | ||
65 | // virtual bool audioReadStereoSamples( short *samples, long samples, long& samplesRead, int stream ) = 0; | ||
66 | virtual bool audioReadSamples( short *samples, int channels, long samples, long& samplesRead, int stream ) = 0; | 64 | virtual bool audioReadSamples( short *samples, int channels, long samples, long& samplesRead, int stream ) = 0; |
67 | // Libmpeg3 functions, perhaps good for reading an audio file with 5 channels or something! | ||
68 | // virtual bool audioReadSamples( short *samples, int channel, long samples, int stream ) = 0; | ||
69 | // virtual bool audioReReadSamples( short *samples, int channel, long samples, int stream ) = 0; | ||
70 | 65 | ||
71 | // If decoder doesn't support video then return 0 here | 66 | // If decoder doesn't support video then return 0 here |
72 | virtual int videoStreams() = 0; | 67 | virtual int videoStreams() = 0; |
@@ -96,6 +91,9 @@ public: | |||
96 | virtual bool supportsStereo() = 0; | 91 | virtual bool supportsStereo() = 0; |
97 | virtual bool supportsScaling() = 0; | 92 | virtual bool supportsScaling() = 0; |
98 | 93 | ||
94 | // File Properies | ||
95 | virtual long getPlayTime() { return -1; } | ||
96 | virtual int audioBitsPerSample( int stream ) = 0; | ||
99 | }; | 97 | }; |
100 | 98 | ||
101 | 99 | ||
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 9b9d133..2a6bca3 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp | |||
@@ -26,6 +26,8 @@ | |||
26 | #include "mediaplayerplugininterface.h" | 26 | #include "mediaplayerplugininterface.h" |
27 | #include "mediaplayerstate.h" | 27 | #include "mediaplayerstate.h" |
28 | 28 | ||
29 | |||
30 | |||
29 | #ifdef QT_NO_COMPONENT | 31 | #ifdef QT_NO_COMPONENT |
30 | // Plugins which are compiled in when no plugin architecture available | 32 | // Plugins which are compiled in when no plugin architecture available |
31 | #include "libmad/libmadpluginimpl.h" | 33 | #include "libmad/libmadpluginimpl.h" |
@@ -114,6 +116,10 @@ MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { | |||
114 | return libmpeg3decoder; | 116 | return libmpeg3decoder; |
115 | } | 117 | } |
116 | 118 | ||
119 | // ### hack to get true sample count | ||
120 | // MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { | ||
121 | // return libwavdecoder; | ||
122 | // } | ||
117 | 123 | ||
118 | void MediaPlayerState::loadPlugins() { | 124 | void MediaPlayerState::loadPlugins() { |
119 | 125 | ||
diff --git a/core/multimedia/opieplayer/mediaplayerstate.h b/core/multimedia/opieplayer/mediaplayerstate.h index 5d95b92..1a23742 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.h +++ b/core/multimedia/opieplayer/mediaplayerstate.h | |||
@@ -106,6 +106,7 @@ private: | |||
106 | 106 | ||
107 | MediaPlayerDecoder *decoder; | 107 | MediaPlayerDecoder *decoder; |
108 | MediaPlayerDecoder *libmpeg3decoder; | 108 | MediaPlayerDecoder *libmpeg3decoder; |
109 | // MediaPlayerDecoder *libwavdecoder; | ||
109 | 110 | ||
110 | void loadPlugins(); | 111 | void loadPlugins(); |
111 | void readConfig( Config& cfg ); | 112 | void readConfig( Config& cfg ); |
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index fbfb946..f17ab6f 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 969fc4b..4e1543e 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 21 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/fileselector.h> | 22 | #include <qpe/fileselector.h> |
23 | #include <qpe/qpeapplication.h> | ||
24 | |||
23 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
24 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
25 | #include <qpe/global.h> | 27 | #include <qpe/global.h> |
@@ -34,6 +36,10 @@ | |||
34 | #include <qmainwindow.h> | 36 | #include <qmainwindow.h> |
35 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
36 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | #include <qtabwidget.h> | ||
40 | #include <qlistview.h> | ||
41 | #include <qpoint.h> | ||
42 | #include <qtimer.h> | ||
37 | 43 | ||
38 | #include "playlistselection.h" | 44 | #include "playlistselection.h" |
39 | #include "playlistwidget.h" | 45 | #include "playlistwidget.h" |
@@ -41,18 +47,18 @@ | |||
41 | 47 | ||
42 | #include <stdlib.h> | 48 | #include <stdlib.h> |
43 | 49 | ||
50 | #define BUTTONS_ON_TOOLBAR | ||
51 | #define SIDE_BUTTONS | ||
52 | #define CAN_SAVE_LOAD_PLAYLISTS | ||
44 | 53 | ||
45 | extern MediaPlayerState *mediaPlayerState; | 54 | extern MediaPlayerState *mediaPlayerState; |
46 | 55 | ||
56 | // class myFileSelector { | ||
47 | 57 | ||
58 | // }; | ||
48 | class PlayListWidgetPrivate { | 59 | class PlayListWidgetPrivate { |
49 | public: | 60 | public: |
50 | QToolButton *tbPlay; | 61 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
51 | QToolButton *tbFull; | ||
52 | QToolButton *tbLoop; | ||
53 | QToolButton *tbScale; | ||
54 | QToolButton *tbShuffle; | ||
55 | |||
56 | QFrame *playListFrame; | 62 | QFrame *playListFrame; |
57 | FileSelector *files; | 63 | FileSelector *files; |
58 | PlayListSelection *selectedFiles; | 64 | PlayListSelection *selectedFiles; |
@@ -92,10 +98,12 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
92 | d = new PlayListWidgetPrivate; | 98 | d = new PlayListWidgetPrivate; |
93 | d->setDocumentUsed = FALSE; | 99 | d->setDocumentUsed = FALSE; |
94 | d->current = NULL; | 100 | d->current = NULL; |
101 | menuTimer = new QTimer( this ,"menu timer"), | ||
102 | connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | ||
95 | 103 | ||
96 | setBackgroundMode( PaletteButton ); | 104 | setBackgroundMode( PaletteButton ); |
97 | 105 | ||
98 | setCaption( tr("MediaPlayer") ); | 106 | setCaption( tr("OpiePlayer") ); |
99 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 107 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
100 | 108 | ||
101 | setToolBarsMovable( FALSE ); | 109 | setToolBarsMovable( FALSE ); |
@@ -110,77 +118,161 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
110 | 118 | ||
111 | QPEToolBar *bar = new QPEToolBar( this ); | 119 | QPEToolBar *bar = new QPEToolBar( this ); |
112 | bar->setLabel( tr( "Play Operations" ) ); | 120 | bar->setLabel( tr( "Play Operations" ) ); |
113 | #ifdef BUTTONS_ON_TOOLBAR | 121 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", |
114 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | 122 | this , SLOT(addSelected()) ); |
115 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 123 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", |
116 | #endif | 124 | this , SLOT(removeSelected()) ); |
117 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 125 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", |
118 | d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE ); | 126 | mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); |
119 | d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE ); | 127 | |
128 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", | ||
129 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | ||
130 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", | ||
131 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | ||
132 | |||
133 | // d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE ); | ||
134 | // d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE ); | ||
120 | 135 | ||
121 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 136 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
122 | menu->insertItem( tr( "PlayList" ), pmPlayList ); | 137 | menu->insertItem( tr( "File" ), pmPlayList ); |
123 | new MenuItem( pmPlayList, tr( "Toggle PlayList" ), mediaPlayerState, SLOT( togglePlaylist() ) ); | ||
124 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 138 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
125 | new MenuItem( pmPlayList, tr( "Add all music files" ), this, SLOT( addAllMusicToList() ) ); | 139 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
126 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 140 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
127 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 141 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
128 | #ifdef CAN_SAVE_LOAD_PLAYLISTS | ||
129 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 142 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
130 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 143 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
131 | #endif | 144 | |
145 | QPopupMenu *pmView = new QPopupMenu( this ); | ||
146 | menu->insertItem( tr( "View" ), pmView ); | ||
147 | |||
148 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | ||
149 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | ||
150 | fullScreenButton->addTo(pmView); | ||
151 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | ||
152 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | ||
153 | scaleButton->addTo(pmView); | ||
132 | 154 | ||
133 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 155 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
156 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | ||
157 | // vbox4->setMargin(4); | ||
158 | // libString = new QLabel( tr(" Media Library"), vbox4 ); | ||
159 | // libString->setBackgroundMode( QButton::PaletteButton ); | ||
160 | // libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | ||
161 | |||
162 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | ||
163 | |||
164 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | ||
165 | tabWidget->setTabShape(QTabWidget::Triangular); | ||
166 | |||
167 | |||
168 | QWidget *pTab; | ||
169 | pTab = new QWidget( tabWidget, "pTab" ); | ||
170 | playlistView = new QListView( pTab, "Videoview" ); | ||
171 | playlistView->setMinimumSize(236,260); | ||
172 | tabWidget->insertTab( pTab,"Playlist"); | ||
134 | 173 | ||
135 | // Add the playlist area | 174 | // Add the playlist area |
136 | QVBox *vbox3 = new QVBox( vbox5 ); vbox3->setBackgroundMode( PaletteButton ); | ||
137 | d->playListFrame = vbox3; | ||
138 | 175 | ||
139 | QLabel *plString = new QLabel( tr(" PlayList"), vbox3 ); | 176 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
140 | plString->setBackgroundMode( QButton::PaletteButton ); | 177 | d->playListFrame = vbox3; |
141 | plString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | 178 | d->playListFrame ->setMinimumSize(235,260); |
142 | 179 | ||
143 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 180 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
144 | d->selectedFiles = new PlayListSelection( hbox2 ); | 181 | d->selectedFiles = new PlayListSelection( hbox2 ); |
145 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 182 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
146 | 183 | ||
147 | #ifndef BUTTONS_ON_TOOLBAR | ||
148 | d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | ||
149 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 184 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
150 | #endif | ||
151 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 185 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
152 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 186 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
153 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 187 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
154 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 188 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
155 | #ifndef BUTTONS_ON_TOOLBAR | 189 | |
156 | d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 190 | QWidget *aTab; |
157 | #endif | 191 | aTab = new QWidget( tabWidget, "aTab" ); |
192 | audioView = new QListView( aTab, "Audioview" ); | ||
193 | audioView->setMinimumSize(233,260); | ||
194 | audioView->addColumn( "Title",150); | ||
195 | audioView->addColumn("Size", 45); | ||
196 | audioView->addColumn("Media",35); | ||
197 | audioView->setColumnAlignment(1, Qt::AlignRight); | ||
198 | audioView->setColumnAlignment(2, Qt::AlignRight); | ||
199 | tabWidget->insertTab(aTab,"Audio"); | ||
200 | // audioView | ||
201 | Global::findDocuments(&files, "audio/*"); | ||
202 | QListIterator<DocLnk> dit( files.children() ); | ||
203 | QString storage; | ||
204 | for ( ; dit.current(); ++dit ) { | ||
205 | QListViewItem * newItem; | ||
206 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
207 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
208 | else storage="RAM"; | ||
209 | |||
210 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | ||
211 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | ||
212 | } | ||
213 | // videowidget | ||
214 | |||
215 | QWidget *vTab; | ||
216 | vTab = new QWidget( tabWidget, "vTab" ); | ||
217 | videoView = new QListView( vTab, "Videoview" ); | ||
218 | videoView->setMinimumSize(233,260); | ||
219 | |||
220 | videoView->addColumn("Title",150); | ||
221 | videoView->addColumn("Size",45); | ||
222 | videoView->addColumn("Media",35); | ||
223 | videoView->setColumnAlignment(1, Qt::AlignRight); | ||
224 | videoView->setColumnAlignment(2, Qt::AlignRight); | ||
225 | |||
226 | tabWidget->insertTab( vTab,"Video"); | ||
227 | |||
228 | Global::findDocuments(&vFiles, "video/*"); | ||
229 | QListIterator<DocLnk> Vdit( vFiles.children() ); | ||
230 | for ( ; Vdit.current(); ++Vdit ) { | ||
231 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
232 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
233 | else storage="RAM"; | ||
234 | QListViewItem * newItem; | ||
235 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | ||
236 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | ||
237 | } | ||
238 | |||
239 | |||
240 | // d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | ||
241 | // d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | ||
158 | 242 | ||
159 | // add the library area | 243 | // add the library area |
160 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | ||
161 | 244 | ||
162 | QLabel *libString = new QLabel( tr(" Media Library"), vbox4 ); | 245 | // d->files->setBackgroundMode( PaletteButton ); |
163 | libString->setBackgroundMode( QButton::PaletteButton ); | 246 | // QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); |
164 | libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | ||
165 | 247 | ||
166 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 248 | // #ifdef SIDE_BUTTONS |
167 | d->files = new FileSelector( "video/*;audio/*", hbox6, "Find Media Files", FALSE, FALSE ); | 249 | // QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch |
168 | d->files->setBackgroundMode( PaletteButton ); | 250 | // #endif |
169 | QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); | 251 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
252 | |||
253 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
254 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
170 | 255 | ||
171 | #ifdef SIDE_BUTTONS | 256 | connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
172 | new ToolButton( vbox7, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", d->selectedFiles, SLOT(addSelected()) ); | 257 | connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
173 | new ToolButton( vbox7, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", d->selectedFiles, SLOT(removeSelected()) ); | ||
174 | QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch | ||
175 | #endif | ||
176 | 258 | ||
177 | connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 259 | connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), |
260 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | ||
261 | connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), | ||
262 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | ||
263 | |||
264 | connect( playlistView, SIGNAL( pressed( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
265 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | ||
266 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
267 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
178 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 268 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
179 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 269 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
180 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 270 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
181 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbFull, SLOT( setOn( bool ) ) ); | 271 | |
182 | connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), d->tbScale, SLOT( setOn( bool ) ) ); | 272 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); |
183 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbScale, SLOT( setEnabled( bool ) ) ); | 273 | // connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); |
274 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) ); | ||
275 | |||
184 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 276 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
185 | 277 | ||
186 | setCentralWidget( vbox5 ); | 278 | setCentralWidget( vbox5 ); |
@@ -203,13 +295,14 @@ PlayListWidget::~PlayListWidget() { | |||
203 | 295 | ||
204 | 296 | ||
205 | void PlayListWidget::initializeStates() { | 297 | void PlayListWidget::initializeStates() { |
298 | |||
206 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 299 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
207 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 300 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
208 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 301 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
209 | d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 302 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
210 | d->tbScale->setOn( mediaPlayerState->scaled() ); | 303 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
211 | d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 304 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
212 | setPlaylist( mediaPlayerState->playlist() ); | 305 | // setPlaylist( mediaPlayerState->playlist() ); |
213 | } | 306 | } |
214 | 307 | ||
215 | 308 | ||
@@ -274,6 +367,16 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { | |||
274 | } | 367 | } |
275 | 368 | ||
276 | 369 | ||
370 | void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) { | ||
371 | qDebug("add"); | ||
372 | // d->selectedFiles->addToSelection( lnk ); | ||
373 | // } | ||
374 | // else | ||
375 | // mediaPlayerState->setPlaying( TRUE ); | ||
376 | // | ||
377 | } | ||
378 | |||
379 | |||
277 | void PlayListWidget::clearList() { | 380 | void PlayListWidget::clearList() { |
278 | while ( first() ) | 381 | while ( first() ) |
279 | d->selectedFiles->removeSelected(); | 382 | d->selectedFiles->removeSelected(); |
@@ -446,3 +549,145 @@ void PlayListWidget::setView( char view ) { | |||
446 | hide(); | 549 | hide(); |
447 | } | 550 | } |
448 | 551 | ||
552 | void PlayListWidget::addSelected() { | ||
553 | // QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here"); | ||
554 | int tabPage=tabWidget->currentPageIndex(); | ||
555 | switch (tabPage) { | ||
556 | case 0: //playlist | ||
557 | break; | ||
558 | case 1: { //audio | ||
559 | addToSelection( audioView->selectedItem() ); | ||
560 | } | ||
561 | break; | ||
562 | case 2: { // video | ||
563 | addToSelection( videoView->selectedItem() ); | ||
564 | } | ||
565 | break; | ||
566 | }; | ||
567 | } | ||
568 | |||
569 | void PlayListWidget::removeSelected() { | ||
570 | d->selectedFiles->removeSelected( ); | ||
571 | } | ||
572 | |||
573 | |||
574 | void PlayListWidget::playIt( QListViewItem *it) { | ||
575 | d->setDocumentUsed = FALSE; | ||
576 | |||
577 | if(it) { | ||
578 | qDebug("playit"); | ||
579 | int tabPage=tabWidget->currentPageIndex(); | ||
580 | switch (tabPage) { | ||
581 | case 1: { | ||
582 | DocLnkSet files; | ||
583 | QListIterator<DocLnk> dit( files.children() ); | ||
584 | for ( ; dit.current(); ++dit ) { | ||
585 | if( dit.current()->name() == it->text(0)) { | ||
586 | setDocument( dit.current()->name()); | ||
587 | } | ||
588 | } | ||
589 | } | ||
590 | break; | ||
591 | case 2: { | ||
592 | DocLnkSet vFiles; | ||
593 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
594 | for ( ; dit.current(); ++dit ) { | ||
595 | qDebug(dit.current()->name()); | ||
596 | if( dit.current()->name() == it->text(0)) { | ||
597 | qDebug(it->text(0)); | ||
598 | setDocument( dit.current()->name()); | ||
599 | } | ||
600 | } | ||
601 | } | ||
602 | break; | ||
603 | }; | ||
604 | } | ||
605 | } | ||
606 | |||
607 | void PlayListWidget::addToSelection( QListViewItem *it) { | ||
608 | d->setDocumentUsed = FALSE; | ||
609 | |||
610 | if(it) { | ||
611 | qDebug("add to selection"); | ||
612 | int tabPage=tabWidget->currentPageIndex(); | ||
613 | switch (tabPage) { | ||
614 | case 1: { | ||
615 | QListIterator<DocLnk> dit( files.children() ); | ||
616 | for ( ; dit.current(); ++dit ) { | ||
617 | if( dit.current()->name() == it->text(0)) { | ||
618 | d->selectedFiles->addToSelection( **dit ); | ||
619 | } | ||
620 | } | ||
621 | } | ||
622 | break; | ||
623 | case 2: { | ||
624 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
625 | for ( ; dit.current(); ++dit ) { | ||
626 | qDebug(dit.current()->name()); | ||
627 | if( dit.current()->name() == it->text(0)) { | ||
628 | d->selectedFiles->addToSelection( **dit ); | ||
629 | } | ||
630 | } | ||
631 | } | ||
632 | break; | ||
633 | case 0: | ||
634 | break; | ||
635 | }; | ||
636 | tabWidget->setCurrentPage(0); | ||
637 | // mediaPlayerState->setPlaying( TRUE ); | ||
638 | } | ||
639 | } | ||
640 | |||
641 | void PlayListWidget::tabChanged(QWidget *widg) { | ||
642 | |||
643 | int tabPage=tabWidget->currentPageIndex(); | ||
644 | switch (tabPage) { | ||
645 | case 0: | ||
646 | { | ||
647 | d->tbRemoveFromList->setEnabled(TRUE); | ||
648 | d->tbAddToList->setEnabled(FALSE); | ||
649 | } | ||
650 | break; | ||
651 | case 1: | ||
652 | { | ||
653 | d->tbRemoveFromList->setEnabled(FALSE); | ||
654 | d->tbAddToList->setEnabled(TRUE); | ||
655 | } | ||
656 | break; | ||
657 | case 2: | ||
658 | { | ||
659 | d->tbRemoveFromList->setEnabled(FALSE); | ||
660 | d->tbAddToList->setEnabled(TRUE); | ||
661 | } | ||
662 | break; | ||
663 | }; | ||
664 | } | ||
665 | |||
666 | void PlayListWidget::cancelMenuTimer() { | ||
667 | if( menuTimer->isActive() ) | ||
668 | menuTimer->stop(); | ||
669 | } | ||
670 | |||
671 | void PlayListWidget::showFileMenu() { | ||
672 | |||
673 | } | ||
674 | |||
675 | void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) | ||
676 | { | ||
677 | // QListView::contentsMousePressEvent( e ); | ||
678 | menuTimer->start( 750, TRUE ); | ||
679 | } | ||
680 | |||
681 | |||
682 | void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) | ||
683 | { | ||
684 | // QListView::contentsMouseReleaseEvent( e ); | ||
685 | menuTimer->stop(); | ||
686 | } | ||
687 | // void PlayListWidget::setFullScreen() { | ||
688 | // mediaPlayerState->toggleFullscreen( ); | ||
689 | // } | ||
690 | |||
691 | // void PlayListWidget::setScaled() { | ||
692 | // mediaPlayerState->toggleScaled(); | ||
693 | // } | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 6976641..3a52dd5 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -23,25 +23,39 @@ | |||
23 | 23 | ||
24 | #include <qmainwindow.h> | 24 | #include <qmainwindow.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | #include <qtabwidget.h> | ||
27 | #include <qtimer.h> | ||
26 | 28 | ||
27 | 29 | ||
28 | class PlayListWidgetPrivate; | 30 | class PlayListWidgetPrivate; |
29 | class Config; | 31 | class Config; |
30 | 32 | class QListViewItem; | |
33 | class QListView; | ||
34 | class QPoint; | ||
35 | class QAction; | ||
36 | class QLabel; | ||
31 | 37 | ||
32 | class PlayListWidget : public QMainWindow { | 38 | class PlayListWidget : public QMainWindow { |
33 | Q_OBJECT | 39 | Q_OBJECT |
34 | public: | 40 | public: |
35 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 41 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
36 | ~PlayListWidget(); | 42 | ~PlayListWidget(); |
37 | 43 | QTabWidget * tabWidget; | |
44 | QAction *fullScreenButton, *scaleButton; | ||
45 | DocLnkSet files; | ||
46 | DocLnkSet vFiles; | ||
47 | QListView *audioView, *videoView, *playlistView; | ||
48 | QLabel *libString; | ||
38 | // retrieve the current playlist entry (media file link) | 49 | // retrieve the current playlist entry (media file link) |
39 | const DocLnk *current(); | 50 | const DocLnk *current(); |
40 | void useSelectedDocument(); | 51 | void useSelectedDocument(); |
52 | QTimer * menuTimer; | ||
41 | 53 | ||
42 | public slots: | 54 | public slots: |
43 | void setDocument( const QString& fileref ); | 55 | void setDocument( const QString& fileref ); |
44 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 56 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
57 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | ||
58 | void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist | ||
45 | void setActiveWindow(); // need to handle this to show the right view | 59 | void setActiveWindow(); // need to handle this to show the right view |
46 | void setPlaylist( bool ); // Show/Hide the playlist | 60 | void setPlaylist( bool ); // Show/Hide the playlist |
47 | void setView( char ); | 61 | void setView( char ); |
@@ -51,16 +65,31 @@ public slots: | |||
51 | void addAllVideoToList(); | 65 | void addAllVideoToList(); |
52 | void saveList(); // Save the playlist | 66 | void saveList(); // Save the playlist |
53 | void loadList(); // Load a playlist | 67 | void loadList(); // Load a playlist |
68 | void playIt( QListViewItem *); | ||
54 | bool first(); | 69 | bool first(); |
55 | bool last(); | 70 | bool last(); |
56 | bool next(); | 71 | bool next(); |
57 | bool prev(); | 72 | bool prev(); |
73 | void addSelected(); | ||
74 | void removeSelected(); | ||
75 | void tabChanged(QWidget*); | ||
76 | /* void setFullScreen(); */ | ||
77 | /* void setScaled(); */ | ||
78 | protected: | ||
79 | void contentsMousePressEvent( QMouseEvent * e ); | ||
80 | void contentsMouseReleaseEvent( QMouseEvent * e ); | ||
58 | 81 | ||
59 | private: | 82 | private: |
60 | void initializeStates(); | 83 | void initializeStates(); |
61 | void readConfig( Config& cfg ); | 84 | void readConfig( Config& cfg ); |
62 | void writeConfig( Config& cfg ) const; | 85 | void writeConfig( Config& cfg ) const; |
63 | PlayListWidgetPrivate *d; // Private implementation data | 86 | PlayListWidgetPrivate *d; // Private implementation data |
87 | |||
88 | protected slots: | ||
89 | void cancelMenuTimer(); | ||
90 | void showFileMenu(); | ||
91 | |||
92 | |||
64 | }; | 93 | }; |
65 | 94 | ||
66 | 95 | ||
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index f3974a0..1f128a4 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -18,13 +18,13 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include "mediaplayerplugininterface.h" | ||
21 | #include <qwidget.h> | 22 | #include <qwidget.h> |
22 | #include <qpainter.h> | 23 | #include <qpainter.h> |
23 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
24 | #include <qslider.h> | 25 | #include <qslider.h> |
25 | #include <qdrawutil.h> | 26 | #include <qdrawutil.h> |
26 | #include "videowidget.h" | 27 | #include "videowidget.h" |
27 | #include "mediaplayerplugininterface.h" | ||
28 | #include "mediaplayerstate.h" | 28 | #include "mediaplayerstate.h" |
29 | 29 | ||
30 | 30 | ||
@@ -66,7 +66,7 @@ static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | |||
66 | 66 | ||
67 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 67 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
68 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 68 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
69 | setCaption( tr("MediaPlayer") ); | 69 | setCaption( tr("OpiePlayer") ); |
70 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 70 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
71 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); | 71 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); |
72 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0b" ) ); | 72 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0b" ) ); |
diff --git a/core/multimedia/opieplayer/wavplugin/Makefile.in b/core/multimedia/opieplayer/wavplugin/Makefile.in index bcbe7f2..a46b925 100644 --- a/core/multimedia/opieplayer/wavplugin/Makefile.in +++ b/core/multimedia/opieplayer/wavplugin/Makefile.in | |||
@@ -100,10 +100,12 @@ REQUIRES= | |||
100 | ####### Compile | 100 | ####### Compile |
101 | 101 | ||
102 | wavplugin.o: wavplugin.cpp \ | 102 | wavplugin.o: wavplugin.cpp \ |
103 | wavplugin.h | 103 | wavplugin.h \ |
104 | ../mediaplayerplugininterface.h | ||
104 | 105 | ||
105 | wavpluginimpl.o: wavpluginimpl.cpp \ | 106 | wavpluginimpl.o: wavpluginimpl.cpp \ |
106 | wavplugin.h \ | 107 | wavplugin.h \ |
108 | ../mediaplayerplugininterface.h \ | ||
107 | wavpluginimpl.h | 109 | wavpluginimpl.h |
108 | 110 | ||
109 | 111 | ||
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp index a6bd974..7f63b3b 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp | |||
@@ -17,6 +17,8 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
20 | #include <stdio.h> | 22 | #include <stdio.h> |
21 | #include <stdarg.h> | 23 | #include <stdarg.h> |
22 | #include <stdlib.h> | 24 | #include <stdlib.h> |
@@ -47,7 +49,7 @@ struct ChunkData { | |||
47 | }; | 49 | }; |
48 | 50 | ||
49 | 51 | ||
50 | const int sound_buffer_size = 4096; | 52 | const int sound_buffer_size = 512; // 4096; // you got to be kidding right? |
51 | 53 | ||
52 | 54 | ||
53 | class WavPluginData { | 55 | class WavPluginData { |
@@ -73,6 +75,7 @@ public: | |||
73 | bool add( short *output, long count, long& done, bool stereo ) | 75 | bool add( short *output, long count, long& done, bool stereo ) |
74 | { | 76 | { |
75 | done = 0; | 77 | done = 0; |
78 | qApp->processEvents(); | ||
76 | 79 | ||
77 | if ( input == 0 ) { | 80 | if ( input == 0 ) { |
78 | qDebug("no input"); | 81 | qDebug("no input"); |
@@ -85,7 +88,7 @@ public: | |||
85 | qDebug("didn't get sample"); | 88 | qDebug("didn't get sample"); |
86 | return FALSE; | 89 | return FALSE; |
87 | } | 90 | } |
88 | samples_due += 44100; | 91 | samples_due += chunkdata.samplesPerSec; |
89 | while ( count && (samples_due > chunkdata.samplesPerSec) ) { | 92 | while ( count && (samples_due > chunkdata.samplesPerSec) ) { |
90 | *output++ = l; | 93 | *output++ = l; |
91 | if ( stereo ) | 94 | if ( stereo ) |
@@ -95,7 +98,6 @@ public: | |||
95 | done++; | 98 | done++; |
96 | } | 99 | } |
97 | } | 100 | } |
98 | |||
99 | return TRUE; | 101 | return TRUE; |
100 | } | 102 | } |
101 | 103 | ||
@@ -143,7 +145,7 @@ public: | |||
143 | } | 145 | } |
144 | } | 146 | } |
145 | } // while | 147 | } // while |
146 | 148 | qDebug("bits %d", chunkdata.wBitsPerSample); | |
147 | return TRUE; | 149 | return TRUE; |
148 | } | 150 | } |
149 | 151 | ||
@@ -205,7 +207,7 @@ WavPlugin::~WavPlugin() { | |||
205 | 207 | ||
206 | 208 | ||
207 | bool WavPlugin::isFileSupported( const QString& path ) { | 209 | bool WavPlugin::isFileSupported( const QString& path ) { |
208 | debugMsg( "WavPlugin::isFileSupported" ); | 210 | // qDebug( "WavPlugin::isFileSupported" ); |
209 | 211 | ||
210 | char *ext = strrchr( path.latin1(), '.' ); | 212 | char *ext = strrchr( path.latin1(), '.' ); |
211 | 213 | ||
@@ -224,7 +226,7 @@ bool WavPlugin::isFileSupported( const QString& path ) { | |||
224 | 226 | ||
225 | 227 | ||
226 | bool WavPlugin::open( const QString& path ) { | 228 | bool WavPlugin::open( const QString& path ) { |
227 | debugMsg( "WavPlugin::open" ); | 229 | // qDebug( "WavPlugin::open" ); |
228 | 230 | ||
229 | d->max = d->out = sound_buffer_size; | 231 | d->max = d->out = sound_buffer_size; |
230 | d->wavedata_remaining = 0; | 232 | d->wavedata_remaining = 0; |
@@ -245,7 +247,7 @@ bool WavPlugin::open( const QString& path ) { | |||
245 | 247 | ||
246 | 248 | ||
247 | bool WavPlugin::close() { | 249 | bool WavPlugin::close() { |
248 | debugMsg( "WavPlugin::close" ); | 250 | // qDebug( "WavPlugin::close" ); |
249 | 251 | ||
250 | d->input->close(); | 252 | d->input->close(); |
251 | delete d->input; | 253 | delete d->input; |
@@ -255,44 +257,44 @@ bool WavPlugin::close() { | |||
255 | 257 | ||
256 | 258 | ||
257 | bool WavPlugin::isOpen() { | 259 | bool WavPlugin::isOpen() { |
258 | debugMsg( "WavPlugin::isOpen" ); | 260 | // qDebug( "WavPlugin::isOpen" ); |
259 | return ( d->input != 0 ); | 261 | return ( d->input != 0 ); |
260 | } | 262 | } |
261 | 263 | ||
262 | 264 | ||
263 | int WavPlugin::audioStreams() { | 265 | int WavPlugin::audioStreams() { |
264 | debugMsg( "WavPlugin::audioStreams" ); | 266 | // qDebug( "WavPlugin::audioStreams" ); |
265 | return 1; | 267 | return 1; |
266 | } | 268 | } |
267 | 269 | ||
268 | 270 | ||
269 | int WavPlugin::audioChannels( int ) { | 271 | int WavPlugin::audioChannels( int ) { |
270 | debugMsg( "WavPlugin::audioChannels" ); | 272 | // qDebug( "WavPlugin::audioChannels" ); |
271 | return 2; // ### Always scale audio to stereo samples | 273 | return d->chunkdata.channels;// 2; // ### Always scale audio to stereo samples |
272 | } | 274 | } |
273 | 275 | ||
274 | 276 | ||
275 | int WavPlugin::audioFrequency( int ) { | 277 | int WavPlugin::audioFrequency( int ) { |
276 | debugMsg( "WavPlugin::audioFrequency" ); | 278 | // qDebug( "WavPlugin::audioFrequency %d", d->chunkdata.samplesPerSec ); |
277 | return 44100; // ### Always scale to frequency of 44100 | 279 | return d->chunkdata.samplesPerSec; //44100; // ### Always scale to frequency of 44100 |
278 | } | 280 | } |
279 | 281 | ||
280 | 282 | ||
281 | int WavPlugin::audioSamples( int ) { | 283 | int WavPlugin::audioSamples( int ) { |
282 | debugMsg( "WavPlugin::audioSamples" ); | 284 | // qDebug( "WavPlugin::audioSamples" ); |
283 | return d->samples * 2 / d->chunkdata.channels; // ### Scaled samples will be made stereo, | 285 | return d->samples / d->chunkdata.channels/2; // ### Scaled samples will be made stereo, |
284 | // Therefore if source is mono we will double the number of samples | 286 | // Therefore if source is mono we will double the number of samples |
285 | } | 287 | } |
286 | 288 | ||
287 | 289 | ||
288 | bool WavPlugin::audioSetSample( long, int ) { | 290 | bool WavPlugin::audioSetSample( long, int ) { |
289 | debugMsg( "WavPlugin::audioSetSample" ); | 291 | // qDebug( "WavPlugin::audioSetSample" ); |
290 | return FALSE; | 292 | return FALSE; |
291 | } | 293 | } |
292 | 294 | ||
293 | 295 | ||
294 | long WavPlugin::audioGetSample( int ) { | 296 | long WavPlugin::audioGetSample( int ) { |
295 | debugMsg( "WavPlugin::audioGetSample" ); | 297 | // qDebug( "WavPlugin::audioGetSample" ); |
296 | return 0; | 298 | return 0; |
297 | } | 299 | } |
298 | 300 | ||
@@ -322,13 +324,18 @@ bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& sampl | |||
322 | */ | 324 | */ |
323 | 325 | ||
324 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { | 326 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { |
325 | debugMsg( "WavPlugin::audioReadSamples" ); | 327 | // qDebug( "WavPlugin::audioReadSamples" ); |
326 | return d->add( output, samples, samplesMade, channels != 1 ); | 328 | return d->add( output, samples, samplesMade, channels != 1 ); |
327 | } | 329 | } |
328 | 330 | ||
329 | double WavPlugin::getTime() { | 331 | double WavPlugin::getTime() { |
330 | debugMsg( "WavPlugin::getTime" ); | 332 | // qDebug( "WavPlugin::getTime" ); |
331 | return 0.0; | 333 | return 0.0; |
332 | } | 334 | } |
333 | 335 | ||
336 | int WavPlugin::audioBitsPerSample( int ) { | ||
337 | // qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample ); | ||
338 | return d->chunkdata.wBitsPerSample; // | ||
339 | } | ||
340 | |||
334 | 341 | ||
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.h b/core/multimedia/opieplayer/wavplugin/wavplugin.h index 64635ca..6afd67e 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.h +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.h | |||
@@ -17,13 +17,18 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
20 | #ifndef WAV_PLUGIN_H | 22 | #ifndef WAV_PLUGIN_H |
21 | #define WAV_PLUGIN_H | 23 | #define WAV_PLUGIN_H |
22 | 24 | ||
23 | 25 | ||
24 | #include <qstring.h> | 26 | #include <qstring.h> |
25 | #include <qapplication.h> | 27 | #include <qapplication.h> |
26 | #include "mediaplayerplugininterface.h" | 28 | #include "../mediaplayerplugininterface.h" |
29 | |||
30 | |||
31 | // #define OLD_MEDIAPLAYER_API | ||
27 | 32 | ||
28 | 33 | ||
29 | class WavPluginData; | 34 | class WavPluginData; |
@@ -43,21 +48,24 @@ public: | |||
43 | bool open( const QString& ); | 48 | bool open( const QString& ); |
44 | bool close(); | 49 | bool close(); |
45 | bool isOpen(); | 50 | bool isOpen(); |
46 | //const QString &fileInfo() { return strInfo = qApp->translate( "MediaPlayer", "No Information Available", "media plugin text" ); } | 51 | const QString &fileInfo() { return strInfo = ""; } |
47 | const QString &fileInfo() { return strInfo = QString(""); } | ||
48 | 52 | ||
49 | // If decoder doesn't support audio then return 0 here | 53 | // If decoder doesn't support audio then return 0 here |
50 | int audioStreams(); | 54 | int audioStreams(); |
51 | int audioChannels( int stream ); | 55 | int audioChannels( int stream ); |
52 | int audioFrequency( int stream ); | 56 | int audioFrequency( int stream ); |
57 | int audioBitsPerSample( int stream ); | ||
53 | int audioSamples( int stream ); | 58 | int audioSamples( int stream ); |
54 | bool audioSetSample( long sample, int stream ); | 59 | bool audioSetSample( long sample, int stream ); |
55 | long audioGetSample( int stream ); | 60 | long audioGetSample( int stream ); |
56 | //bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 61 | #ifdef OLD_MEDIAPLAYER_API |
57 | //bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | 62 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
63 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | ||
64 | bool audioReadSamples( short *output, int channel, long samples, int stream ); | ||
65 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
66 | #else | ||
58 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); | 67 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); |
59 | //bool audioReadSamples( short *output, int channel, long samples, int stream ); | 68 | #endif |
60 | //bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
61 | 69 | ||
62 | // If decoder doesn't support video then return 0 here | 70 | // If decoder doesn't support video then return 0 here |
63 | int videoStreams() { return 0; } | 71 | int videoStreams() { return 0; } |
@@ -87,6 +95,8 @@ public: | |||
87 | bool supportsStereo() { return TRUE; } | 95 | bool supportsStereo() { return TRUE; } |
88 | bool supportsScaling() { return FALSE; } | 96 | bool supportsScaling() { return FALSE; } |
89 | 97 | ||
98 | long getPlayTime() { return -1; } | ||
99 | |||
90 | private: | 100 | private: |
91 | WavPluginData *d; | 101 | WavPluginData *d; |
92 | QString strInfo; | 102 | QString strInfo; |