summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2002-02-25 01:35:47 (UTC)
committer llornkcor <llornkcor>2002-02-25 01:35:47 (UTC)
commitf180c1a5e8fc889ff1fb390d5cc94cdbc5085046 (patch) (unidiff)
tree5e9ea6f1313f4c33d57fb266523c1cfbe0826756 /core
parentc0446b55fc32b7fdea9f58db06e40da703f5e8ff (diff)
downloadopie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.zip
opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.gz
opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.bz2
fucked up- no workie.. back out
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/Makefile.in30
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp156
-rw-r--r--core/multimedia/opieplayer/audiodevice.h11
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp127
-rw-r--r--core/multimedia/opieplayer/audiowidget.h5
-rw-r--r--core/multimedia/opieplayer/libflash/libflashplugin.h4
-rw-r--r--core/multimedia/opieplayer/libflash/libflashpluginimpl.h3
-rw-r--r--core/multimedia/opieplayer/libflash/swf.h2
-rw-r--r--core/multimedia/opieplayer/libmad/Makefile.in2
-rw-r--r--core/multimedia/opieplayer/libmad/libmad.pro20
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.h5
-rw-r--r--core/multimedia/opieplayer/libmad/libmadpluginimpl.h5
-rw-r--r--core/multimedia/opieplayer/libmad/version.c2
-rw-r--r--core/multimedia/opieplayer/libmpeg3/Makefile.in6
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h5
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h4
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp352
-rw-r--r--core/multimedia/opieplayer/loopcontrol.h7
-rw-r--r--core/multimedia/opieplayer/loopcontrol_threaded.cpp7
-rw-r--r--core/multimedia/opieplayer/loopcontrol_threaded.h5
-rw-r--r--core/multimedia/opieplayer/main.cpp7
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp5
-rw-r--r--core/multimedia/opieplayer/mediaplayer.h7
-rw-r--r--core/multimedia/opieplayer/mediaplayerplugininterface.h9
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp68
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.h64
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp41
-rw-r--r--core/multimedia/opieplayer/playlistselection.h5
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp563
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h38
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp363
-rw-r--r--core/multimedia/opieplayer/videowidget.h5
-rw-r--r--core/multimedia/opieplayer/wavplugin/Makefile.in4
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.cpp425
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.h6
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp1
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavpluginimpl.h3
37 files changed, 1102 insertions, 1270 deletions
diff --git a/core/multimedia/opieplayer/Makefile.in b/core/multimedia/opieplayer/Makefile.in
index 8d33fb4..1d2ff5e 100644
--- a/core/multimedia/opieplayer/Makefile.in
+++ b/core/multimedia/opieplayer/Makefile.in
@@ -138,4 +138,2 @@ 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 \
141 mediaplayerstate.h \ 139 mediaplayerstate.h \
@@ -149,4 +147,3 @@ main.o: main.cpp \
149 $(OPIEDIR)/include/qpe/qcom.h \ 147 $(OPIEDIR)/include/qpe/qcom.h \
150 $(OPIEDIR)/include/qpe/quuid.h \ 148 $(OPIEDIR)/include/qpe/quuid.h
151 mediaplayerplugininterface.h
152 149
@@ -154,4 +151,3 @@ loopcontrol.o: loopcontrol.cpp \
154 $(OPIEDIR)/include/qpe/qpeapplication.h \ 151 $(OPIEDIR)/include/qpe/qpeapplication.h \
155 $(OPIEDIR)/include/qpedecoration_qws.h \ 152 $(OPIEDIR)/include/qpe/qcopenvelope_qws.h \
156 $(OPIEDIR)/include/timestring.h \
157 loopcontrol.h \ 153 loopcontrol.h \
@@ -171,4 +167,2 @@ mediaplayerstate.o: mediaplayerstate.cpp \
171 $(OPIEDIR)/include/qpe/qpeapplication.h \ 167 $(OPIEDIR)/include/qpe/qpeapplication.h \
172 $(OPIEDIR)/include/qpedecoration_qws.h \
173 $(OPIEDIR)/include/timestring.h \
174 $(OPIEDIR)/include/qpe/qlibrary.h \ 168 $(OPIEDIR)/include/qpe/qlibrary.h \
@@ -177,3 +171,2 @@ mediaplayerstate.o: mediaplayerstate.cpp \
177 $(OPIEDIR)/include/qpe/config.h \ 171 $(OPIEDIR)/include/qpe/config.h \
178 mediaplayerplugininterface.h \
179 mediaplayerstate.h \ 172 mediaplayerstate.h \
@@ -185,5 +178,2 @@ videowidget.o: videowidget.cpp \
185 $(OPIEDIR)/include/qpe/resource.h \ 178 $(OPIEDIR)/include/qpe/resource.h \
186 mediaplayerplugininterface.h \
187 $(OPIEDIR)/include/qpe/qcom.h \
188 $(OPIEDIR)/include/qpe/quuid.h \
189 videowidget.h \ 179 videowidget.h \
@@ -200,7 +190,2 @@ playlistwidget.o: playlistwidget.cpp \
200 $(OPIEDIR)/include/qpe/fileselector.h \ 190 $(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 \
206 $(OPIEDIR)/include/qpe/applnk.h \ 191 $(OPIEDIR)/include/qpe/applnk.h \
@@ -215,4 +200,2 @@ mediaplayer.o: mediaplayer.cpp \
215 $(OPIEDIR)/include/qpe/qpeapplication.h \ 200 $(OPIEDIR)/include/qpe/qpeapplication.h \
216 $(OPIEDIR)/include/qpedecoration_qws.h \
217 $(OPIEDIR)/include/timestring.h \
218 $(OPIEDIR)/include/qpe/qlibrary.h \ 201 $(OPIEDIR)/include/qpe/qlibrary.h \
@@ -223,3 +206,2 @@ mediaplayer.o: mediaplayer.cpp \
223 mediaplayer.h \ 206 mediaplayer.h \
224 mediaplayerplugininterface.h \
225 playlistwidget.h \ 207 playlistwidget.h \
@@ -233,6 +215,5 @@ audiodevice.o: audiodevice.cpp \
233 $(OPIEDIR)/include/qpe/qpeapplication.h \ 215 $(OPIEDIR)/include/qpe/qpeapplication.h \
234 $(OPIEDIR)/include/qpedecoration_qws.h \
235 $(OPIEDIR)/include/timestring.h \
236 $(OPIEDIR)/include/qpe/config.h \ 216 $(OPIEDIR)/include/qpe/config.h \
237 audiodevice.h 217 audiodevice.h \
218 $(OPIEDIR)/include/qpe/qcopenvelope_qws.h
238 219
@@ -262,4 +243,3 @@ moc_mediaplayer.o: moc_mediaplayer.cpp \
262 $(OPIEDIR)/include/qpe/qcom.h \ 243 $(OPIEDIR)/include/qpe/qcom.h \
263 $(OPIEDIR)/include/qpe/quuid.h \ 244 $(OPIEDIR)/include/qpe/quuid.h
264 mediaplayerplugininterface.h
265 245
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 11fd9e8..7b3700a 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -19,7 +19,4 @@
19**********************************************************************/ 19**********************************************************************/
20// L.J.Potter added better error code Fri 02-15-2002 14:37:47
21
22 20
23#include <stdlib.h> 21#include <stdlib.h>
24#include <stdio.h>
25#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
@@ -111,3 +108,3 @@ void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume
111 if ( waveOutGetVolume( handle, (LPDWORD)&volume ) ) 108 if ( waveOutGetVolume( handle, (LPDWORD)&volume ) )
112// qDebug( "get volume of audio device failed" ); 109 qDebug( "get volume of audio device failed" );
113 waveOutClose( handle ); 110 waveOutClose( handle );
@@ -118,7 +115,6 @@ void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume
118 if ( mixerHandle >= 0 ) { 115 if ( mixerHandle >= 0 ) {
119 if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1) 116 ioctl( mixerHandle, MIXER_READ(0), &volume );
120 perror("ioctl(\"MIXER_READ\")");
121 close( mixerHandle ); 117 close( mixerHandle );
122 } else 118 } else
123 perror("open(\"/dev/mixer\")"); 119 qDebug( "get volume of audio device failed" );
124 leftVolume = ((volume & 0x00FF) << 16) / 101; 120 leftVolume = ((volume & 0x00FF) << 16) / 101;
@@ -132,9 +128,9 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
132 if ( muted ) { 128 if ( muted ) {
133 AudioDevicePrivate::leftVolume = leftVolume; 129 AudioDevicePrivate::leftVolume = leftVolume;
134 AudioDevicePrivate::rightVolume = rightVolume; 130 AudioDevicePrivate::rightVolume = rightVolume;
135 leftVolume = 0; 131 leftVolume = 0;
136 rightVolume = 0; 132 rightVolume = 0;
137 } else { 133 } else {
138 leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume ); 134 leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume );
139 rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume ); 135 rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume );
140 } 136 }
@@ -153,3 +149,3 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
153 if ( waveOutSetVolume( handle, volume ) ) 149 if ( waveOutSetVolume( handle, volume ) )
154// qDebug( "set volume of audio device failed" ); 150 qDebug( "set volume of audio device failed" );
155 waveOutClose( handle ); 151 waveOutClose( handle );
@@ -164,8 +160,6 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
164 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 160 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
165 if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) 161 ioctl( mixerHandle, MIXER_WRITE(0), &volume );
166 perror("ioctl(\"MIXER_WRITE\")");
167 close( mixerHandle ); 162 close( mixerHandle );
168 } else 163 } else
169 perror("open(\"/dev/mixer\")"); 164 qDebug( "set volume of audio device failed" );
170
171# else 165# else
@@ -194,13 +188,41 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
194 d->bytesPerSample = bps; 188 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;
200 189
201// qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
202 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); 190 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
203 191
192#ifdef Q_OS_WIN32
193 UINT result;
194 WAVEFORMATEX formatData;
195 formatData.cbSize = sizeof(WAVEFORMATEX);
196/*
197 // Other possible formats windows supports
198 formatData.wFormatTag = WAVE_FORMAT_MPEG;
199 formatData.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
200 formatData.wFormatTag = WAVE_FORMAT_ADPCM;
201*/
202 formatData.wFormatTag = WAVE_FORMAT_PCM;
203 formatData.nAvgBytesPerSec = bps * chs * f;
204 formatData.nBlockAlign = bps * chs;
205 formatData.nChannels = chs;
206 formatData.nSamplesPerSec = f;
207 formatData.wBitsPerSample = bps * 8;
208 // Open a waveform device for output
209 if (result = waveOutOpen((LPHWAVEOUT)&d->handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL)) {
210 QString errorMsg = "error opening audio device.\nReason: %i - ";
211 switch (result) {
212 case MMSYSERR_ALLOCATED:errorMsg += "Specified resource is already allocated."; break;
213 case MMSYSERR_BADDEVICEID:errorMsg += "Specified device identifier is out of range."; break;
214 case MMSYSERR_NODRIVER:errorMsg += "No device driver is present."; break;
215 case MMSYSERR_NOMEM:errorMsg += "Unable to allocate or lock memory."; break;
216 case WAVERR_BADFORMAT:errorMsg += "Attempted to open with an unsupported waveform-audio format."; break;
217 case WAVERR_SYNC: errorMsg += "The device is synchronous but waveOutOpen was called without using the WAVE_ALLOWSYNC flag."; break;
218 default: errorMsg += "Undefined error"; break;
219 }
220 qDebug( errorMsg, result );
221 }
222
223 d->bufferSize = sound_fragment_bytes;
224#else
204 225
205 int fragments = 0x10000 * 8 + sound_fragment_shift; 226 int fragments = 0x10000 * 8 + sound_fragment_shift;
227 int format = AFMT_S16_LE;
206 int capabilities = 0; 228 int capabilities = 0;
@@ -211,7 +233,7 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
211 if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { 233 if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) {
212 perror("open(\"/dev/dsp\") sending to /dev/null instead"); 234 qDebug( "error opening audio device /dev/dsp, sending data to /dev/null instead" );
213 d->handle = ::open( "/dev/null", O_WRONLY ); 235 d->handle = ::open( "/dev/null", O_WRONLY );
214 } 236 }
215#ifdef KEEP_DEVICE_OPEN 237#ifdef KEEP_DEVICE_OPEN
216 AudioDevicePrivate::dspFd = d->handle; 238 AudioDevicePrivate::dspFd = d->handle;
217 } else { 239 } else {
@@ -221,16 +243,9 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
221 243
222 if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1) 244 ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities );
223 perror("ioctl(\"SNDCTL_DSP_GETCAPS\")"); 245 ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments );
224 if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1) 246 ioctl( d->handle, SNDCTL_DSP_SETFMT, &format );
225 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); 247 ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency );
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);
232 if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { 248 if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) {
233 d->channels = ( d->channels == 1 ) ? 2 : d->channels; 249 d->channels = ( d->channels == 1 ) ? 2 : d->channels;
234 if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) 250 ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels );
235 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
236 } 251 }
@@ -242,4 +257,4 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
242 257
243 //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); 258 //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels );
244 //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); 259 //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency );
245 //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); 260 //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" );
@@ -248,2 +263,3 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
248 //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); 263 //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" );
264#endif
249} 265}
@@ -256,3 +272,3 @@ AudioDevice::~AudioDevice() {
256# ifndef KEEP_DEVICE_OPEN 272# ifndef KEEP_DEVICE_OPEN
257 close( d->handle ); // Now it should be safe to shut the handle 273 close( d->handle ); // Now it should be safe to shut the handle
258# endif 274# endif
@@ -283,3 +299,3 @@ void AudioDevice::write( char *buffer, unsigned int length )
283 if ( waveOutWrite( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) ) ) 299 if ( waveOutWrite( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) ) )
284 qDebug( "failed to write block to audio device" ); 300 qDebug( "failed to write block to audio device" );
285 // emit completedIO(); 301 // emit completedIO();
@@ -289,5 +305,5 @@ void AudioDevice::write( char *buffer, unsigned int length )
289 if ( t != (int)length) { 305 if ( t != (int)length) {
290 qDebug("Ahhh!! memcpys 1"); 306 qDebug("Ahhh!! memcpys 1");
291 memcpy(d->unwrittenBuffer,buffer+t,length-t); 307 memcpy(d->unwrittenBuffer,buffer+t,length-t);
292 d->unwritten = length-t; 308 d->unwritten = length-t;
293 } 309 }
@@ -327,23 +343,23 @@ unsigned int AudioDevice::canWrite() const
327 if ( d->can_GETOSPACE && ioctl(d->handle,SNDCTL_DSP_GETOSPACE,&info) ) { 343 if ( d->can_GETOSPACE && ioctl(d->handle,SNDCTL_DSP_GETOSPACE,&info) ) {
328 d->can_GETOSPACE = FALSE; 344 d->can_GETOSPACE = FALSE;
329 fcntl( d->handle, F_SETFL, O_NONBLOCK ); 345 fcntl( d->handle, F_SETFL, O_NONBLOCK );
330 } 346 }
331 if ( d->can_GETOSPACE ) { 347 if ( d->can_GETOSPACE ) {
332 int t = info.fragments * sound_fragment_bytes; 348 int t = info.fragments * sound_fragment_bytes;
333 return QMIN(t,(int)bufferSize()); 349 return QMIN(t,(int)bufferSize());
334 } else { 350 } else {
335 if ( d->unwritten ) { 351 if ( d->unwritten ) {
336 int t = ::write( d->handle, d->unwrittenBuffer, d->unwritten ); 352 int t = ::write( d->handle, d->unwrittenBuffer, d->unwritten );
337 if ( t<0 ) t = 0; 353 if ( t<0 ) t = 0;
338 if ( (unsigned)t!=d->unwritten ) { 354 if ( (unsigned)t!=d->unwritten ) {
339 memcpy(d->unwrittenBuffer,d->unwrittenBuffer+t,d->unwritten-t); 355 memcpy(d->unwrittenBuffer,d->unwrittenBuffer+t,d->unwritten-t);
340 d->unwritten -= t; 356 d->unwritten -= t;
341 } else { 357 } else {
342 d->unwritten = 0; 358 d->unwritten = 0;
343 } 359 }
344 } 360 }
345 if ( d->unwritten ) 361 if ( d->unwritten )
346 return 0; 362 return 0;
347 else 363 else
348 return d->bufferSize; 364 return d->bufferSize;
349 } 365 }
@@ -357,4 +373,4 @@ int AudioDevice::bytesWritten() {
357 if ( ( waveOutGetPosition( (HWAVEOUT)d->handle, &pmmt, sizeof(MMTIME) ) != MMSYSERR_NOERROR ) || ( pmmt.wType != TIME_BYTES ) ) { 373 if ( ( waveOutGetPosition( (HWAVEOUT)d->handle, &pmmt, sizeof(MMTIME) ) != MMSYSERR_NOERROR ) || ( pmmt.wType != TIME_BYTES ) ) {
358 qDebug( "failed to get audio device position" ); 374 qDebug( "failed to get audio device position" );
359 return -1; 375 return -1;
360 } 376 }
@@ -364,4 +380,4 @@ int AudioDevice::bytesWritten() {
364 if ( ioctl( d->handle, SNDCTL_DSP_GETODELAY, &buffered ) ) { 380 if ( ioctl( d->handle, SNDCTL_DSP_GETODELAY, &buffered ) ) {
365 qDebug( "failed to get audio device position" ); 381 qDebug( "failed to get audio device position" );
366 return -1; 382 return -1;
367 } 383 }
diff --git a/core/multimedia/opieplayer/audiodevice.h b/core/multimedia/opieplayer/audiodevice.h
index dcd79fe..ec70788 100644
--- a/core/multimedia/opieplayer/audiodevice.h
+++ b/core/multimedia/opieplayer/audiodevice.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -19,5 +19,2 @@
19**********************************************************************/ 19**********************************************************************/
20// L.J.Potter added changes Fri 02-15-2002
21
22
23#ifndef AUDIODEVICE_H 20#ifndef AUDIODEVICE_H
@@ -25,5 +22,3 @@
25 22
26
27#include <qobject.h> 23#include <qobject.h>
28#include <sys/soundcard.h>
29 24
@@ -36,3 +31,3 @@ class AudioDevice : public QObject {
36public: 31public:
37 AudioDevice( unsigned int freq = 44000, unsigned int channels = 2, unsigned int bytesPerSample = AFMT_S16_LE ); 32 AudioDevice( unsigned int freq = 44000, unsigned int channels = 2, unsigned int bytesPerSample = 2 );
38 ~AudioDevice(); 33 ~AudioDevice();
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 0d88591..1e0757f 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -28,3 +28,2 @@
28 28
29
30extern MediaPlayerState *mediaPlayerState; 29extern MediaPlayerState *mediaPlayerState;
@@ -63,3 +62,3 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
63{ 62{
64 setCaption( tr("OpiePlayer") ); 63 setCaption( tr("MediaPlayer") );
65 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 64 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) );
@@ -106,3 +105,3 @@ AudioWidget::~AudioWidget() {
106 for ( int i = 0; i < 4; i++ ) 105 for ( int i = 0; i < 4; i++ )
107 delete pixmaps[i]; 106 delete pixmaps[i];
108} 107}
@@ -121,3 +120,3 @@ void AudioWidget::sliderReleased() {
121 if ( slider->width() == 0 ) 120 if ( slider->width() == 0 )
122 return; 121 return;
123 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 122 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
@@ -139,7 +138,7 @@ void AudioWidget::setView( char view ) {
139 if ( view == 'a' ) { 138 if ( view == 'a' ) {
140 startTimer( 150 ); 139 startTimer( 150 );
141 showMaximized(); 140 showMaximized();
142 } else { 141 } else {
143 killTimers(); 142 killTimers();
144 hide(); 143 hide();
145 } 144 }
@@ -150,3 +149,3 @@ void AudioWidget::updateSlider( long i, long max ) {
150 if ( max == 0 ) 149 if ( max == 0 )
151 return; 150 return;
152 // Will flicker too much if we don't do this 151 // Will flicker too much if we don't do this
@@ -156,6 +155,6 @@ void AudioWidget::updateSlider( long i, long max ) {
156 if ( !audioSliderBeingMoved ) { 155 if ( !audioSliderBeingMoved ) {
157 if ( slider->value() != val ) 156 if ( slider->value() != val )
158 slider->setValue( val ); 157 slider->setValue( val );
159 if ( slider->maxValue() != width ) 158 if ( slider->maxValue() != width )
160 slider->setMaxValue( width ); 159 slider->setMaxValue( width );
161 } 160 }
@@ -166,3 +165,3 @@ void AudioWidget::setToggleButton( int i, bool down ) {
166 if ( down != audioButtons[i].isDown ) 165 if ( down != audioButtons[i].isDown )
167 toggleButton( i ); 166 toggleButton( i );
168} 167}
@@ -190,9 +189,9 @@ void AudioWidget::timerEvent( QTimerEvent * ) {
190 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { 189 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
191 frame = frame >= 7 ? 0 : frame + 1; 190 frame = frame >= 7 ? 0 : frame + 1;
192 int x = audioButtons[AudioPlay].xPos; 191 int x = audioButtons[AudioPlay].xPos;
193 int y = audioButtons[AudioPlay].yPos; 192 int y = audioButtons[AudioPlay].yPos;
194 QPainter p( this ); 193 QPainter p( this );
195 // Optimize to only draw the little bit of the changing images which is different 194 // Optimize to only draw the little bit of the changing images which is different
196 p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); 195 p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 );
197 p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); 196 p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 );
198 } 197 }
@@ -203,44 +202,44 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
203 for ( int i = 0; i < numButtons; i++ ) { 202 for ( int i = 0; i < numButtons; i++ ) {
204 int size = audioButtons[i].isBig; 203 int size = audioButtons[i].isBig;
205 int x = audioButtons[i].xPos; 204 int x = audioButtons[i].xPos;
206 int y = audioButtons[i].yPos; 205 int y = audioButtons[i].yPos;
207 if ( event->state() == QMouseEvent::LeftButton ) { 206 if ( event->state() == QMouseEvent::LeftButton ) {
208 // The test to see if the mouse click is inside the circular button or not 207 // The test to see if the mouse click is inside the circular button or not
209 // (compared with the radius squared to avoid a square-root of our distance) 208 // (compared with the radius squared to avoid a square-root of our distance)
210 int radius = 32 + 13 * size; 209 int radius = 32 + 13 * size;
211 QPoint center = QPoint( x + radius, y + radius ); 210 QPoint center = QPoint( x + radius, y + radius );
212 QPoint dXY = center - event->pos(); 211 QPoint dXY = center - event->pos();
213 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); 212 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
214 bool isOnButton = dist <= (radius * radius); 213 bool isOnButton = dist <= (radius * radius);
215// QRect r( x, y, 64 + 22*size, 64 + 22*size ); 214 // QRect r( x, y, 64 + 22*size, 64 + 22*size );
216// bool isOnButton = r.contains( event->pos() ); // Rectangular Button code 215 // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code
217 if ( isOnButton && !audioButtons[i].isHeld ) { 216 if ( isOnButton && !audioButtons[i].isHeld ) {
218 audioButtons[i].isHeld = TRUE; 217 audioButtons[i].isHeld = TRUE;
219 toggleButton(i); 218 toggleButton(i);
220 switch (i) { 219 switch (i) {
221 case AudioVolumeUp: emit moreClicked(); return; 220 case AudioVolumeUp: emit moreClicked(); return;
222 case AudioVolumeDown: emit lessClicked(); return; 221 case AudioVolumeDown: emit lessClicked(); return;
223 } 222 }
224 } else if ( !isOnButton && audioButtons[i].isHeld ) { 223 } else if ( !isOnButton && audioButtons[i].isHeld ) {
225 audioButtons[i].isHeld = FALSE; 224 audioButtons[i].isHeld = FALSE;
226 toggleButton(i); 225 toggleButton(i);
227 } 226 }
228 } else { 227 } else {
229 if ( audioButtons[i].isHeld ) { 228 if ( audioButtons[i].isHeld ) {
230 audioButtons[i].isHeld = FALSE; 229 audioButtons[i].isHeld = FALSE;
231 if ( !audioButtons[i].isToggle ) 230 if ( !audioButtons[i].isToggle )
232 setToggleButton( i, FALSE ); 231 setToggleButton( i, FALSE );
233 switch (i) { 232 switch (i) {
234 case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; 233 case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
235 case AudioStop: mediaPlayerState->setPlaying(FALSE); return; 234 case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
236 case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; 235 case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return;
237 case AudioNext: mediaPlayerState->setNext(); return; 236 case AudioNext: mediaPlayerState->setNext(); return;
238 case AudioPrevious: mediaPlayerState->setPrev(); return; 237 case AudioPrevious: mediaPlayerState->setPrev(); return;
239 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; 238 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
240 case AudioVolumeUp: emit moreReleased(); return; 239 case AudioVolumeUp: emit moreReleased(); return;
241 case AudioVolumeDown: emit lessReleased(); return; 240 case AudioVolumeDown: emit lessReleased(); return;
242 case AudioPlayList: mediaPlayerState->setList(); return; 241 case AudioPlayList: mediaPlayerState->setList(); return;
243 } 242 }
244 } 243 }
245 } 244 }
246 } 245 }
@@ -273,3 +272,3 @@ void AudioWidget::paintEvent( QPaintEvent * ) {
273 for ( int i = 0; i < numButtons; i++ ) 272 for ( int i = 0; i < numButtons; i++ )
274 paintButton( &p, i ); 273 paintButton( &p, i );
275} 274}
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h
index 4b82a91..95f5322 100644
--- a/core/multimedia/opieplayer/audiowidget.h
+++ b/core/multimedia/opieplayer/audiowidget.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -22,3 +22,2 @@
22 22
23
24#include <qwidget.h> 23#include <qwidget.h>
diff --git a/core/multimedia/opieplayer/libflash/libflashplugin.h b/core/multimedia/opieplayer/libflash/libflashplugin.h
index a2f1c42..48b512f 100644
--- a/core/multimedia/opieplayer/libflash/libflashplugin.h
+++ b/core/multimedia/opieplayer/libflash/libflashplugin.h
@@ -26,4 +26,3 @@
26#include "flash.h" 26#include "flash.h"
27//#include <qpe/mediaplayerplugininterface.h> 27#include <qpe/mediaplayerplugininterface.h>
28#include "../mediaplayerplugininterface.h"
29 28
@@ -51,3 +50,2 @@ public:
51 int audioSamples( int /*stream*/ ) { return 1000000; } 50 int audioSamples( int /*stream*/ ) { return 1000000; }
52int audioBitsPerSample(int) { return 0;}
53 bool audioSetSample( long sample, int stream ); 51 bool audioSetSample( long sample, int stream );
diff --git a/core/multimedia/opieplayer/libflash/libflashpluginimpl.h b/core/multimedia/opieplayer/libflash/libflashpluginimpl.h
index cb8d959..33d8ad2 100644
--- a/core/multimedia/opieplayer/libflash/libflashpluginimpl.h
+++ b/core/multimedia/opieplayer/libflash/libflashpluginimpl.h
@@ -23,4 +23,3 @@
23 23
24//#include <qpe/mediaplayerplugininterface.h> 24#include <qpe/mediaplayerplugininterface.h>
25#include "../mediaplayerplugininterface.h"
26 25
diff --git a/core/multimedia/opieplayer/libflash/swf.h b/core/multimedia/opieplayer/libflash/swf.h
index 48986cc..5f5e4f7 100644
--- a/core/multimedia/opieplayer/libflash/swf.h
+++ b/core/multimedia/opieplayer/libflash/swf.h
@@ -210,3 +210,3 @@ extern "C" {
210//#include "zlib.h" 210//#include "zlib.h"
211#include "/opt/qt-2.3.2-embedded/src/3rdparty/zlib/zlib.h" 211#include "../src/3rdparty/zlib/zlib.h"
212}; 212};
diff --git a/core/multimedia/opieplayer/libmad/Makefile.in b/core/multimedia/opieplayer/libmad/Makefile.in
index 552043c..e9f74e7 100644
--- a/core/multimedia/opieplayer/libmad/Makefile.in
+++ b/core/multimedia/opieplayer/libmad/Makefile.in
@@ -216,3 +216,2 @@ libmadplugin.o: libmadplugin.cpp \
216 libmadplugin.h \ 216 libmadplugin.h \
217 ../mediaplayerplugininterface.h \
218 mad.h 217 mad.h
@@ -221,3 +220,2 @@ libmadpluginimpl.o: libmadpluginimpl.cpp \
221 libmadplugin.h \ 220 libmadplugin.h \
222 ../mediaplayerplugininterface.h \
223 libmadpluginimpl.h 221 libmadpluginimpl.h
diff --git a/core/multimedia/opieplayer/libmad/libmad.pro b/core/multimedia/opieplayer/libmad/libmad.pro
index b54ca6b..6c40a15 100644
--- a/core/multimedia/opieplayer/libmad/libmad.pro
+++ b/core/multimedia/opieplayer/libmad/libmad.pro
@@ -1,14 +1,12 @@
1TEMPLATE = lib 1 TEMPLATE= lib
2CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3HEADERS = libmad_version.h fixed.h bit.h timer.h stream.h frame.h synth.h decoder.h \ 3 HEADERS = libmad_version.h fixed.h bit.h timer.h stream.h frame.h synth.h decoder.h \
4 layer12.h layer3.h huffman.h libmad_global.h mad.h libmadplugin.h libmadpluginimpl.h 4 layer12.h layer3.h huffman.h libmad_global.h mad.h libmadplugin.h libmadpluginimpl.h
5SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c synth.c decoder.c \ 5 SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c synth.c decoder.c \
6 layer12.c layer3.c huffman.c libmadplugin.cpp libmadpluginimpl.cpp 6 layer12.c layer3.c huffman.c libmadplugin.cpp libmadpluginimpl.cpp
7TARGET = madplugin 7 TARGET = madplugin
8DESTDIR = ../../plugins/codecs 8 DESTDIR = ../../plugins/codecs
9INCLUDEPATH += $(OPIEDIR)/include .. 9INCLUDEPATH += $(OPIEDIR)/include ..
10DEPENDPATH += ../$(OPIEDIR)/include .. 10DEPENDPATH += ../$(OPIEDIR)/include ..
11TMAKE_CFLAGS += -DFPM_64BIT
12TMAKE_CXXFLAGS += -DFPM_64BIT
13LIBS += -lqpe -lm 11LIBS += -lqpe -lm
14VERSION = 1.0.0 12 VERSION = 1.0.0
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h
index ff84c27..d85e0d4 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.h
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.h
@@ -22,6 +22,4 @@
22 22
23
24#include <qstring.h> 23#include <qstring.h>
25//#include <qpe/mediaplayerplugininterface.h> 24#include <qpe/mediaplayerplugininterface.h>
26#include "../mediaplayerplugininterface.h"
27 25
@@ -56,3 +54,2 @@ public:
56 bool audioSetSample( long sample, int stream ); 54 bool audioSetSample( long sample, int stream );
57 int audioBitsPerSample(int) {return 0;}
58 long audioGetSample( int stream ); 55 long audioGetSample( int stream );
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h
index 8ad4956..2c5ed3b 100644
--- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h
+++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h
@@ -22,5 +22,3 @@
22 22
23 23#include <qpe/mediaplayerplugininterface.h>
24//#include <qpe/mediaplayerplugininterface.h>
25#include "../mediaplayerplugininterface.h"
26 24
@@ -45,2 +43,3 @@ public:
45 virtual MediaPlayerEncoder *encoder(); 43 virtual MediaPlayerEncoder *encoder();
44
46private: 45private:
diff --git a/core/multimedia/opieplayer/libmad/version.c b/core/multimedia/opieplayer/libmad/version.c
index 1baba26..413d54b 100644
--- a/core/multimedia/opieplayer/libmad/version.c
+++ b/core/multimedia/opieplayer/libmad/version.c
@@ -90,2 +90,2 @@ char const mad_build[] =
90# endif 90# endif
91; \ No newline at end of file 91;
diff --git a/core/multimedia/opieplayer/libmpeg3/Makefile.in b/core/multimedia/opieplayer/libmpeg3/Makefile.in
index d255e4f..154f85d 100644
--- a/core/multimedia/opieplayer/libmpeg3/Makefile.in
+++ b/core/multimedia/opieplayer/libmpeg3/Makefile.in
@@ -178,4 +178,3 @@ libmpeg3plugin.o: libmpeg3plugin.cpp \
178 video/mpeg3video.h \ 178 video/mpeg3video.h \
179 mpeg3protos.h \ 179 mpeg3protos.h
180 ../mediaplayerplugininterface.h
181 180
@@ -195,3 +194,2 @@ libmpeg3pluginimpl.o: libmpeg3pluginimpl.cpp \
195 mpeg3protos.h \ 194 mpeg3protos.h \
196 ../mediaplayerplugininterface.h \
197 libmpeg3pluginimpl.h 195 libmpeg3pluginimpl.h
@@ -418,3 +416,3 @@ audio/layer2.o: audio/layer2.c \
418audio/layer3.o: audio/layer3.c \ 416audio/layer3.o: audio/layer3.c \
419 huffman.h \ 417 audio/huffman.h \
420 audio/mpeg3audio.h \ 418 audio/mpeg3audio.h \
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
index 54f259b..e0eb930 100644
--- a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
@@ -22,3 +22,2 @@
22 22
23
24#include <qstring.h> 23#include <qstring.h>
@@ -27,4 +26,3 @@
27#include "mpeg3protos.h" 26#include "mpeg3protos.h"
28//#include <qpe/mediaplayerplugininterface.h> 27#include <qpe/mediaplayerplugininterface.h>
29#include "../mediaplayerplugininterface.h"
30 28
@@ -54,3 +52,2 @@ public:
54 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; }
55 int audioBitsPerSample(int) { return 0;}
56 int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } 53 int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; }
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h
index 89abf97..e9926f4 100644
--- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h
@@ -22,5 +22,3 @@
22 22
23 23#include <qpe/mediaplayerplugininterface.h>
24//#include <qpe/mediaplayerplugininterface.h>
25#include "../mediaplayerplugininterface.h"
26 24
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 1ae0059..dd466ed 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -19,9 +19,8 @@
19**********************************************************************/ 19**********************************************************************/
20// L.J.Potter added changes Fri 02-15-2002
21
22#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
23
24#ifdef Q_WS_QWS 21#ifdef Q_WS_QWS
22
25#include <qpe/qcopenvelope_qws.h> 23#include <qpe/qcopenvelope_qws.h>
26#endif 24#endif
25#include <qpe/mediaplayerplugininterface.h>
27#include <stdio.h> 26#include <stdio.h>
@@ -35,3 +34,2 @@
35#include "audiodevice.h" 34#include "audiodevice.h"
36#include "mediaplayerplugininterface.h"
37#include "mediaplayerstate.h" 35#include "mediaplayerstate.h"
@@ -47,9 +45,9 @@ extern MediaPlayerState *mediaPlayerState;
47 45
48static char *audioBuffer = NULL; 46 static char *audioBuffer = NULL;
49static AudioDevice *audioDevice = NULL; 47static AudioDevice *audioDevice = NULL;
50static bool disabledSuspendScreenSaver = FALSE; 48 static bool disabledSuspendScreenSaver = FALSE;
51static bool previousSuspendMode = FALSE; 49 static bool previousSuspendMode = FALSE;
52 50
53 51
54pthread_t audio_tid; 52 pthread_taudio_tid;
55pthread_attr_t audio_attr; 53pthread_attr_t audio_attr;
@@ -61,6 +59,6 @@ public:
61 Mutex() { 59 Mutex() {
62 pthread_mutexattr_t attr; 60 pthread_mutexattr_t attr;
63 pthread_mutexattr_init( &attr ); 61 pthread_mutexattr_init( &attr );
64 pthread_mutex_init( &mutex, &attr ); 62 pthread_mutex_init( &mutex, &attr );
65 pthread_mutexattr_destroy( &attr ); 63 pthread_mutexattr_destroy( &attr );
66 } 64 }
@@ -68,3 +66,3 @@ public:
68 ~Mutex() { 66 ~Mutex() {
69 pthread_mutex_destroy( &mutex ); 67 pthread_mutex_destroy( &mutex );
70 } 68 }
@@ -72,3 +70,3 @@ public:
72 void lock() { 70 void lock() {
73 pthread_mutex_lock( &mutex ); 71 pthread_mutex_lock( &mutex );
74 } 72 }
@@ -76,3 +74,3 @@ public:
76 void unlock() { 74 void unlock() {
77 pthread_mutex_unlock( &mutex ); 75 pthread_mutex_unlock( &mutex );
78 } 76 }
@@ -86,6 +84,6 @@ void *startAudioThread( void *ptr ) {
86 while ( TRUE ) { 84 while ( TRUE ) {
87 if ( threadOkToGo && mpegView->moreAudio ) 85 if ( threadOkToGo && mpegView->moreAudio )
88 mpegView->startAudio(); 86 mpegView->startAudio();
89 else 87 else
90 usleep( 10000 ); // Semi-buzy-wait till we are playing again 88 usleep( 10000 ); // Semi-buzy-wait till we are playing again
91 } 89 }
@@ -106,15 +104,20 @@ LoopControl::LoopControl( QObject *parent, const char *name )
106 pthread_attr_init(&audio_attr); 104 pthread_attr_init(&audio_attr);
107#define USE_REALTIME_AUDIO_THREAD 105
108#ifdef USE_REALTIME_AUDIO_THREAD 106 if ( getuid() == 0 ) {
109 // Attempt to set it to real-time round robin 107 printf("true, guid = %i\n", getuid());
110 if ( pthread_attr_setschedpolicy( &audio_attr, SCHED_RR ) == 0 ) { 108
111 sched_param params; 109 // Attempt to set it to real-time round robin
112 params.sched_priority = 50; 110 if ( pthread_attr_setschedpolicy( &audio_attr, SCHED_RR ) == 0 ) {
113 pthread_attr_setschedparam(&audio_attr,&params); 111 sched_param params;
114 } else { 112 params.sched_priority = 50;
115 qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); 113 pthread_attr_setschedparam(&audio_attr,&params);
116 pthread_attr_destroy(&audio_attr); 114 } else {
117 pthread_attr_init(&audio_attr); 115 qDebug( "Error setting up a realtime thread, reverting to using a normal thread." );
116 pthread_attr_destroy(&audio_attr);
117 pthread_attr_init(&audio_attr);
118 }
118 } 119 }
119#endif 120// printf("false, guid = %i\n", getuid());
121 usleep( 100 );
122
120 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); 123 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this);
@@ -135,10 +138,10 @@ void LoopControl::timerEvent( QTimerEvent *te ) {
135 if ( te->timerId() == videoId ) 138 if ( te->timerId() == videoId )
136 startVideo(); 139 startVideo();
137 140
138 if ( te->timerId() == sliderId ) { 141 if ( te->timerId() == sliderId ) {
139 if ( hasAudioChannel && !hasVideoChannel && moreAudio ) { 142 if ( hasAudioChannel && !hasVideoChannel && moreAudio ) {
140 mediaPlayerState->updatePosition( audioSampleCounter ); 143 mediaPlayerState->updatePosition( audioSampleCounter );
141 } else if ( hasVideoChannel && moreVideo ) { 144 } else if ( hasVideoChannel && moreVideo ) {
142 mediaPlayerState->updatePosition( current_frame ); 145 mediaPlayerState->updatePosition( current_frame );
143 } 146 }
144 } 147 }
@@ -156,22 +159,22 @@ void LoopControl::setPosition( long pos ) {
156 if ( hasVideoChannel && hasAudioChannel ) { 159 if ( hasVideoChannel && hasAudioChannel ) {
157 playtime.restart(); 160 playtime.restart();
158 playtime = playtime.addMSecs( long((double)-pos * 1000.0 / framerate) ); 161 playtime = playtime.addMSecs( long((double)-pos * 1000.0 / framerate) );
159 current_frame = pos + 1; 162 current_frame = pos + 1;
160 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); 163 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
161 prev_frame = current_frame - 1; 164 prev_frame = current_frame - 1;
162 currentSample = (int)( (double)current_frame * freq / framerate ); 165 currentSample = (int)( (double)current_frame * freq / framerate );
163 mediaPlayerState->curDecoder()->audioSetSample( currentSample, stream ); 166 mediaPlayerState->curDecoder()->audioSetSample( currentSample, stream );
164 audioSampleCounter = currentSample - 1; 167 audioSampleCounter = currentSample - 1;
165 } else if ( hasVideoChannel ) { 168 } else if ( hasVideoChannel ) {
166 playtime.restart(); 169 playtime.restart();
167 playtime = playtime.addMSecs( long((double)-pos * 1000.0 / framerate) ); 170 playtime = playtime.addMSecs( long((double)-pos * 1000.0 / framerate) );
168 current_frame = pos + 1; 171 current_frame = pos + 1;
169 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); 172 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
170 prev_frame = current_frame - 1; 173 prev_frame = current_frame - 1;
171 } else if ( hasAudioChannel ) { 174 } else if ( hasAudioChannel ) {
172 playtime.restart(); 175 playtime.restart();
173 playtime = playtime.addMSecs( long((double)-pos * 1000.0 / freq) ); 176 playtime = playtime.addMSecs( long((double)-pos * 1000.0 / freq) );
174 currentSample = pos + 1; 177 currentSample = pos + 1;
175 mediaPlayerState->curDecoder()->audioSetSample( currentSample, stream ); 178 mediaPlayerState->curDecoder()->audioSetSample( currentSample, stream );
176 audioSampleCounter = currentSample - 1; 179 audioSampleCounter = currentSample - 1;
177 } 180 }
@@ -188,28 +191,28 @@ void LoopControl::startVideo() {
188 191
189 if ( hasAudioChannel && !isMuted ) { 192 if ( hasAudioChannel && !isMuted ) {
190 193
191 current_frame = long( playtime.elapsed() * framerate / 1000 ); 194 current_frame = long( playtime.elapsed() * framerate / 1000 );
192 195
193 if ( prev_frame != -1 && current_frame <= prev_frame ) 196 if ( prev_frame != -1 && current_frame <= prev_frame )
194 return; 197 return;
195 198
196 } else { 199 } else {
197 // Don't skip 200 // Don't skip
198 current_frame++; 201 current_frame++;
199 } 202 }
200 203
201 if ( prev_frame == -1 || current_frame > prev_frame ) { 204 if ( prev_frame == -1 || current_frame > prev_frame ) {
202 if ( current_frame > prev_frame + 1 ) { 205 if ( current_frame > prev_frame + 1 ) {
203 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); 206 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
204 } 207 }
205 moreVideo = videoUI->playVideo(); 208 moreVideo = videoUI->playVideo();
206 prev_frame = current_frame; 209 prev_frame = current_frame;
207 } 210 }
208 211
209 } else { 212 } else {
210 213
211 moreVideo = FALSE; 214 moreVideo = FALSE;
212 killTimer( videoId ); 215 killTimer( videoId );
213 216
214 } 217 }
215 218
@@ -225,33 +228,32 @@ void LoopControl::startAudio() {
225 228
226 if ( !isMuted && mediaPlayerState->curDecoder() ) { 229 if ( !isMuted && mediaPlayerState->curDecoder() ) {
227 230
228 currentSample = audioSampleCounter + 1; 231 currentSample = audioSampleCounter + 1;
229 232
230 if ( currentSample != audioSampleCounter + 1 ) 233 if ( currentSample != audioSampleCounter + 1 )
231 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); 234 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter);
232 235
233 long samplesRead = 0; 236 long samplesRead = 0;
234 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); 237 mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
235 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; 238 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
236 long sampleWaitTime = currentSample - sampleWeShouldBeAt; 239 long sampleWaitTime = currentSample - sampleWeShouldBeAt;
237 240
238 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { 241 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
239 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); 242 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
240 } 243 } else if ( sampleWaitTime <= -5000 ) {
241 else if ( sampleWaitTime <= -5000 ) { 244 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
242 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 245 //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
243 //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 246 currentSample = sampleWeShouldBeAt;
244 currentSample = sampleWeShouldBeAt; 247 }
245 }
246 248
247 audioDevice->write( audioBuffer, samplesRead * 2 * channels ); 249 audioDevice->write( audioBuffer, samplesRead * 2 * channels );
248 audioSampleCounter = currentSample + samplesRead - 1; 250 audioSampleCounter = currentSample + samplesRead - 1;
249 251
250 moreAudio = readOk && (audioSampleCounter <= total_audio_samples); 252 moreAudio = audioSampleCounter <= total_audio_samples;
251 253
252 } else { 254 } else {
253 255
254 moreAudio = FALSE; 256 moreAudio = FALSE;
255 257
256 } 258 }
257 259
@@ -268,3 +270,3 @@ void LoopControl::killTimers() {
268 if ( hasVideoChannel ) 270 if ( hasVideoChannel )
269 killTimer( videoId ); 271 killTimer( videoId );
270 killTimer( sliderId ); 272 killTimer( sliderId );
@@ -284,5 +286,5 @@ void LoopControl::startTimers() {
284 if ( hasVideoChannel ) { 286 if ( hasVideoChannel ) {
285 moreVideo = TRUE; 287 moreVideo = TRUE;
286 int mSecsBetweenFrames = (int)(100 / framerate); // 10% of the real value 288 int mSecsBetweenFrames = (int)(100 / framerate); // 10% of the real value
287 videoId = startTimer( mSecsBetweenFrames ); 289 videoId = startTimer( mSecsBetweenFrames );
288 } 290 }
@@ -290,4 +292,4 @@ void LoopControl::startTimers() {
290 if ( hasAudioChannel ) { 292 if ( hasAudioChannel ) {
291 moreAudio = TRUE; 293 moreAudio = TRUE;
292 threadOkToGo = TRUE; 294 threadOkToGo = TRUE;
293 } 295 }
@@ -303,12 +305,12 @@ void LoopControl::setPaused( bool pause ) {
303 if ( !mediaPlayerState->curDecoder() || !mediaPlayerState->curDecoder()->isOpen() ) 305 if ( !mediaPlayerState->curDecoder() || !mediaPlayerState->curDecoder()->isOpen() )
304 return; 306 return;
305 307
306 if ( pause ) { 308 if ( pause ) {
307 killTimers(); 309 killTimers();
308 } else { 310 } else {
309 // Force an update of the position 311 // Force an update of the position
310 mediaPlayerState->setPosition( mediaPlayerState->position() + 1 ); 312 mediaPlayerState->setPosition( mediaPlayerState->position() + 1 );
311 mediaPlayerState->setPosition( mediaPlayerState->position() - 1 ); 313 mediaPlayerState->setPosition( mediaPlayerState->position() - 1 );
312 // Just like we never stopped 314 // Just like we never stopped
313 startTimers(); 315 startTimers();
314 } 316 }
@@ -321,5 +323,5 @@ void LoopControl::stop( bool willPlayAgainShortly ) {
321 if ( !willPlayAgainShortly && disabledSuspendScreenSaver ) { 323 if ( !willPlayAgainShortly && disabledSuspendScreenSaver ) {
322 disabledSuspendScreenSaver = FALSE; 324 disabledSuspendScreenSaver = FALSE;
323 // Re-enable the suspend mode 325 // Re-enable the suspend mode
324 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 326 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
325 } 327 }
@@ -329,16 +331,16 @@ void LoopControl::stop( bool willPlayAgainShortly ) {
329 331
330 killTimers(); 332 killTimers();
331 333
332 audioMutex->lock(); 334 audioMutex->lock();
333 335
334 mediaPlayerState->curDecoder()->close(); 336 mediaPlayerState->curDecoder()->close();
335 337
336 if ( audioDevice ) { 338 if ( audioDevice ) {
337 delete audioDevice; 339 delete audioDevice;
338 delete audioBuffer; 340 delete audioBuffer;
339 audioDevice = 0; 341 audioDevice = 0;
340 audioBuffer = 0; 342 audioBuffer = 0;
341 } 343 }
342 344
343 audioMutex->unlock(); 345 audioMutex->unlock();
344 346
@@ -361,11 +363,11 @@ bool LoopControl::init( const QString& filename ) {
361 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { 363 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) {
362 if ( mediaPlayerState->libMpeg3Decoder() && mediaPlayerState->libMpeg3Decoder()->open( filename ) ) { 364 if ( mediaPlayerState->libMpeg3Decoder() && mediaPlayerState->libMpeg3Decoder()->open( filename ) ) {
363 total_audio_samples = mediaPlayerState->libMpeg3Decoder()->audioSamples( 0 ); 365 total_audio_samples = mediaPlayerState->libMpeg3Decoder()->audioSamples( 0 );
364 mediaPlayerState->libMpeg3Decoder()->close(); 366 mediaPlayerState->libMpeg3Decoder()->close();
365 } 367 }
366 } 368 }
367 369
368 if ( !mediaPlayerState->curDecoder()|| !mediaPlayerState->curDecoder()->open( filename ) ) { 370 if ( !mediaPlayerState->curDecoder()|| !mediaPlayerState->curDecoder()->open( filename ) ) {
369 audioMutex->unlock(); 371 audioMutex->unlock();
370 return FALSE; 372 return FALSE;
371 } 373 }
@@ -376,30 +378,30 @@ bool LoopControl::init( const QString& filename ) {
376 if ( hasAudioChannel ) { 378 if ( hasAudioChannel ) {
377 int astream = 0; 379 int astream = 0;
378 380
379 channels = mediaPlayerState->curDecoder()->audioChannels( astream ); 381 channels = mediaPlayerState->curDecoder()->audioChannels( astream );
380 qDebug( "LC- channels = %d", channels ); 382 DecodeLoopDebug(( "channels = %d\n", channels ));
381 383
382 if ( !total_audio_samples ) 384 if ( !total_audio_samples )
383 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); 385 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream );
384 386
385// total_audio_samples += 1000; 387 total_audio_samples += 1000;
386 388
387 mediaPlayerState->setLength( total_audio_samples ); 389 mediaPlayerState->setLength( total_audio_samples );
388 390
389 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 391 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
390 qDebug( "LC- frequency = %d", freq ); 392 DecodeLoopDebug(( "frequency = %d\n", freq ));
391 393
392 audioSampleCounter = 0; 394 audioSampleCounter = 0;
393 395
394 int bits_per_sample = mediaPlayerState->curDecoder()->audioBitsPerSample( astream); 396 static const int bytes_per_sample = 2; //16 bit
395 397
396 audioDevice = new AudioDevice( freq, channels, bits_per_sample); 398 audioDevice = new AudioDevice( freq, channels, bytes_per_sample );
397 audioBuffer = new char[ audioDevice->bufferSize() ]; 399 audioBuffer = new char[ audioDevice->bufferSize() ];
398 channels = audioDevice->channels(); 400 channels = audioDevice->channels();
399 401
400 //### must check which frequency is actually used. 402 //### must check which frequency is actually used.
401 static const int size = 1; 403 static const int size = 1;
402 short int buf[size]; 404 short int buf[size];
403 long samplesRead = 0; 405 long samplesRead = 0;
404 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream ); 406 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream );
405 } 407 }
@@ -407,17 +409,17 @@ bool LoopControl::init( const QString& filename ) {
407 if ( hasVideoChannel ) { 409 if ( hasVideoChannel ) {
408 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream ); 410 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream );
409 411
410 mediaPlayerState->setLength( total_video_frames ); 412 mediaPlayerState->setLength( total_video_frames );
411 413
412 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream ); 414 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream );
413 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames )); 415 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames ));
414 416
415 if ( framerate <= 1.0 ) { 417 if ( framerate <= 1.0 ) {
416 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" )); 418 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" ));
417 framerate = 25; 419 framerate = 25;
418 } 420 }
419 421
420 if ( total_video_frames == 1 ) { 422 if ( total_video_frames == 1 ) {
421 DecodeLoopDebug(( "Cannot seek to frame" )); 423 DecodeLoopDebug(( "Cannot seek to frame" ));
422 } 424 }
423 425
@@ -441,7 +443,7 @@ void LoopControl::play() {
441 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) { 443 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) {
442 disabledSuspendScreenSaver = TRUE; 444 disabledSuspendScreenSaver = TRUE;
443 previousSuspendMode = hasVideoChannel; 445 previousSuspendMode = hasVideoChannel;
444 // Stop the screen from blanking and power saving state 446 // Stop the screen from blanking and power saving state
445 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 447 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
446 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 448 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend );
447 } 449 }
@@ -456,10 +458,10 @@ void LoopControl::setMute( bool on ) {
456 if ( on != isMuted ) { 458 if ( on != isMuted ) {
457 isMuted = on; 459 isMuted = on;
458 if ( !on ) { 460 if ( !on ) {
459 // Force an update of the position 461 // Force an update of the position
460 mediaPlayerState->setPosition( mediaPlayerState->position() + 1 ); 462 mediaPlayerState->setPosition( mediaPlayerState->position() + 1 );
461 mediaPlayerState->setPosition( mediaPlayerState->position() - 1 ); 463 mediaPlayerState->setPosition( mediaPlayerState->position() - 1 );
462 // Resume playing audio 464 // Resume playing audio
463 moreAudio = TRUE; 465 moreAudio = TRUE;
464 } 466 }
465 } 467 }
diff --git a/core/multimedia/opieplayer/loopcontrol.h b/core/multimedia/opieplayer/loopcontrol.h
index fc7d316..3191259 100644
--- a/core/multimedia/opieplayer/loopcontrol.h
+++ b/core/multimedia/opieplayer/loopcontrol.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -19,4 +19,2 @@
19**********************************************************************/ 19**********************************************************************/
20// L.J.Potter added changes Fri 02-15-2002
21
22#ifndef MPEGVIEW_H 20#ifndef MPEGVIEW_H
@@ -24,3 +22,2 @@
24 22
25
26#include <qwidget.h> 23#include <qwidget.h>
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
index 2e49bb7..eb89b85 100644
--- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp
+++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -22,2 +22,3 @@
22 22
23
23#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
@@ -28,3 +29,3 @@
28#endif 29#endif
29#include "mediaplayerplugininterface.h" 30#include <qpe/mediaplayerplugininterface.h>
30#include <stdio.h> 31#include <stdio.h>
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.h b/core/multimedia/opieplayer/loopcontrol_threaded.h
index 9a009d1..ced6ac8 100644
--- a/core/multimedia/opieplayer/loopcontrol_threaded.h
+++ b/core/multimedia/opieplayer/loopcontrol_threaded.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -23,2 +23,3 @@
23 23
24
24#include <qwidget.h> 25#include <qwidget.h>
diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp
index 9f7ef73..720a1ca 100644
--- a/core/multimedia/opieplayer/main.cpp
+++ b/core/multimedia/opieplayer/main.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -27,3 +27,2 @@
27 27
28
29MediaPlayerState *mediaPlayerState; 28MediaPlayerState *mediaPlayerState;
@@ -50,3 +49,3 @@ int main(int argc, char **argv) {
50 49
51 pl.setCaption( MediaPlayer::tr("Opie Player") ); 50 pl.setCaption( MediaPlayer::tr("Media Player") );
52 a.showMainDocumentWidget(&pl); 51 a.showMainDocumentWidget(&pl);
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index 3d8f76c..ce42c2c 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -19,2 +19,3 @@
19**********************************************************************/ 19**********************************************************************/
20
20#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
diff --git a/core/multimedia/opieplayer/mediaplayer.h b/core/multimedia/opieplayer/mediaplayer.h
index 379d95c..73f8124 100644
--- a/core/multimedia/opieplayer/mediaplayer.h
+++ b/core/multimedia/opieplayer/mediaplayer.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -22,3 +22,2 @@
22 22
23
24#include <qmainwindow.h> 23#include <qmainwindow.h>
@@ -26,3 +25,3 @@
26#include <qpe/qlibrary.h> 25#include <qpe/qlibrary.h>
27#include "mediaplayerplugininterface.h" 26#include <qpe/mediaplayerplugininterface.h>
28 27
diff --git a/core/multimedia/opieplayer/mediaplayerplugininterface.h b/core/multimedia/opieplayer/mediaplayerplugininterface.h
index 339b2e4..aeeffde 100644
--- a/core/multimedia/opieplayer/mediaplayerplugininterface.h
+++ b/core/multimedia/opieplayer/mediaplayerplugininterface.h
@@ -22,2 +22,3 @@
22 22
23
23#include <qpe/qcom.h> 24#include <qpe/qcom.h>
@@ -63,3 +64,8 @@ public:
63 virtual long audioGetSample( int stream ) = 0; 64 virtual long audioGetSample( int stream ) = 0;
65// virtual bool audioReadMonoSamples( short *samples, long samples, long& samplesRead, int stream ) = 0;
66// virtual bool audioReadStereoSamples( short *samples, long samples, long& samplesRead, int stream ) = 0;
64 virtual bool audioReadSamples( short *samples, int channels, long samples, long& samplesRead, int stream ) = 0; 67 virtual bool audioReadSamples( short *samples, int channels, long samples, long& samplesRead, int stream ) = 0;
68 // Libmpeg3 functions, perhaps good for reading an audio file with 5 channels or something!
69// virtual bool audioReadSamples( short *samples, int channel, long samples, int stream ) = 0;
70// virtual bool audioReReadSamples( short *samples, int channel, long samples, int stream ) = 0;
65 71
@@ -93,5 +99,2 @@ public:
93 99
94 // File Properies
95 virtual long getPlayTime() { return -1; }
96 virtual int audioBitsPerSample( int stream ) = 0;
97}; 100};
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index 2a6bca3..7e82166 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -21,2 +21,3 @@
21#include <qpe/qlibrary.h> 21#include <qpe/qlibrary.h>
22#include <qpe/mediaplayerplugininterface.h>
22#include <qpe/config.h> 23#include <qpe/config.h>
@@ -25,7 +26,4 @@
25#include <qdir.h> 26#include <qdir.h>
26#include "mediaplayerplugininterface.h"
27#include "mediaplayerstate.h" 27#include "mediaplayerstate.h"
28 28
29
30
31#ifdef QT_NO_COMPONENT 29#ifdef QT_NO_COMPONENT
@@ -38,4 +36,4 @@
38 36
39//#define MediaPlayerDebug(x) qDebug x 37 #define MediaPlayerDebug(x)qDebug x
40#define MediaPlayerDebug(x) 38//#define MediaPlayerDebug(x)
41 39
@@ -99,6 +97,6 @@ MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) {
99 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 97 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
100 if ( (*it).decoder->isFileSupported( file ) ) { 98 if ( (*it).decoder->isFileSupported( file ) ) {
101 tmpDecoder = (*it).decoder; 99 tmpDecoder = (*it).decoder;
102 break; 100 break;
103 } 101 }
104 } 102 }
@@ -118,6 +116,2 @@ MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
118 116
119// ### hack to get true sample count
120// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
121// return libwavdecoder;
122// }
123 117
@@ -128,5 +122,5 @@ void MediaPlayerState::loadPlugins() {
128 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 122 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
129 (*mit).iface->release(); 123 (*mit).iface->release();
130 (*mit).library->unload(); 124 (*mit).library->unload();
131 delete (*mit).library; 125 delete (*mit).library;
132 } 126 }
@@ -139,25 +133,25 @@ void MediaPlayerState::loadPlugins() {
139 for ( it = list.begin(); it != list.end(); ++it ) { 133 for ( it = list.begin(); it != list.end(); ++it ) {
140 MediaPlayerPluginInterface *iface = 0; 134 MediaPlayerPluginInterface *iface = 0;
141 QLibrary *lib = new QLibrary( path + "/" + *it ); 135 QLibrary *lib = new QLibrary( path + "/" + *it );
142 136
143 MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() )); 137 MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() ));
144 138
145 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { 139 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
146 140
147 MediaPlayerDebug(( "loading: %s", QString( path + "/" + *it ).latin1() )); 141 MediaPlayerDebug(( "loading: %s", QString( path + "/" + *it ).latin1() ));
148 142
149 MediaPlayerPlugin plugin; 143 MediaPlayerPlugin plugin;
150 plugin.library = lib; 144 plugin.library = lib;
151 plugin.iface = iface; 145 plugin.iface = iface;
152 plugin.decoder = plugin.iface->decoder(); 146 plugin.decoder = plugin.iface->decoder();
153 plugin.encoder = plugin.iface->encoder(); 147 plugin.encoder = plugin.iface->encoder();
154 pluginList.append( plugin ); 148 pluginList.append( plugin );
155 149
156 // ### hack to get true sample count 150 // ### hack to get true sample count
157 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") ) 151 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") )
158 libmpeg3decoder = plugin.decoder; 152 libmpeg3decoder = plugin.decoder;
159 153
160 } else { 154 } else {
161 delete lib; 155 delete lib;
162 } 156 }
163 } 157 }
@@ -186,5 +180,5 @@ void MediaPlayerState::loadPlugins() {
186 if ( pluginList.count() ) 180 if ( pluginList.count() )
187 MediaPlayerDebug(( "%i decoders found", pluginList.count() )); 181 MediaPlayerDebug(( "%i decoders found", pluginList.count() ));
188 else 182 else
189 MediaPlayerDebug(( "No decoders found" )); 183 MediaPlayerDebug(( "No decoders found" ));
190} 184}
diff --git a/core/multimedia/opieplayer/mediaplayerstate.h b/core/multimedia/opieplayer/mediaplayerstate.h
index 1a23742..e82c263 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.h
+++ b/core/multimedia/opieplayer/mediaplayerstate.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -22,3 +22,2 @@
22 22
23
24#include <qobject.h> 23#include <qobject.h>
@@ -36,12 +35,12 @@ public:
36 35
37 bool fullscreen() { return isFullscreen; } 36 bool fullscreen() { return isFullscreen; }
38 bool scaled() { return isScaled; } 37 bool scaled() { return isScaled; }
39 bool looping() { return isLooping; } 38 bool looping() { return isLooping; }
40 bool shuffled() { return isShuffled; } 39 bool shuffled() { return isShuffled; }
41 bool playlist() { return usePlaylist; } 40 bool playlist() { return usePlaylist; }
42 bool paused() { return isPaused; } 41 bool paused() { return isPaused; }
43 bool playing() { return isPlaying; } 42 bool playing() { return isPlaying; }
44 long position() { return curPosition; } 43 long position() { return curPosition; }
45 long length() { return curLength; } 44 long length() { return curLength; }
46 char view() { return curView; } 45 char view() { return curView; }
47 46
@@ -50,3 +49,3 @@ public:
50 MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the 49 MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the
51 // number of audio samples if we are using the libmad plugin 50 // number of audio samples if we are using the libmad plugin
52public slots: 51public slots:
@@ -57,22 +56,22 @@ public slots:
57 void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } 56 void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); }
58 void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } 57 void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); }
59 void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } 58 void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); }
60 void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); } 59 void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); }
61 void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); } 60 void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); }
62 void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); } 61 void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); }
63 void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); } 62 void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); }
64 63
65 void setPrev() { emit prev(); } 64 void setPrev() { emit prev(); }
66 void setNext() { emit next(); } 65 void setNext() { emit next(); }
67 void setList() { setPlaying( FALSE ); setView('l'); } 66 void setList() { setPlaying( FALSE ); setView('l'); }
68 void setVideo() { setView('v'); } 67 void setVideo() { setView('v'); }
69 void setAudio() { setView('a'); } 68 void setAudio() { setView('a'); }
70 69
71 void toggleFullscreen() { setFullscreen( !isFullscreen ); } 70 void toggleFullscreen() { setFullscreen( !isFullscreen ); }
72 void toggleScaled() { setScaled( !isScaled); } 71 void toggleScaled() { setScaled( !isScaled); }
73 void toggleLooping() { setLooping( !isLooping); } 72 void toggleLooping() { setLooping( !isLooping); }
74 void toggleShuffled() { setShuffled( !isShuffled); } 73 void toggleShuffled() { setShuffled( !isShuffled); }
75 void togglePlaylist() { setPlaylist( !usePlaylist); } 74 void togglePlaylist() { setPlaylist( !usePlaylist); }
76 void togglePaused() { setPaused( !isPaused); } 75 void togglePaused() { setPaused( !isPaused); }
77 void togglePlaying() { setPlaying( !isPlaying); } 76 void togglePlaying() { setPlaying( !isPlaying); }
78 77
@@ -108,3 +107,2 @@ private:
108 MediaPlayerDecoder *libmpeg3decoder; 107 MediaPlayerDecoder *libmpeg3decoder;
109// MediaPlayerDecoder *libwavdecoder;
110 108
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index f17ab6f..a82b594 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -32,3 +32,2 @@
32 32
33
34class PlayListSelectionItem : public QListViewItem { 33class PlayListSelectionItem : public QListViewItem {
@@ -36,4 +35,4 @@ public:
36 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { 35 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) {
37 setText( 0, f->name() ); 36 setText( 0, f->name() );
38 setPixmap( 0, f->pixmap() ); 37 setPixmap( 0, f->pixmap() );
39 } 38 }
@@ -73,3 +72,3 @@ void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
73 if ( !logo.isNull() ) 72 if ( !logo.isNull() )
74 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 73 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
75} 74}
@@ -80,8 +79,8 @@ void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
80 if ( event->state() == QMouseEvent::LeftButton ) { 79 if ( event->state() == QMouseEvent::LeftButton ) {
81 QListViewItem *currentItem = selectedItem(); 80 QListViewItem *currentItem = selectedItem();
82 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 81 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
83 if ( currentItem && currentItem->itemAbove() == itemUnder ) 82 if ( currentItem && currentItem->itemAbove() == itemUnder )
84 moveSelectedUp(); 83 moveSelectedUp();
85 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 84 else if ( currentItem && currentItem->itemBelow() == itemUnder )
86 moveSelectedDown(); 85 moveSelectedDown();
87 } 86 }
@@ -93,3 +92,3 @@ const DocLnk *PlayListSelection::current() {
93 if ( item ) 92 if ( item )
94 return item->file(); 93 return item->file();
95 return NULL; 94 return NULL;
@@ -99,3 +98,3 @@ const DocLnk *PlayListSelection::current() {
99void PlayListSelection::addToSelection( const DocLnk &lnk ) { 98void PlayListSelection::addToSelection( const DocLnk &lnk ) {
100 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); 99 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) );
101 QListViewItem *current = selectedItem(); 100 QListViewItem *current = selectedItem();
@@ -111,3 +110,3 @@ void PlayListSelection::removeSelected() {
111 if ( item ) 110 if ( item )
112 delete item; 111 delete item;
113 setSelected( currentItem(), TRUE ); 112 setSelected( currentItem(), TRUE );
@@ -120,3 +119,3 @@ void PlayListSelection::moveSelectedUp() {
120 if ( item && item->itemAbove() ) 119 if ( item && item->itemAbove() )
121 item->itemAbove()->moveItem( item ); 120 item->itemAbove()->moveItem( item );
122 ensureItemVisible( selectedItem() ); 121 ensureItemVisible( selectedItem() );
@@ -138,3 +137,3 @@ bool PlayListSelection::prev() {
138 else 137 else
139 return FALSE; 138 return FALSE;
140 ensureItemVisible( selectedItem() ); 139 ensureItemVisible( selectedItem() );
@@ -149,3 +148,3 @@ bool PlayListSelection::next() {
149 else 148 else
150 return FALSE; 149 return FALSE;
151 ensureItemVisible( selectedItem() ); 150 ensureItemVisible( selectedItem() );
@@ -160,3 +159,3 @@ bool PlayListSelection::first() {
160 else 159 else
161 return FALSE; 160 return FALSE;
162 ensureItemVisible( selectedItem() ); 161 ensureItemVisible( selectedItem() );
@@ -170,3 +169,3 @@ bool PlayListSelection::last() {
170 while ( ( item = item->nextSibling() ) ) 169 while ( ( item = item->nextSibling() ) )
171 prevItem = item; 170 prevItem = item;
172 if ( prevItem ) 171 if ( prevItem )
@@ -174,3 +173,3 @@ bool PlayListSelection::last() {
174 else 173 else
175 return FALSE; 174 return FALSE;
176 ensureItemVisible( selectedItem() ); 175 ensureItemVisible( selectedItem() );
diff --git a/core/multimedia/opieplayer/playlistselection.h b/core/multimedia/opieplayer/playlistselection.h
index 6ce6bdc..22d3c74 100644
--- a/core/multimedia/opieplayer/playlistselection.h
+++ b/core/multimedia/opieplayer/playlistselection.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -23,2 +23,3 @@
23 23
24
24#include <qlist.h> 25#include <qlist.h>
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 269aed8..0423e7a 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -19,2 +19,3 @@
19**********************************************************************/ 19**********************************************************************/
20
20#include <qpe/qpemenubar.h> 21#include <qpe/qpemenubar.h>
@@ -22,4 +23,2 @@
22#include <qpe/fileselector.h> 23#include <qpe/fileselector.h>
23#include <qpe/qpeapplication.h>
24
25#include <qpe/applnk.h> 24#include <qpe/applnk.h>
@@ -38,6 +37,2 @@
38#include <qtoolbutton.h> 37#include <qtoolbutton.h>
39#include <qtabwidget.h>
40#include <qlistview.h>
41#include <qpoint.h>
42//#include <qtimer.h>
43 38
@@ -49,5 +44,2 @@
49 44
50#define BUTTONS_ON_TOOLBAR
51#define SIDE_BUTTONS
52#define CAN_SAVE_LOAD_PLAYLISTS
53 45
@@ -55,8 +47,11 @@ extern MediaPlayerState *mediaPlayerState;
55 47
56// class myFileSelector {
57 48
58// };
59class PlayListWidgetPrivate { 49class PlayListWidgetPrivate {
60public: 50public:
61 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 51 QToolButton *tbPlay;
52 QToolButton *tbFull;
53 QToolButton *tbLoop;
54 QToolButton *tbScale;
55 QToolButton *tbShuffle;
56
62 QFrame *playListFrame; 57 QFrame *playListFrame;
@@ -72,10 +67,10 @@ public:
72 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 67 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
73 : QToolButton( parent, name ) { 68 : QToolButton( parent, name ) {
74 setTextLabel( name ); 69 setTextLabel( name );
75 setPixmap( Resource::loadPixmap( icon ) ); 70 setPixmap( Resource::loadPixmap( icon ) );
76 setAutoRaise( TRUE ); 71 setAutoRaise( TRUE );
77 setFocusPolicy( QWidget::NoFocus ); 72 setFocusPolicy( QWidget::NoFocus );
78 setToggleButton( t ); 73 setToggleButton( t );
79 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 74 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
80 QPEMenuToolFocusManager::manager()->addWidget( this ); 75 QPEMenuToolFocusManager::manager()->addWidget( this );
81 } 76 }
@@ -87,5 +82,5 @@ public:
87 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 82 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
88 : QAction( text, QString::null, 0, 0 ) { 83 : QAction( text, QString::null, 0, 0 ) {
89 connect( this, SIGNAL( activated() ), handler, slot ); 84 connect( this, SIGNAL( activated() ), handler, slot );
90 addTo( parent ); 85 addTo( parent );
91 } 86 }
@@ -100,4 +95,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
100 d->current = NULL; 95 d->current = NULL;
101// menuTimer = new QTimer( this ,"menu timer"),
102// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
103 96
@@ -105,3 +98,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
105 98
106 setCaption( tr("OpiePlayer") ); 99 setCaption( tr("MediaPlayer") );
107 setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); 100 setIcon( Resource::loadPixmap( "MPEGPlayer" ) );
@@ -120,154 +113,67 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
120 bar->setLabel( tr( "Play Operations" ) ); 113 bar->setLabel( tr( "Play Operations" ) );
121 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", 114#ifdef BUTTONS_ON_TOOLBAR
122 this , SLOT(addSelected()) ); 115 d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE );
123 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", 116 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
124 this , SLOT(removeSelected()) ); 117#endif
125 d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", 118 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE );
126 mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); 119 d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE );
127 120 d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE );
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 );
135 121
136 QPopupMenu *pmPlayList = new QPopupMenu( this ); 122 QPopupMenu *pmPlayList = new QPopupMenu( this );
137 menu->insertItem( tr( "File" ), pmPlayList ); 123 menu->insertItem( tr( "PlayList" ), pmPlayList );
124 new MenuItem( pmPlayList, tr( "Toggle PlayList" ), mediaPlayerState, SLOT( togglePlaylist() ) );
138 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 125 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
139 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 126 new MenuItem( pmPlayList, tr( "Add all music files" ), this, SLOT( addAllMusicToList() ) );
140 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 127 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
141 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 128 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
129#ifdef CAN_SAVE_LOAD_PLAYLISTS
142 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 130 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
143 new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); 131 new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) );
144 132#endif
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);
154 133
155 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 134 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");
173 135
174 // Add the playlist area 136 // Add the playlist area
175 137 QVBox *vbox3 = new QVBox( vbox5 ); vbox3->setBackgroundMode( PaletteButton );
176 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
177 d->playListFrame = vbox3; 138 d->playListFrame = vbox3;
178 d->playListFrame ->setMinimumSize(235,260); 139
140 QLabel *plString = new QLabel( tr(" PlayList"), vbox3 );
141 plString->setBackgroundMode( QButton::PaletteButton );
142 plString->setFont( QFont( "Helvetica", 8, QFont::Bold ) );
179 143
180 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 144 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
181 d->selectedFiles = new PlayListSelection( hbox2); 145 d->selectedFiles = new PlayListSelection( hbox2 );
182 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 146 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
183 147
184 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 148#ifndef BUTTONS_ON_TOOLBAR
185 new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 149 d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE );
186 new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 150 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
187 new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 151#endif
188 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 152 new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
189 153 new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
190 QWidget *aTab; 154 new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
191 aTab = new QWidget( tabWidget, "aTab" ); 155 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
192 audioView = new QListView( aTab, "Audioview" ); 156#ifndef BUTTONS_ON_TOOLBAR
193 audioView->setMinimumSize(233,260); 157 d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
194 audioView->addColumn( "Title",150); 158#endif
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/hda") != -1 ) storage="CF";
208 else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD";
209 else storage="RAM";
210 if ( QFile( dit.current()->file()).exists() ) {
211 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage);
212 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" ));
213 }
214 }
215// videowidget
216
217 QWidget *vTab;
218 vTab = new QWidget( tabWidget, "vTab" );
219 videoView = new QListView( vTab, "Videoview" );
220 videoView->setMinimumSize(233,260);
221
222 videoView->addColumn("Title",150);
223 videoView->addColumn("Size",45);
224 videoView->addColumn("Media",35);
225 videoView->setColumnAlignment(1, Qt::AlignRight);
226 videoView->setColumnAlignment(2, Qt::AlignRight);
227
228 tabWidget->insertTab( vTab,"Video");
229
230 Global::findDocuments(&vFiles, "video/*");
231 QListIterator<DocLnk> Vdit( vFiles.children() );
232 for ( ; Vdit.current(); ++Vdit ) {
233 if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF";
234 else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF";
235 else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD";
236 else storage="RAM";
237 QListViewItem * newItem;
238 if ( QFile( Vdit.current()->file()).exists() ) {
239 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
240 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" ));
241 }
242 }
243
244
245// d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE );
246// d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
247 159
248 // add the library area 160 // add the library area
161 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
249 162
250// d->files->setBackgroundMode( PaletteButton ); 163 QLabel *libString = new QLabel( tr(" Media Library"), vbox4 );
251// QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); 164 libString->setBackgroundMode( QButton::PaletteButton );
252 165 libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) );
253// #ifdef SIDE_BUTTONS
254// QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch
255// #endif
256 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
257
258// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
259// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
260 166
261 connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 167 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
262 connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 168 d->files = new FileSelector( "video/*;audio/*", hbox6, "Find Media Files", FALSE, FALSE );
169 d->files->setBackgroundMode( PaletteButton );
170 QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton );
263 171
264 connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), 172#ifdef SIDE_BUTTONS
265 this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); 173 new ToolButton( vbox7, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", d->selectedFiles, SLOT(addSelected()) );
266 connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), 174 new ToolButton( vbox7, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", d->selectedFiles, SLOT(removeSelected()) );
267 this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); 175 QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch
176#endif
268 177
269 connect( playlistView, SIGNAL( pressed( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 178 connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
270 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
271 // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
272 // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
273 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 179 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
@@ -275,7 +181,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
275 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 181 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
276 182 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbFull, SLOT( setOn( bool ) ) );
277// connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); 183 connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), d->tbScale, SLOT( setOn( bool ) ) );
278// connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); 184 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbScale, SLOT( setEnabled( bool ) ) );
279// connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) );
280
281 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 185 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
@@ -296,3 +200,3 @@ PlayListWidget::~PlayListWidget() {
296 if ( d->current ) 200 if ( d->current )
297 delete d->current; 201 delete d->current;
298 delete d; 202 delete d;
@@ -302,3 +206,2 @@ PlayListWidget::~PlayListWidget() {
302void PlayListWidget::initializeStates() { 206void PlayListWidget::initializeStates() {
303
304 d->tbPlay->setOn( mediaPlayerState->playing() ); 207 d->tbPlay->setOn( mediaPlayerState->playing() );
@@ -306,6 +209,6 @@ void PlayListWidget::initializeStates() {
306 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 209 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
307// d->tbFull->setOn( mediaPlayerState->fullscreen() ); 210 d->tbFull->setOn( mediaPlayerState->fullscreen() );
308// d->tbScale->setOn( mediaPlayerState->scaled() ); 211 d->tbScale->setOn( mediaPlayerState->scaled() );
309// d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); 212 d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
310// setPlaylist( mediaPlayerState->playlist() ); 213 setPlaylist( mediaPlayerState->playlist() );
311} 214}
@@ -319,7 +222,7 @@ void PlayListWidget::readConfig( Config& cfg ) {
319 for ( int i = 0; i < noOfFiles; i++ ) { 222 for ( int i = 0; i < noOfFiles; i++ ) {
320 QString entryName; 223 QString entryName;
321 entryName.sprintf( "File%i", i + 1 ); 224 entryName.sprintf( "File%i", i + 1 );
322 QString linkFile = cfg.readEntry( entryName ); 225 QString linkFile = cfg.readEntry( entryName );
323 DocLnk lnk( linkFile ); 226 DocLnk lnk( linkFile );
324 if ( lnk.isValid() ) 227 if ( lnk.isValid() )
325 d->selectedFiles->addToSelection( lnk ); 228 d->selectedFiles->addToSelection( lnk );
@@ -337,24 +240,24 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
337 do { 240 do {
338 const DocLnk *lnk = d->selectedFiles->current(); 241 const DocLnk *lnk = d->selectedFiles->current();
339 if ( lnk ) { 242 if ( lnk ) {
340 QString entryName; 243 QString entryName;
341 entryName.sprintf( "File%i", noOfFiles + 1 ); 244 entryName.sprintf( "File%i", noOfFiles + 1 );
342 cfg.writeEntry( entryName, lnk->linkFile() ); 245 cfg.writeEntry( entryName, lnk->linkFile() );
343 // if this link does exist, add it so we have the file 246 // if this link does exist, add it so we have the file
344 // next time... 247 // next time...
345 if ( !QFile::exists( lnk->linkFile() ) ) { 248 if ( !QFile::exists( lnk->linkFile() ) ) {
346 // the way writing lnks doesn't really check for out 249 // the way writing lnks doesn't really check for out
347 // of disk space, but check it anyway. 250 // of disk space, but check it anyway.
348 if ( !lnk->writeLink() ) { 251 if ( !lnk->writeLink() ) {
349 QMessageBox::critical( 0, tr("Out of space"), 252 QMessageBox::critical( 0, tr("Out of space"),
350 tr( "There was a problem saving " 253 tr( "There was a problem saving "
351 "the playlist.\n" 254 "the playlist.\n"
352 "Your playlist " 255 "Your playlist "
353 "may be missing some entries\n" 256 "may be missing some entries\n"
354 "the next time you start it." ) 257 "the next time you start it." )
355 ); 258 );
356 } 259 }
357 } 260 }
358 noOfFiles++; 261 noOfFiles++;
359 } 262 }
360 } while ( d->selectedFiles->next() ); 263 } while ( d->selectedFiles->next() );
@@ -366,3 +269,3 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
366void PlayListWidget::addToSelection( const DocLnk& lnk ) { 269void PlayListWidget::addToSelection( const DocLnk& lnk ) {
367 d->setDocumentUsed = FALSE; 270 d->setDocumentUsed = FALSE;
368 if ( mediaPlayerState->playlist() ) 271 if ( mediaPlayerState->playlist() )
@@ -370,13 +273,3 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
370 else 273 else
371 mediaPlayerState->setPlaying( TRUE ); 274 mediaPlayerState->setPlaying( TRUE );
372}
373
374
375void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) {
376 qDebug("add");
377// d->selectedFiles->addToSelection( lnk );
378 // }
379// else
380// mediaPlayerState->setPlaying( TRUE );
381//
382} 275}
@@ -386,3 +279,3 @@ void PlayListWidget::clearList() {
386 while ( first() ) 279 while ( first() )
387 d->selectedFiles->removeSelected(); 280 d->selectedFiles->removeSelected();
388} 281}
@@ -419,12 +312,12 @@ void PlayListWidget::setDocument(const QString& fileref) {
419 if ( fileref.isNull() ) { 312 if ( fileref.isNull() ) {
420 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 313 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
421 return; 314 return;
422 } 315 }
423 if ( mediaPlayerState->playlist() ) 316 if ( mediaPlayerState->playlist() )
424 addToSelection( DocLnk( fileref ) ); 317 addToSelection( DocLnk( fileref ) );
425 else { 318 else {
426 d->setDocumentUsed = TRUE; 319 d->setDocumentUsed = TRUE;
427 if ( d->current ) 320 if ( d->current )
428 delete d->current; 321 delete d->current;
429 d->current = new DocLnk( fileref ); 322 d->current = new DocLnk( fileref );
430 } 323 }
@@ -450,7 +343,7 @@ const DocLnk *PlayListWidget::current() {
450 if ( mediaPlayerState->playlist() ) 343 if ( mediaPlayerState->playlist() )
451 return d->selectedFiles->current(); 344 return d->selectedFiles->current();
452 else if ( d->setDocumentUsed && d->current ) { 345 else if ( d->setDocumentUsed && d->current ) {
453 return d->current; 346 return d->current;
454 } else 347 } else
455 return d->files->selected(); 348 return d->files->selected();
456} 349}
@@ -460,25 +353,25 @@ bool PlayListWidget::prev() {
460 if ( mediaPlayerState->playlist() ) { 353 if ( mediaPlayerState->playlist() ) {
461 if ( mediaPlayerState->shuffled() ) { 354 if ( mediaPlayerState->shuffled() ) {
462 const DocLnk *cur = current(); 355 const DocLnk *cur = current();
463 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 356 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
464 for ( int i = 0; i < j; i++ ) { 357 for ( int i = 0; i < j; i++ ) {
465 if ( !d->selectedFiles->next() ) 358 if ( !d->selectedFiles->next() )
466 d->selectedFiles->first(); 359 d->selectedFiles->first();
467 } 360 }
468 if ( cur == current() ) 361 if ( cur == current() )
469 if ( !d->selectedFiles->next() ) 362 if ( !d->selectedFiles->next() )
470 d->selectedFiles->first(); 363 d->selectedFiles->first();
471 return TRUE; 364 return TRUE;
472 } else { 365 } else {
473 if ( !d->selectedFiles->prev() ) { 366 if ( !d->selectedFiles->prev() ) {
474 if ( mediaPlayerState->looping() ) { 367 if ( mediaPlayerState->looping() ) {
475 return d->selectedFiles->last(); 368 return d->selectedFiles->last();
476 } else { 369 } else {
477 return FALSE; 370 return FALSE;
478 } 371 }
479 } 372 }
480 return TRUE; 373 return TRUE;
481 } 374 }
482 } else { 375 } else {
483 return mediaPlayerState->looping(); 376 return mediaPlayerState->looping();
484 } 377 }
@@ -489,16 +382,16 @@ bool PlayListWidget::next() {
489 if ( mediaPlayerState->playlist() ) { 382 if ( mediaPlayerState->playlist() ) {
490 if ( mediaPlayerState->shuffled() ) { 383 if ( mediaPlayerState->shuffled() ) {
491 return prev(); 384 return prev();
492 } else { 385 } else {
493 if ( !d->selectedFiles->next() ) { 386 if ( !d->selectedFiles->next() ) {
494 if ( mediaPlayerState->looping() ) { 387 if ( mediaPlayerState->looping() ) {
495 return d->selectedFiles->first(); 388 return d->selectedFiles->first();
389 } else {
390 return FALSE;
391 }
392 }
393 return TRUE;
394 }
496 } else { 395 } else {
497 return FALSE; 396 return mediaPlayerState->looping();
498 }
499 }
500 return TRUE;
501 }
502 } else {
503 return mediaPlayerState->looping();
504 } 397 }
@@ -509,5 +402,5 @@ bool PlayListWidget::first() {
509 if ( mediaPlayerState->playlist() ) 402 if ( mediaPlayerState->playlist() )
510 return d->selectedFiles->first(); 403 return d->selectedFiles->first();
511 else 404 else
512 return mediaPlayerState->looping(); 405 return mediaPlayerState->looping();
513} 406}
@@ -517,5 +410,5 @@ bool PlayListWidget::last() {
517 if ( mediaPlayerState->playlist() ) 410 if ( mediaPlayerState->playlist() )
518 return d->selectedFiles->last(); 411 return d->selectedFiles->last();
519 else 412 else
520 return mediaPlayerState->looping(); 413 return mediaPlayerState->looping();
521} 414}
@@ -543,5 +436,5 @@ void PlayListWidget::setPlaylist( bool shown ) {
543 if ( shown ) 436 if ( shown )
544 d->playListFrame->show(); 437 d->playListFrame->show();
545 else 438 else
546 d->playListFrame->hide(); 439 d->playListFrame->hide();
547} 440}
@@ -551,148 +444,6 @@ void PlayListWidget::setView( char view ) {
551 if ( view == 'l' ) 444 if ( view == 'l' )
552 showMaximized(); 445 showMaximized();
553 else 446 else
554 hide(); 447 hide();
555} 448}
556 449
557void PlayListWidget::addSelected() {
558// QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here");
559 int tabPage=tabWidget->currentPageIndex();
560 switch (tabPage) {
561 case 0: //playlist
562 break;
563 case 1: { //audio
564 addToSelection( audioView->selectedItem() );
565 }
566 break;
567 case 2: { // video
568 addToSelection( videoView->selectedItem() );
569 }
570 break;
571 };
572}
573
574void PlayListWidget::removeSelected() {
575 d->selectedFiles->removeSelected( );
576}
577
578
579void PlayListWidget::playIt( QListViewItem *it) {
580 d->setDocumentUsed = FALSE;
581
582 if(it) {
583 qDebug("playit");
584 int tabPage=tabWidget->currentPageIndex();
585 switch (tabPage) {
586 case 1: {
587 DocLnkSet files;
588 QListIterator<DocLnk> dit( files.children() );
589 for ( ; dit.current(); ++dit ) {
590 if( dit.current()->name() == it->text(0)) {
591 setDocument( dit.current()->name());
592 }
593 }
594 }
595 break;
596 case 2: {
597 DocLnkSet vFiles;
598 QListIterator<DocLnk> dit( vFiles.children() );
599 for ( ; dit.current(); ++dit ) {
600 qDebug(dit.current()->name());
601 if( dit.current()->name() == it->text(0)) {
602 qDebug(it->text(0));
603 setDocument( dit.current()->name());
604 }
605 }
606 }
607 break;
608 };
609 }
610}
611
612void PlayListWidget::addToSelection( QListViewItem *it) {
613 d->setDocumentUsed = FALSE;
614
615 if(it) {
616 qDebug("add to selection");
617 int tabPage=tabWidget->currentPageIndex();
618 switch (tabPage) {
619 case 1: {
620 QListIterator<DocLnk> dit( files.children() );
621 for ( ; dit.current(); ++dit ) {
622 if( dit.current()->name() == it->text(0)) {
623 d->selectedFiles->addToSelection( **dit );
624 }
625 }
626 }
627 break;
628 case 2: {
629 QListIterator<DocLnk> dit( vFiles.children() );
630 for ( ; dit.current(); ++dit ) {
631 qDebug(dit.current()->name());
632 if( dit.current()->name() == it->text(0)) {
633 d->selectedFiles->addToSelection( **dit );
634 }
635 }
636 }
637 break;
638 case 0:
639 break;
640 };
641 tabWidget->setCurrentPage(0);
642// mediaPlayerState->setPlaying( TRUE );
643 }
644}
645
646void PlayListWidget::tabChanged(QWidget *widg) {
647
648 int tabPage=tabWidget->currentPageIndex();
649 switch (tabPage) {
650 case 0:
651 {
652 d->tbRemoveFromList->setEnabled(TRUE);
653 d->tbAddToList->setEnabled(FALSE);
654 }
655 break;
656 case 1:
657 {
658 d->tbRemoveFromList->setEnabled(FALSE);
659 d->tbAddToList->setEnabled(TRUE);
660 }
661 break;
662 case 2:
663 {
664 d->tbRemoveFromList->setEnabled(FALSE);
665 d->tbAddToList->setEnabled(TRUE);
666 }
667 break;
668 };
669}
670
671// void PlayListWidget::cancelMenuTimer() {
672// if( menuTimer->isActive() )
673// menuTimer->stop();
674// }
675
676// void PlayListWidget::showFileMenu() {
677
678// }
679
680// void PlayListWidget::contentsMousePressEvent( QMouseEvent * e )
681// {
682// // QListView::contentsMousePressEvent( e );
683// menuTimer->start( 750, TRUE );
684// }
685
686
687// void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e )
688// {
689// // QListView::contentsMouseReleaseEvent( e );
690// menuTimer->stop();
691// }
692// // void PlayListWidget::setFullScreen() {
693// mediaPlayerState->toggleFullscreen( );
694// }
695
696// void PlayListWidget::setScaled() {
697// mediaPlayerState->toggleScaled();
698// }
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 6fe2211..819adb1 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -22,7 +22,4 @@
22 22
23
24#include <qmainwindow.h> 23#include <qmainwindow.h>
25#include <qpe/applnk.h> 24#include <qpe/applnk.h>
26#include <qtabwidget.h>
27/* #include <qtimer.h> */
28 25
@@ -31,7 +28,3 @@ class PlayListWidgetPrivate;
31class Config; 28class Config;
32class QListViewItem; 29
33class QListView;
34class QPoint;
35class QAction;
36class QLabel;
37 30
@@ -42,8 +35,3 @@ public:
42 ~PlayListWidget(); 35 ~PlayListWidget();
43 QTabWidget * tabWidget; 36
44 QAction *fullScreenButton, *scaleButton;
45 DocLnkSet files;
46 DocLnkSet vFiles;
47 QListView *audioView, *videoView, *playlistView;
48 QLabel *libString;
49 // retrieve the current playlist entry (media file link) 37 // retrieve the current playlist entry (media file link)
@@ -51,3 +39,2 @@ public:
51 void useSelectedDocument(); 39 void useSelectedDocument();
52/* QTimer * menuTimer; */
53 40
@@ -56,4 +43,2 @@ public slots:
56 void addToSelection( const DocLnk& ); // Add a media file to the playlist 43 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
59 void setActiveWindow(); // need to handle this to show the right view 44 void setActiveWindow(); // need to handle this to show the right view
@@ -67,3 +52,2 @@ public slots:
67 void loadList(); // Load a playlist 52 void loadList(); // Load a playlist
68 void playIt( QListViewItem *);
69 bool first(); 53 bool first();
@@ -72,10 +56,2 @@ public slots:
72 bool prev(); 56 bool prev();
73 void addSelected();
74 void removeSelected();
75 void tabChanged(QWidget*);
76/* void setFullScreen(); */
77/* void setScaled(); */
78protected:
79/* void contentsMousePressEvent( QMouseEvent * e ); */
80/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
81 57
@@ -86,8 +62,2 @@ private:
86 PlayListWidgetPrivate *d; // Private implementation data 62 PlayListWidgetPrivate *d; // Private implementation data
87
88protected slots:
89/* void cancelMenuTimer(); */
90/* void showFileMenu(); */
91
92
93}; 63};
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 1f128a4..12ae4fd 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -19,4 +19,5 @@
19**********************************************************************/ 19**********************************************************************/
20
20#include <qpe/resource.h> 21#include <qpe/resource.h>
21#include "mediaplayerplugininterface.h" 22#include <qpe/mediaplayerplugininterface.h>
22#include <qwidget.h> 23#include <qwidget.h>
@@ -68,3 +69,3 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
68 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { 69 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
69 setCaption( tr("OpiePlayer") ); 70 setCaption( tr("MediaPlayer") );
70 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 71 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) );
@@ -82,4 +83,4 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
82 83
83 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 84 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
84 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 85 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
85 86
@@ -103,3 +104,3 @@ VideoWidget::~VideoWidget() {
103 for ( int i = 0; i < 3; i++ ) 104 for ( int i = 0; i < 3; i++ )
104 delete pixmaps[i]; 105 delete pixmaps[i];
105 delete currentFrame; 106 delete currentFrame;
@@ -119,3 +120,3 @@ void VideoWidget::sliderReleased() {
119 if ( slider->width() == 0 ) 120 if ( slider->width() == 0 )
120 return; 121 return;
121 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 122 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
@@ -137,8 +138,8 @@ void VideoWidget::setView( char view ) {
137 if ( view == 'v' ) { 138 if ( view == 'v' ) {
138 makeVisible(); 139 makeVisible();
139 } else { 140 } else {
140 // Effectively blank the view next time we show it so it looks nicer 141 // Effectively blank the view next time we show it so it looks nicer
141 scaledWidth = 0; 142 scaledWidth = 0;
142 scaledHeight = 0; 143 scaledHeight = 0;
143 hide(); 144 hide();
144 } 145 }
@@ -150,3 +151,3 @@ void VideoWidget::updateSlider( long i, long max ) {
150 if ( max == 0 ) 151 if ( max == 0 )
151 return; 152 return;
152 int width = slider->width(); 153 int width = slider->width();
@@ -154,6 +155,6 @@ void VideoWidget::updateSlider( long i, long max ) {
154 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { 155 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) {
155 if ( slider->value() != val ) 156 if ( slider->value() != val )
156 slider->setValue( val ); 157 slider->setValue( val );
157 if ( slider->maxValue() != width ) 158 if ( slider->maxValue() != width )
158 slider->setMaxValue( width ); 159 slider->setMaxValue( width );
159 } 160 }
@@ -164,3 +165,3 @@ void VideoWidget::setToggleButton( int i, bool down ) {
164 if ( down != videoButtons[i].isDown ) 165 if ( down != videoButtons[i].isDown )
165 toggleButton( i ); 166 toggleButton( i );
166} 167}
@@ -186,32 +187,32 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
186 for ( int i = 0; i < numButtons; i++ ) { 187 for ( int i = 0; i < numButtons; i++ ) {
187 int x = videoButtons[i].xPos; 188 int x = videoButtons[i].xPos;
188 int y = videoButtons[i].yPos; 189 int y = videoButtons[i].yPos;
189 if ( event->state() == QMouseEvent::LeftButton ) { 190 if ( event->state() == QMouseEvent::LeftButton ) {
190 // The test to see if the mouse click is inside the circular button or not 191 // The test to see if the mouse click is inside the circular button or not
191 // (compared with the radius squared to avoid a square-root of our distance) 192 // (compared with the radius squared to avoid a square-root of our distance)
192 int radius = 16; 193 int radius = 16;
193 QPoint center = QPoint( x + radius, y + radius ); 194 QPoint center = QPoint( x + radius, y + radius );
194 QPoint dXY = center - event->pos(); 195 QPoint dXY = center - event->pos();
195 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); 196 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
196 bool isOnButton = dist <= (radius * radius); 197 bool isOnButton = dist <= (radius * radius);
197 if ( isOnButton != videoButtons[i].isHeld ) { 198 if ( isOnButton != videoButtons[i].isHeld ) {
198 videoButtons[i].isHeld = isOnButton; 199 videoButtons[i].isHeld = isOnButton;
199 toggleButton(i); 200 toggleButton(i);
200 } 201 }
201 } else { 202 } else {
202 if ( videoButtons[i].isHeld ) { 203 if ( videoButtons[i].isHeld ) {
203 videoButtons[i].isHeld = FALSE; 204 videoButtons[i].isHeld = FALSE;
204 if ( !videoButtons[i].isToggle ) 205 if ( !videoButtons[i].isToggle )
205 setToggleButton( i, FALSE ); 206 setToggleButton( i, FALSE );
206 switch (i) { 207 switch (i) {
207 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; 208 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
208 case VideoStop: mediaPlayerState->setPlaying(FALSE); return; 209 case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
209 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; 210 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
210 case VideoNext: mediaPlayerState->setNext(); return; 211 case VideoNext: mediaPlayerState->setNext(); return;
211 case VideoPrevious: mediaPlayerState->setPrev(); return; 212 case VideoPrevious: mediaPlayerState->setPrev(); return;
212 case VideoPlayList: mediaPlayerState->setList(); return; 213 case VideoPlayList: mediaPlayerState->setList(); return;
213 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 214 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
214 } 215 }
215 } 216 }
216 } 217 }
217 } 218 }
@@ -227,6 +228,6 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
227 if ( mediaPlayerState->fullscreen() ) { 228 if ( mediaPlayerState->fullscreen() ) {
228 mediaPlayerState->setFullscreen( FALSE ); 229 mediaPlayerState->setFullscreen( FALSE );
229 makeVisible(); 230 makeVisible();
230 } else { 231 } else {
231 mouseMoveEvent( event ); 232 mouseMoveEvent( event );
232 } 233 }
@@ -237,11 +238,11 @@ void VideoWidget::makeVisible() {
237 if ( mediaPlayerState->fullscreen() ) { 238 if ( mediaPlayerState->fullscreen() ) {
238 setBackgroundMode( QWidget::NoBackground ); 239 setBackgroundMode( QWidget::NoBackground );
239 showFullScreen(); 240 showFullScreen();
240 resize( qApp->desktop()->size() ); 241 resize( qApp->desktop()->size() );
241 slider->hide(); 242 slider->hide();
242 } else { 243 } else {
243 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 244 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) );
244 showNormal(); 245 showNormal();
245 showMaximized(); 246 showMaximized();
246 slider->show(); 247 slider->show();
247 } 248 }
@@ -254,25 +255,25 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
254 if ( mediaPlayerState->fullscreen() ) { 255 if ( mediaPlayerState->fullscreen() ) {
255 // Clear the background 256 // Clear the background
256 p.setBrush( QBrush( Qt::black ) ); 257 p.setBrush( QBrush( Qt::black ) );
257 p.drawRect( rect() ); 258 p.drawRect( rect() );
258 259
259 // Draw the current frame 260 // Draw the current frame
260 //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen 261 //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen
261 } else { 262 } else {
262 // draw border 263 // draw border
263 qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); 264 qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL );
264 265
265 // Clear the movie screen first 266 // Clear the movie screen first
266 p.setBrush( QBrush( Qt::black ) ); 267 p.setBrush( QBrush( Qt::black ) );
267 p.drawRect( 9, 20, 220, 160 ); 268 p.drawRect( 9, 20, 220, 160 );
268 269
269 // draw current frame (centrally positioned from scaling to maintain aspect ratio) 270 // draw current frame (centrally positioned from scaling to maintain aspect ratio)
270 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 271 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
271 272
272 // draw the buttons 273 // draw the buttons
273 for ( int i = 0; i < numButtons; i++ ) 274 for ( int i = 0; i < numButtons; i++ )
274 paintButton( &p, i ); 275 paintButton( &p, i );
275 276
276 // draw the slider 277 // draw the slider
277 slider->repaint( TRUE ); 278 slider->repaint( TRUE );
278 } 279 }
@@ -301,89 +302,89 @@ bool VideoWidget::playVideo() {
301#ifdef USE_DIRECT_PAINTER 302#ifdef USE_DIRECT_PAINTER
302 QDirectPainter p(this); 303 QDirectPainter p(this);
303 304
304 if ( ( qt_screen->transformOrientation() == 3 ) && 305 if ( ( qt_screen->transformOrientation() == 3 ) &&
305 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) { 306 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) {
306 307
307 w = 320; 308 w = 320;
308 h = 240; 309 h = 240;
309 310
310 if ( mediaPlayerState->scaled() ) { 311 if ( mediaPlayerState->scaled() ) {
311 // maintain aspect ratio 312 // maintain aspect ratio
312 if ( w * sh > sw * h ) 313 if ( w * sh > sw * h )
313 w = sw * h / sh; 314 w = sw * h / sh;
314 else 315 else
315 h = sh * w / sw; 316 h = sh * w / sw;
316 } else { 317 } else {
317 w = sw; 318 w = sw;
318 h = sh; 319 h = sh;
319 } 320 }
320 321
321 w--; // we can't allow libmpeg to overwrite. 322 w--; // we can't allow libmpeg to overwrite.
322 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); 323 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) );
323 324
324 int ox = roff.x() - height() + 2 + (height() - w) / 2; 325 int ox = roff.x() - height() + 2 + (height() - w) / 2;
325 int oy = roff.y() + (width() - h) / 2; 326 int oy = roff.y() + (width() - h) / 2;
326 int sx = 0, sy = 0; 327 int sx = 0, sy = 0;
327 328
328 uchar* fp = p.frameBuffer() + p.lineStep() * oy; 329 uchar* fp = p.frameBuffer() + p.lineStep() * oy;
329 fp += dd * ox / 8; 330 fp += dd * ox / 8;
330 uchar **jt = new uchar*[h]; 331 uchar **jt = new uchar*[h];
331 for ( int i = h; i; i-- ) { 332 for ( int i = h; i; i-- ) {
332 jt[h - i] = fp; 333 jt[h - i] = fp;
333 fp += p.lineStep(); 334 fp += p.lineStep();
334 } 335 }
335 336
336 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; 337 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0;
337 338
338 delete [] jt; 339 delete [] jt;
339 } else { 340 } else {
340#endif 341#endif
341 QPainter p(this); 342 QPainter p(this);
342 343
343 w = 320; 344 w = 320;
344 h = 240; 345 h = 240;
345 346
346 if ( mediaPlayerState->scaled() ) { 347 if ( mediaPlayerState->scaled() ) {
347 // maintain aspect ratio 348 // maintain aspect ratio
348 if ( w * sh > sw * h ) 349 if ( w * sh > sw * h )
349 w = sw * h / sh; 350 w = sw * h / sh;
350 else 351 else
351 h = sh * w / sw; 352 h = sh * w / sw;
352 } else { 353 } else {
353 w = sw; 354 w = sw;
354 h = sh; 355 h = sh;
355 } 356 }
356 357
357 int bytes = ( dd == 16 ) ? 2 : 4; 358 int bytes = ( dd == 16 ) ? 2 : 4;
358 QImage tempFrame( w, h, bytes << 3 ); 359 QImage tempFrame( w, h, bytes << 3 );
359 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), 360 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(),
360 0, 0, sw, sh, w, h, format, 0) == 0; 361 0, 0, sw, sh, w, h, format, 0) == 0;
361 if ( result && mediaPlayerState->fullscreen() ) { 362 if ( result && mediaPlayerState->fullscreen() ) {
362 363
363 int rw = h, rh = w; 364 int rw = h, rh = w;
364 QImage rotatedFrame( rw, rh, bytes << 3 ); 365 QImage rotatedFrame( rw, rh, bytes << 3 );
365 366
366 ushort* in = (ushort*)tempFrame.bits(); 367 ushort* in = (ushort*)tempFrame.bits();
367 ushort* out = (ushort*)rotatedFrame.bits(); 368 ushort* out = (ushort*)rotatedFrame.bits();
368 int spl = rotatedFrame.bytesPerLine() / bytes; 369 int spl = rotatedFrame.bytesPerLine() / bytes;
369 for (int x=0; x<h; x++) { 370 for (int x=0; x<h; x++) {
370 if ( bytes == 2 ) { 371 if ( bytes == 2 ) {
371 ushort* lout = out++ + (w - 1)*spl; 372 ushort* lout = out++ + (w - 1)*spl;
372 for (int y=0; y<w; y++) { 373 for (int y=0; y<w; y++) {
373 *lout=*in++; 374 *lout=*in++;
374 lout-=spl; 375 lout-=spl;
375 } 376 }
376 } else { 377 } else {
377 ulong* lout = ((ulong *)out)++ + (w - 1)*spl; 378 ulong* lout = ((ulong *)out)++ + (w - 1)*spl;
378 for (int y=0; y<w; y++) { 379 for (int y=0; y<w; y++) {
379 *lout=*((ulong*)in)++; 380 *lout=*((ulong*)in)++;
380 lout-=spl; 381 lout-=spl;
381 } 382 }
382 } 383 }
383 } 384 }
384 385
385 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); 386 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh );
386 } 387 }
387#ifdef USE_DIRECT_PAINTER 388#ifdef USE_DIRECT_PAINTER
388 } 389 }
389#endif 390#endif
@@ -391,27 +392,27 @@ bool VideoWidget::playVideo() {
391 392
392 w = 220; 393 w = 220;
393 h = 160; 394 h = 160;
394 395
395 // maintain aspect ratio 396 // maintain aspect ratio
396 if ( w * sh > sw * h ) 397 if ( w * sh > sw * h )
397 w = sw * h / sh; 398 w = sw * h / sh;
398 else 399 else
399 h = sh * w / sw; 400 h = sh * w / sw;
400 401
401 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; 402 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0;
402 403
403 QPainter p( this ); 404 QPainter p( this );
404 405
405 // Image changed size, therefore need to blank the possibly unpainted regions first 406 // Image changed size, therefore need to blank the possibly unpainted regions first
406 if ( scaledWidth != w || scaledHeight != h ) { 407 if ( scaledWidth != w || scaledHeight != h ) {
407 p.setBrush( QBrush( Qt::black ) ); 408 p.setBrush( QBrush( Qt::black ) );
408 p.drawRect( 9, 20, 220, 160 ); 409 p.drawRect( 9, 20, 220, 160 );
409 } 410 }
410 411
411 scaledWidth = w; 412 scaledWidth = w;
412 scaledHeight = h; 413 scaledHeight = h;
413 414
414 if ( result ) { 415 if ( result ) {
415 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 416 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
416 } 417 }
417 418
diff --git a/core/multimedia/opieplayer/videowidget.h b/core/multimedia/opieplayer/videowidget.h
index 8b49091..cf13743 100644
--- a/core/multimedia/opieplayer/videowidget.h
+++ b/core/multimedia/opieplayer/videowidget.h
@@ -1,5 +1,5 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
@@ -25,3 +25,2 @@
25 25
26
27class QPixmap; 26class QPixmap;
diff --git a/core/multimedia/opieplayer/wavplugin/Makefile.in b/core/multimedia/opieplayer/wavplugin/Makefile.in
index a46b925..bcbe7f2 100644
--- a/core/multimedia/opieplayer/wavplugin/Makefile.in
+++ b/core/multimedia/opieplayer/wavplugin/Makefile.in
@@ -102,4 +102,3 @@ REQUIRES=
102wavplugin.o: wavplugin.cpp \ 102wavplugin.o: wavplugin.cpp \
103 wavplugin.h \ 103 wavplugin.h
104 ../mediaplayerplugininterface.h
105 104
@@ -107,3 +106,2 @@ wavpluginimpl.o: wavpluginimpl.cpp \
107 wavplugin.h \ 106 wavplugin.h \
108 ../mediaplayerplugininterface.h \
109 wavpluginimpl.h 107 wavpluginimpl.h
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
index 7f63b3b..0be667f 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
@@ -19,4 +19,2 @@
19**********************************************************************/ 19**********************************************************************/
20// L.J.Potter added changes Fri 02-15-2002
21
22#include <stdio.h> 20#include <stdio.h>
@@ -29,3 +27,2 @@
29 27
30
31//#define debugMsg(a) qDebug(a) 28//#define debugMsg(a) qDebug(a)
@@ -51,3 +48,3 @@ struct ChunkData {
51 48
52const int sound_buffer_size = 512; // 4096; // you got to be kidding right? 49const int sound_buffer_size = 4096;
53 50
@@ -65,86 +62,97 @@ public:
65 int samples; 62 int samples;
66 63 int freq;
64 int chan;
65 int sampleRate;
66 int resolution;
67
67 WavPluginData() { 68 WavPluginData() {
68 max = out = sound_buffer_size; 69 max = out = sound_buffer_size;
69 wavedata_remaining = 0; 70 wavedata_remaining = 0;
70 samples_due = 0; 71 samples_due = 0;
71 samples = -1; 72 samples = -1;
72 } 73 }
73 74
74 // expands out samples to the frequency of 44kHz 75 // expands out samples to the frequency of 44kHz
75 bool add( short *output, long count, long& done, bool stereo ) 76 bool add( short *output, long count, long& done, bool stereo )
76 { 77 {
77 done = 0; 78 qDebug("add");
78 qApp->processEvents(); 79 done = 0;
79 80
80 if ( input == 0 ) { 81 if ( input == 0 ) {
81 qDebug("no input"); 82 qDebug("no input");
82 return FALSE;
83 }
84
85 while ( count ) {
86 int l,r;
87 if ( getSample(l, r) == FALSE ) {
88 qDebug("didn't get sample");
89 return FALSE; 83 return FALSE;
90 } 84 }
91 samples_due += chunkdata.samplesPerSec; 85
92 while ( count && (samples_due > chunkdata.samplesPerSec) ) { 86 while ( count ) {
93 *output++ = l; 87 int l,r;
94 if ( stereo ) 88 if ( getSample(l, r) == FALSE ) {
95 *output++ = r; 89 qDebug("didn't get sample");
96 samples_due -= chunkdata.samplesPerSec; 90 return FALSE;
97 count--; 91 }
98 done++; 92 samples_due += 44100;
93 while ( count && (samples_due > chunkdata.samplesPerSec) ) {
94 *output++ = l;
95 if ( stereo )
96 *output++ = r;
97 samples_due -= chunkdata.samplesPerSec;
98 count--;
99 done++;
100 }
99 } 101 }
102
103 return TRUE;
100 } 104 }
101 return TRUE;
102 }
103 105
104 bool initialise() { 106 bool initialise() {
105 if ( input == 0 ) 107 qDebug("initialize");
106 return FALSE; 108 if ( input == 0 )
109 return FALSE;
110
111 wavedata_remaining = -1;
112
113 while ( wavedata_remaining == -1 ) {
114 // Keep reading chunks...
115 const int n = sizeof(chunk) - sizeof(chunk.data);
116 int t = input->readBlock( (char*)&chunk, n );
117 if ( t != n ) {
118 if ( t == -1 )
119 return FALSE;
120 return TRUE;
121 }
122 if ( qstrncmp(chunk.id,"data",4) == 0 ) {
123 samples = wavedata_remaining = chunk.size;
124 } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) {
125 char d[4];
126 if ( input->readBlock(d,4) != 4 ) {
127 return FALSE;
128 }
129 if ( qstrncmp(d,"WAVE",4) != 0 ) {
130 // skip
131 if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size-4) ) {
132 return FALSE;
133 }
134 }
135 } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) {
136 if ( input->readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) {
137 return FALSE;
138 }
139#define WAVE_FORMAT_PCM 1
140 if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
141 qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
142 return FALSE;
143 }
144 }
107 145
108 wavedata_remaining = -1;
109 146
110 while ( wavedata_remaining == -1 ) { 147
111 // Keep reading chunks... 148
112 const int n = sizeof(chunk) - sizeof(chunk.data); 149 else {
113 int t = input->readBlock( (char*)&chunk, n ); 150 // ignored chunk
114 if ( t != n ) { 151 if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size) ) {
115 if ( t == -1 ) 152 return FALSE;
116 return FALSE; 153 }
117 return TRUE; 154 }
118 } 155 } // while
119 if ( qstrncmp(chunk.id,"data",4) == 0 ) { 156
120 samples = wavedata_remaining = chunk.size; 157 return TRUE;
121 } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) {
122 char d[4];
123 if ( input->readBlock(d,4) != 4 ) {
124 return FALSE;
125 }
126 if ( qstrncmp(d,"WAVE",4) != 0 ) {
127 // skip
128 if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size-4) ) {
129 return FALSE;
130 }
131 }
132 } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) {
133 if ( input->readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) {
134 return FALSE;
135 }
136#define WAVE_FORMAT_PCM 1
137 if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
138 qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
139 return FALSE;
140 }
141 } else {
142 // ignored chunk
143 if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size) ) {
144 return FALSE;
145 }
146 }
147 } // while
148 qDebug("bits %d", chunkdata.wBitsPerSample);
149 return TRUE;
150 } 158 }
@@ -152,43 +160,191 @@ public:
152 160
153 // gets a sample from the file 161 // gets a sample from the file
154 bool getSample(int& l, int& r) 162 bool getSample(int& l, int& r)
155 { 163 {
156 l = r = 0; 164 l = r = 0;
157 165
158 if ( input == 0 ) 166 if ( input == 0 )
159 return FALSE; 167 return FALSE;
160 168
161 if ( (wavedata_remaining < 0) || !max ) 169 if ( (wavedata_remaining < 0) || !max )
162 return FALSE; 170 return FALSE;
163 171
164 if ( out >= max ) { 172 if ( out >= max ) {
165 max = input->readBlock( (char*)data, (uint)QMIN(sound_buffer_size,wavedata_remaining) ); 173 max = input->readBlock( (char*)data, (uint)QMIN(sound_buffer_size,wavedata_remaining) );
166 174
167 wavedata_remaining -= max; 175 wavedata_remaining -= max;
168 176
169 out = 0; 177 out = 0;
170 if ( max <= 0 ) { 178 if ( max <= 0 ) {
171 max = 0; 179 max = 0;
172 return TRUE; 180 return TRUE;
173 } 181 }
174 } 182 }
175 if ( chunkdata.wBitsPerSample == 8 ) { 183 if ( resolution == 8 ) {
176 l = (data[out++] - 128) * 128; 184 l = (data[out++] - 128) * 128;
177 } else { 185 } else {
178 l = ((short*)data)[out/2]; 186 l = ((short*)data)[out/2];
179 out += 2; 187 out += 2;
180 } 188 }
181 if ( chunkdata.channels == 1 ) { 189 if ( chan == 1 ) {
182 r = l; 190 r = l;
183 } else { 191 } else {
184 if ( chunkdata.wBitsPerSample == 8 ) { 192 if ( resolution == 8 ) {
185 r = (data[out++] - 128) * 128; 193 r = (data[out++] - 128) * 128;
186 } else { 194 } else {
187 r = ((short*)data)[out/2]; 195 r = ((short*)data)[out/2];
188 out += 2; 196 out += 2;
189 } 197 }
190 } 198 }
191 return TRUE; 199 return TRUE;
192 } // getSample 200 } // getSample
201
202//////////////////////////////////////////////////////
203int getWavSettings(int fd)
204{ //this came from wmrecord
205
206 char t1[4];
207 unsigned long l1;
208 int found;
209 short fmt;
210 unsigned short ch, brate;
211 unsigned long srate;
212
213
214 /* First read in the RIFF identifier. If this is missing then the
215 * file is not a valid WAVE file.
216 */
217 if (read(fd, t1, 4)<4) {
218 qDebug(" Could not read from sound file.\n");
219 return -1;
220 }
221 if (strncmp(t1, "RIFF", 4)) {
222 qDebug(" not a valid WAV file.\n");
223 return -1;
224 }
225 /* Advance the file pointer to the next relevant field. */
226 lseek(fd, 4, SEEK_CUR);
227 /* Read in the WAVE identifier. */
228 if (read(fd, t1, 4)<4) {
229 qDebug("Could not read from sound file.\n");
230 return -1;
231 }
232 if (strncmp(t1, "WAVE", 4)) {
233 qDebug("not a valid WAV file.\n");
234 return -1;
235 }
193 236
237 /* Search through the file for the format chunk. If the end of the
238 * file is reached without finding the chunk, then the file is not a
239 * valid WAVE file.
240 */
241 found = 0;
242 while (!found) {
243 if (read(fd, t1, 4)<4) {
244 qDebug("Could not read from sound file.\n");
245 return -1;
246 }
247 if (strncmp(t1, "fmt ", 4)) {
248 /* Determine the length of the chunk found and skip to the next
249 * chunk. The chunk length is always stored in the four bytes
250 * following the chunk id.
251 */
252 if (read(fd, &l1, 4)<4) {
253 qDebug("Could not read from sound file.\n");
254 return -1;
255 }
256 lseek(fd, l1, SEEK_CUR);
257 }
258 else {
259 /* This is the format chunk, which stores the playback settings
260 * for the recording.
261 */
262 /* Skip the length field, since we don't really need it. */
263 lseek(fd, 4, SEEK_CUR);
264 /* Read in the format tag. If it has a value of 1, then there is
265 * no compression and we can attempt to play the file
266 * back. Otherwise, return.
267 */
268 if (read(fd, &fmt, 2)<2) {
269 qDebug("Could not read from format chunk.\n");
270 return -1;
271 }
272 if (fmt != 1) {
273 qDebug("Wave file contains compressed data."
274 " Unable to continue.\n");
275 return -1;
276 }
277 /* Get the stereo mode. */
278 if (read(fd, &ch, 2)<2) {
279 qDebug("Could not read from format chunk.\n");
280 return -1;
281 }
282 else {
283 chan = ch;
284 qDebug("File has %d channels", chan);
285 }
286 /* Get the sample rate. */
287 if (read(fd, &srate, 4)<4) {
288 qDebug("Could not read from format chunk.\n");
289 return -1;
290 }
291 else {
292 sampleRate = srate;
293 qDebug("File has samplerate of %d", sampleRate);
294 }
295 /* Get the bit rate. This is at the end of the format chunk. */
296 lseek(fd, 6, SEEK_CUR);
297 if (read(fd, &brate, 2)<2) {
298 qDebug("Could not read from format chunk.\n");
299 return -1;
300 }
301 else {
302 resolution = brate;
303 qDebug("File has bitrate of %d", resolution);
304 }
305
306 found++;
307 }
308 }
309
310 /* Search through the file for the data chunk. If the end of the
311 * file is reached without finding the chunk, then the file is not a
312 * valid WAVE file.
313 */
314 found = 0;
315 while (!found) {
316 if (read(fd, t1, 4)<4) {
317 qDebug("Could not read from sound file.\n");
318 return -1;
319 }
320 if (strncmp(t1, "data", 4)) {
321 /* Determine the length of the chunk found and skip to the next
322 * chunk. The chunk length is always stored in the four bytes
323 * following the chunk id.
324 */
325 if (read(fd, &l1, 4)<4) {
326 qDebug("Could not read from sound file.\n");
327 return -1;
328 }
329 lseek(fd, l1, SEEK_CUR);
330 }
331 else {
332 /* This is the data chunk, which stores the recording. */
333 /* Get the length field. */
334 if (read(fd, &l1, 4)<4) {
335 qDebug("Could not read from sound file.\n");
336 return -1;
337 }
338 else {
339 samples =l1;
340 qDebug("file has length of %d\nlasting %d seconds",l1, (( l1 / sampleRate) / chan) / 2 ); // ????
341 return l1;
342 }
343 }
344 }
345
346 return 0;
347}
348
349//////////////////////////////////////////////////
194}; 350};
@@ -209,3 +365,3 @@ WavPlugin::~WavPlugin() {
209bool WavPlugin::isFileSupported( const QString& path ) { 365bool WavPlugin::isFileSupported( const QString& path ) {
210// qDebug( "WavPlugin::isFileSupported" ); 366 debugMsg( "WavPlugin::isFileSupported" );
211 367
@@ -228,3 +384,3 @@ bool WavPlugin::isFileSupported( const QString& path ) {
228bool WavPlugin::open( const QString& path ) { 384bool WavPlugin::open( const QString& path ) {
229// qDebug( "WavPlugin::open" ); 385 qDebug( "WavPlugin::open" );
230 386
@@ -236,8 +392,9 @@ bool WavPlugin::open( const QString& path ) {
236 if ( d->input->open(IO_ReadOnly) == FALSE ) { 392 if ( d->input->open(IO_ReadOnly) == FALSE ) {
237 qDebug("couldn't open file"); 393 qDebug("couldn't open file");
238 delete d->input; 394 delete d->input;
239 d->input = 0; 395 d->input = 0;
240 return FALSE; 396 return FALSE;
241 } 397 }
242 398
399// d->getWavSettings( d->input.handle());
243 d->initialise(); 400 d->initialise();
@@ -249,3 +406,3 @@ bool WavPlugin::open( const QString& path ) {
249bool WavPlugin::close() { 406bool WavPlugin::close() {
250// qDebug( "WavPlugin::close" ); 407 qDebug( "WavPlugin::close" );
251 408
@@ -259,3 +416,3 @@ bool WavPlugin::close() {
259bool WavPlugin::isOpen() { 416bool WavPlugin::isOpen() {
260// qDebug( "WavPlugin::isOpen" ); 417 qDebug( "WavPlugin::isOpen" );
261 return ( d->input != 0 ); 418 return ( d->input != 0 );
@@ -265,3 +422,3 @@ bool WavPlugin::isOpen() {
265int WavPlugin::audioStreams() { 422int WavPlugin::audioStreams() {
266// qDebug( "WavPlugin::audioStreams" ); 423 qDebug( "WavPlugin::audioStreams" );
267 return 1; 424 return 1;
@@ -271,4 +428,4 @@ int WavPlugin::audioStreams() {
271int WavPlugin::audioChannels( int ) { 428int WavPlugin::audioChannels( int ) {
272// qDebug( "WavPlugin::audioChannels" ); 429 debugMsg( "WavPlugin::audioChannels" );
273 return d->chunkdata.channels;// 2; // ### Always scale audio to stereo samples 430 return d->chan;
274} 431}
@@ -277,4 +434,4 @@ int WavPlugin::audioChannels( int ) {
277int WavPlugin::audioFrequency( int ) { 434int WavPlugin::audioFrequency( int ) {
278// qDebug( "WavPlugin::audioFrequency %d", d->chunkdata.samplesPerSec ); 435 qDebug( "WavPlugin::audioFrequency" );
279 return d->chunkdata.samplesPerSec; //44100; // ### Always scale to frequency of 44100 436 return d->freq;
280} 437}
@@ -283,5 +440,6 @@ int WavPlugin::audioFrequency( int ) {
283int WavPlugin::audioSamples( int ) { 440int WavPlugin::audioSamples( int ) {
284// qDebug( "WavPlugin::audioSamples" ); 441 qDebug( "WavPlugin::audioSamples" );
285 return d->samples / d->chunkdata.channels/2; // ### Scaled samples will be made stereo, 442 return d->samples;
286 // Therefore if source is mono we will double the number of samples 443// return d->samples * 2 / d->chunkdata.channels; // ### Scaled samples will be made stereo,
444// // Therefore if source is mono we will double the number of samples
287} 445}
@@ -290,3 +448,3 @@ int WavPlugin::audioSamples( int ) {
290bool WavPlugin::audioSetSample( long, int ) { 448bool WavPlugin::audioSetSample( long, int ) {
291// qDebug( "WavPlugin::audioSetSample" ); 449 qDebug( "WavPlugin::audioSetSample" );
292 return FALSE; 450 return FALSE;
@@ -296,3 +454,3 @@ bool WavPlugin::audioSetSample( long, int ) {
296long WavPlugin::audioGetSample( int ) { 454long WavPlugin::audioGetSample( int ) {
297// qDebug( "WavPlugin::audioGetSample" ); 455 qDebug( "WavPlugin::audioGetSample" );
298 return 0; 456 return 0;
@@ -326,3 +484,3 @@ bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& sampl
326bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { 484bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) {
327// qDebug( "WavPlugin::audioReadSamples" ); 485 qDebug( "WavPlugin::audioReadSamples" );
328 return d->add( output, samples, samplesMade, channels != 1 ); 486 return d->add( output, samples, samplesMade, channels != 1 );
@@ -331,3 +489,3 @@ bool WavPlugin::audioReadSamples( short *output, int channels, long samples, lon
331double WavPlugin::getTime() { 489double WavPlugin::getTime() {
332// qDebug( "WavPlugin::getTime" ); 490 qDebug( "WavPlugin::getTime" );
333 return 0.0; 491 return 0.0;
@@ -335,7 +493,2 @@ double WavPlugin::getTime() {
335 493
336int WavPlugin::audioBitsPerSample( int ) {
337// qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample );
338 return d->chunkdata.wBitsPerSample; //
339}
340
341 494
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.h b/core/multimedia/opieplayer/wavplugin/wavplugin.h
index 6afd67e..19d1a8e 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.h
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.h
@@ -19,4 +19,2 @@
19**********************************************************************/ 19**********************************************************************/
20// L.J.Potter added changes Fri 02-15-2002
21
22#ifndef WAV_PLUGIN_H 20#ifndef WAV_PLUGIN_H
@@ -24,6 +22,5 @@
24 22
25
26#include <qstring.h> 23#include <qstring.h>
27#include <qapplication.h> 24#include <qapplication.h>
28#include "../mediaplayerplugininterface.h" 25#include <qpe/mediaplayerplugininterface.h>
29 26
@@ -56,3 +53,2 @@ public:
56 int audioFrequency( int stream ); 53 int audioFrequency( int stream );
57 int audioBitsPerSample( int stream );
58 int audioSamples( int stream ); 54 int audioSamples( int stream );
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
index 1f7b85b..2923180 100644
--- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
@@ -22,3 +22,2 @@
22 22
23
24WavPluginImpl::WavPluginImpl() 23WavPluginImpl::WavPluginImpl()
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
index ee32f54..71f5f20 100644
--- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
+++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
@@ -22,4 +22,3 @@
22 22
23 23#include <qpe/mediaplayerplugininterface.h>
24#include "../mediaplayerplugininterface.h"
25 24