diff options
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/audio/qaudiodevicefactory.cpp | 20 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo.cpp | 34 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo.h | 2 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 12 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioformat.cpp | 66 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioformat.h | 4 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput.cpp | 18 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_alsa_p.h | 5 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 9 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.h | 3 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_alsa_p.h | 5 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.h | 2 | ||||
-rw-r--r-- | src/multimedia/multimedia.pro | 4 | ||||
-rw-r--r-- | src/multimedia/video/qabstractvideobuffer.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/video/qabstractvideobuffer.h | 2 |
16 files changed, 147 insertions, 43 deletions
diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 4f45110..96545b4 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -67,9 +67,10 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QAudioEngineFactoryInterface_iid, QLatin1String("/audio"), Qt::CaseInsensitive)) - +#endif class QNullDeviceInfo : public QAbstractAudioDeviceInfo { @@ -137,6 +138,8 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif #endif + +#ifndef QT_NO_LIBRARY QFactoryLoader* l = loader(); foreach (QString const& key, l->keys()) { @@ -148,12 +151,14 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) delete plugin; } +#endif return devices; } QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() { +#ifndef QT_NO_LIBRARY QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); if (plugin) { @@ -161,6 +166,8 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); } +#endif + #ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); @@ -171,6 +178,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() { +#ifndef QT_NO_LIBRARY QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); if (plugin) { @@ -178,6 +186,8 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } +#endif + #ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); @@ -196,11 +206,14 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re return new QAudioDeviceInfoInternal(handle, mode); #endif #endif + +#ifndef QT_NO_LIBRARY QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(realm)); if (plugin) rc = plugin->createDeviceInfo(handle, mode); +#endif return rc == 0 ? new QNullDeviceInfo() : rc; } @@ -225,11 +238,13 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con return new QAudioInputPrivate(deviceInfo.handle(), format); #endif #endif +#ifndef QT_NO_LIBRARY QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm())); if (plugin) return plugin->createInput(deviceInfo.handle(), format); +#endif return new QNullInputDevice(); } @@ -244,11 +259,14 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c return new QAudioOutputPrivate(deviceInfo.handle(), format); #endif #endif + +#ifndef QT_NO_LIBRARY QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm())); if (plugin) return plugin->createOutput(deviceInfo.handle(), format); +#endif return new QNullOutputDevice(); } diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index ae65b02..201a03d 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -106,8 +106,8 @@ public: The values supported by the the device for each of these parameters can be fetched with - supportedByteOrders(), supportedChannels(), supportedCodecs(), - supportedFrequencies(), supportedSampleSizes(), and + supportedByteOrders(), supportedChannelCounts(), supportedCodecs(), + supportedSampleRates(), supportedSampleSizes(), and supportedSampleTypes(). The combinations supported are dependent on the platform, audio plugins installed and the audio device capabilities. If you need a specific format, you can check if the device supports it with isFormatSupported(), or fetch a @@ -319,7 +319,20 @@ QStringList QAudioDeviceInfo::supportedCodecs() const } /*! - Returns a list of supported frequencies. + Returns a list of supported sample rates. + + \since 4.7 +*/ + +QList<int> QAudioDeviceInfo::supportedSampleRates() const +{ + return supportedFrequencies(); +} + +/*! + \obsolete + + Use supportedSampleRates() instead. */ QList<int> QAudioDeviceInfo::supportedFrequencies() const @@ -328,7 +341,20 @@ QList<int> QAudioDeviceInfo::supportedFrequencies() const } /*! - Returns a list of supported channels. + Returns a list of supported channel counts. + + \since 4.7 +*/ + +QList<int> QAudioDeviceInfo::supportedChannelCounts() const +{ + return supportedChannels(); +} + +/*! + \obsolete + + Use supportedChannelCount() instead. */ QList<int> QAudioDeviceInfo::supportedChannels() const diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index 62dc8a2..1cc0731 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo.h @@ -84,7 +84,9 @@ public: QStringList supportedCodecs() const; QList<int> supportedFrequencies() const; + QList<int> supportedSampleRates() const; QList<int> supportedChannels() const; + QList<int> supportedChannelCounts() const; QList<int> supportedSampleSizes() const; QList<QAudioFormat::Endian> supportedByteOrders() const; QList<QAudioFormat::SampleType> supportedSampleTypes() const; diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 465bc98..aee0807 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -97,14 +97,14 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const QAudioFormat nearest; if(mode == QAudio::AudioOutput) { nearest.setFrequency(44100); - nearest.setChannels(2); + nearest.setChannelCount(2); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(16); nearest.setCodec(QLatin1String("audio/pcm")); } else { nearest.setFrequency(11025); - nearest.setChannels(1); + nearest.setChannelCount(1); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(8); @@ -268,7 +268,7 @@ void QAudioDeviceInfoInternal::updateLists() for(i=0;i<iNumDevs;i++) { if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { - tmp = QString::fromUtf16((const unsigned short*)woc.szPname); + tmp = QString((const QChar *)woc.szPname); if(tmp.compare(device) == 0) { match = true; fmt = woc.dwFormats; @@ -288,7 +288,7 @@ void QAudioDeviceInfoInternal::updateLists() for(i=0;i<iNumDevs;i++) { if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { - tmp = QString::fromUtf16((const unsigned short*)woc.szPname); + tmp = QString((const QChar *)woc.szPname); if(tmp.compare(device) == 0) { match = true; fmt = woc.dwFormats; @@ -399,7 +399,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) for(i=0;i<iNumDevs;i++) { if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { - devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData()); + devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); } } } else { @@ -409,7 +409,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) for(i=0;i<iNumDevs;i++) { if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { - devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData()); + devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); } } diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index 89ae0ff..86d72f6 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -111,7 +111,7 @@ public: \o Parameter \o Description \row - \o Frequency + \o Sample Rate \o Samples per second of audio data in Hertz. \row \o Number of channels @@ -143,8 +143,8 @@ public: Values are initialized as follows: \list - \o frequency() = -1 - \o channels() = -1 + \o sampleRate() = -1 + \o channelCount() = -1 \o sampleSize() = -1 \o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder) \o sampleType() = QAudioFormat::Unknown @@ -224,7 +224,20 @@ bool QAudioFormat::isValid() const } /*! - Sets the frequency to \a frequency. + Sets the sample rate to \a samplerate Hertz. + + \since 4.7 +*/ + +void QAudioFormat::setSampleRate(int samplerate) +{ + d->frequency = samplerate; +} + +/*! + \obsolete + + Use setSampleRate() instead. */ void QAudioFormat::setFrequency(int frequency) @@ -233,7 +246,20 @@ void QAudioFormat::setFrequency(int frequency) } /*! - Returns the current frequency value. + Returns the current sample rate in Hertz. + + \since 4.7 +*/ + +int QAudioFormat::sampleRate() const +{ + return d->frequency; +} + +/*! + \obsolete + + Use sampleRate() instead. */ int QAudioFormat::frequency() const @@ -242,7 +268,20 @@ int QAudioFormat::frequency() const } /*! - Sets the channels to \a channels. + Sets the channel count to \a channels. + + \since 4.7 +*/ + +void QAudioFormat::setChannelCount(int channels) +{ + d->channels = channels; +} + +/*! + \obsolete + + Use setChannelCount() instead. */ void QAudioFormat::setChannels(int channels) @@ -251,7 +290,20 @@ void QAudioFormat::setChannels(int channels) } /*! - Returns the current channel value. + Returns the current channel count value. + + \since 4.7 +*/ + +int QAudioFormat::channelCount() const +{ + return d->channels; +} + +/*! + \obsolete + + Use channelCount() instead. */ int QAudioFormat::channels() const diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index cb58d1c..6c835b7 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -75,9 +75,13 @@ public: void setFrequency(int frequency); int frequency() const; + void setSampleRate(int sampleRate); + int sampleRate() const; void setChannels(int channels); int channels() const; + void setChannelCount(int channelCount); + int channelCount() const; void setSampleSize(int sampleSize); int sampleSize() const; diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 6ea7ff3..3676f64 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -211,11 +211,7 @@ QAudioInput::~QAudioInput() If a problem occurs during this process the error() is set to QAudio::OpenError, state() is set to QAudio::StoppedState and stateChanged() signal is emitted. - In either case, the stateChanged() signal may be emitted either synchronously - during execution of the start() function or asynchronously after start() has - returned to the caller. - - \sa {Symbian Platform Security Requirements} + \l{QAudioInput#Symbian Platform Security Requirements} \sa QIODevice */ @@ -237,11 +233,7 @@ void QAudioInput::start(QIODevice* device) If a problem occurs during this process the error() is set to QAudio::OpenError, state() is set to QAudio::StoppedState and stateChanged() signal is emitted. - In either case, the stateChanged() signal may be emitted either synchronously - during execution of the start() function or asynchronously after start() has - returned to the caller. - - \sa {Symbian Platform Security Requirements} + \l{QAudioInput#Symbian Platform Security Requirements} \sa QIODevice */ @@ -286,8 +278,6 @@ void QAudioInput::reset() Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and emit stateChanged() signal. - - Note: signal will always be emitted during execution of the resume() function. */ void QAudioInput::suspend() @@ -310,7 +300,7 @@ void QAudioInput::resume() } /*! - Sets the audio buffer size to \a value bytes. + Sets the audio buffer size to \a value milliseconds. Note: This function can be called anytime before start(), calls to this are ignored after start(). It should not be assumed that the buffer size @@ -325,7 +315,7 @@ void QAudioInput::setBufferSize(int value) } /*! - Returns the audio buffer size in bytes. + Returns the audio buffer size in milliseconds. If called before start(), returns platform default value. If called before start() but setBufferSize() was called prior, returns value set by setBufferSize(). diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index 92cef83..c907019 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -61,6 +61,7 @@ #include <QtCore/qtimer.h> #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> +#include <QtCore/qelapsedtimer.h> #include <QtCore/qdatetime.h> #include <QtMultimedia/qaudio.h> @@ -116,8 +117,8 @@ private: void drain(); QTimer* timer; - QTime timeStamp; - QTime clockStamp; + QElapsedTimer timeStamp; + QElapsedTimer clockStamp; qint64 elapsedTimeOffset; int intervalTime; char* audioBuffer; diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 8240047..14a1cf3 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -79,7 +79,7 @@ QAudioInputPrivate::~QAudioInputPrivate() stop(); } -void CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, +void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) { Q_UNUSED(dwParam1) @@ -221,6 +221,11 @@ bool QAudioInputPrivate::open() } else { period_size = buffer_size/5; } +#ifdef Q_OS_WINCE + // For wince reduce size to 40ms for buffer size and 20ms period + buffer_size = settings.sampleRate()*settings.channelCount()*(settings.sampleSize()/8)*0.04; + period_size = buffer_size/2; +#endif timeStamp.restart(); elapsedTimeOffset = 0; wfx.nSamplesPerSec = settings.frequency(); @@ -241,7 +246,7 @@ bool QAudioInputPrivate::open() if(waveInGetDevCaps(ii, &wic, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { QString tmp; - tmp = QString::fromUtf16((const unsigned short*)wic.szPname); + tmp = QString((const QChar *)wic.szPname); if(tmp.compare(QLatin1String(m_device)) == 0) { devId = ii; break; diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index 1737bb1..8a9b02b 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -124,8 +124,7 @@ private: int waveCurrentBlock; QMutex mutex; - - static void CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg, + static void QT_WIN_CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); WAVEHDR* allocateBlocks(int size, int count); diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index 802bc27..e6ac231 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -60,6 +60,7 @@ #include <QtCore/qtimer.h> #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> +#include <QtCore/qelapsedtimer.h> #include <QtCore/qdatetime.h> #include <QtMultimedia/qaudio.h> @@ -133,8 +134,8 @@ private: QTimer* timer; QByteArray m_device; int bytesAvailable; - QTime timeStamp; - QTime clockStamp; + QElapsedTimer timeStamp; + QElapsedTimer clockStamp; qint64 elapsedTimeOffset; char* audioBuffer; snd_pcm_t* handle; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 533583a..a8aeb41 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -250,7 +250,7 @@ bool QAudioOutputPrivate::open() if(waveOutGetDevCaps(ii, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { QString tmp; - tmp = QString::fromUtf16((const unsigned short*)woc.szPname); + tmp = QString((const QChar *)woc.szPname); if(tmp.compare(QLatin1String(m_device)) == 0) { devId = ii; break; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index aab1064..2d19225 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -117,7 +117,7 @@ private: qint64 totalTimeValue; bool pullMode; int intervalTime; - static void CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, + static void QT_WIN_CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); QMutex mutex; diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index c729103..852322d 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -11,4 +11,6 @@ include(../qbase.pri) include(audio/audio.pri) include(video/video.pri) -symbian: TARGET.UID3 = 0x2001E627
\ No newline at end of file +symbian: { + TARGET.UID3 = 0x2001E627 +} diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp index 465a1e7..e9d30d0 100644 --- a/src/multimedia/video/qabstractvideobuffer.cpp +++ b/src/multimedia/video/qabstractvideobuffer.cpp @@ -71,6 +71,8 @@ QT_BEGIN_NAMESPACE \value NoHandle The buffer has no handle, its data can only be accessed by mapping the buffer. \value GLTextureHandle The handle of the buffer is an OpenGL texture ID. + \value XvShmImageHandle The handle contains pointer to shared memory XVideo image. + \value CoreImageHandle The handle contains pointer to Mac OS X CIImage. \value UserHandle Start value for user defined handle types. \sa handleType() diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h index 4ffa46f..a8389db 100644 --- a/src/multimedia/video/qabstractvideobuffer.h +++ b/src/multimedia/video/qabstractvideobuffer.h @@ -61,6 +61,8 @@ public: { NoHandle, GLTextureHandle, + XvShmImageHandle, + CoreImageHandle, UserHandle = 1000 }; |