author | llornkcor <llornkcor> | 2002-02-25 05:10:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 05:10:32 (UTC) |
commit | 1bebd27631a6c9d1ab967cbb32dd4e796b3b0402 (patch) (unidiff) | |
tree | 8ce49800cba26f6f2c33de74a71d4efe0338843f | |
parent | d948361c1b475fab4660b28fbf5ec21fd34d923f (diff) | |
download | opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.zip opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.tar.gz opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.tar.bz2 |
fixed 2
27 files changed, 432 insertions, 182 deletions
diff --git a/core/multimedia/opieplayer/Makefile.in b/core/multimedia/opieplayer/Makefile.in index 1d2ff5e..e8ccc34 100644 --- a/core/multimedia/opieplayer/Makefile.in +++ b/core/multimedia/opieplayer/Makefile.in | |||
@@ -133,26 +133,30 @@ REQUIRES= | |||
133 | 133 | ||
134 | 134 | ||
135 | ####### Compile | 135 | ####### Compile |
136 | 136 | ||
137 | main.o: main.cpp \ | 137 | main.o: main.cpp \ |
138 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 138 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
139 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
140 | $(OPIEDIR)/include/timestring.h \ | ||
139 | mediaplayerstate.h \ | 141 | mediaplayerstate.h \ |
140 | playlistwidget.h \ | 142 | playlistwidget.h \ |
141 | $(OPIEDIR)/include/qpe/applnk.h \ | 143 | $(OPIEDIR)/include/qpe/applnk.h \ |
142 | audiowidget.h \ | 144 | audiowidget.h \ |
143 | videowidget.h \ | 145 | videowidget.h \ |
144 | loopcontrol.h \ | 146 | loopcontrol.h \ |
145 | mediaplayer.h \ | 147 | mediaplayer.h \ |
146 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 148 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
147 | $(OPIEDIR)/include/qpe/qcom.h \ | 149 | $(OPIEDIR)/include/qpe/qcom.h \ |
148 | $(OPIEDIR)/include/qpe/quuid.h | 150 | $(OPIEDIR)/include/qpe/quuid.h \ |
151 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h | ||
149 | 152 | ||
150 | loopcontrol.o: loopcontrol.cpp \ | 153 | loopcontrol.o: loopcontrol.cpp \ |
151 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 154 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
152 | $(OPIEDIR)/include/qpe/qcopenvelope_qws.h \ | 155 | $(OPIEDIR)/include/qpedecoration_qws.h \ |
156 | $(OPIEDIR)/include/timestring.h \ | ||
153 | loopcontrol.h \ | 157 | loopcontrol.h \ |
154 | videowidget.h \ | 158 | videowidget.h \ |
155 | audiodevice.h \ | 159 | audiodevice.h \ |
156 | mediaplayerplugininterface.h \ | 160 | mediaplayerplugininterface.h \ |
157 | $(OPIEDIR)/include/qpe/qcom.h \ | 161 | $(OPIEDIR)/include/qpe/qcom.h \ |
158 | $(OPIEDIR)/include/qpe/quuid.h \ | 162 | $(OPIEDIR)/include/qpe/quuid.h \ |
@@ -162,63 +166,78 @@ playlistselection.o: playlistselection.cpp \ | |||
162 | $(OPIEDIR)/include/qpe/applnk.h \ | 166 | $(OPIEDIR)/include/qpe/applnk.h \ |
163 | $(OPIEDIR)/include/qpe/resource.h \ | 167 | $(OPIEDIR)/include/qpe/resource.h \ |
164 | playlistselection.h | 168 | playlistselection.h |
165 | 169 | ||
166 | mediaplayerstate.o: mediaplayerstate.cpp \ | 170 | mediaplayerstate.o: mediaplayerstate.cpp \ |
167 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 171 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
172 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
173 | $(OPIEDIR)/include/timestring.h \ | ||
168 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 174 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
169 | $(OPIEDIR)/include/qpe/qcom.h \ | 175 | $(OPIEDIR)/include/qpe/qcom.h \ |
170 | $(OPIEDIR)/include/qpe/quuid.h \ | 176 | $(OPIEDIR)/include/qpe/quuid.h \ |
171 | $(OPIEDIR)/include/qpe/config.h \ | 177 | $(OPIEDIR)/include/qpe/config.h \ |
178 | mediaplayerplugininterface.h \ | ||
172 | mediaplayerstate.h \ | 179 | mediaplayerstate.h \ |
173 | libmad/libmadpluginimpl.h \ | 180 | libmad/libmadpluginimpl.h \ |
174 | libmpeg3/libmpeg3pluginimpl.h \ | 181 | libmpeg3/libmpeg3pluginimpl.h \ |
175 | wavplugin/wavpluginimpl.h | 182 | wavplugin/wavpluginimpl.h |
176 | 183 | ||
177 | videowidget.o: videowidget.cpp \ | 184 | videowidget.o: videowidget.cpp \ |
178 | $(OPIEDIR)/include/qpe/resource.h \ | 185 | $(OPIEDIR)/include/qpe/resource.h \ |
186 | mediaplayerplugininterface.h \ | ||
187 | $(OPIEDIR)/include/qpe/qcom.h \ | ||
188 | $(OPIEDIR)/include/qpe/quuid.h \ | ||
179 | videowidget.h \ | 189 | videowidget.h \ |
180 | mediaplayerstate.h | 190 | mediaplayerstate.h |
181 | 191 | ||
182 | audiowidget.o: audiowidget.cpp \ | 192 | audiowidget.o: audiowidget.cpp \ |
183 | $(OPIEDIR)/include/qpe/resource.h \ | 193 | $(OPIEDIR)/include/qpe/resource.h \ |
184 | audiowidget.h \ | 194 | audiowidget.h \ |
185 | mediaplayerstate.h | 195 | mediaplayerstate.h |
186 | 196 | ||
187 | playlistwidget.o: playlistwidget.cpp \ | 197 | playlistwidget.o: playlistwidget.cpp \ |
188 | $(OPIEDIR)/include/qpe/qpemenubar.h \ | 198 | $(OPIEDIR)/include/qpe/qpemenubar.h \ |
189 | $(OPIEDIR)/include/qpe/qpetoolbar.h \ | 199 | $(OPIEDIR)/include/qpe/qpetoolbar.h \ |
190 | $(OPIEDIR)/include/qpe/fileselector.h \ | 200 | $(OPIEDIR)/include/qpe/fileselector.h \ |
201 | $(OPIEDIR)/include/filemanager.h \ | ||
202 | $(OPIEDIR)/include/applnk.h \ | ||
203 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | ||
204 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
205 | $(OPIEDIR)/include/timestring.h \ | ||
191 | $(OPIEDIR)/include/qpe/applnk.h \ | 206 | $(OPIEDIR)/include/qpe/applnk.h \ |
192 | $(OPIEDIR)/include/qpe/config.h \ | 207 | $(OPIEDIR)/include/qpe/config.h \ |
193 | $(OPIEDIR)/include/qpe/global.h \ | 208 | $(OPIEDIR)/include/qpe/global.h \ |
194 | $(OPIEDIR)/include/qpe/resource.h \ | 209 | $(OPIEDIR)/include/qpe/resource.h \ |
195 | playlistselection.h \ | 210 | playlistselection.h \ |
196 | playlistwidget.h \ | 211 | playlistwidget.h \ |
197 | mediaplayerstate.h | 212 | mediaplayerstate.h |
198 | 213 | ||
199 | mediaplayer.o: mediaplayer.cpp \ | 214 | mediaplayer.o: mediaplayer.cpp \ |
200 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 215 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
216 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
217 | $(OPIEDIR)/include/timestring.h \ | ||
201 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 218 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
202 | $(OPIEDIR)/include/qpe/qcom.h \ | 219 | $(OPIEDIR)/include/qpe/qcom.h \ |
203 | $(OPIEDIR)/include/qpe/quuid.h \ | 220 | $(OPIEDIR)/include/qpe/quuid.h \ |
204 | $(OPIEDIR)/include/qpe/resource.h \ | 221 | $(OPIEDIR)/include/qpe/resource.h \ |
205 | $(OPIEDIR)/include/qpe/config.h \ | 222 | $(OPIEDIR)/include/qpe/config.h \ |
206 | mediaplayer.h \ | 223 | mediaplayer.h \ |
224 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h \ | ||
207 | playlistwidget.h \ | 225 | playlistwidget.h \ |
208 | $(OPIEDIR)/include/qpe/applnk.h \ | 226 | $(OPIEDIR)/include/qpe/applnk.h \ |
209 | audiowidget.h \ | 227 | audiowidget.h \ |
210 | loopcontrol.h \ | 228 | loopcontrol.h \ |
211 | audiodevice.h \ | 229 | audiodevice.h \ |
212 | mediaplayerstate.h | 230 | mediaplayerstate.h |
213 | 231 | ||
214 | audiodevice.o: audiodevice.cpp \ | 232 | audiodevice.o: audiodevice.cpp \ |
215 | $(OPIEDIR)/include/qpe/qpeapplication.h \ | 233 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
234 | $(OPIEDIR)/include/qpedecoration_qws.h \ | ||
235 | $(OPIEDIR)/include/timestring.h \ | ||
216 | $(OPIEDIR)/include/qpe/config.h \ | 236 | $(OPIEDIR)/include/qpe/config.h \ |
217 | audiodevice.h \ | 237 | audiodevice.h |
218 | $(OPIEDIR)/include/qpe/qcopenvelope_qws.h | ||
219 | 238 | ||
220 | moc_loopcontrol.o: moc_loopcontrol.cpp \ | 239 | moc_loopcontrol.o: moc_loopcontrol.cpp \ |
221 | loopcontrol.h | 240 | loopcontrol.h |
222 | 241 | ||
223 | moc_playlistselection.o: moc_playlistselection.cpp \ | 242 | moc_playlistselection.o: moc_playlistselection.cpp \ |
224 | playlistselection.h \ | 243 | playlistselection.h \ |
@@ -238,13 +257,14 @@ moc_playlistwidget.o: moc_playlistwidget.cpp \ | |||
238 | $(OPIEDIR)/include/qpe/applnk.h | 257 | $(OPIEDIR)/include/qpe/applnk.h |
239 | 258 | ||
240 | moc_mediaplayer.o: moc_mediaplayer.cpp \ | 259 | moc_mediaplayer.o: moc_mediaplayer.cpp \ |
241 | mediaplayer.h \ | 260 | mediaplayer.h \ |
242 | $(OPIEDIR)/include/qpe/qlibrary.h \ | 261 | $(OPIEDIR)/include/qpe/qlibrary.h \ |
243 | $(OPIEDIR)/include/qpe/qcom.h \ | 262 | $(OPIEDIR)/include/qpe/qcom.h \ |
244 | $(OPIEDIR)/include/qpe/quuid.h | 263 | $(OPIEDIR)/include/qpe/quuid.h \ |
264 | $(OPIEDIR)/include/qpe/mediaplayerplugininterface.h | ||
245 | 265 | ||
246 | moc_audiodevice.o: moc_audiodevice.cpp \ | 266 | moc_audiodevice.o: moc_audiodevice.cpp \ |
247 | audiodevice.h | 267 | audiodevice.h |
248 | 268 | ||
249 | moc_loopcontrol.cpp: loopcontrol.h | 269 | moc_loopcontrol.cpp: loopcontrol.h |
250 | $(MOC) loopcontrol.h -o moc_loopcontrol.cpp | 270 | $(MOC) loopcontrol.h -o moc_loopcontrol.cpp |
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 7b3700a..9a10eb4 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -14,14 +14,16 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added better error code Fri 02-15-2002 14:37:47 | ||
20 | 21 | ||
21 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <stdio.h> | ||
22 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
24 | #include "audiodevice.h" | 26 | #include "audiodevice.h" |
25 | 27 | ||
26 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 28 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
27 | #include "qpe/qcopenvelope_qws.h" | 29 | #include "qpe/qcopenvelope_qws.h" |
@@ -103,23 +105,24 @@ void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume | |||
103 | formatData.nBlockAlign = 4; | 105 | formatData.nBlockAlign = 4; |
104 | formatData.nChannels = 2; | 106 | formatData.nChannels = 2; |
105 | formatData.nSamplesPerSec = 44000; | 107 | formatData.nSamplesPerSec = 44000; |
106 | formatData.wBitsPerSample = 16; | 108 | formatData.wBitsPerSample = 16; |
107 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); | 109 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); |
108 | if ( waveOutGetVolume( handle, (LPDWORD)&volume ) ) | 110 | if ( waveOutGetVolume( handle, (LPDWORD)&volume ) ) |
109 | qDebug( "get volume of audio device failed" ); | 111 | // qDebug( "get volume of audio device failed" ); |
110 | waveOutClose( handle ); | 112 | waveOutClose( handle ); |
111 | leftVolume = volume & 0xFFFF; | 113 | leftVolume = volume & 0xFFFF; |
112 | rightVolume = volume >> 16; | 114 | rightVolume = volume >> 16; |
113 | #else | 115 | #else |
114 | int mixerHandle = open( "/dev/mixer", O_RDWR ); | 116 | int mixerHandle = open( "/dev/mixer", O_RDWR ); |
115 | if ( mixerHandle >= 0 ) { | 117 | if ( mixerHandle >= 0 ) { |
116 | ioctl( mixerHandle, MIXER_READ(0), &volume ); | 118 | if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1) |
119 | perror("ioctl(\"MIXER_READ\")"); | ||
117 | close( mixerHandle ); | 120 | close( mixerHandle ); |
118 | } else | 121 | } else |
119 | qDebug( "get volume of audio device failed" ); | 122 | perror("open(\"/dev/mixer\")"); |
120 | leftVolume = ((volume & 0x00FF) << 16) / 101; | 123 | leftVolume = ((volume & 0x00FF) << 16) / 101; |
121 | rightVolume = ((volume & 0xFF00) << 8) / 101; | 124 | rightVolume = ((volume & 0xFF00) << 8) / 101; |
122 | #endif | 125 | #endif |
123 | } | 126 | } |
124 | 127 | ||
125 | 128 | ||
@@ -144,27 +147,29 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
144 | formatData.nChannels = 2; | 147 | formatData.nChannels = 2; |
145 | formatData.nSamplesPerSec = 44000; | 148 | formatData.nSamplesPerSec = 44000; |
146 | formatData.wBitsPerSample = 16; | 149 | formatData.wBitsPerSample = 16; |
147 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); | 150 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); |
148 | unsigned int volume = (rightVolume << 16) | leftVolume; | 151 | unsigned int volume = (rightVolume << 16) | leftVolume; |
149 | if ( waveOutSetVolume( handle, volume ) ) | 152 | if ( waveOutSetVolume( handle, volume ) ) |
150 | qDebug( "set volume of audio device failed" ); | 153 | // qDebug( "set volume of audio device failed" ); |
151 | waveOutClose( handle ); | 154 | waveOutClose( handle ); |
152 | #else | 155 | #else |
153 | // Volume can be from 0 to 100 which is 101 distinct values | 156 | // Volume can be from 0 to 100 which is 101 distinct values |
154 | unsigned int rV = (rightVolume * 101) >> 16; | 157 | unsigned int rV = (rightVolume * 101) >> 16; |
155 | 158 | ||
156 | # if 0 | 159 | # if 0 |
157 | unsigned int lV = (leftVolume * 101) >> 16; | 160 | unsigned int lV = (leftVolume * 101) >> 16; |
158 | unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); | 161 | unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); |
159 | int mixerHandle = 0; | 162 | int mixerHandle = 0; |
160 | if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 163 | if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
161 | ioctl( mixerHandle, MIXER_WRITE(0), &volume ); | 164 | if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) |
165 | perror("ioctl(\"MIXER_WRITE\")"); | ||
162 | close( mixerHandle ); | 166 | close( mixerHandle ); |
163 | } else | 167 | } else |
164 | qDebug( "set volume of audio device failed" ); | 168 | perror("open(\"/dev/mixer\")"); |
169 | |||
165 | # else | 170 | # else |
166 | // This is the way this has to be done now I guess, doesn't allow for | 171 | // This is the way this has to be done now I guess, doesn't allow for |
167 | // independant right and left channel setting, or setting for different outputs | 172 | // independant right and left channel setting, or setting for different outputs |
168 | Config cfg("Sound"); | 173 | Config cfg("Sound"); |
169 | cfg.setGroup("System"); | 174 | cfg.setGroup("System"); |
170 | cfg.writeEntry("Volume",(int)rV); | 175 | cfg.writeEntry("Volume",(int)rV); |
@@ -183,74 +188,53 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
183 | 188 | ||
184 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | 189 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { |
185 | d = new AudioDevicePrivate; | 190 | d = new AudioDevicePrivate; |
186 | d->frequency = f; | 191 | d->frequency = f; |
187 | d->channels = chs; | 192 | d->channels = chs; |
188 | d->bytesPerSample = bps; | 193 | d->bytesPerSample = bps; |
194 | // qDebug("%d",bps); | ||
195 | int format=0; | ||
196 | if( bps == 8) format = AFMT_U8; | ||
197 | else if( bps <= 0) format = AFMT_S16_LE; | ||
198 | else format = AFMT_S16_LE; | ||
189 | 199 | ||
200 | // qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); | ||
190 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 201 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
191 | 202 | ||
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 | ||
225 | 203 | ||
226 | int fragments = 0x10000 * 8 + sound_fragment_shift; | 204 | int fragments = 0x10000 * 8 + sound_fragment_shift; |
227 | int format = AFMT_S16_LE; | ||
228 | int capabilities = 0; | 205 | int capabilities = 0; |
229 | 206 | ||
230 | #ifdef KEEP_DEVICE_OPEN | 207 | #ifdef KEEP_DEVICE_OPEN |
231 | if ( AudioDevicePrivate::dspFd == 0 ) { | 208 | if ( AudioDevicePrivate::dspFd == 0 ) { |
232 | #endif | 209 | #endif |
233 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { | 210 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { |
234 | qDebug( "error opening audio device /dev/dsp, sending data to /dev/null instead" ); | 211 | perror("open(\"/dev/dsp\") sending to /dev/null instead"); |
235 | d->handle = ::open( "/dev/null", O_WRONLY ); | 212 | d->handle = ::open( "/dev/null", O_WRONLY ); |
236 | } | 213 | } |
237 | #ifdef KEEP_DEVICE_OPEN | 214 | #ifdef KEEP_DEVICE_OPEN |
238 | AudioDevicePrivate::dspFd = d->handle; | 215 | AudioDevicePrivate::dspFd = d->handle; |
239 | } else { | 216 | } else { |
240 | d->handle = AudioDevicePrivate::dspFd; | 217 | d->handle = AudioDevicePrivate::dspFd; |
241 | } | 218 | } |
242 | #endif | 219 | #endif |
243 | 220 | ||
244 | ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities ); | 221 | if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1) |
245 | ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments ); | 222 | perror("ioctl(\"SNDCTL_DSP_GETCAPS\")"); |
246 | ioctl( d->handle, SNDCTL_DSP_SETFMT, &format ); | 223 | if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1) |
247 | ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency ); | 224 | perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); |
225 | if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1) | ||
226 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); | ||
227 | qDebug("freq %d", d->frequency); | ||
228 | if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) | ||
229 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); | ||
230 | qDebug("channels %d",d->channels); | ||
248 | if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { | 231 | if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { |
249 | d->channels = ( d->channels == 1 ) ? 2 : d->channels; | 232 | d->channels = ( d->channels == 1 ) ? 2 : d->channels; |
250 | ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ); | 233 | if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) |
234 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); | ||
251 | } | 235 | } |
252 | 236 | ||
253 | d->bufferSize = sound_fragment_bytes; | 237 | d->bufferSize = sound_fragment_bytes; |
254 | d->unwrittenBuffer = new char[d->bufferSize]; | 238 | d->unwrittenBuffer = new char[d->bufferSize]; |
255 | d->unwritten = 0; | 239 | d->unwritten = 0; |
256 | d->can_GETOSPACE = TRUE; // until we find otherwise | 240 | d->can_GETOSPACE = TRUE; // until we find otherwise |
@@ -258,13 +242,12 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
258 | //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); | 242 | //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); |
259 | //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); | 243 | //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); |
260 | //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); | 244 | //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); |
261 | //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); | 245 | //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); |
262 | //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); | 246 | //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); |
263 | //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); | 247 | //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); |
264 | #endif | ||
265 | } | 248 | } |
266 | 249 | ||
267 | 250 | ||
268 | AudioDevice::~AudioDevice() { | 251 | AudioDevice::~AudioDevice() { |
269 | #ifdef Q_OS_WIN32 | 252 | #ifdef Q_OS_WIN32 |
270 | waveOutClose( (HWAVEOUT)d->handle ); | 253 | waveOutClose( (HWAVEOUT)d->handle ); |
diff --git a/core/multimedia/opieplayer/audiodevice.h b/core/multimedia/opieplayer/audiodevice.h index ec70788..d59c388 100644 --- a/core/multimedia/opieplayer/audiodevice.h +++ b/core/multimedia/opieplayer/audiodevice.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -14,25 +14,29 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
20 | #ifndef AUDIODEVICE_H | 22 | #ifndef AUDIODEVICE_H |
21 | #define AUDIODEVICE_H | 23 | #define AUDIODEVICE_H |
22 | 24 | ||
25 | |||
23 | #include <qobject.h> | 26 | #include <qobject.h> |
27 | #include <sys/soundcard.h> | ||
24 | 28 | ||
25 | 29 | ||
26 | class AudioDevicePrivate; | 30 | class AudioDevicePrivate; |
27 | 31 | ||
28 | 32 | ||
29 | class AudioDevice : public QObject { | 33 | class AudioDevice : public QObject { |
30 | Q_OBJECT | 34 | Q_OBJECT |
31 | public: | 35 | public: |
32 | AudioDevice( unsigned int freq = 44000, unsigned int channels = 2, unsigned int bytesPerSample = 2 ); | 36 | AudioDevice( unsigned int freq = 44000, unsigned int channels = 2, unsigned int bytesPerSample = AFMT_S16_LE ); |
33 | ~AudioDevice(); | 37 | ~AudioDevice(); |
34 | 38 | ||
35 | unsigned int canWrite() const; | 39 | unsigned int canWrite() const; |
36 | void write( char *buffer, unsigned int length ); | 40 | void write( char *buffer, unsigned int length ); |
37 | int bytesWritten(); | 41 | int bytesWritten(); |
38 | 42 | ||
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 1e0757f..582660c 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -57,13 +57,13 @@ MediaButton audioButtons[] = { | |||
57 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 57 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
58 | 58 | ||
59 | 59 | ||
60 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 60 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
61 | QWidget( parent, name, f ) | 61 | QWidget( parent, name, f ) |
62 | { | 62 | { |
63 | setCaption( tr("MediaPlayer") ); | 63 | setCaption( tr("OpiePlayer") ); |
64 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 64 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
65 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); | 65 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); |
66 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) ); | 66 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) ); |
67 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls" ) ); | 67 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls" ) ); |
68 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "mpegplayer/animatedButton" ) ); | 68 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "mpegplayer/animatedButton" ) ); |
69 | 69 | ||
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index 95f5322..53e84b3 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
diff --git a/core/multimedia/opieplayer/libmad/Makefile.in b/core/multimedia/opieplayer/libmad/Makefile.in index e9f74e7..552043c 100644 --- a/core/multimedia/opieplayer/libmad/Makefile.in +++ b/core/multimedia/opieplayer/libmad/Makefile.in | |||
@@ -211,13 +211,15 @@ layer3.o: layer3.c \ | |||
211 | huffman.o: huffman.c \ | 211 | huffman.o: huffman.c \ |
212 | libmad_global.h \ | 212 | libmad_global.h \ |
213 | huffman.h | 213 | huffman.h |
214 | 214 | ||
215 | libmadplugin.o: libmadplugin.cpp \ | 215 | libmadplugin.o: libmadplugin.cpp \ |
216 | libmadplugin.h \ | 216 | libmadplugin.h \ |
217 | ../mediaplayerplugininterface.h \ | ||
217 | mad.h | 218 | mad.h |
218 | 219 | ||
219 | libmadpluginimpl.o: libmadpluginimpl.cpp \ | 220 | libmadpluginimpl.o: libmadpluginimpl.cpp \ |
220 | libmadplugin.h \ | 221 | libmadplugin.h \ |
222 | ../mediaplayerplugininterface.h \ | ||
221 | libmadpluginimpl.h | 223 | libmadpluginimpl.h |
222 | 224 | ||
223 | 225 | ||
diff --git a/core/multimedia/opieplayer/libmad/libmad.pro b/core/multimedia/opieplayer/libmad/libmad.pro index 6c40a15..06e19e4 100644 --- a/core/multimedia/opieplayer/libmad/libmad.pro +++ b/core/multimedia/opieplayer/libmad/libmad.pro | |||
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 9d04f7e..9f8ba65 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -462,13 +462,13 @@ bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) { | |||
462 | memcpy( &(buffer[0][offset]), d->synth.pcm.samples[0], decodedSamples * sizeof(mad_fixed_t) ); | 462 | memcpy( &(buffer[0][offset]), d->synth.pcm.samples[0], decodedSamples * sizeof(mad_fixed_t) ); |
463 | if ( d->synth.pcm.channels == 2 ) | 463 | if ( d->synth.pcm.channels == 2 ) |
464 | memcpy( &(buffer[1][offset]), d->synth.pcm.samples[1], decodedSamples * sizeof(mad_fixed_t) ); | 464 | memcpy( &(buffer[1][offset]), d->synth.pcm.samples[1], decodedSamples * sizeof(mad_fixed_t) ); |
465 | offset += decodedSamples; | 465 | offset += decodedSamples; |
466 | buffered += decodedSamples; | 466 | buffered += decodedSamples; |
467 | } | 467 | } |
468 | 468 | //qApp->processEvents(); | |
469 | audio_pcm( output, samples, buffer[0], (d->synth.pcm.channels == 2) ? buffer[1] : 0 ); | 469 | audio_pcm( output, samples, buffer[0], (d->synth.pcm.channels == 2) ? buffer[1] : 0 ); |
470 | // audio_pcm( output, samples, buffer[1], buffer[0] ); | 470 | // audio_pcm( output, samples, buffer[1], buffer[0] ); |
471 | // audio_pcm( output, samples, buffer[0], buffer[1] ); | 471 | // audio_pcm( output, samples, buffer[0], buffer[1] ); |
472 | samplesMade = samples; | 472 | samplesMade = samples; |
473 | memmove( buffer[0], &(buffer[0][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); | 473 | memmove( buffer[0], &(buffer[0][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); |
474 | if ( d->synth.pcm.channels == 2 ) | 474 | if ( d->synth.pcm.channels == 2 ) |
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h index d85e0d4..d163458 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.h +++ b/core/multimedia/opieplayer/libmad/libmadplugin.h | |||
@@ -18,13 +18,14 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef LIBMAD_PLUGIN_H | 20 | #ifndef LIBMAD_PLUGIN_H |
21 | #define LIBMAD_PLUGIN_H | 21 | #define LIBMAD_PLUGIN_H |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qpe/mediaplayerplugininterface.h> | 24 | //#include <qpe/mediaplayerplugininterface.h> |
25 | #include "../mediaplayerplugininterface.h" | ||
25 | 26 | ||
26 | 27 | ||
27 | // #define OLD_MEDIAPLAYER_API | 28 | // #define OLD_MEDIAPLAYER_API |
28 | 29 | ||
29 | 30 | ||
30 | class LibMadPluginData; | 31 | class LibMadPluginData; |
@@ -49,12 +50,13 @@ public: | |||
49 | // If decoder doesn't support audio then return 0 here | 50 | // If decoder doesn't support audio then return 0 here |
50 | int audioStreams(); | 51 | int audioStreams(); |
51 | int audioChannels( int stream ); | 52 | int audioChannels( int stream ); |
52 | int audioFrequency( int stream ); | 53 | int audioFrequency( int stream ); |
53 | int audioSamples( int stream ); | 54 | int audioSamples( int stream ); |
54 | bool audioSetSample( long sample, int stream ); | 55 | bool audioSetSample( long sample, int stream ); |
56 | int audioBitsPerSample(int) {return 0;} | ||
55 | long audioGetSample( int stream ); | 57 | long audioGetSample( int stream ); |
56 | #ifdef OLD_MEDIAPLAYER_API | 58 | #ifdef OLD_MEDIAPLAYER_API |
57 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 59 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
58 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | 60 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); |
59 | bool audioReadSamples( short *output, int channel, long samples, int stream ); | 61 | bool audioReadSamples( short *output, int channel, long samples, int stream ); |
60 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); | 62 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); |
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h index 2c5ed3b..bc864ee 100644 --- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h +++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h | |||
@@ -17,13 +17,14 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef LIBMAD_PLUGIN_IMPL_H | 20 | #ifndef LIBMAD_PLUGIN_IMPL_H |
21 | #define LIBMAD_PLUGIN_IMPL_H | 21 | #define LIBMAD_PLUGIN_IMPL_H |
22 | 22 | ||
23 | #include <qpe/mediaplayerplugininterface.h> | 23 | //#include <qpe/mediaplayerplugininterface.h> |
24 | #include "../mediaplayerplugininterface.h" | ||
24 | 25 | ||
25 | 26 | ||
26 | class LibMadPlugin; | 27 | class LibMadPlugin; |
27 | 28 | ||
28 | 29 | ||
29 | class LibMadPluginImpl : public MediaPlayerPluginInterface | 30 | class LibMadPluginImpl : public MediaPlayerPluginInterface |
@@ -38,13 +39,12 @@ public: | |||
38 | Q_REFCOUNT | 39 | Q_REFCOUNT |
39 | 40 | ||
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | virtual MediaPlayerDecoder *decoder(); | 43 | virtual MediaPlayerDecoder *decoder(); |
43 | virtual MediaPlayerEncoder *encoder(); | 44 | virtual MediaPlayerEncoder *encoder(); |
44 | |||
45 | private: | 45 | private: |
46 | LibMadPlugin *libmadplugin; | 46 | LibMadPlugin *libmadplugin; |
47 | ulong ref; | 47 | ulong ref; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | 50 | ||
diff --git a/core/multimedia/opieplayer/libmpeg3/Makefile.in b/core/multimedia/opieplayer/libmpeg3/Makefile.in index 154f85d..d255e4f 100644 --- a/core/multimedia/opieplayer/libmpeg3/Makefile.in +++ b/core/multimedia/opieplayer/libmpeg3/Makefile.in | |||
@@ -173,13 +173,14 @@ libmpeg3plugin.o: libmpeg3plugin.cpp \ | |||
173 | mpeg3io.h \ | 173 | mpeg3io.h \ |
174 | mpeg3css.h \ | 174 | mpeg3css.h \ |
175 | mpeg3private.inc \ | 175 | mpeg3private.inc \ |
176 | audio/mpeg3audio.h \ | 176 | audio/mpeg3audio.h \ |
177 | mpeg3vtrack.h \ | 177 | mpeg3vtrack.h \ |
178 | video/mpeg3video.h \ | 178 | video/mpeg3video.h \ |
179 | mpeg3protos.h | 179 | mpeg3protos.h \ |
180 | ../mediaplayerplugininterface.h | ||
180 | 181 | ||
181 | libmpeg3pluginimpl.o: libmpeg3pluginimpl.cpp \ | 182 | libmpeg3pluginimpl.o: libmpeg3pluginimpl.cpp \ |
182 | libmpeg3plugin.h \ | 183 | libmpeg3plugin.h \ |
183 | libmpeg3.h \ | 184 | libmpeg3.h \ |
184 | mpeg3private.h \ | 185 | mpeg3private.h \ |
185 | mpeg3atrack.h \ | 186 | mpeg3atrack.h \ |
@@ -189,12 +190,13 @@ libmpeg3pluginimpl.o: libmpeg3pluginimpl.cpp \ | |||
189 | mpeg3css.h \ | 190 | mpeg3css.h \ |
190 | mpeg3private.inc \ | 191 | mpeg3private.inc \ |
191 | audio/mpeg3audio.h \ | 192 | audio/mpeg3audio.h \ |
192 | mpeg3vtrack.h \ | 193 | mpeg3vtrack.h \ |
193 | video/mpeg3video.h \ | 194 | video/mpeg3video.h \ |
194 | mpeg3protos.h \ | 195 | mpeg3protos.h \ |
196 | ../mediaplayerplugininterface.h \ | ||
195 | libmpeg3pluginimpl.h | 197 | libmpeg3pluginimpl.h |
196 | 198 | ||
197 | bitstream.o: bitstream.c \ | 199 | bitstream.o: bitstream.c \ |
198 | mpeg3private.h \ | 200 | mpeg3private.h \ |
199 | mpeg3atrack.h \ | 201 | mpeg3atrack.h \ |
200 | mpeg3demux.h \ | 202 | mpeg3demux.h \ |
@@ -411,13 +413,13 @@ audio/layer2.o: audio/layer2.c \ | |||
411 | mpeg3vtrack.h \ | 413 | mpeg3vtrack.h \ |
412 | video/mpeg3video.h \ | 414 | video/mpeg3video.h \ |
413 | audio/../mpeg3protos.h \ | 415 | audio/../mpeg3protos.h \ |
414 | audio/tables.h | 416 | audio/tables.h |
415 | 417 | ||
416 | audio/layer3.o: audio/layer3.c \ | 418 | audio/layer3.o: audio/layer3.c \ |
417 | audio/huffman.h \ | 419 | huffman.h \ |
418 | audio/mpeg3audio.h \ | 420 | audio/mpeg3audio.h \ |
419 | audio/ac3.h \ | 421 | audio/ac3.h \ |
420 | audio/mpeg3real.h \ | 422 | audio/mpeg3real.h \ |
421 | audio/../bitstream.h \ | 423 | audio/../bitstream.h \ |
422 | mpeg3demux.h \ | 424 | mpeg3demux.h \ |
423 | mpeg3title.h \ | 425 | mpeg3title.h \ |
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3.pro b/core/multimedia/opieplayer/libmpeg3/libmpeg3.pro index b1426d1..e50aa4e 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3.pro +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3.pro | |||
@@ -32,11 +32,12 @@ SOURCES = libmpeg3plugin.cpp libmpeg3pluginimpl.cpp \ | |||
32 | video/output.c \ | 32 | video/output.c \ |
33 | video/reconstruct.c \ | 33 | video/reconstruct.c \ |
34 | video/seek.c \ | 34 | video/seek.c \ |
35 | video/slice.c \ | 35 | video/slice.c \ |
36 | video/vlc.c | 36 | video/vlc.c |
37 | TARGET = mpeg3plugin | 37 | TARGET = mpeg3plugin |
38 | TMAKE_CC=g++ | ||
38 | DESTDIR = ../../plugins/codecs | 39 | DESTDIR = ../../plugins/codecs |
39 | INCLUDEPATH += $(OPIEDIR)/include .. | 40 | INCLUDEPATH += $(OPIEDIR)/include .. |
40 | DEPENDPATH += ../$(OPIEDIR)/include .. | 41 | DEPENDPATH += ../$(OPIEDIR)/include .. |
41 | LIBS += -lqpe -lpthread -lm | 42 | LIBS += -lqpe -lpthread -lm |
42 | VERSION = 1.0.0 | 43 | VERSION = 1.0.0 |
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h index e0eb930..bd31706 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h | |||
@@ -21,13 +21,14 @@ | |||
21 | #define LIBMPEG3_PLUGIN_H | 21 | #define LIBMPEG3_PLUGIN_H |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include "libmpeg3.h" | 25 | #include "libmpeg3.h" |
26 | #include "mpeg3protos.h" | 26 | #include "mpeg3protos.h" |
27 | #include <qpe/mediaplayerplugininterface.h> | 27 | //#include <qpe/mediaplayerplugininterface.h> |
28 | #include "../mediaplayerplugininterface.h" | ||
28 | 29 | ||
29 | 30 | ||
30 | // #define OLD_MEDIAPLAYER_API | 31 | // #define OLD_MEDIAPLAYER_API |
31 | 32 | ||
32 | 33 | ||
33 | class LibMpeg3Plugin : public MediaPlayerDecoder { | 34 | class LibMpeg3Plugin : public MediaPlayerDecoder { |
@@ -47,12 +48,13 @@ public: | |||
47 | const QString &fileInfo() { return strInfo = ""; } | 48 | const QString &fileInfo() { return strInfo = ""; } |
48 | 49 | ||
49 | // If decoder doesn't support audio then return 0 here | 50 | // If decoder doesn't support audio then return 0 here |
50 | int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; } | 51 | int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; } |
51 | int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; } | 52 | int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; } |
52 | int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } | 53 | int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } |
54 | int audioBitsPerSample(int) { return 0;} | ||
53 | int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } | 55 | int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } |
54 | bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; } | 56 | bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; } |
55 | long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; } | 57 | long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; } |
56 | #ifdef OLD_MEDIAPLAYER_API | 58 | #ifdef OLD_MEDIAPLAYER_API |
57 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 59 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
58 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | 60 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); |
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h index e9926f4..a2f5211 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h | |||
@@ -17,13 +17,14 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef LIBMPEG3_PLUGIN_IMPL_H | 20 | #ifndef LIBMPEG3_PLUGIN_IMPL_H |
21 | #define LIBMPEG3_PLUGIN_IMPL_H | 21 | #define LIBMPEG3_PLUGIN_IMPL_H |
22 | 22 | ||
23 | #include <qpe/mediaplayerplugininterface.h> | 23 | //#include <qpe/mediaplayerplugininterface.h> |
24 | #include "../mediaplayerplugininterface.h" | ||
24 | 25 | ||
25 | 26 | ||
26 | class LibMpeg3Plugin; | 27 | class LibMpeg3Plugin; |
27 | 28 | ||
28 | 29 | ||
29 | class LibMpeg3PluginImpl : public MediaPlayerPluginInterface | 30 | class LibMpeg3PluginImpl : public MediaPlayerPluginInterface |
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index dd466ed..90a7cc6 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -14,27 +14,30 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
22 | |||
20 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
21 | #ifdef Q_WS_QWS | ||
22 | 24 | ||
25 | #ifdef Q_WS_QWS | ||
23 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
24 | #endif | 27 | #endif |
25 | #include <qpe/mediaplayerplugininterface.h> | ||
26 | #include <stdio.h> | 28 | #include <stdio.h> |
27 | #include <stdlib.h> | 29 | #include <stdlib.h> |
28 | #include <string.h> | 30 | #include <string.h> |
29 | #include <pthread.h> | 31 | #include <pthread.h> |
30 | #include <errno.h> | 32 | #include <errno.h> |
31 | #include <unistd.h> | 33 | #include <unistd.h> |
32 | #include "loopcontrol.h" | 34 | #include "loopcontrol.h" |
33 | #include "videowidget.h" | 35 | #include "videowidget.h" |
34 | #include "audiodevice.h" | 36 | #include "audiodevice.h" |
37 | #include "mediaplayerplugininterface.h" | ||
35 | #include "mediaplayerstate.h" | 38 | #include "mediaplayerstate.h" |
36 | 39 | ||
37 | 40 | ||
38 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame | 41 | extern VideoWidget *videoUI; // now only needed to tell it to play a frame |
39 | extern MediaPlayerState *mediaPlayerState; | 42 | extern MediaPlayerState *mediaPlayerState; |
40 | 43 | ||
@@ -99,30 +102,25 @@ LoopControl::LoopControl( QObject *parent, const char *name ) | |||
99 | isMuted = FALSE; | 102 | isMuted = FALSE; |
100 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); | 103 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); |
101 | 104 | ||
102 | audioMutex = new Mutex; | 105 | audioMutex = new Mutex; |
103 | 106 | ||
104 | pthread_attr_init(&audio_attr); | 107 | pthread_attr_init(&audio_attr); |
105 | 108 | #define USE_REALTIME_AUDIO_THREAD | |
106 | if ( getuid() == 0 ) { | 109 | #ifdef USE_REALTIME_AUDIO_THREAD |
107 | printf("true, guid = %i\n", getuid()); | ||
108 | |||
109 | // Attempt to set it to real-time round robin | 110 | // Attempt to set it to real-time round robin |
110 | if ( pthread_attr_setschedpolicy( &audio_attr, SCHED_RR ) == 0 ) { | 111 | if ( pthread_attr_setschedpolicy( &audio_attr, SCHED_RR ) == 0 ) { |
111 | sched_param params; | 112 | sched_param params; |
112 | params.sched_priority = 50; | 113 | params.sched_priority = 50; |
113 | pthread_attr_setschedparam(&audio_attr,¶ms); | 114 | pthread_attr_setschedparam(&audio_attr,¶ms); |
114 | } else { | 115 | } else { |
115 | qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); | 116 | qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); |
116 | pthread_attr_destroy(&audio_attr); | 117 | pthread_attr_destroy(&audio_attr); |
117 | pthread_attr_init(&audio_attr); | 118 | pthread_attr_init(&audio_attr); |
118 | } | 119 | } |
119 | } | 120 | #endif |
120 | // printf("false, guid = %i\n", getuid()); | ||
121 | usleep( 100 ); | ||
122 | |||
123 | pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); | 121 | pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); |
124 | } | 122 | } |
125 | 123 | ||
126 | 124 | ||
127 | LoopControl::~LoopControl() { | 125 | LoopControl::~LoopControl() { |
128 | stop(); | 126 | stop(); |
@@ -231,28 +229,29 @@ void LoopControl::startAudio() { | |||
231 | currentSample = audioSampleCounter + 1; | 229 | currentSample = audioSampleCounter + 1; |
232 | 230 | ||
233 | if ( currentSample != audioSampleCounter + 1 ) | 231 | if ( currentSample != audioSampleCounter + 1 ) |
234 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); | 232 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); |
235 | 233 | ||
236 | long samplesRead = 0; | 234 | long samplesRead = 0; |
237 | mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); | 235 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); |
238 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; | 236 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; |
239 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; | 237 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; |
240 | 238 | ||
241 | if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { | 239 | if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { |
242 | usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | 240 | usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); |
243 | } else if ( sampleWaitTime <= -5000 ) { | 241 | } |
242 | else if ( sampleWaitTime <= -5000 ) { | ||
244 | qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | 243 | qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); |
245 | //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | 244 | //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); |
246 | currentSample = sampleWeShouldBeAt; | 245 | currentSample = sampleWeShouldBeAt; |
247 | } | 246 | } |
248 | 247 | ||
249 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); | 248 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); |
250 | audioSampleCounter = currentSample + samplesRead - 1; | 249 | audioSampleCounter = currentSample + samplesRead - 1; |
251 | 250 | ||
252 | moreAudio = audioSampleCounter <= total_audio_samples; | 251 | moreAudio = readOk && (audioSampleCounter <= total_audio_samples); |
253 | 252 | ||
254 | } else { | 253 | } else { |
255 | 254 | ||
256 | moreAudio = FALSE; | 255 | moreAudio = FALSE; |
257 | 256 | ||
258 | } | 257 | } |
@@ -376,29 +375,29 @@ bool LoopControl::init( const QString& filename ) { | |||
376 | hasVideoChannel = mediaPlayerState->curDecoder()->videoStreams() > 0; | 375 | hasVideoChannel = mediaPlayerState->curDecoder()->videoStreams() > 0; |
377 | 376 | ||
378 | if ( hasAudioChannel ) { | 377 | if ( hasAudioChannel ) { |
379 | int astream = 0; | 378 | int astream = 0; |
380 | 379 | ||
381 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); | 380 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); |
382 | DecodeLoopDebug(( "channels = %d\n", channels )); | 381 | qDebug( "LC- channels = %d", channels ); |
383 | 382 | ||
384 | if ( !total_audio_samples ) | 383 | if ( !total_audio_samples ) |
385 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); | 384 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); |
386 | 385 | ||
387 | total_audio_samples += 1000; | 386 | // total_audio_samples += 1000; |
388 | 387 | ||
389 | mediaPlayerState->setLength( total_audio_samples ); | 388 | mediaPlayerState->setLength( total_audio_samples ); |
390 | 389 | ||
391 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); | 390 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); |
392 | DecodeLoopDebug(( "frequency = %d\n", freq )); | 391 | qDebug( "LC- frequency = %d", freq ); |
393 | 392 | ||
394 | audioSampleCounter = 0; | 393 | audioSampleCounter = 0; |
395 | 394 | ||
396 | static const int bytes_per_sample = 2; //16 bit | 395 | int bits_per_sample = mediaPlayerState->curDecoder()->audioBitsPerSample( astream); |
397 | 396 | ||
398 | audioDevice = new AudioDevice( freq, channels, bytes_per_sample ); | 397 | audioDevice = new AudioDevice( freq, channels, bits_per_sample); |
399 | audioBuffer = new char[ audioDevice->bufferSize() ]; | 398 | audioBuffer = new char[ audioDevice->bufferSize() ]; |
400 | channels = audioDevice->channels(); | 399 | channels = audioDevice->channels(); |
401 | 400 | ||
402 | //### must check which frequency is actually used. | 401 | //### must check which frequency is actually used. |
403 | static const int size = 1; | 402 | static const int size = 1; |
404 | short int buf[size]; | 403 | short int buf[size]; |
diff --git a/core/multimedia/opieplayer/loopcontrol.h b/core/multimedia/opieplayer/loopcontrol.h index 3191259..f4a7fcd 100644 --- a/core/multimedia/opieplayer/loopcontrol.h +++ b/core/multimedia/opieplayer/loopcontrol.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -14,15 +14,19 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added changes Fri 02-15-2002 | ||
21 | |||
22 | |||
20 | #ifndef MPEGVIEW_H | 23 | #ifndef MPEGVIEW_H |
21 | #define MPEGVIEW_H | 24 | #define MPEGVIEW_H |
22 | 25 | ||
26 | |||
23 | #include <qwidget.h> | 27 | #include <qwidget.h> |
24 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
25 | 29 | ||
26 | 30 | ||
27 | class LoopControl : public QObject { | 31 | class LoopControl : public QObject { |
28 | Q_OBJECT | 32 | Q_OBJECT |
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp index eb89b85..c7dc7a8 100644 --- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp +++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -14,23 +14,21 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
21 | #define _REENTRANT | 20 | #define _REENTRANT |
22 | 21 | ||
23 | |||
24 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
25 | #include <qimage.h> | 23 | #include <qimage.h> |
26 | #include <qpainter.h> | 24 | #include <qpainter.h> |
27 | #ifdef Q_WS_QWS | 25 | #ifdef Q_WS_QWS |
28 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
29 | #endif | 27 | #endif |
30 | #include <qpe/mediaplayerplugininterface.h> | 28 | #include "mediaplayerplugininterface.h" |
31 | #include <stdio.h> | 29 | #include <stdio.h> |
32 | #include <stdlib.h> | 30 | #include <stdlib.h> |
33 | #include <string.h> | 31 | #include <string.h> |
34 | #include <time.h> | 32 | #include <time.h> |
35 | #include <unistd.h> | 33 | #include <unistd.h> |
36 | #include <pthread.h> | 34 | #include <pthread.h> |
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.h b/core/multimedia/opieplayer/loopcontrol_threaded.h index ced6ac8..1031169 100644 --- a/core/multimedia/opieplayer/loopcontrol_threaded.h +++ b/core/multimedia/opieplayer/loopcontrol_threaded.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -17,14 +17,12 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef MPEGVIEW_H | 20 | #ifndef MPEGVIEW_H |
21 | #define MPEGVIEW_H | 21 | #define MPEGVIEW_H |
22 | 22 | ||
23 | |||
24 | |||
25 | #include <qwidget.h> | 23 | #include <qwidget.h> |
26 | #include <qdatetime.h> | 24 | #include <qdatetime.h> |
27 | 25 | ||
28 | 26 | ||
29 | class LoopControl : public QObject { | 27 | class LoopControl : public QObject { |
30 | Q_OBJECT | 28 | Q_OBJECT |
diff --git a/core/multimedia/opieplayer/mediaplayerplugininterface.h b/core/multimedia/opieplayer/mediaplayerplugininterface.h index aeeffde..339b2e4 100644 --- a/core/multimedia/opieplayer/mediaplayerplugininterface.h +++ b/core/multimedia/opieplayer/mediaplayerplugininterface.h | |||
@@ -17,13 +17,12 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef MEDIA_PLAYER_PLUGIN_INTERFACE_H | 20 | #ifndef MEDIA_PLAYER_PLUGIN_INTERFACE_H |
21 | #define MEDIA_PLAYER_PLUGIN_INTERFACE_H | 21 | #define MEDIA_PLAYER_PLUGIN_INTERFACE_H |
22 | 22 | ||
23 | |||
24 | #include <qpe/qcom.h> | 23 | #include <qpe/qcom.h> |
25 | 24 | ||
26 | #ifndef QT_NO_COMPONENT | 25 | #ifndef QT_NO_COMPONENT |
27 | // {c0093632-b44c-4cf7-a279-d82fe8a8890c} | 26 | // {c0093632-b44c-4cf7-a279-d82fe8a8890c} |
28 | # ifndef IID_MediaPlayerPlugin | 27 | # ifndef IID_MediaPlayerPlugin |
29 | # define IID_MediaPlayerPlugin QUuid( 0xc0093632, 0xb44c, 0x4cf7, 0xa2, 0x79, 0xd8, 0x2f, 0xe8, 0xa8, 0x89, 0x0c ) | 28 | # define IID_MediaPlayerPlugin QUuid( 0xc0093632, 0xb44c, 0x4cf7, 0xa2, 0x79, 0xd8, 0x2f, 0xe8, 0xa8, 0x89, 0x0c ) |
@@ -59,18 +58,13 @@ public: | |||
59 | virtual int audioStreams() = 0; | 58 | virtual int audioStreams() = 0; |
60 | virtual int audioChannels( int stream ) = 0; | 59 | virtual int audioChannels( int stream ) = 0; |
61 | virtual int audioFrequency( int stream ) = 0; | 60 | virtual int audioFrequency( int stream ) = 0; |
62 | virtual int audioSamples( int stream ) = 0; | 61 | virtual int audioSamples( int stream ) = 0; |
63 | virtual bool audioSetSample( long sample, int stream ) = 0; | 62 | virtual bool audioSetSample( long sample, int stream ) = 0; |
64 | virtual long audioGetSample( int stream ) = 0; | 63 | 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; | ||
67 | virtual bool audioReadSamples( short *samples, int channels, long samples, long& samplesRead, int stream ) = 0; | 64 | virtual bool audioReadSamples( short *samples, int channels, long samples, long& samplesRead, int stream ) = 0; |
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; | ||
71 | 65 | ||
72 | // If decoder doesn't support video then return 0 here | 66 | // If decoder doesn't support video then return 0 here |
73 | virtual int videoStreams() = 0; | 67 | virtual int videoStreams() = 0; |
74 | virtual int videoWidth( int stream ) = 0; | 68 | virtual int videoWidth( int stream ) = 0; |
75 | virtual int videoHeight( int stream ) = 0; | 69 | virtual int videoHeight( int stream ) = 0; |
76 | virtual double videoFrameRate( int stream ) = 0; // frames per second (this may change to frames/1000secs) | 70 | virtual double videoFrameRate( int stream ) = 0; // frames per second (this may change to frames/1000secs) |
@@ -94,12 +88,15 @@ public: | |||
94 | virtual bool supportsYUV() = 0; | 88 | virtual bool supportsYUV() = 0; |
95 | virtual bool supportsMMX() = 0; | 89 | virtual bool supportsMMX() = 0; |
96 | virtual bool supportsSMP() = 0; | 90 | virtual bool supportsSMP() = 0; |
97 | virtual bool supportsStereo() = 0; | 91 | virtual bool supportsStereo() = 0; |
98 | virtual bool supportsScaling() = 0; | 92 | virtual bool supportsScaling() = 0; |
99 | 93 | ||
94 | // File Properies | ||
95 | virtual long getPlayTime() { return -1; } | ||
96 | virtual int audioBitsPerSample( int stream ) = 0; | ||
100 | }; | 97 | }; |
101 | 98 | ||
102 | 99 | ||
103 | class MediaPlayerEncoder; | 100 | class MediaPlayerEncoder; |
104 | 101 | ||
105 | 102 | ||
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 7e82166..13741f6 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -16,29 +16,30 @@ | |||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/qlibrary.h> | 21 | #include <qpe/qlibrary.h> |
22 | #include <qpe/mediaplayerplugininterface.h> | ||
23 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
24 | #include <qvaluelist.h> | 23 | #include <qvaluelist.h> |
25 | #include <qobject.h> | 24 | #include <qobject.h> |
26 | #include <qdir.h> | 25 | #include <qdir.h> |
26 | #include "mediaplayerplugininterface.h" | ||
27 | #include "mediaplayerstate.h" | 27 | #include "mediaplayerstate.h" |
28 | 28 | ||
29 | |||
29 | #ifdef QT_NO_COMPONENT | 30 | #ifdef QT_NO_COMPONENT |
30 | // Plugins which are compiled in when no plugin architecture available | 31 | // Plugins which are compiled in when no plugin architecture available |
31 | #include "libmad/libmadpluginimpl.h" | 32 | #include "libmad/libmadpluginimpl.h" |
32 | #include "libmpeg3/libmpeg3pluginimpl.h" | 33 | #include "libmpeg3/libmpeg3pluginimpl.h" |
33 | #include "wavplugin/wavpluginimpl.h" | 34 | #include "wavplugin/wavpluginimpl.h" |
34 | #endif | 35 | #endif |
35 | 36 | ||
36 | 37 | ||
37 | #define MediaPlayerDebug(x)qDebug x | 38 | //#define MediaPlayerDebug(x) qDebug x |
38 | //#define MediaPlayerDebug(x) | 39 | #define MediaPlayerDebug(x) |
39 | 40 | ||
40 | 41 | ||
41 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 42 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
42 | : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) { | 43 | : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) { |
43 | Config cfg( "MediaPlayer" ); | 44 | Config cfg( "MediaPlayer" ); |
44 | readConfig( cfg ); | 45 | readConfig( cfg ); |
@@ -111,12 +112,16 @@ MediaPlayerDecoder *MediaPlayerState::curDecoder() { | |||
111 | 112 | ||
112 | // ### hack to get true sample count | 113 | // ### hack to get true sample count |
113 | MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { | 114 | MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { |
114 | return libmpeg3decoder; | 115 | return libmpeg3decoder; |
115 | } | 116 | } |
116 | 117 | ||
118 | // ### hack to get true sample count | ||
119 | // MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { | ||
120 | // return libwavdecoder; | ||
121 | // } | ||
117 | 122 | ||
118 | void MediaPlayerState::loadPlugins() { | 123 | void MediaPlayerState::loadPlugins() { |
119 | 124 | ||
120 | #ifndef QT_NO_COMPONENT | 125 | #ifndef QT_NO_COMPONENT |
121 | QValueList<MediaPlayerPlugin>::Iterator mit; | 126 | QValueList<MediaPlayerPlugin>::Iterator mit; |
122 | for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { | 127 | for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { |
diff --git a/core/multimedia/opieplayer/mpegplayer.pro b/core/multimedia/opieplayer/mpegplayer.pro index 3b8d4b0..41f2de0 100644 --- a/core/multimedia/opieplayer/mpegplayer.pro +++ b/core/multimedia/opieplayer/mpegplayer.pro | |||
@@ -1,8 +1,9 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | #release | ||
3 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = loopcontrol.h mediaplayerplugininterface.h playlistselection.h mediaplayerstate.h \ | 5 | HEADERS = loopcontrol.h mediaplayerplugininterface.h playlistselection.h mediaplayerstate.h \ |
5 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h | 6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h |
6 | SOURCES = main.cpp \ | 7 | SOURCES = main.cpp \ |
7 | loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ | 8 | loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ |
8 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp | 9 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp |
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index a82b594..2c62e86 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -47,35 +47,38 @@ private: | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | 49 | ||
50 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 50 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
51 | : QListView( parent, name ) | 51 | : QListView( parent, name ) |
52 | { | 52 | { |
53 | #ifdef USE_PLAYLIST_BACKGROUND | 53 | // #ifdef USE_PLAYLIST_BACKGROUND |
54 | setStaticBackground( TRUE ); | 54 | setStaticBackground( TRUE ); |
55 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); | 55 | // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); |
56 | #endif | 56 | setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) ); |
57 | // #endif | ||
58 | addColumn("Title",236); | ||
57 | setAllColumnsShowFocus( TRUE ); | 59 | setAllColumnsShowFocus( TRUE ); |
58 | addColumn( tr( "Playlist Selection" ) ); | 60 | addColumn( tr( "Playlist Selection" ) ); |
59 | header()->hide(); | 61 | header()->hide(); |
60 | setSorting( -1, FALSE ); | 62 | setSorting( -1, FALSE ); |
61 | } | 63 | } |
62 | 64 | ||
63 | 65 | ||
64 | PlayListSelection::~PlayListSelection() { | 66 | PlayListSelection::~PlayListSelection() { |
65 | } | 67 | } |
66 | 68 | ||
67 | 69 | ||
68 | #ifdef USE_PLAYLIST_BACKGROUND | 70 | // #ifdef USE_PLAYLIST_BACKGROUND |
69 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 71 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
70 | p->fillRect( r, QBrush( white ) ); | 72 | p->fillRect( r, QBrush( white ) ); |
71 | QImage logo = Resource::loadImage( "mpegplayer/background" ); | 73 | // QImage logo = Resource::loadImage( "mpegplayer/background" ); |
74 | QImage logo = Resource::loadImage( "opielogo" ); | ||
72 | if ( !logo.isNull() ) | 75 | if ( !logo.isNull() ) |
73 | p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); | 76 | p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); |
74 | } | 77 | } |
75 | #endif | 78 | // #endif |
76 | 79 | ||
77 | 80 | ||
78 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 81 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
79 | if ( event->state() == QMouseEvent::LeftButton ) { | 82 | if ( event->state() == QMouseEvent::LeftButton ) { |
80 | QListViewItem *currentItem = selectedItem(); | 83 | QListViewItem *currentItem = selectedItem(); |
81 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 84 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
diff --git a/core/multimedia/opieplayer/playlistselection.h b/core/multimedia/opieplayer/playlistselection.h index 22d3c74..57e10f1 100644 --- a/core/multimedia/opieplayer/playlistselection.h +++ b/core/multimedia/opieplayer/playlistselection.h | |||
@@ -17,14 +17,12 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef PLAY_LIST_SELECTION_H | 20 | #ifndef PLAY_LIST_SELECTION_H |
21 | #define PLAY_LIST_SELECTION_H | 21 | #define PLAY_LIST_SELECTION_H |
22 | 22 | ||
23 | |||
24 | |||
25 | #include <qlist.h> | 23 | #include <qlist.h> |
26 | #include <qlistview.h> | 24 | #include <qlistview.h> |
27 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
28 | 26 | ||
29 | 27 | ||
30 | class PlayListSelection : public QListView { | 28 | class PlayListSelection : public QListView { |
@@ -44,16 +42,16 @@ public slots: | |||
44 | bool next(); | 42 | bool next(); |
45 | bool first(); | 43 | bool first(); |
46 | bool last(); | 44 | bool last(); |
47 | 45 | ||
48 | protected: | 46 | protected: |
49 | virtual void contentsMouseMoveEvent(QMouseEvent *); | 47 | virtual void contentsMouseMoveEvent(QMouseEvent *); |
50 | #ifdef USE_PLAYLIST_BACKGROUND | 48 | /* #ifdef USE_PLAYLIST_BACKGROUND */ |
51 | virtual void drawBackground( QPainter *p, const QRect &r ); | 49 | virtual void drawBackground( QPainter *p, const QRect &r ); |
52 | virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); }; | 50 | virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); }; |
53 | #endif | 51 | /* #endif */ |
54 | 52 | ||
55 | private: | 53 | private: |
56 | QList<DocLnk> selectedList; | 54 | QList<DocLnk> selectedList; |
57 | const DocLnk *lnk; | 55 | const DocLnk *lnk; |
58 | }; | 56 | }; |
59 | 57 | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 0423e7a..202f351 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -18,12 +18,14 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
23 | #include <qpe/fileselector.h> | 23 | #include <qpe/fileselector.h> |
24 | #include <qpe/qpeapplication.h> | ||
25 | |||
24 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
25 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
26 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
27 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
28 | #include <qaction.h> | 30 | #include <qaction.h> |
29 | #include <qimage.h> | 31 | #include <qimage.h> |
@@ -32,31 +34,35 @@ | |||
32 | #include <qlabel.h> | 34 | #include <qlabel.h> |
33 | #include <qlist.h> | 35 | #include <qlist.h> |
34 | #include <qlistbox.h> | 36 | #include <qlistbox.h> |
35 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
36 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
37 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
40 | #include <qtabwidget.h> | ||
41 | #include <qlistview.h> | ||
42 | #include <qpoint.h> | ||
43 | //#include <qtimer.h> | ||
38 | 44 | ||
39 | #include "playlistselection.h" | 45 | #include "playlistselection.h" |
40 | #include "playlistwidget.h" | 46 | #include "playlistwidget.h" |
41 | #include "mediaplayerstate.h" | 47 | #include "mediaplayerstate.h" |
42 | 48 | ||
43 | #include <stdlib.h> | 49 | #include <stdlib.h> |
44 | 50 | ||
51 | #define BUTTONS_ON_TOOLBAR | ||
52 | #define SIDE_BUTTONS | ||
53 | #define CAN_SAVE_LOAD_PLAYLISTS | ||
45 | 54 | ||
46 | extern MediaPlayerState *mediaPlayerState; | 55 | extern MediaPlayerState *mediaPlayerState; |
47 | 56 | ||
57 | // class myFileSelector { | ||
48 | 58 | ||
59 | // }; | ||
49 | class PlayListWidgetPrivate { | 60 | class PlayListWidgetPrivate { |
50 | public: | 61 | public: |
51 | QToolButton *tbPlay; | 62 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
52 | QToolButton *tbFull; | ||
53 | QToolButton *tbLoop; | ||
54 | QToolButton *tbScale; | ||
55 | QToolButton *tbShuffle; | ||
56 | |||
57 | QFrame *playListFrame; | 63 | QFrame *playListFrame; |
58 | FileSelector *files; | 64 | FileSelector *files; |
59 | PlayListSelection *selectedFiles; | 65 | PlayListSelection *selectedFiles; |
60 | bool setDocumentUsed; | 66 | bool setDocumentUsed; |
61 | DocLnk *current; | 67 | DocLnk *current; |
62 | }; | 68 | }; |
@@ -90,16 +96,18 @@ public: | |||
90 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 96 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
91 | : QMainWindow( parent, name, fl ) { | 97 | : QMainWindow( parent, name, fl ) { |
92 | 98 | ||
93 | d = new PlayListWidgetPrivate; | 99 | d = new PlayListWidgetPrivate; |
94 | d->setDocumentUsed = FALSE; | 100 | d->setDocumentUsed = FALSE; |
95 | d->current = NULL; | 101 | d->current = NULL; |
102 | // menuTimer = new QTimer( this ,"menu timer"), | ||
103 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | ||
96 | 104 | ||
97 | setBackgroundMode( PaletteButton ); | 105 | setBackgroundMode( PaletteButton ); |
98 | 106 | ||
99 | setCaption( tr("MediaPlayer") ); | 107 | setCaption( tr("OpiePlayer") ); |
100 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 108 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
101 | 109 | ||
102 | setToolBarsMovable( FALSE ); | 110 | setToolBarsMovable( FALSE ); |
103 | 111 | ||
104 | // Create Toolbar | 112 | // Create Toolbar |
105 | QPEToolBar *toolbar = new QPEToolBar( this ); | 113 | QPEToolBar *toolbar = new QPEToolBar( this ); |
@@ -108,85 +116,152 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
108 | // Create Menubar | 116 | // Create Menubar |
109 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 117 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
110 | menu->setMargin( 0 ); | 118 | menu->setMargin( 0 ); |
111 | 119 | ||
112 | QPEToolBar *bar = new QPEToolBar( this ); | 120 | QPEToolBar *bar = new QPEToolBar( this ); |
113 | bar->setLabel( tr( "Play Operations" ) ); | 121 | bar->setLabel( tr( "Play Operations" ) ); |
114 | #ifdef BUTTONS_ON_TOOLBAR | 122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),"mpegplayer/add_to_playlist",this , SLOT(addSelected()) ); |
123 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", this , SLOT(removeSelected()) ); | ||
115 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | 124 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); |
116 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 125 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
117 | #endif | ||
118 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 126 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
119 | d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE ); | ||
120 | d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE ); | ||
121 | 127 | ||
122 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 128 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
123 | menu->insertItem( tr( "PlayList" ), pmPlayList ); | 129 | menu->insertItem( tr( "File" ), pmPlayList ); |
124 | new MenuItem( pmPlayList, tr( "Toggle PlayList" ), mediaPlayerState, SLOT( togglePlaylist() ) ); | ||
125 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 130 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
126 | new MenuItem( pmPlayList, tr( "Add all music files" ), this, SLOT( addAllMusicToList() ) ); | 131 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
127 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 132 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
128 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 133 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
129 | #ifdef CAN_SAVE_LOAD_PLAYLISTS | ||
130 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 134 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
131 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 135 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
132 | #endif | 136 | |
137 | QPopupMenu *pmView = new QPopupMenu( this ); | ||
138 | menu->insertItem( tr( "View" ), pmView ); | ||
139 | |||
140 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | ||
141 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | ||
142 | fullScreenButton->addTo(pmView); | ||
143 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | ||
144 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | ||
145 | scaleButton->addTo(pmView); | ||
133 | 146 | ||
134 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 147 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
148 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | ||
149 | |||
150 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | ||
151 | |||
152 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | ||
153 | tabWidget->setTabShape(QTabWidget::Triangular); | ||
154 | |||
155 | QWidget *pTab; | ||
156 | pTab = new QWidget( tabWidget, "pTab" ); | ||
157 | playlistView = new QListView( pTab, "Videoview" ); | ||
158 | playlistView->setMinimumSize(236,260); | ||
159 | tabWidget->insertTab( pTab,"Playlist"); | ||
135 | 160 | ||
136 | // Add the playlist area | 161 | // Add the playlist area |
137 | QVBox *vbox3 = new QVBox( vbox5 ); vbox3->setBackgroundMode( PaletteButton ); | ||
138 | d->playListFrame = vbox3; | ||
139 | 162 | ||
140 | QLabel *plString = new QLabel( tr(" PlayList"), vbox3 ); | 163 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
141 | plString->setBackgroundMode( QButton::PaletteButton ); | 164 | d->playListFrame = vbox3; |
142 | plString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | 165 | d->playListFrame ->setMinimumSize(235,260); |
143 | 166 | ||
144 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 167 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
168 | |||
145 | d->selectedFiles = new PlayListSelection( hbox2 ); | 169 | d->selectedFiles = new PlayListSelection( hbox2 ); |
146 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 170 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
147 | 171 | ||
148 | #ifndef BUTTONS_ON_TOOLBAR | ||
149 | d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | ||
150 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 172 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
151 | #endif | ||
152 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 173 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
153 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 174 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
154 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 175 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
155 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 176 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
156 | #ifndef BUTTONS_ON_TOOLBAR | ||
157 | d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | ||
158 | #endif | ||
159 | 177 | ||
178 | QWidget *aTab; | ||
179 | aTab = new QWidget( tabWidget, "aTab" ); | ||
180 | audioView = new QListView( aTab, "Audioview" ); | ||
181 | audioView->setMinimumSize(233,260); | ||
182 | audioView->addColumn( "Title",150); | ||
183 | audioView->addColumn("Size", 45); | ||
184 | audioView->addColumn("Media",35); | ||
185 | audioView->setColumnAlignment(1, Qt::AlignRight); | ||
186 | audioView->setColumnAlignment(2, Qt::AlignRight); | ||
187 | tabWidget->insertTab(aTab,"Audio"); | ||
188 | // audioView | ||
189 | Global::findDocuments(&files, "audio/*"); | ||
190 | QListIterator<DocLnk> dit( files.children() ); | ||
191 | QString storage; | ||
192 | for ( ; dit.current(); ++dit ) { | ||
193 | QListViewItem * newItem; | ||
194 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
195 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
196 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
197 | else storage="RAM"; | ||
198 | if ( QFile( dit.current()->file()).exists() ) { | ||
199 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | ||
200 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | ||
201 | } | ||
202 | } | ||
203 | // videowidget | ||
204 | |||
205 | QWidget *vTab; | ||
206 | vTab = new QWidget( tabWidget, "vTab" ); | ||
207 | videoView = new QListView( vTab, "Videoview" ); | ||
208 | videoView->setMinimumSize(233,260); | ||
209 | |||
210 | videoView->addColumn("Title",150); | ||
211 | videoView->addColumn("Size",45); | ||
212 | videoView->addColumn("Media",35); | ||
213 | videoView->setColumnAlignment(1, Qt::AlignRight); | ||
214 | videoView->setColumnAlignment(2, Qt::AlignRight); | ||
215 | |||
216 | tabWidget->insertTab( vTab,"Video"); | ||
217 | |||
218 | Global::findDocuments(&vFiles, "video/*"); | ||
219 | QListIterator<DocLnk> Vdit( vFiles.children() ); | ||
220 | for ( ; Vdit.current(); ++Vdit ) { | ||
221 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | ||
222 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
223 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | ||
224 | else storage="RAM"; | ||
225 | QListViewItem * newItem; | ||
226 | if ( QFile( Vdit.current()->file()).exists() ) { | ||
227 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | ||
228 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | ||
229 | } | ||
230 | } | ||
160 | // add the library area | 231 | // add the library area |
161 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 232 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
162 | 233 | ||
163 | QLabel *libString = new QLabel( tr(" Media Library"), vbox4 ); | 234 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
164 | libString->setBackgroundMode( QButton::PaletteButton ); | 235 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
165 | libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) ); | ||
166 | 236 | ||
167 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 237 | connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
168 | d->files = new FileSelector( "video/*;audio/*", hbox6, "Find Media Files", FALSE, FALSE ); | 238 | connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
169 | d->files->setBackgroundMode( PaletteButton ); | 239 | |
170 | QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); | 240 | connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), |
241 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | ||
242 | connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), | ||
243 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | ||
171 | 244 | ||
172 | #ifdef SIDE_BUTTONS | ||
173 | new ToolButton( vbox7, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", d->selectedFiles, SLOT(addSelected()) ); | ||
174 | new ToolButton( vbox7, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", d->selectedFiles, SLOT(removeSelected()) ); | ||
175 | QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch | ||
176 | #endif | ||
177 | 245 | ||
178 | connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 246 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
247 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
248 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
179 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 249 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
180 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 250 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
181 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 251 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
182 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbFull, SLOT( setOn( bool ) ) ); | 252 | |
183 | connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), d->tbScale, SLOT( setOn( bool ) ) ); | 253 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); |
184 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), d->tbScale, SLOT( setEnabled( bool ) ) ); | 254 | // connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); |
255 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) ); | ||
256 | |||
185 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 257 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
186 | 258 | ||
259 | connect( d->selectedFiles, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
260 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
261 | |||
187 | setCentralWidget( vbox5 ); | 262 | setCentralWidget( vbox5 ); |
188 | 263 | ||
189 | Config cfg( "MediaPlayer" ); | 264 | Config cfg( "MediaPlayer" ); |
190 | readConfig( cfg ); | 265 | readConfig( cfg ); |
191 | 266 | ||
192 | initializeStates(); | 267 | initializeStates(); |
@@ -201,19 +276,20 @@ PlayListWidget::~PlayListWidget() { | |||
201 | delete d->current; | 276 | delete d->current; |
202 | delete d; | 277 | delete d; |
203 | } | 278 | } |
204 | 279 | ||
205 | 280 | ||
206 | void PlayListWidget::initializeStates() { | 281 | void PlayListWidget::initializeStates() { |
282 | |||
207 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 283 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
208 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 284 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
209 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 285 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
210 | d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 286 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
211 | d->tbScale->setOn( mediaPlayerState->scaled() ); | 287 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
212 | d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 288 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
213 | setPlaylist( mediaPlayerState->playlist() ); | 289 | // setPlaylist( mediaPlayerState->playlist() ); |
214 | } | 290 | } |
215 | 291 | ||
216 | 292 | ||
217 | void PlayListWidget::readConfig( Config& cfg ) { | 293 | void PlayListWidget::readConfig( Config& cfg ) { |
218 | cfg.setGroup("PlayList"); | 294 | cfg.setGroup("PlayList"); |
219 | 295 | ||
@@ -272,12 +348,22 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { | |||
272 | d->selectedFiles->addToSelection( lnk ); | 348 | d->selectedFiles->addToSelection( lnk ); |
273 | else | 349 | else |
274 | mediaPlayerState->setPlaying( TRUE ); | 350 | mediaPlayerState->setPlaying( TRUE ); |
275 | } | 351 | } |
276 | 352 | ||
277 | 353 | ||
354 | void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) { | ||
355 | qDebug("add"); | ||
356 | // d->selectedFiles->addToSelection( lnk ); | ||
357 | // } | ||
358 | // else | ||
359 | // mediaPlayerState->setPlaying( TRUE ); | ||
360 | // | ||
361 | } | ||
362 | |||
363 | |||
278 | void PlayListWidget::clearList() { | 364 | void PlayListWidget::clearList() { |
279 | while ( first() ) | 365 | while ( first() ) |
280 | d->selectedFiles->removeSelected(); | 366 | d->selectedFiles->removeSelected(); |
281 | } | 367 | } |
282 | 368 | ||
283 | 369 | ||
@@ -444,6 +530,120 @@ void PlayListWidget::setView( char view ) { | |||
444 | if ( view == 'l' ) | 530 | if ( view == 'l' ) |
445 | showMaximized(); | 531 | showMaximized(); |
446 | else | 532 | else |
447 | hide(); | 533 | hide(); |
448 | } | 534 | } |
449 | 535 | ||
536 | void PlayListWidget::addSelected() { | ||
537 | // QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here"); | ||
538 | int tabPage=tabWidget->currentPageIndex(); | ||
539 | switch (tabPage) { | ||
540 | case 0: //playlist | ||
541 | break; | ||
542 | case 1: { //audio | ||
543 | addToSelection( audioView->selectedItem() ); | ||
544 | } | ||
545 | break; | ||
546 | case 2: { // video | ||
547 | addToSelection( videoView->selectedItem() ); | ||
548 | } | ||
549 | break; | ||
550 | }; | ||
551 | } | ||
552 | |||
553 | void PlayListWidget::removeSelected() { | ||
554 | d->selectedFiles->removeSelected( ); | ||
555 | } | ||
556 | |||
557 | |||
558 | void PlayListWidget::playIt( QListViewItem *it) { | ||
559 | // d->setDocumentUsed = FALSE; | ||
560 | mediaPlayerState->setPlaying(true); | ||
561 | } | ||
562 | |||
563 | void PlayListWidget::addToSelection( QListViewItem *it) { | ||
564 | d->setDocumentUsed = FALSE; | ||
565 | |||
566 | if(it) { | ||
567 | qDebug("add to selection"); | ||
568 | int tabPage=tabWidget->currentPageIndex(); | ||
569 | switch (tabPage) { | ||
570 | case 1: { | ||
571 | QListIterator<DocLnk> dit( files.children() ); | ||
572 | for ( ; dit.current(); ++dit ) { | ||
573 | if( dit.current()->name() == it->text(0)) { | ||
574 | d->selectedFiles->addToSelection( **dit ); | ||
575 | } | ||
576 | } | ||
577 | } | ||
578 | break; | ||
579 | case 2: { | ||
580 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
581 | for ( ; dit.current(); ++dit ) { | ||
582 | qDebug(dit.current()->name()); | ||
583 | if( dit.current()->name() == it->text(0)) { | ||
584 | d->selectedFiles->addToSelection( **dit ); | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | break; | ||
589 | case 0: | ||
590 | break; | ||
591 | }; | ||
592 | tabWidget->setCurrentPage(0); | ||
593 | // mediaPlayerState->setPlaying( TRUE ); | ||
594 | } | ||
595 | } | ||
596 | |||
597 | void PlayListWidget::tabChanged(QWidget *widg) { | ||
598 | |||
599 | int tabPage=tabWidget->currentPageIndex(); | ||
600 | switch (tabPage) { | ||
601 | case 0: | ||
602 | { | ||
603 | d->tbRemoveFromList->setEnabled(TRUE); | ||
604 | d->tbAddToList->setEnabled(FALSE); | ||
605 | } | ||
606 | break; | ||
607 | case 1: | ||
608 | { | ||
609 | d->tbRemoveFromList->setEnabled(FALSE); | ||
610 | d->tbAddToList->setEnabled(TRUE); | ||
611 | } | ||
612 | break; | ||
613 | case 2: | ||
614 | { | ||
615 | d->tbRemoveFromList->setEnabled(FALSE); | ||
616 | d->tbAddToList->setEnabled(TRUE); | ||
617 | } | ||
618 | break; | ||
619 | }; | ||
620 | } | ||
621 | |||
622 | // void PlayListWidget::cancelMenuTimer() { | ||
623 | // if( menuTimer->isActive() ) | ||
624 | // menuTimer->stop(); | ||
625 | // } | ||
626 | |||
627 | // void PlayListWidget::showFileMenu() { | ||
628 | |||
629 | // } | ||
630 | |||
631 | // void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) | ||
632 | // { | ||
633 | // // QListView::contentsMousePressEvent( e ); | ||
634 | // menuTimer->start( 750, TRUE ); | ||
635 | // } | ||
636 | |||
637 | |||
638 | // void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) | ||
639 | // { | ||
640 | // // QListView::contentsMouseReleaseEvent( e ); | ||
641 | // menuTimer->stop(); | ||
642 | // } | ||
643 | // // void PlayListWidget::setFullScreen() { | ||
644 | // mediaPlayerState->toggleFullscreen( ); | ||
645 | // } | ||
646 | |||
647 | // void PlayListWidget::setScaled() { | ||
648 | // mediaPlayerState->toggleScaled(); | ||
649 | // } | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 819adb1..5b05f11 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -19,49 +19,78 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef PLAY_LIST_WIDGET_H | 20 | #ifndef PLAY_LIST_WIDGET_H |
21 | #define PLAY_LIST_WIDGET_H | 21 | #define PLAY_LIST_WIDGET_H |
22 | 22 | ||
23 | #include <qmainwindow.h> | 23 | #include <qmainwindow.h> |
24 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
25 | #include <qtabwidget.h> | ||
26 | /* #include <qtimer.h> */ | ||
25 | 27 | ||
26 | 28 | ||
27 | class PlayListWidgetPrivate; | 29 | class PlayListWidgetPrivate; |
28 | class Config; | 30 | class Config; |
29 | 31 | class QListViewItem; | |
32 | class QListView; | ||
33 | class QPoint; | ||
34 | class QAction; | ||
35 | class QLabel; | ||
30 | 36 | ||
31 | class PlayListWidget : public QMainWindow { | 37 | class PlayListWidget : public QMainWindow { |
32 | Q_OBJECT | 38 | Q_OBJECT |
33 | public: | 39 | public: |
34 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 40 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
35 | ~PlayListWidget(); | 41 | ~PlayListWidget(); |
36 | 42 | QTabWidget * tabWidget; | |
43 | QAction *fullScreenButton, *scaleButton; | ||
44 | DocLnkSet files; | ||
45 | DocLnkSet vFiles; | ||
46 | QListView *audioView, *videoView, *playlistView; | ||
47 | QLabel *libString; | ||
37 | // retrieve the current playlist entry (media file link) | 48 | // retrieve the current playlist entry (media file link) |
38 | const DocLnk *current(); | 49 | const DocLnk *current(); |
39 | void useSelectedDocument(); | 50 | void useSelectedDocument(); |
51 | /* QTimer * menuTimer; */ | ||
40 | 52 | ||
41 | public slots: | 53 | public slots: |
42 | void setDocument( const QString& fileref ); | 54 | void setDocument( const QString& fileref ); |
43 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 55 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
56 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | ||
57 | void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist | ||
44 | void setActiveWindow(); // need to handle this to show the right view | 58 | void setActiveWindow(); // need to handle this to show the right view |
45 | void setPlaylist( bool ); // Show/Hide the playlist | 59 | void setPlaylist( bool ); // Show/Hide the playlist |
46 | void setView( char ); | 60 | void setView( char ); |
47 | void clearList(); | 61 | void clearList(); |
48 | void addAllToList(); | 62 | void addAllToList(); |
49 | void addAllMusicToList(); | 63 | void addAllMusicToList(); |
50 | void addAllVideoToList(); | 64 | void addAllVideoToList(); |
51 | void saveList(); // Save the playlist | 65 | void saveList(); // Save the playlist |
52 | void loadList(); // Load a playlist | 66 | void loadList(); // Load a playlist |
67 | void playIt( QListViewItem *); | ||
53 | bool first(); | 68 | bool first(); |
54 | bool last(); | 69 | bool last(); |
55 | bool next(); | 70 | bool next(); |
56 | bool prev(); | 71 | bool prev(); |
72 | void addSelected(); | ||
73 | void removeSelected(); | ||
74 | void tabChanged(QWidget*); | ||
75 | /* void setFullScreen(); */ | ||
76 | /* void setScaled(); */ | ||
77 | protected: | ||
78 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | ||
79 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | ||
57 | 80 | ||
58 | private: | 81 | private: |
59 | void initializeStates(); | 82 | void initializeStates(); |
60 | void readConfig( Config& cfg ); | 83 | void readConfig( Config& cfg ); |
61 | void writeConfig( Config& cfg ) const; | 84 | void writeConfig( Config& cfg ) const; |
62 | PlayListWidgetPrivate *d; // Private implementation data | 85 | PlayListWidgetPrivate *d; // Private implementation data |
86 | |||
87 | protected slots: | ||
88 | /* void cancelMenuTimer(); */ | ||
89 | /* void showFileMenu(); */ | ||
90 | |||
91 | |||
63 | }; | 92 | }; |
64 | 93 | ||
65 | 94 | ||
66 | #endif // PLAY_LIST_WIDGET_H | 95 | #endif // PLAY_LIST_WIDGET_H |
67 | 96 | ||
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 12ae4fd..1f128a4 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -14,15 +14,14 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
21 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
22 | #include <qpe/mediaplayerplugininterface.h> | 21 | #include "mediaplayerplugininterface.h" |
23 | #include <qwidget.h> | 22 | #include <qwidget.h> |
24 | #include <qpainter.h> | 23 | #include <qpainter.h> |
25 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
26 | #include <qslider.h> | 25 | #include <qslider.h> |
27 | #include <qdrawutil.h> | 26 | #include <qdrawutil.h> |
28 | #include "videowidget.h" | 27 | #include "videowidget.h" |
@@ -64,13 +63,13 @@ MediaButton videoButtons[] = { | |||
64 | 63 | ||
65 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 64 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
66 | 65 | ||
67 | 66 | ||
68 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 67 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
69 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 68 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
70 | setCaption( tr("MediaPlayer") ); | 69 | setCaption( tr("OpiePlayer") ); |
71 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 70 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
72 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); | 71 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); |
73 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0b" ) ); | 72 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0b" ) ); |
74 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls0" ) ); | 73 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls0" ) ); |
75 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 74 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
76 | 75 | ||
diff --git a/core/multimedia/opieplayer/wavplugin/Makefile.in b/core/multimedia/opieplayer/wavplugin/Makefile.in index bcbe7f2..a46b925 100644 --- a/core/multimedia/opieplayer/wavplugin/Makefile.in +++ b/core/multimedia/opieplayer/wavplugin/Makefile.in | |||
@@ -97,13 +97,15 @@ REQUIRES= | |||
97 | 97 | ||
98 | 98 | ||
99 | 99 | ||
100 | ####### Compile | 100 | ####### Compile |
101 | 101 | ||
102 | wavplugin.o: wavplugin.cpp \ | 102 | wavplugin.o: wavplugin.cpp \ |
103 | wavplugin.h | 103 | wavplugin.h \ |
104 | ../mediaplayerplugininterface.h | ||
104 | 105 | ||
105 | wavpluginimpl.o: wavpluginimpl.cpp \ | 106 | wavpluginimpl.o: wavpluginimpl.cpp \ |
106 | wavplugin.h \ | 107 | wavplugin.h \ |
108 | ../mediaplayerplugininterface.h \ | ||
107 | wavpluginimpl.h | 109 | wavpluginimpl.h |
108 | 110 | ||
109 | 111 | ||