summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/wavplugin
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/wavplugin') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.cpp16
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.h5
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp8
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavpluginimpl.h3
4 files changed, 18 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
index 7ac63c0..4a0da16 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
@@ -61,42 +61,44 @@ public:
61 uchar data[sound_buffer_size+32]; // +32 to handle badly aligned input data 61 uchar data[sound_buffer_size+32]; // +32 to handle badly aligned input data
62 int out,max; 62 int out,max;
63 int samples_due; 63 int samples_due;
64 int samples; 64 int samples;
65 65
66 WavPluginData() { 66 WavPluginData() {
67 max = out = sound_buffer_size; 67 max = out = sound_buffer_size;
68 wavedata_remaining = 0; 68 wavedata_remaining = 0;
69 samples_due = 0; 69 samples_due = 0;
70 samples = -1; 70 samples = -1;
71 } 71 }
72 72
73 // expands out samples to the frequency of 44kHz 73 // expands out samples to the frequency of 44kHz //not any more
74 bool add( short *output, long count, long& done, bool stereo ) 74 bool add( short *output, long count, long& done, bool stereo )
75 { 75 {
76 done = 0; 76 done = 0;
77 qApp->processEvents(); 77 qApp->processEvents();
78 78
79 if ( input == 0 ) { 79 if ( input == 0 ) {
80 qDebug("no input"); 80 qDebug("no input");
81 return FALSE; 81 return FALSE;
82 } 82 }
83 83
84 while ( count ) { 84 while ( count ) {
85 int l,r; 85 int l,r;
86 if ( getSample(l, r) == FALSE ) { 86 if ( getSample(l, r) == FALSE ) {
87 qDebug("didn't get sample"); 87 qDebug("didn't get sample");
88 return FALSE; 88 return FALSE;
89 } 89 }
90 samples_due += chunkdata.samplesPerSec; 90 samples_due += chunkdata.samplesPerSec;
91 printf("samples due %d\r", samples_due);
92 fflush(stdout);
91 while ( count && (samples_due > chunkdata.samplesPerSec) ) { 93 while ( count && (samples_due > chunkdata.samplesPerSec) ) {
92 *output++ = l; 94 *output++ = l;
93 if ( stereo ) 95 if ( stereo )
94 *output++ = r; 96 *output++ = r;
95 samples_due -= chunkdata.samplesPerSec; 97 samples_due -= chunkdata.samplesPerSec;
96 count--; 98 count--;
97 done++; 99 done++;
98 } 100 }
99 } 101 }
100 return TRUE; 102 return TRUE;
101 } 103 }
102 104
@@ -319,22 +321,22 @@ bool WavPlugin::audioReadMonoSamples( short *output, long samples, long& samples
319bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) { 321bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) {
320 debugMsg( "WavPlugin::audioReadStereoSamples" ); 322 debugMsg( "WavPlugin::audioReadStereoSamples" );
321 return !d->add( output, samples, samplesMade, TRUE ); 323 return !d->add( output, samples, samplesMade, TRUE );
322} 324}
323*/ 325*/
324 326
325bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { 327bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) {
326// qDebug( "WavPlugin::audioReadSamples" ); 328// qDebug( "WavPlugin::audioReadSamples" );
327 return d->add( output, samples, samplesMade, channels != 1 ); 329 return d->add( output, samples, samplesMade, channels != 1 );
328} 330}
329 331
330double WavPlugin::getTime() { 332double WavPlugin::getTime() {
331// qDebug( "WavPlugin::getTime" ); 333// qDebug( "WavPlugin::getTime" ); //this is a stupid hack here!!
332 return 0.0; 334 return d->chunkdata.wBitsPerSample; /*0.0*/;
333} 335}
334 336
335int WavPlugin::audioBitsPerSample( int ) { 337// int WavPlugin::audioBitsPerSample( int ) {
336// qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample ); 338// // qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample );
337 return d->chunkdata.wBitsPerSample; // 339// return d->chunkdata.wBitsPerSample; //
338} 340// }
339 341
340 342
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.h b/core/multimedia/opieplayer/wavplugin/wavplugin.h
index 6ae6e06..1c8ba14 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.h
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.h
@@ -15,25 +15,26 @@
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 20// L.J.Potter added changes Fri 02-15-2002
21 21
22#ifndef WAV_PLUGIN_H 22#ifndef WAV_PLUGIN_H
23#define WAV_PLUGIN_H 23#define WAV_PLUGIN_H
24 24
25#include <qstring.h> 25#include <qstring.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include "../mediaplayerplugininterface.h" 27/* #include "../mediaplayerplugininterface.h" */
28#include <qpe/mediaplayerplugininterface.h>
28 29
29 30
30// #define OLD_MEDIAPLAYER_API 31// #define OLD_MEDIAPLAYER_API
31 32
32 33
33class WavPluginData; 34class WavPluginData;
34 35
35 36
36class WavPlugin : public MediaPlayerDecoder { 37class WavPlugin : public MediaPlayerDecoder {
37 38
38public: 39public:
39 WavPlugin(); 40 WavPlugin();
@@ -44,25 +45,25 @@ public:
44 double pluginVersion() { return 1.0; } 45 double pluginVersion() { return 1.0; }
45 46
46 bool isFileSupported( const QString& ); 47 bool isFileSupported( const QString& );
47 bool open( const QString& ); 48 bool open( const QString& );
48 bool close(); 49 bool close();
49 bool isOpen(); 50 bool isOpen();
50 const QString &fileInfo() { return strInfo = ""; } 51 const QString &fileInfo() { return strInfo = ""; }
51 52
52 // If decoder doesn't support audio then return 0 here 53 // If decoder doesn't support audio then return 0 here
53 int audioStreams(); 54 int audioStreams();
54 int audioChannels( int stream ); 55 int audioChannels( int stream );
55 int audioFrequency( int stream ); 56 int audioFrequency( int stream );
56 int audioBitsPerSample( int stream ); 57/* int audioBitsPerSample( int stream ); */
57 int audioSamples( int stream ); 58 int audioSamples( int stream );
58 bool audioSetSample( long sample, int stream ); 59 bool audioSetSample( long sample, int stream );
59 long audioGetSample( int stream ); 60 long audioGetSample( int stream );
60#ifdef OLD_MEDIAPLAYER_API 61#ifdef OLD_MEDIAPLAYER_API
61 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); 62 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
62 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); 63 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
63 bool audioReadSamples( short *output, int channel, long samples, int stream ); 64 bool audioReadSamples( short *output, int channel, long samples, int stream );
64 bool audioReReadSamples( short *output, int channel, long samples, int stream ); 65 bool audioReReadSamples( short *output, int channel, long samples, int stream );
65#else 66#else
66 bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); 67 bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream );
67#endif 68#endif
68 69
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
index 2923180..c232d7b 100644
--- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
@@ -20,50 +20,50 @@
20#include "wavplugin.h" 20#include "wavplugin.h"
21#include "wavpluginimpl.h" 21#include "wavpluginimpl.h"
22 22
23WavPluginImpl::WavPluginImpl() 23WavPluginImpl::WavPluginImpl()
24 : libmadplugin(0), ref(0) 24 : libmadplugin(0), ref(0)
25{ 25{
26} 26}
27 27
28 28
29WavPluginImpl::~WavPluginImpl() 29WavPluginImpl::~WavPluginImpl()
30{ 30{
31 if ( libmadplugin ) 31 if ( libmadplugin )
32 delete libmadplugin; 32 delete libmadplugin;
33} 33}
34 34
35 35
36MediaPlayerDecoder *WavPluginImpl::decoder() 36MediaPlayerDecoder *WavPluginImpl::decoder()
37{ 37{
38 if ( !libmadplugin ) 38 if ( !libmadplugin )
39 libmadplugin = new WavPlugin; 39 libmadplugin = new WavPlugin;
40 return libmadplugin; 40 return libmadplugin;
41} 41}
42 42
43 43
44MediaPlayerEncoder *WavPluginImpl::encoder() 44MediaPlayerEncoder *WavPluginImpl::encoder()
45{ 45{
46 return NULL; 46 return NULL;
47} 47}
48 48
49 49
50#ifndef QT_NO_COMPONENT 50#ifndef QT_NO_COMPONENT
51 51
52 52
53QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 53QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
54{ 54{
55 *iface = 0; 55 *iface = 0;
56 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 56 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
57 *iface = this, (*iface)->addRef(); 57 *iface = this, (*iface)->addRef();
58 return QS_OK; 58 return QS_OK;
59} 59}
60 60
61 61
62Q_EXPORT_INTERFACE() 62Q_EXPORT_INTERFACE()
63{ 63{
64 Q_CREATE_INSTANCE( WavPluginImpl ) 64 Q_CREATE_INSTANCE( WavPluginImpl )
65} 65}
66 66
67 67
68#endif 68#endif
69 69
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
index 10f9305..fb1fa73 100644
--- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
+++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h
@@ -11,25 +11,26 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef WAV_PLUGIN_IMPL_H 20#ifndef WAV_PLUGIN_IMPL_H
21#define WAV_PLUGIN_IMPL_H 21#define WAV_PLUGIN_IMPL_H
22 22
23#include "../mediaplayerplugininterface.h" 23
24/* #include "../mediaplayerplugininterface.h" */
24 25
25 26
26class WavPlugin; 27class WavPlugin;
27 28
28 29
29class WavPluginImpl : public MediaPlayerPluginInterface 30class WavPluginImpl : public MediaPlayerPluginInterface
30{ 31{
31public: 32public:
32 WavPluginImpl(); 33 WavPluginImpl();
33 virtual ~WavPluginImpl(); 34 virtual ~WavPluginImpl();
34 35
35#ifndef QT_NO_COMPONENT 36#ifndef QT_NO_COMPONENT