Diffstat (limited to 'core/multimedia/opieplayer/wavplugin') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/.cvsignore | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/Makefile.in | 112 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/qpe-wavplugin.control | 9 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavplugin.cpp | 334 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavplugin.h | 97 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavplugin.pro | 10 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp | 70 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavpluginimpl.h | 53 |
8 files changed, 687 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/wavplugin/.cvsignore b/core/multimedia/opieplayer/wavplugin/.cvsignore new file mode 100644 index 0000000..6fe2396 --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/.cvsignore | |||
@@ -0,0 +1,2 @@ | |||
1 | moc_* | ||
2 | Makefile | ||
diff --git a/core/multimedia/opieplayer/wavplugin/Makefile.in b/core/multimedia/opieplayer/wavplugin/Makefile.in new file mode 100644 index 0000000..c9203f8 --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/Makefile.in | |||
@@ -0,0 +1,112 @@ | |||
1 | ############################################################################# | ||
2 | |||
3 | ####### Compiler, tools and options | ||
4 | |||
5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | ||
6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB) -DQCONFIG=\"qpe\" | ||
7 | CC =$(SYSCONF_CC) $(QT_C_MT) | ||
8 | CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB) -DQCONFIG=\"qpe\" | ||
9 | INCPATH =-I$(QPEDIR)/include -I.. | ||
10 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | ||
11 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP) | ||
12 | MOC =$(SYSCONF_MOC) | ||
13 | UIC =$(SYSCONF_UIC) | ||
14 | |||
15 | ####### Target | ||
16 | |||
17 | DESTDIR = ../../plugins/codecs/ | ||
18 | VER_MAJ = 1 | ||
19 | VER_MIN = 0 | ||
20 | VER_PATCH = 0 | ||
21 | TARGET= wavplugin | ||
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS =wavplugin.h \ | ||
27 | wavpluginimpl.h | ||
28 | SOURCES =wavplugin.cpp \ | ||
29 | wavpluginimpl.cpp | ||
30 | OBJECTS =wavplugin.o \ | ||
31 | wavpluginimpl.o | ||
32 | INTERFACES = | ||
33 | UICDECLS = | ||
34 | UICIMPLS = | ||
35 | SRCMOC = | ||
36 | OBJMOC = | ||
37 | |||
38 | |||
39 | ####### Implicit rules | ||
40 | |||
41 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
42 | |||
43 | .cpp.o: | ||
44 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
45 | |||
46 | .cxx.o: | ||
47 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
48 | |||
49 | .cc.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .C.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .c.o: | ||
56 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | ####### Build rules | ||
59 | |||
60 | |||
61 | all: $(DESTDIR)$(SYSCONF_LINK_TARGET) | ||
62 | |||
63 | $(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
64 | $(SYSCONF_LINK_LIB) | ||
65 | |||
66 | moc: $(SRCMOC) | ||
67 | |||
68 | tmake: | ||
69 | tmake wavplugin.pro | ||
70 | |||
71 | clean: | ||
72 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | ||
73 | -rm -f *~ core | ||
74 | -rm -f allmoc.cpp | ||
75 | |||
76 | ####### Extension Modules | ||
77 | |||
78 | listpromodules: | ||
79 | @echo | ||
80 | |||
81 | listallmodules: | ||
82 | @echo | ||
83 | |||
84 | listaddonpromodules: | ||
85 | @echo | ||
86 | |||
87 | listaddonentmodules: | ||
88 | @echo | ||
89 | |||
90 | |||
91 | REQUIRES= | ||
92 | |||
93 | ####### Sub-libraries | ||
94 | |||
95 | |||
96 | ###### Combined headers | ||
97 | |||
98 | |||
99 | |||
100 | ####### Compile | ||
101 | |||
102 | wavplugin.o: wavplugin.cpp \ | ||
103 | wavplugin.h \ | ||
104 | ../mediaplayerplugininterface.h | ||
105 | |||
106 | wavpluginimpl.o: wavpluginimpl.cpp \ | ||
107 | wavplugin.h \ | ||
108 | ../mediaplayerplugininterface.h \ | ||
109 | wavpluginimpl.h \ | ||
110 | ../mediaplayerplugininterface.h | ||
111 | |||
112 | |||
diff --git a/core/multimedia/opieplayer/wavplugin/qpe-wavplugin.control b/core/multimedia/opieplayer/wavplugin/qpe-wavplugin.control new file mode 100644 index 0000000..8e7eedb --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/qpe-wavplugin.control | |||
@@ -0,0 +1,9 @@ | |||
1 | Files: plugins/codecs/libwavplugin.so.1.0.0 plugins/codecs/libwavplugin.so.1.0 plugins/codecs/libwavplugin.so.1 plugins/codecs/libwavplugin.so | ||
2 | Priority: optional | ||
3 | Section: qpe/plugins | ||
4 | Maintainer: John Ryland <jryland@trolltech.com> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-3 | ||
7 | Depends: qpe-base ($QPE_VERSION) | ||
8 | Description: WAV file plugin | ||
9 | Plugin to play WAV files with the mediaplayer in the Qtopia environment. | ||
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp new file mode 100644 index 0000000..60a0024 --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp | |||
@@ -0,0 +1,334 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #include <stdio.h> | ||
21 | #include <stdarg.h> | ||
22 | #include <stdlib.h> | ||
23 | #include <errno.h> | ||
24 | #include <unistd.h> | ||
25 | #include <qfile.h> | ||
26 | #include "wavplugin.h" | ||
27 | |||
28 | |||
29 | //#define debugMsg(a) qDebug(a) | ||
30 | #define debugMsg(a) | ||
31 | |||
32 | |||
33 | struct RiffChunk { | ||
34 | char id[4]; | ||
35 | Q_UINT32 size; | ||
36 | char data[4]; | ||
37 | }; | ||
38 | |||
39 | |||
40 | struct ChunkData { | ||
41 | Q_INT16 formatTag; | ||
42 | Q_INT16 channels; | ||
43 | Q_INT32 samplesPerSec; | ||
44 | Q_INT32 avgBytesPerSec; | ||
45 | Q_INT16 blockAlign; | ||
46 | Q_INT16 wBitsPerSample; | ||
47 | }; | ||
48 | |||
49 | |||
50 | const int sound_buffer_size = 4096; | ||
51 | |||
52 | |||
53 | class WavPluginData { | ||
54 | public: | ||
55 | QFile *input; | ||
56 | |||
57 | int wavedata_remaining; | ||
58 | ChunkData chunkdata; | ||
59 | RiffChunk chunk; | ||
60 | uchar data[sound_buffer_size+32]; // +32 to handle badly aligned input data | ||
61 | int out,max; | ||
62 | int samples_due; | ||
63 | int samples; | ||
64 | |||
65 | WavPluginData() { | ||
66 | max = out = sound_buffer_size; | ||
67 | wavedata_remaining = 0; | ||
68 | samples_due = 0; | ||
69 | samples = -1; | ||
70 | } | ||
71 | |||
72 | // expands out samples to the frequency of 44kHz | ||
73 | bool add( short *output, long count, long& done, bool stereo ) | ||
74 | { | ||
75 | done = 0; | ||
76 | |||
77 | if ( input == 0 ) { | ||
78 | qDebug("no input"); | ||
79 | return FALSE; | ||
80 | } | ||
81 | |||
82 | while ( count ) { | ||
83 | int l,r; | ||
84 | if ( getSample(l, r) == FALSE ) { | ||
85 | qDebug("didn't get sample"); | ||
86 | return FALSE; | ||
87 | } | ||
88 | samples_due += 44100; | ||
89 | while ( count && (samples_due > chunkdata.samplesPerSec) ) { | ||
90 | *output++ = l; | ||
91 | if ( stereo ) | ||
92 | *output++ = r; | ||
93 | samples_due -= chunkdata.samplesPerSec; | ||
94 | count--; | ||
95 | done++; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | return TRUE; | ||
100 | } | ||
101 | |||
102 | bool initialise() { | ||
103 | if ( input == 0 ) | ||
104 | return FALSE; | ||
105 | |||
106 | wavedata_remaining = -1; | ||
107 | |||
108 | while ( wavedata_remaining == -1 ) { | ||
109 | // Keep reading chunks... | ||
110 | const int n = sizeof(chunk) - sizeof(chunk.data); | ||
111 | int t = input->readBlock( (char*)&chunk, n ); | ||
112 | if ( t != n ) { | ||
113 | if ( t == -1 ) | ||
114 | return FALSE; | ||
115 | return TRUE; | ||
116 | } | ||
117 | if ( qstrncmp(chunk.id,"data",4) == 0 ) { | ||
118 | samples = wavedata_remaining = chunk.size; | ||
119 | } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) { | ||
120 | char d[4]; | ||
121 | if ( input->readBlock(d,4) != 4 ) { | ||
122 | return FALSE; | ||
123 | } | ||
124 | if ( qstrncmp(d,"WAVE",4) != 0 ) { | ||
125 | // skip | ||
126 | if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size-4) ) { | ||
127 | return FALSE; | ||
128 | } | ||
129 | } | ||
130 | } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) { | ||
131 | if ( input->readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) { | ||
132 | return FALSE; | ||
133 | } | ||
134 | #define WAVE_FORMAT_PCM 1 | ||
135 | if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { | ||
136 | qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); | ||
137 | return FALSE; | ||
138 | } | ||
139 | } else { | ||
140 | // ignored chunk | ||
141 | if ( chunk.size > 1000000000 || !input->at(input->at()+chunk.size) ) { | ||
142 | return FALSE; | ||
143 | } | ||
144 | } | ||
145 | } // while | ||
146 | |||
147 | return TRUE; | ||
148 | } | ||
149 | |||
150 | |||
151 | // gets a sample from the file | ||
152 | bool getSample(int& l, int& r) | ||
153 | { | ||
154 | l = r = 0; | ||
155 | |||
156 | if ( input == 0 ) | ||
157 | return FALSE; | ||
158 | |||
159 | if ( (wavedata_remaining < 0) || !max ) | ||
160 | return FALSE; | ||
161 | |||
162 | if ( out >= max ) { | ||
163 | max = input->readBlock( (char*)data, (uint)QMIN(sound_buffer_size,wavedata_remaining) ); | ||
164 | |||
165 | wavedata_remaining -= max; | ||
166 | |||
167 | out = 0; | ||
168 | if ( max <= 0 ) { | ||
169 | max = 0; | ||
170 | return TRUE; | ||
171 | } | ||
172 | } | ||
173 | if ( chunkdata.wBitsPerSample == 8 ) { | ||
174 | l = (data[out++] - 128) * 128; | ||
175 | } else { | ||
176 | l = ((short*)data)[out/2]; | ||
177 | out += 2; | ||
178 | } | ||
179 | if ( chunkdata.channels == 1 ) { | ||
180 | r = l; | ||
181 | } else { | ||
182 | if ( chunkdata.wBitsPerSample == 8 ) { | ||
183 | r = (data[out++] - 128) * 128; | ||
184 | } else { | ||
185 | r = ((short*)data)[out/2]; | ||
186 | out += 2; | ||
187 | } | ||
188 | } | ||
189 | return TRUE; | ||
190 | } // getSample | ||
191 | |||
192 | }; | ||
193 | |||
194 | |||
195 | WavPlugin::WavPlugin() { | ||
196 | d = new WavPluginData; | ||
197 | d->input = 0; | ||
198 | } | ||
199 | |||
200 | |||
201 | WavPlugin::~WavPlugin() { | ||
202 | close(); | ||
203 | delete d; | ||
204 | } | ||
205 | |||
206 | |||
207 | bool WavPlugin::isFileSupported( const QString& path ) { | ||
208 | debugMsg( "WavPlugin::isFileSupported" ); | ||
209 | |||
210 | char *ext = strrchr( path.latin1(), '.' ); | ||
211 | |||
212 | // Test file extension | ||
213 | if ( ext ) { | ||
214 | if ( strncasecmp(ext, ".raw", 4) == 0 ) | ||
215 | return TRUE; | ||
216 | if ( strncasecmp(ext, ".wav", 4) == 0 ) | ||
217 | return TRUE; | ||
218 | if ( strncasecmp(ext, ".wave", 4) == 0 ) | ||
219 | return TRUE; | ||
220 | } | ||
221 | |||
222 | return FALSE; | ||
223 | } | ||
224 | |||
225 | |||
226 | bool WavPlugin::open( const QString& path ) { | ||
227 | debugMsg( "WavPlugin::open" ); | ||
228 | |||
229 | d->max = d->out = sound_buffer_size; | ||
230 | d->wavedata_remaining = 0; | ||
231 | d->samples_due = 0; | ||
232 | |||
233 | d->input = new QFile( path ); | ||
234 | if ( d->input->open(IO_ReadOnly) == FALSE ) { | ||
235 | qDebug("couldn't open file"); | ||
236 | delete d->input; | ||
237 | d->input = 0; | ||
238 | return FALSE; | ||
239 | } | ||
240 | |||
241 | d->initialise(); | ||
242 | |||
243 | return TRUE; | ||
244 | } | ||
245 | |||
246 | |||
247 | bool WavPlugin::close() { | ||
248 | debugMsg( "WavPlugin::close" ); | ||
249 | |||
250 | d->input->close(); | ||
251 | delete d->input; | ||
252 | d->input = 0; | ||
253 | return TRUE; | ||
254 | } | ||
255 | |||
256 | |||
257 | bool WavPlugin::isOpen() { | ||
258 | debugMsg( "WavPlugin::isOpen" ); | ||
259 | return ( d->input != 0 ); | ||
260 | } | ||
261 | |||
262 | |||
263 | int WavPlugin::audioStreams() { | ||
264 | debugMsg( "WavPlugin::audioStreams" ); | ||
265 | return 1; | ||
266 | } | ||
267 | |||
268 | |||
269 | int WavPlugin::audioChannels( int ) { | ||
270 | debugMsg( "WavPlugin::audioChannels" ); | ||
271 | return 2; // ### Always scale audio to stereo samples | ||
272 | } | ||
273 | |||
274 | |||
275 | int WavPlugin::audioFrequency( int ) { | ||
276 | debugMsg( "WavPlugin::audioFrequency" ); | ||
277 | return 44100; // ### Always scale to frequency of 44100 | ||
278 | } | ||
279 | |||
280 | |||
281 | int WavPlugin::audioSamples( int ) { | ||
282 | debugMsg( "WavPlugin::audioSamples" ); | ||
283 | return d->samples * 2 / d->chunkdata.channels; // ### Scaled samples will be made stereo, | ||
284 | // Therefore if source is mono we will double the number of samples | ||
285 | } | ||
286 | |||
287 | |||
288 | bool WavPlugin::audioSetSample( long, int ) { | ||
289 | debugMsg( "WavPlugin::audioSetSample" ); | ||
290 | return FALSE; | ||
291 | } | ||
292 | |||
293 | |||
294 | long WavPlugin::audioGetSample( int ) { | ||
295 | debugMsg( "WavPlugin::audioGetSample" ); | ||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | /* | ||
300 | bool WavPlugin::audioReadSamples( short *, int, long, int ) { | ||
301 | debugMsg( "WavPlugin::audioReadSamples" ); | ||
302 | return FALSE; | ||
303 | } | ||
304 | |||
305 | |||
306 | bool WavPlugin::audioReReadSamples( short *, int, long, int ) { | ||
307 | debugMsg( "WavPlugin::audioReReadSamples" ); | ||
308 | return FALSE; | ||
309 | } | ||
310 | |||
311 | |||
312 | bool WavPlugin::audioReadMonoSamples( short *output, long samples, long& samplesMade, int ) { | ||
313 | debugMsg( "WavPlugin::audioReadMonoSamples" ); | ||
314 | return !d->add( output, samples, samplesMade, FALSE ); | ||
315 | } | ||
316 | |||
317 | |||
318 | bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) { | ||
319 | debugMsg( "WavPlugin::audioReadStereoSamples" ); | ||
320 | return !d->add( output, samples, samplesMade, TRUE ); | ||
321 | } | ||
322 | */ | ||
323 | |||
324 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { | ||
325 | debugMsg( "WavPlugin::audioReadSamples" ); | ||
326 | return !d->add( output, samples, samplesMade, channels != 1 ); | ||
327 | } | ||
328 | |||
329 | double WavPlugin::getTime() { | ||
330 | debugMsg( "WavPlugin::getTime" ); | ||
331 | return 0.0; | ||
332 | } | ||
333 | |||
334 | |||
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.h b/core/multimedia/opieplayer/wavplugin/wavplugin.h new file mode 100644 index 0000000..64635ca --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef WAV_PLUGIN_H | ||
21 | #define WAV_PLUGIN_H | ||
22 | |||
23 | |||
24 | #include <qstring.h> | ||
25 | #include <qapplication.h> | ||
26 | #include "mediaplayerplugininterface.h" | ||
27 | |||
28 | |||
29 | class WavPluginData; | ||
30 | |||
31 | |||
32 | class WavPlugin : public MediaPlayerDecoder { | ||
33 | |||
34 | public: | ||
35 | WavPlugin(); | ||
36 | ~WavPlugin(); | ||
37 | |||
38 | const char *pluginName() { return "WavPlugin"; } | ||
39 | const char *pluginComment() { return "This is a simple plugin for playing wav files"; } | ||
40 | double pluginVersion() { return 1.0; } | ||
41 | |||
42 | bool isFileSupported( const QString& ); | ||
43 | bool open( const QString& ); | ||
44 | bool close(); | ||
45 | bool isOpen(); | ||
46 | //const QString &fileInfo() { return strInfo = qApp->translate( "MediaPlayer", "No Information Available", "media plugin text" ); } | ||
47 | const QString &fileInfo() { return strInfo = QString(""); } | ||
48 | |||
49 | // If decoder doesn't support audio then return 0 here | ||
50 | int audioStreams(); | ||
51 | int audioChannels( int stream ); | ||
52 | int audioFrequency( int stream ); | ||
53 | int audioSamples( int stream ); | ||
54 | bool audioSetSample( long sample, int stream ); | ||
55 | long audioGetSample( int stream ); | ||
56 | //bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | ||
57 | //bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | ||
58 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); | ||
59 | //bool audioReadSamples( short *output, int channel, long samples, int stream ); | ||
60 | //bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
61 | |||
62 | // If decoder doesn't support video then return 0 here | ||
63 | int videoStreams() { return 0; } | ||
64 | int videoWidth( int ) { return 0; } | ||
65 | int videoHeight( int ) { return 0; } | ||
66 | double videoFrameRate( int ) { return 0.0; } | ||
67 | int videoFrames( int ) { return 0; } | ||
68 | bool videoSetFrame( long, int ) { return FALSE; } | ||
69 | long videoGetFrame( int ) { return 0; } | ||
70 | bool videoReadFrame( unsigned char **, int, int, int, int, ColorFormat, int ) { return FALSE; } | ||
71 | bool videoReadScaledFrame( unsigned char **, int, int, int, int, int, int, ColorFormat, int ) { return FALSE; } | ||
72 | bool videoReadYUVFrame( char *, char *, char *, int, int, int, int, int ) { return FALSE; } | ||
73 | |||
74 | // Profiling | ||
75 | double getTime(); | ||
76 | |||
77 | // Ignore if these aren't supported | ||
78 | bool setSMP( int ) { return FALSE; } | ||
79 | bool setMMX( bool ) { return FALSE; } | ||
80 | |||
81 | // Capabilities | ||
82 | bool supportsAudio() { return TRUE; } | ||
83 | bool supportsVideo() { return FALSE; } | ||
84 | bool supportsYUV() { return FALSE; } | ||
85 | bool supportsMMX() { return TRUE; } | ||
86 | bool supportsSMP() { return FALSE; } | ||
87 | bool supportsStereo() { return TRUE; } | ||
88 | bool supportsScaling() { return FALSE; } | ||
89 | |||
90 | private: | ||
91 | WavPluginData *d; | ||
92 | QString strInfo; | ||
93 | |||
94 | }; | ||
95 | |||
96 | |||
97 | #endif | ||
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.pro b/core/multimedia/opieplayer/wavplugin/wavplugin.pro new file mode 100644 index 0000000..4663813 --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.pro | |||
@@ -0,0 +1,10 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG += qt warn_on release | ||
3 | HEADERS = wavplugin.h wavpluginimpl.h | ||
4 | SOURCES = wavplugin.cpp wavpluginimpl.cpp | ||
5 | TARGET = wavplugin | ||
6 | DESTDIR = ../../plugins/codecs | ||
7 | INCLUDEPATH += $(QPEDIR)/include .. | ||
8 | DEPENDPATH += ../$(QPEDIR)/include .. | ||
9 | LIBS += -lqpe | ||
10 | VERSION = 1.0.0 | ||
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp new file mode 100644 index 0000000..1f7b85b --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp | |||
@@ -0,0 +1,70 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #include "wavplugin.h" | ||
21 | #include "wavpluginimpl.h" | ||
22 | |||
23 | |||
24 | WavPluginImpl::WavPluginImpl() | ||
25 | : libmadplugin(0), ref(0) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | |||
30 | WavPluginImpl::~WavPluginImpl() | ||
31 | { | ||
32 | if ( libmadplugin ) | ||
33 | delete libmadplugin; | ||
34 | } | ||
35 | |||
36 | |||
37 | MediaPlayerDecoder *WavPluginImpl::decoder() | ||
38 | { | ||
39 | if ( !libmadplugin ) | ||
40 | libmadplugin = new WavPlugin; | ||
41 | return libmadplugin; | ||
42 | } | ||
43 | |||
44 | |||
45 | MediaPlayerEncoder *WavPluginImpl::encoder() | ||
46 | { | ||
47 | return NULL; | ||
48 | } | ||
49 | |||
50 | |||
51 | #ifndef QT_NO_COMPONENT | ||
52 | |||
53 | |||
54 | QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
55 | { | ||
56 | *iface = 0; | ||
57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | ||
58 | *iface = this, (*iface)->addRef(); | ||
59 | return QS_OK; | ||
60 | } | ||
61 | |||
62 | |||
63 | Q_EXPORT_INTERFACE() | ||
64 | { | ||
65 | Q_CREATE_INSTANCE( WavPluginImpl ) | ||
66 | } | ||
67 | |||
68 | |||
69 | #endif | ||
70 | |||
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h new file mode 100644 index 0000000..ee32f54 --- a/dev/null +++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef WAV_PLUGIN_IMPL_H | ||
21 | #define WAV_PLUGIN_IMPL_H | ||
22 | |||
23 | |||
24 | #include "../mediaplayerplugininterface.h" | ||
25 | |||
26 | |||
27 | class WavPlugin; | ||
28 | |||
29 | |||
30 | class WavPluginImpl : public MediaPlayerPluginInterface | ||
31 | { | ||
32 | public: | ||
33 | WavPluginImpl(); | ||
34 | virtual ~WavPluginImpl(); | ||
35 | |||
36 | #ifndef QT_NO_COMPONENT | ||
37 | |||
38 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
39 | Q_REFCOUNT | ||
40 | |||
41 | #endif | ||
42 | |||
43 | virtual MediaPlayerDecoder *decoder(); | ||
44 | virtual MediaPlayerEncoder *encoder(); | ||
45 | |||
46 | private: | ||
47 | WavPlugin *libmadplugin; | ||
48 | ulong ref; | ||
49 | }; | ||
50 | |||
51 | |||
52 | #endif | ||
53 | |||