Declare more metatypes and debug operators.
Nearly all of the multimedia metatypes used in the auto tests are now declared properly, and a large number of the types have debug operators as well. Removed the superfluous decls as well. Change-Id: I42cfe37562db0c71d9811b4577fc326a3326ccc9 Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
6a3a442ea6
commit
7dfb883df6
@@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
#include <qaudio.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -98,6 +98,48 @@ public:
|
||||
\value AudioInput audio input device
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug dbg, QAudio::Error error)
|
||||
{
|
||||
switch (error) {
|
||||
case QAudio::NoError:
|
||||
return dbg.nospace() << "NoError";
|
||||
case QAudio::OpenError:
|
||||
return dbg.nospace() << "OpenError";
|
||||
case QAudio::IOError:
|
||||
return dbg.nospace() << "IOError";
|
||||
case QAudio::UnderrunError:
|
||||
return dbg.nospace() << "UnderrunError";
|
||||
case QAudio::FatalError:
|
||||
return dbg.nospace() << "FatalError";
|
||||
}
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, QAudio::State state)
|
||||
{
|
||||
switch (state) {
|
||||
case QAudio::ActiveState:
|
||||
return dbg.nospace() << "ActiveState";
|
||||
case QAudio::SuspendedState:
|
||||
return dbg.nospace() << "SuspendedState";
|
||||
case QAudio::StoppedState:
|
||||
return dbg.nospace() << "StoppedState";
|
||||
case QAudio::IdleState:
|
||||
return dbg.nospace() << "IdleState";
|
||||
}
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, QAudio::Mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case QAudio::AudioInput:
|
||||
return dbg.nospace() << "AudioInput";
|
||||
case QAudio::AudioOutput:
|
||||
return dbg.nospace() << "AudioOutput";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
@@ -63,12 +63,18 @@ namespace QAudio
|
||||
enum Mode { AudioInput, AudioOutput };
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Error error);
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::State state);
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Mode mode);
|
||||
#endif
|
||||
|
||||
QT_END_HEADER
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(QAudio::Error)
|
||||
Q_DECLARE_METATYPE(QAudio::State)
|
||||
Q_DECLARE_METATYPE(QAudio::Mode)
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QAUDIO_H
|
||||
|
||||
@@ -44,21 +44,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Debugging
|
||||
QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat)
|
||||
{
|
||||
dbg.nospace() << "QAudioFormat(" <<
|
||||
audioFormat.frequency() << "," <<
|
||||
audioFormat.channels() << "," <<
|
||||
audioFormat.sampleSize()<< "," <<
|
||||
audioFormat.codec() << "," <<
|
||||
audioFormat.byteOrder() << "," <<
|
||||
audioFormat.sampleType() << ")";
|
||||
|
||||
return dbg.space();
|
||||
}
|
||||
|
||||
|
||||
// Conversion
|
||||
QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf)
|
||||
{
|
||||
|
||||
@@ -67,10 +67,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_MODULE(Multimedia)
|
||||
|
||||
|
||||
|
||||
extern QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat);
|
||||
|
||||
extern QAudioFormat toQAudioFormat(const AudioStreamBasicDescription& streamFormat);
|
||||
extern AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& audioFormat);
|
||||
|
||||
|
||||
@@ -109,8 +109,8 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
Q_DECLARE_METATYPE(QAudioDeviceInfo)
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QAUDIODEVICEINFO_H
|
||||
|
||||
@@ -403,5 +403,46 @@ QAudioFormat::SampleType QAudioFormat::sampleType() const
|
||||
\value LittleEndian Samples are little endian byte order
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug dbg, QAudioFormat::Endian endian)
|
||||
{
|
||||
switch (endian) {
|
||||
case QAudioFormat::BigEndian:
|
||||
return dbg.nospace() << "BigEndian";
|
||||
case QAudioFormat::LittleEndian:
|
||||
return dbg.nospace() << "LittleEndian";
|
||||
}
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, QAudioFormat::SampleType type)
|
||||
{
|
||||
switch (type) {
|
||||
case QAudioFormat::SignedInt:
|
||||
return dbg.nospace() << "SignedInt";
|
||||
case QAudioFormat::UnSignedInt:
|
||||
return dbg.nospace() << "UnSignedInt";
|
||||
case QAudioFormat::Float:
|
||||
return dbg.nospace() << "Float";
|
||||
default:
|
||||
return dbg.nospace() << "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, const QAudioFormat &f)
|
||||
{
|
||||
dbg.nospace() << "QAudioFormat(" << f.sampleRate();
|
||||
dbg.nospace() << "Hz, " << f.sampleSize();
|
||||
dbg.nospace() << "bit, channelCount=" << f.channelCount();
|
||||
dbg.nospace() << ", sampleType=" << f.sampleType();
|
||||
dbg.nospace() << ", byteOrder=" << f.byteOrder();
|
||||
dbg.nospace() << ", codec=" << f.codec();
|
||||
dbg.nospace() << ")";
|
||||
|
||||
return dbg.space();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_MODULE(Multimedia)
|
||||
|
||||
|
||||
|
||||
class QAudioFormatPrivate;
|
||||
|
||||
class Q_MULTIMEDIA_EXPORT QAudioFormat
|
||||
@@ -101,9 +99,18 @@ private:
|
||||
QSharedDataPointer<QAudioFormatPrivate> d;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QAudioFormat &);
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QAudioFormat::SampleType);
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QAudioFormat::Endian);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(QAudioFormat)
|
||||
Q_DECLARE_METATYPE(QAudioFormat::SampleType)
|
||||
Q_DECLARE_METATYPE(QAudioFormat::Endian)
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QAUDIOFORMAT_H
|
||||
|
||||
Reference in New Issue
Block a user