diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-02-19 10:04:30 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-02-19 10:05:11 +0100 |
commit | 13882cd5da72bf0f6657752344793103a43a8e41 (patch) | |
tree | 6a3323763df5e42fc5d25a84786efff1f41c256e /src | |
parent | 391e8a7147edb1cdff6f1362ae0d3be4e7271ea7 (diff) | |
parent | 01714ef0c5ee80544e3799ae2a66d9a611c9d71f (diff) |
Merge remote-tracking branch 'origin/dev' into stable
Change-Id: I84b36fa41f3d5f8fea2dec2545f72ebe6a0c7908
Diffstat (limited to 'src')
85 files changed, 913 insertions, 586 deletions
diff --git a/src/gsttools/qgstreameraudioinputselector.cpp b/src/gsttools/qgstreameraudioinputselector.cpp index dcab762a2..02d3e5681 100644 --- a/src/gsttools/qgstreameraudioinputselector.cpp +++ b/src/gsttools/qgstreameraudioinputselector.cpp @@ -119,33 +119,36 @@ void QGstreamerAudioInputSelector::updateAlsaDevices() { #ifdef HAVE_ALSA void **hints, **n; - if (snd_device_name_hint(-1, "pcm", &hints) < 0) { - qWarning()<<"no alsa devices available"; - return; - } - n = hints; - - while (*n != NULL) { - char *name = snd_device_name_get_hint(*n, "NAME"); - char *descr = snd_device_name_get_hint(*n, "DESC"); - char *io = snd_device_name_get_hint(*n, "IOID"); - - if ((name != NULL) && (descr != NULL)) { - if ( io == NULL || qstrcmp(io,"Input") == 0 ) { - m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name)); - m_descriptions.append(QString::fromUtf8(descr)); + int card = -1; + + while (snd_card_next(&card) == 0 && card >= 0) { + if (snd_device_name_hint(card, "pcm", &hints) < 0) + continue; + + n = hints; + while (*n != NULL) { + char *name = snd_device_name_get_hint(*n, "NAME"); + char *descr = snd_device_name_get_hint(*n, "DESC"); + char *io = snd_device_name_get_hint(*n, "IOID"); + + if ((name != NULL) && (descr != NULL)) { + if ( io == NULL || qstrcmp(io,"Input") == 0 ) { + m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name)); + m_descriptions.append(QString::fromUtf8(descr)); + } } + + if (name != NULL) + free(name); + if (descr != NULL) + free(descr); + if (io != NULL) + free(io); + ++n; } - if (name != NULL) - free(name); - if (descr != NULL) - free(descr); - if (io != NULL) - free(io); - n++; + snd_device_name_free_hint(hints); } - snd_device_name_free_hint(hints); #endif } diff --git a/src/gsttools/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp index cf3bc1afe..8297040c1 100644 --- a/src/gsttools/qgstreamervideowidget.cpp +++ b/src/gsttools/qgstreamervideowidget.cpp @@ -100,7 +100,7 @@ QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent) , m_videoSink(0) , m_widget(0) , m_fullScreen(false) -{ +{ } QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl() diff --git a/src/imports/multimedia/qdeclarativecameracapture.cpp b/src/imports/multimedia/qdeclarativecameracapture.cpp index d5f363431..7e30867c8 100644 --- a/src/imports/multimedia/qdeclarativecameracapture.cpp +++ b/src/imports/multimedia/qdeclarativecameracapture.cpp @@ -110,10 +110,10 @@ QDeclarativeCameraCapture::QDeclarativeCameraCapture(QCamera *camera, QObject *p connect(m_capture, SIGNAL(readyForCaptureChanged(bool)), this, SIGNAL(readyForCaptureChanged(bool))); connect(m_capture, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int))); - connect(m_capture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(_q_imageCaptured(int, QImage))); + connect(m_capture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(_q_imageCaptured(int,QImage))); connect(m_capture, SIGNAL(imageMetadataAvailable(int,QString,QVariant)), this, SLOT(_q_imageMetadataAvailable(int,QString,QVariant))); - connect(m_capture, SIGNAL(imageSaved(int,QString)), this, SLOT(_q_imageSaved(int, QString))); + connect(m_capture, SIGNAL(imageSaved(int,QString)), this, SLOT(_q_imageSaved(int,QString))); connect(m_capture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this, SLOT(_q_captureFailed(int,QCameraImageCapture::Error,QString))); diff --git a/src/imports/multimedia/qdeclarativeradio.cpp b/src/imports/multimedia/qdeclarativeradio.cpp index 26620f302..b3a7b3f6e 100644 --- a/src/imports/multimedia/qdeclarativeradio.cpp +++ b/src/imports/multimedia/qdeclarativeradio.cpp @@ -114,7 +114,7 @@ QDeclarativeRadio::QDeclarativeRadio(QObject *parent) : connect(m_radioTuner, SIGNAL(signalStrengthChanged(int)), this, SIGNAL(signalStrengthChanged(int))); connect(m_radioTuner, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int))); connect(m_radioTuner, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); - connect(m_radioTuner, SIGNAL(stationFound(int, QString)), this, SIGNAL(stationFound(int, QString))); + connect(m_radioTuner, SIGNAL(stationFound(int,QString)), this, SIGNAL(stationFound(int,QString))); connect(m_radioTuner, SIGNAL(antennaConnectedChanged(bool)), this, SIGNAL(antennaConnectedChanged(bool))); connect(m_radioTuner, SIGNAL(availabilityChanged(QMultimedia::AvailabilityStatus)), this, SLOT(_q_availabilityChanged(QMultimedia::AvailabilityStatus))); diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index 6fad6604c..96cfb1ce4 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -39,17 +39,8 @@ SOURCES += \ audio/qaudiodecoder.cpp \ audio/qaudiohelpers.cpp -win32 { - PRIVATE_HEADERS += audio/qaudioinput_win32_p.h audio/qaudiooutput_win32_p.h audio/qaudiodeviceinfo_win32_p.h - SOURCES += audio/qaudiodeviceinfo_win32_p.cpp \ - audio/qaudiooutput_win32_p.cpp \ - audio/qaudioinput_win32_p.cpp - LIBS_PRIVATE += -lwinmm -lstrmiids -lole32 -loleaut32 -} - unix:!mac { config_pulseaudio { - DEFINES += QT_NO_AUDIO_BACKEND CONFIG += link_pkgconfig PKGCONFIG_PRIVATE += libpulse @@ -61,15 +52,6 @@ unix:!mac { DEFINES += QT_MULTIMEDIA_QAUDIO PRIVATE_HEADERS += audio/qsoundeffect_qaudio_p.h SOURCES += audio/qsoundeffect_qaudio_p.cpp - - config_alsa { - DEFINES += HAS_ALSA - PRIVATE_HEADERS += audio/qaudiooutput_alsa_p.h audio/qaudioinput_alsa_p.h audio/qaudiodeviceinfo_alsa_p.h - SOURCES += audio/qaudiodeviceinfo_alsa_p.cpp \ - audio/qaudiooutput_alsa_p.cpp \ - audio/qaudioinput_alsa_p.cpp - LIBS_PRIVATE += -lasound - } } } else { DEFINES += QT_MULTIMEDIA_QAUDIO diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index e2d4ec3e8..a36ab3932 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -47,18 +47,6 @@ #include "qmediapluginloader_p.h" #include "qaudiodevicefactory_p.h" -#ifndef QT_NO_AUDIO_BACKEND -#if defined(Q_OS_WIN) -#include "qaudiodeviceinfo_win32_p.h" -#include "qaudiooutput_win32_p.h" -#include "qaudioinput_win32_p.h" -#elif defined(HAS_ALSA) -#include "qaudiodeviceinfo_alsa_p.h" -#include "qaudiooutput_alsa_p.h" -#include "qaudioinput_alsa_p.h" -#endif -#endif - QT_BEGIN_NAMESPACE #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) @@ -132,13 +120,6 @@ public: QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) { QList<QAudioDeviceInfo> devices; -#ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(HAS_ALSA)) - foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode)) - devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); -#endif -#endif - #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QMediaPluginLoader* l = audioLoader(); foreach (const QString& key, l->keys()) { @@ -165,11 +146,6 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() } #endif -#ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(HAS_ALSA)) - return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); -#endif -#endif return QAudioDeviceInfo(); } @@ -185,11 +161,6 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() } #endif -#ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(HAS_ALSA)) - return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); -#endif -#endif return QAudioDeviceInfo(); } @@ -197,13 +168,6 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re { QAbstractAudioDeviceInfo *rc = 0; -#ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(HAS_ALSA)) - if (realm == QLatin1String("builtin")) - return new QAudioDeviceInfoInternal(handle, mode); -#endif -#endif - #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(realm)); @@ -229,15 +193,7 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con { if (deviceInfo.isNull()) return new QNullInputDevice(); -#ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(HAS_ALSA)) - if (deviceInfo.realm() == QLatin1String("builtin")) { - QAbstractAudioInput* p = new QAudioInputPrivate(deviceInfo.handle()); - if (p) p->setFormat(format); - return p; - } -#endif -#endif + #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(deviceInfo.realm())); @@ -256,15 +212,6 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c { if (deviceInfo.isNull()) return new QNullOutputDevice(); -#ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(HAS_ALSA)) - if (deviceInfo.realm() == QLatin1String("builtin")) { - QAbstractAudioOutput* p = new QAudioOutputPrivate(deviceInfo.handle()); - if (p) p->setFormat(format); - return p; - } -#endif -#endif #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioSystemFactoryInterface* plugin = diff --git a/src/multimedia/camera/qcameraimagecapture.cpp b/src/multimedia/camera/qcameraimagecapture.cpp index 0471ef3b0..409db4947 100644 --- a/src/multimedia/camera/qcameraimagecapture.cpp +++ b/src/multimedia/camera/qcameraimagecapture.cpp @@ -266,8 +266,8 @@ bool QCameraImageCapture::setMediaObject(QMediaObject *mediaObject) this, SIGNAL(imageMetadataAvailable(int,QString,QVariant))); connect(d->control, SIGNAL(imageAvailable(int,QVideoFrame)), this, SIGNAL(imageAvailable(int,QVideoFrame))); - connect(d->control, SIGNAL(imageSaved(int, QString)), - this, SIGNAL(imageSaved(int, QString))); + connect(d->control, SIGNAL(imageSaved(int,QString)), + this, SIGNAL(imageSaved(int,QString))); connect(d->control, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(_q_readyChanged(bool))); connect(d->control, SIGNAL(error(int,int,QString)), diff --git a/src/multimedia/controls/qcameraflashcontrol.h b/src/multimedia/controls/qcameraflashcontrol.h index c09c434f0..67108b94f 100644 --- a/src/multimedia/controls/qcameraflashcontrol.h +++ b/src/multimedia/controls/qcameraflashcontrol.h @@ -59,7 +59,7 @@ class Q_MULTIMEDIA_EXPORT QCameraFlashControl : public QMediaControl public: ~QCameraFlashControl(); - + virtual QCameraExposure::FlashModes flashMode() const = 0; virtual void setFlashMode(QCameraExposure::FlashModes mode) = 0; virtual bool isFlashModeSupported(QCameraExposure::FlashModes mode) const = 0; diff --git a/src/multimedia/controls/qcameralockscontrol.h b/src/multimedia/controls/qcameralockscontrol.h index 33edeb094..b03ba3752 100644 --- a/src/multimedia/controls/qcameralockscontrol.h +++ b/src/multimedia/controls/qcameralockscontrol.h @@ -57,7 +57,7 @@ class Q_MULTIMEDIA_EXPORT QCameraLocksControl : public QMediaControl Q_OBJECT public: ~QCameraLocksControl(); - + virtual QCamera::LockTypes supportedLocks() const = 0; virtual QCamera::LockStatus lockStatus(QCamera::LockType lock) const = 0; diff --git a/src/multimedia/controls/qimageencodercontrol.h b/src/multimedia/controls/qimageencodercontrol.h index 1ed76fb3a..6c31dbc3f 100644 --- a/src/multimedia/controls/qimageencodercontrol.h +++ b/src/multimedia/controls/qimageencodercontrol.h @@ -64,7 +64,7 @@ class Q_MULTIMEDIA_EXPORT QImageEncoderControl : public QMediaControl Q_OBJECT public: - virtual ~QImageEncoderControl(); + virtual ~QImageEncoderControl(); virtual QStringList supportedImageCodecs() const = 0; virtual QString imageCodecDescription(const QString &codecName) const = 0; diff --git a/src/multimedia/doc/src/blackberry.qdoc b/src/multimedia/doc/src/blackberry.qdoc index 5af063651..48616a270 100644 --- a/src/multimedia/doc/src/blackberry.qdoc +++ b/src/multimedia/doc/src/blackberry.qdoc @@ -27,7 +27,7 @@ /*! \page blackberry.html -\title BlackBerry +\title Qt Multimedia on BlackBerry \brief Platform notes for the BlackBerry Platform Qt Multimedia supports BlackBerry devices that run the BB10 operating system. diff --git a/src/multimedia/doc/src/classic.css b/src/multimedia/doc/src/classic.css index b8cae8e1e..59fa9dc32 100644 --- a/src/multimedia/doc/src/classic.css +++ b/src/multimedia/doc/src/classic.css @@ -34,44 +34,44 @@ hr { } table.valuelist { - border-width: 1px 1px 1px 1px; - border-style: solid; - border-color: #dddddd; - border-collapse: collapse; - background-color: #f0f0f0; + border-width: 1px 1px 1px 1px; + border-style: solid; + border-color: #dddddd; + border-collapse: collapse; + background-color: #f0f0f0; } table.indextable { - border-width: 1px 1px 1px 1px; - border-style: solid; - border-collapse: collapse; - background-color: #f0f0f0; + border-width: 1px 1px 1px 1px; + border-style: solid; + border-collapse: collapse; + background-color: #f0f0f0; border-color:#555; font-size: 100%; } table td.largeindex { - border-width: 1px 1px 1px 1px; - border-collapse: collapse; - background-color: #f0f0f0; + border-width: 1px 1px 1px 1px; + border-collapse: collapse; + background-color: #f0f0f0; border-color:#555; font-size: 120%; } table.valuelist th { - border-width: 1px 1px 1px 2px; - padding: 4px; - border-style: solid; - border-color: #666; + border-width: 1px 1px 1px 2px; + padding: 4px; + border-style: solid; + border-color: #666; color:white; background-color:#666; } th.titleheader { - border-width: 1px 0px 1px 0px; - padding: 2px; - border-style: solid; - border-color: #666; + border-width: 1px 0px 1px 0px; + padding: 2px; + border-style: solid; + border-color: #666; color:white; background-color:#555; background-image:url('images/gradient.png')}; @@ -81,10 +81,10 @@ th.titleheader { th.largeheader { - border-width: 1px 0px 1px 0px; - padding: 4px; - border-style: solid; - border-color: #444; + border-width: 1px 0px 1px 0px; + padding: 4px; + border-style: solid; + border-color: #444; color:white; background-color:#555555; font-size: 120%; @@ -143,7 +143,7 @@ table.generic, table.annotated { border-width: 1px; border-color:#bbb; - border-style:solid; + border-style:solid; border-collapse:collapse; } diff --git a/src/multimedia/doc/src/qtmultimedia-index.qdoc b/src/multimedia/doc/src/qtmultimedia-index.qdoc index 140594de1..3b74b7a35 100644 --- a/src/multimedia/doc/src/qtmultimedia-index.qdoc +++ b/src/multimedia/doc/src/qtmultimedia-index.qdoc @@ -131,7 +131,7 @@ \section2 Platform Notes \list - \li \l{BlackBerry} + \li \l{Qt Multimedia on BlackBerry}{BlackBerry} \li \l{Qt Multimedia on Windows}{Windows} \endlist diff --git a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h index 42ce913ec..f09bdbd1f 100644 --- a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h +++ b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h @@ -57,7 +57,7 @@ class QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerV public: QGstreamerVideoRenderer(QObject *parent = 0); virtual ~QGstreamerVideoRenderer(); - + QAbstractVideoSurface *surface() const; void setSurface(QAbstractVideoSurface *surface); @@ -73,7 +73,7 @@ signals: private slots: void handleFormatChange(); -private: +private: QVideoSurfaceGstSink *m_videoSink; QPointer<QAbstractVideoSurface> m_surface; }; diff --git a/src/multimedia/playback/playlistfileparser.cpp b/src/multimedia/playback/playlistfileparser.cpp index 1dc93aa7a..ae14d2159 100644 --- a/src/multimedia/playback/playlistfileparser.cpp +++ b/src/multimedia/playback/playlistfileparser.cpp @@ -396,8 +396,8 @@ void QPlaylistFileParserPrivate::processLine(int startIndex, int length) Q_ASSERT(m_currentParser); connect(m_currentParser, SIGNAL(newItem(QVariant)), q, SIGNAL(newItem(QVariant))); connect(m_currentParser, SIGNAL(finished()), q, SLOT(_q_handleParserFinished())); - connect(m_currentParser, SIGNAL(error(QPlaylistFileParser::ParserError, QString)), - q, SLOT(_q_handleParserError(QPlaylistFileParser::ParserError, QString))); + connect(m_currentParser, SIGNAL(error(QPlaylistFileParser::ParserError,QString)), + q, SLOT(_q_handleParserError(QPlaylistFileParser::ParserError,QString))); } QString line; @@ -583,8 +583,8 @@ void QPlaylistFileParser::stop() if (d->m_currentParser) { disconnect(d->m_currentParser, SIGNAL(newItem(QVariant)), this, SIGNAL(newItem(QVariant))); disconnect(d->m_currentParser, SIGNAL(finished()), this, SLOT(_q_handleParserFinished())); - disconnect(d->m_currentParser, SIGNAL(error(QPlaylistFileParser::ParserError, QString)), - this, SLOT(_q_handleParserError(QPlaylistFileParser::ParserError, QString))); + disconnect(d->m_currentParser, SIGNAL(error(QPlaylistFileParser::ParserError,QString)), + this, SLOT(_q_handleParserError(QPlaylistFileParser::ParserError,QString))); d->m_currentParser->deleteLater(); d->m_currentParser = 0; } diff --git a/src/multimedia/playback/qmedianetworkplaylistprovider.cpp b/src/multimedia/playback/qmedianetworkplaylistprovider.cpp index ca8e78b07..a8d8c4b04 100644 --- a/src/multimedia/playback/qmedianetworkplaylistprovider.cpp +++ b/src/multimedia/playback/qmedianetworkplaylistprovider.cpp @@ -113,11 +113,11 @@ QMediaNetworkPlaylistProvider::QMediaNetworkPlaylistProvider(QObject *parent) :QMediaPlaylistProvider(*new QMediaNetworkPlaylistProviderPrivate, parent) { d_func()->q_ptr = this; - connect(&d_func()->parser, SIGNAL(newItem(const QVariant&)), - this, SLOT(_q_handleNewItem(const QVariant&))); + connect(&d_func()->parser, SIGNAL(newItem(QVariant)), + this, SLOT(_q_handleNewItem(QVariant))); connect(&d_func()->parser, SIGNAL(finished()), this, SIGNAL(loaded())); - connect(&d_func()->parser, SIGNAL(error(QPlaylistFileParser::ParserError, const QString &)), - this, SLOT(_q_handleParserError(QPlaylistFileParser::ParserError, const QString &))); + connect(&d_func()->parser, SIGNAL(error(QPlaylistFileParser::ParserError,QString)), + this, SLOT(_q_handleParserError(QPlaylistFileParser::ParserError,QString))); } QMediaNetworkPlaylistProvider::~QMediaNetworkPlaylistProvider() diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h index 3195ae061..454b0f173 100644 --- a/src/multimedia/playback/qmediaplayer.h +++ b/src/multimedia/playback/qmediaplayer.h @@ -150,7 +150,7 @@ public: int bufferStatus() const; bool isSeekable() const; - qreal playbackRate() const; + qreal playbackRate() const; Error error() const; QString errorString() const; diff --git a/src/multimediawidgets/qgraphicsvideoitem.h b/src/multimediawidgets/qgraphicsvideoitem.h index 6db81a55b..24128d2e6 100644 --- a/src/multimediawidgets/qgraphicsvideoitem.h +++ b/src/multimediawidgets/qgraphicsvideoitem.h @@ -68,7 +68,7 @@ public: QGraphicsVideoItem(QGraphicsItem *parent = 0); ~QGraphicsVideoItem(); - QMediaObject *mediaObject() const; + QMediaObject *mediaObject() const; Qt::AspectRatioMode aspectRatioMode() const; void setAspectRatioMode(Qt::AspectRatioMode mode); diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp index 30ebbded4..87757914f 100644 --- a/src/multimediawidgets/qpaintervideosurface.cpp +++ b/src/multimediawidgets/qpaintervideosurface.cpp @@ -841,7 +841,7 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint( painter->fillRect(target, Qt::black); return QAbstractVideoSurface::NoError; } - + const QAbstractVideoBuffer::HandleType h = m_frame.handleType(); if (h == QAbstractVideoBuffer::NoHandle || h == QAbstractVideoBuffer::GLTextureHandle) { bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST); diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h index ec71bb6c7..77e9d75da 100644 --- a/src/multimediawidgets/qvideowidget.h +++ b/src/multimediawidgets/qvideowidget.h @@ -67,9 +67,9 @@ class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWidget : public QWidget, public QMediaBin public: QVideoWidget(QWidget *parent = 0); - ~QVideoWidget(); + ~QVideoWidget(); - QMediaObject *mediaObject() const; + QMediaObject *mediaObject() const; #ifdef Q_QDOC bool isFullScreen() const; diff --git a/src/multimediawidgets/qvideowidget_p.h b/src/multimediawidgets/qvideowidget_p.h index a7412202f..b60235991 100644 --- a/src/multimediawidgets/qvideowidget_p.h +++ b/src/multimediawidgets/qvideowidget_p.h @@ -230,7 +230,7 @@ public: QVideoWidgetPrivate() : q_ptr(0) , mediaObject(0) - , service(0) + , service(0) , widgetBackend(0) , windowBackend(0) , rendererBackend(0) diff --git a/src/plugins/alsa/alsa.json b/src/plugins/alsa/alsa.json new file mode 100644 index 000000000..c2b22dfec --- /dev/null +++ b/src/plugins/alsa/alsa.json @@ -0,0 +1,3 @@ +{ + "Keys": ["alsa"] +} diff --git a/src/plugins/alsa/alsa.pro b/src/plugins/alsa/alsa.pro new file mode 100644 index 000000000..481c57eaf --- /dev/null +++ b/src/plugins/alsa/alsa.pro @@ -0,0 +1,23 @@ +TARGET = qtaudio_alsa +QT += multimedia-private + +PLUGIN_TYPE = audio +PLUGIN_CLASS_NAME = QAlsaPlugin +load(qt_plugin) + +LIBS += -lasound + +HEADERS += \ + qalsaplugin.h \ + qalsaaudiodeviceinfo.h \ + qalsaaudioinput.h \ + qalsaaudiooutput.h + +SOURCES += \ + qalsaplugin.cpp \ + qalsaaudiodeviceinfo.cpp \ + qalsaaudioinput.cpp \ + qalsaaudiooutput.cpp + +OTHER_FILES += \ + alsa.json diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp index d2a4eea3a..1e75c4661 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp @@ -50,13 +50,13 @@ // INTERNAL USE ONLY: Do NOT use for any other purpose. // -#include "qaudiodeviceinfo_alsa_p.h" +#include "qalsaaudiodeviceinfo.h" #include <alsa/version.h> QT_BEGIN_NAMESPACE -QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) +QAlsaAudioDeviceInfo::QAlsaAudioDeviceInfo(QByteArray dev, QAudio::Mode mode) { handle = 0; @@ -66,17 +66,17 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode checkSurround(); } -QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() +QAlsaAudioDeviceInfo::~QAlsaAudioDeviceInfo() { close(); } -bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const +bool QAlsaAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const { return testSettings(format); } -QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const +QAudioFormat QAlsaAudioDeviceInfo::preferredFormat() const { QAudioFormat nearest; if(mode == QAudio::AudioOutput) { @@ -101,48 +101,48 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const return nearest; } -QString QAudioDeviceInfoInternal::deviceName() const +QString QAlsaAudioDeviceInfo::deviceName() const { return device; } -QStringList QAudioDeviceInfoInternal::supportedCodecs() +QStringList QAlsaAudioDeviceInfo::supportedCodecs() { updateLists(); return codecz; } -QList<int> QAudioDeviceInfoInternal::supportedSampleRates() +QList<int> QAlsaAudioDeviceInfo::supportedSampleRates() { updateLists(); return sampleRatez; } -QList<int> QAudioDeviceInfoInternal::supportedChannelCounts() +QList<int> QAlsaAudioDeviceInfo::supportedChannelCounts() { updateLists(); return channelz; } -QList<int> QAudioDeviceInfoInternal::supportedSampleSizes() +QList<int> QAlsaAudioDeviceInfo::supportedSampleSizes() { updateLists(); return sizez; } -QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders() +QList<QAudioFormat::Endian> QAlsaAudioDeviceInfo::supportedByteOrders() { updateLists(); return byteOrderz; } -QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes() +QList<QAudioFormat::SampleType> QAlsaAudioDeviceInfo::supportedSampleTypes() { updateLists(); return typez; } -bool QAudioDeviceInfoInternal::open() +bool QAlsaAudioDeviceInfo::open() { int err = 0; QString dev = device; @@ -166,11 +166,11 @@ bool QAudioDeviceInfoInternal::open() QString shortName = device.mid(device.indexOf(QLatin1String("="),0)+1); - while(snd_card_get_name(idx,&name) == 0) { + while (snd_card_get_name(idx,&name) == 0) { if(dev.contains(QLatin1String(name))) break; idx++; - } + } dev = QString(QLatin1String("hw:%1,0")).arg(idx); #endif } @@ -186,14 +186,14 @@ bool QAudioDeviceInfoInternal::open() return true; } -void QAudioDeviceInfoInternal::close() +void QAlsaAudioDeviceInfo::close() { if(handle) snd_pcm_close(handle); handle = 0; } -bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const +bool QAlsaAudioDeviceInfo::testSettings(const QAudioFormat& format) const { // Set nearest to closest settings that do work. // See if what is in settings will work (return value). @@ -301,7 +301,7 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const return (err == 0); } -void QAudioDeviceInfoInternal::updateLists() +void QAlsaAudioDeviceInfo::updateLists() { // redo all lists based on current settings sampleRatez.clear(); @@ -338,21 +338,16 @@ void QAudioDeviceInfoInternal::updateLists() close(); } -QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) +QList<QByteArray> QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode) { QList<QByteArray> devices; QByteArray filter; #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) // Create a list of all current audio devices that support mode - void **hints, **n; + void **hints; char *name, *descr, *io; - - if(snd_device_name_hint(-1, "pcm", &hints) < 0) { - qWarning() << "no alsa devices available"; - return devices; - } - n = hints; + int card = -1; if(mode == QAudio::AudioInput) { filter = "Input"; @@ -360,28 +355,35 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) filter = "Output"; } - while (*n != NULL) { - name = snd_device_name_get_hint(*n, "NAME"); - if (name != 0 && qstrcmp(name, "null") != 0) { - descr = snd_device_name_get_hint(*n, "DESC"); - io = snd_device_name_get_hint(*n, "IOID"); - - if ((descr != NULL) && ((io == NULL) || (io == filter))) { - QString deviceName = QLatin1String(name); - QString deviceDescription = QLatin1String(descr); - if (deviceDescription.contains(QLatin1String("Default Audio Device"))) - devices.prepend(deviceName.toLocal8Bit().constData()); - else - devices.append(deviceName.toLocal8Bit().constData()); + while (snd_card_next(&card) == 0 && card >= 0) { + if (snd_device_name_hint(card, "pcm", &hints) < 0) + continue; + + void **n = hints; + while (*n != NULL) { + name = snd_device_name_get_hint(*n, "NAME"); + if (name != 0 && qstrcmp(name, "null") != 0) { + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + + if ((descr != NULL) && ((io == NULL) || (io == filter))) { + QString deviceName = QLatin1String(name); + QString deviceDescription = QLatin1String(descr); + if (deviceDescription.contains(QLatin1String("Default Audio Device"))) + devices.prepend(deviceName.toLocal8Bit().constData()); + else + devices.append(deviceName.toLocal8Bit().constData()); + } + + free(descr); + free(io); } - - free(descr); - free(io); + free(name); + ++n; } - free(name); - ++n; + + snd_device_name_free_hint(hints); } - snd_device_name_free_hint(hints); #else int idx = 0; char* name; @@ -398,7 +400,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) return devices; } -QByteArray QAudioDeviceInfoInternal::defaultInputDevice() +QByteArray QAlsaAudioDeviceInfo::defaultInputDevice() { QList<QByteArray> devices = availableDevices(QAudio::AudioInput); if(devices.size() == 0) @@ -407,7 +409,7 @@ QByteArray QAudioDeviceInfoInternal::defaultInputDevice() return devices.first(); } -QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() +QByteArray QAlsaAudioDeviceInfo::defaultOutputDevice() { QList<QByteArray> devices = availableDevices(QAudio::AudioOutput); if(devices.size() == 0) @@ -416,44 +418,47 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() return devices.first(); } -void QAudioDeviceInfoInternal::checkSurround() +void QAlsaAudioDeviceInfo::checkSurround() { surround40 = false; surround51 = false; surround71 = false; - void **hints, **n; + void **hints; char *name, *descr, *io; + int card = -1; - if(snd_device_name_hint(-1, "pcm", &hints) < 0) - return; + while (snd_card_next(&card) == 0 && card >= 0) { + if (snd_device_name_hint(card, "pcm", &hints) < 0) + continue; - n = hints; - - while (*n != NULL) { - name = snd_device_name_get_hint(*n, "NAME"); - descr = snd_device_name_get_hint(*n, "DESC"); - io = snd_device_name_get_hint(*n, "IOID"); - if((name != NULL) && (descr != NULL)) { - QString deviceName = QLatin1String(name); - if (mode == QAudio::AudioOutput) { - if(deviceName.contains(QLatin1String("surround40"))) - surround40 = true; - if(deviceName.contains(QLatin1String("surround51"))) - surround51 = true; - if(deviceName.contains(QLatin1String("surround71"))) - surround71 = true; + void **n = hints; + while (*n != NULL) { + name = snd_device_name_get_hint(*n, "NAME"); + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + if((name != NULL) && (descr != NULL)) { + QString deviceName = QLatin1String(name); + if (mode == QAudio::AudioOutput) { + if(deviceName.contains(QLatin1String("surround40"))) + surround40 = true; + if(deviceName.contains(QLatin1String("surround51"))) + surround51 = true; + if(deviceName.contains(QLatin1String("surround71"))) + surround71 = true; + } } + if(name != NULL) + free(name); + if(descr != NULL) + free(descr); + if(io != NULL) + free(io); + ++n; } - if(name != NULL) - free(name); - if(descr != NULL) - free(descr); - if(io != NULL) - free(io); - ++n; + + snd_device_name_free_hint(hints); } - snd_device_name_free_hint(hints); } QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/plugins/alsa/qalsaaudiodeviceinfo.h index 466bcdece..c1840ee9a 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/plugins/alsa/qalsaaudiodeviceinfo.h @@ -51,8 +51,8 @@ // -#ifndef QAUDIODEVICEINFOALSA_H -#define QAUDIODEVICEINFOALSA_H +#ifndef QALSAAUDIODEVICEINFO_H +#define QALSAAUDIODEVICEINFO_H #include <alsa/asoundlib.h> @@ -61,9 +61,9 @@ #include <QtCore/qlist.h> #include <QtCore/qdebug.h> -#include "qaudio.h" -#include "qaudiodeviceinfo.h" -#include "qaudiosystem.h" +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudiodeviceinfo.h> +#include <QtMultimedia/qaudiosystem.h> QT_BEGIN_NAMESPACE @@ -72,12 +72,12 @@ const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; -class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo +class QAlsaAudioDeviceInfo : public QAbstractAudioDeviceInfo { Q_OBJECT public: - QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode); - ~QAudioDeviceInfoInternal(); + QAlsaAudioDeviceInfo(QByteArray dev,QAudio::Mode mode); + ~QAlsaAudioDeviceInfo(); bool testSettings(const QAudioFormat& format) const; void updateLists(); @@ -119,5 +119,4 @@ private: QT_END_NAMESPACE -#endif - +#endif // QALSAAUDIODEVICEINFO_H diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/plugins/alsa/qalsaaudioinput.cpp index 41180309e..902dd57d7 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/plugins/alsa/qalsaaudioinput.cpp @@ -51,15 +51,15 @@ // #include <QtCore/qcoreapplication.h> -#include "qaudioinput_alsa_p.h" -#include "qaudiodeviceinfo_alsa_p.h" -#include "qaudiohelpers_p.h" +#include <QtMultimedia/private/qaudiohelpers_p.h> +#include "qalsaaudioinput.h" +#include "qalsaaudiodeviceinfo.h" QT_BEGIN_NAMESPACE //#define DEBUG_AUDIO 1 -QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device) +QAlsaAudioInput::QAlsaAudioInput(const QByteArray &device) { bytesAvailable = 0; handle = 0; @@ -86,7 +86,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device) connect(timer,SIGNAL(timeout()),SLOT(userFeed())); } -QAudioInputPrivate::~QAudioInputPrivate() +QAlsaAudioInput::~QAlsaAudioInput() { close(); disconnect(timer, SIGNAL(timeout())); @@ -94,38 +94,38 @@ QAudioInputPrivate::~QAudioInputPrivate() delete timer; } -void QAudioInputPrivate::setVolume(qreal vol) +void QAlsaAudioInput::setVolume(qreal vol) { m_volume = vol; } -qreal QAudioInputPrivate::volume() const +qreal QAlsaAudioInput::volume() const { return m_volume; } -QAudio::Error QAudioInputPrivate::error() const +QAudio::Error QAlsaAudioInput::error() const { return errorState; } -QAudio::State QAudioInputPrivate::state() const +QAudio::State QAlsaAudioInput::state() const { return deviceState; } -void QAudioInputPrivate::setFormat(const QAudioFormat& fmt) +void QAlsaAudioInput::setFormat(const QAudioFormat& fmt) { if (deviceState == QAudio::StoppedState) settings = fmt; } -QAudioFormat QAudioInputPrivate::format() const +QAudioFormat QAlsaAudioInput::format() const { return settings; } -int QAudioInputPrivate::xrun_recovery(int err) +int QAlsaAudioInput::xrun_recovery(int err) { int count = 0; bool reset = false; @@ -166,7 +166,7 @@ int QAudioInputPrivate::xrun_recovery(int err) return err; } -int QAudioInputPrivate::setFormat() +int QAlsaAudioInput::setFormat() { snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN; @@ -225,7 +225,7 @@ int QAudioInputPrivate::setFormat() : -1; } -void QAudioInputPrivate::start(QIODevice* device) +void QAlsaAudioInput::start(QIODevice* device) { if(deviceState != QAudio::StoppedState) close(); @@ -244,7 +244,7 @@ void QAudioInputPrivate::start(QIODevice* device) emit stateChanged(deviceState); } -QIODevice* QAudioInputPrivate::start() +QIODevice* QAlsaAudioInput::start() { if(deviceState != QAudio::StoppedState) close(); @@ -266,7 +266,7 @@ QIODevice* QAudioInputPrivate::start() return audioSource; } -void QAudioInputPrivate::stop() +void QAlsaAudioInput::stop() { if(deviceState == QAudio::StoppedState) return; @@ -277,7 +277,7 @@ void QAudioInputPrivate::stop() emit stateChanged(deviceState); } -bool QAudioInputPrivate::open() +bool QAlsaAudioInput::open() { #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -310,7 +310,7 @@ bool QAudioInputPrivate::open() QString dev = QString(QLatin1String(m_device.constData())); - QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioInput); + QList<QByteArray> devices = QAlsaAudioDeviceInfo::availableDevices(QAudio::AudioInput); if(dev.compare(QLatin1String("default")) == 0) { #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) if (devices.size() > 0) @@ -472,7 +472,7 @@ bool QAudioInputPrivate::open() return true; } -void QAudioInputPrivate::close() +void QAlsaAudioInput::close() { timer->stop(); @@ -483,7 +483,7 @@ void QAudioInputPrivate::close() } } -int QAudioInputPrivate::checkBytesReady() +int QAlsaAudioInput::checkBytesReady() { if(resuming) bytesAvailable = period_size; @@ -503,12 +503,12 @@ int QAudioInputPrivate::checkBytesReady() return bytesAvailable; } -int QAudioInputPrivate::bytesReady() const +int QAlsaAudioInput::bytesReady() const { return qMax(bytesAvailable, 0); } -qint64 QAudioInputPrivate::read(char* data, qint64 len) +qint64 QAlsaAudioInput::read(char* data, qint64 len) { // Read in some audio data and write it to QIODevice, pull mode if ( !handle ) @@ -649,7 +649,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) return 0; } -void QAudioInputPrivate::resume() +void QAlsaAudioInput::resume() { if(deviceState == QAudio::SuspendedState) { int err = 0; @@ -673,32 +673,32 @@ void QAudioInputPrivate::resume() } } -void QAudioInputPrivate::setBufferSize(int value) +void QAlsaAudioInput::setBufferSize(int value) { buffer_size = value; } -int QAudioInputPrivate::bufferSize() const +int QAlsaAudioInput::bufferSize() const { return buffer_size; } -int QAudioInputPrivate::periodSize() const +int QAlsaAudioInput::periodSize() const { return period_size; } -void QAudioInputPrivate::setNotifyInterval(int ms) +void QAlsaAudioInput::setNotifyInterval(int ms) { intervalTime = qMax(0, ms); } -int QAudioInputPrivate::notifyInterval() const +int QAlsaAudioInput::notifyInterval() const { return intervalTime; } -qint64 QAudioInputPrivate::processedUSecs() const +qint64 QAlsaAudioInput::processedUSecs() const { qint64 result = qint64(1000000) * totalTimeValue / (settings.channelCount()*(settings.sampleSize()/8)) / @@ -707,7 +707,7 @@ qint64 QAudioInputPrivate::processedUSecs() const return result; } -void QAudioInputPrivate::suspend() +void QAlsaAudioInput::suspend() { if(deviceState == QAudio::ActiveState||resuming) { timer->stop(); @@ -716,7 +716,7 @@ void QAudioInputPrivate::suspend() } } -void QAudioInputPrivate::userFeed() +void QAlsaAudioInput::userFeed() { if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState) return; @@ -727,7 +727,7 @@ void QAudioInputPrivate::userFeed() deviceReady(); } -bool QAudioInputPrivate::deviceReady() +bool QAlsaAudioInput::deviceReady() { if(pullMode) { // reads some audio data and writes it to QIODevice @@ -764,7 +764,7 @@ bool QAudioInputPrivate::deviceReady() return true; } -qint64 QAudioInputPrivate::elapsedUSecs() const +qint64 QAlsaAudioInput::elapsedUSecs() const { if (deviceState == QAudio::StoppedState) return 0; @@ -772,7 +772,7 @@ qint64 QAudioInputPrivate::elapsedUSecs() const return clockStamp.elapsed()*1000; } -void QAudioInputPrivate::reset() +void QAlsaAudioInput::reset() { if(handle) snd_pcm_reset(handle); @@ -780,15 +780,15 @@ void QAudioInputPrivate::reset() bytesAvailable = 0; } -void QAudioInputPrivate::drain() +void QAlsaAudioInput::drain() { if(handle) snd_pcm_drain(handle); } -InputPrivate::InputPrivate(QAudioInputPrivate* audio) +InputPrivate::InputPrivate(QAlsaAudioInput* audio) { - audioDevice = qobject_cast<QAudioInputPrivate*>(audio); + audioDevice = qobject_cast<QAlsaAudioInput*>(audio); } InputPrivate::~InputPrivate() @@ -879,4 +879,4 @@ void RingBuffer::write(char *data, int len) QT_END_NAMESPACE -#include "moc_qaudioinput_alsa_p.cpp" +#include "moc_qalsaaudioinput.cpp" diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/plugins/alsa/qalsaaudioinput.h index 0455ba903..6af566c8b 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/plugins/alsa/qalsaaudioinput.h @@ -63,9 +63,9 @@ #include <QtCore/qstringlist.h> #include <QtCore/qdatetime.h> -#include "qaudio.h" -#include "qaudiodeviceinfo.h" -#include "qaudiosystem.h" +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudiodeviceinfo.h> +#include <QtMultimedia/qaudiosystem.h> QT_BEGIN_NAMESPACE @@ -95,12 +95,12 @@ private: QByteArray m_data; }; -class QAudioInputPrivate : public QAbstractAudioInput +class QAlsaAudioInput : public QAbstractAudioInput { Q_OBJECT public: - QAudioInputPrivate(const QByteArray &device); - ~QAudioInputPrivate(); + QAlsaAudioInput(const QByteArray &device); + ~QAlsaAudioInput(); qint64 read(char* data, qint64 len); @@ -171,7 +171,7 @@ class InputPrivate : public QIODevice { Q_OBJECT public: - InputPrivate(QAudioInputPrivate* audio); + InputPrivate(QAlsaAudioInput* audio); ~InputPrivate(); qint64 readData( char* data, qint64 len); @@ -179,7 +179,7 @@ public: void trigger(); private: - QAudioInputPrivate *audioDevice; + QAlsaAudioInput *audioDevice; }; QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/plugins/alsa/qalsaaudiooutput.cpp index 3a779f322..192b63596 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/plugins/alsa/qalsaaudiooutput.cpp @@ -51,15 +51,15 @@ // #include <QtCore/qcoreapplication.h> -#include "qaudiooutput_alsa_p.h" -#include "qaudiodeviceinfo_alsa_p.h" -#include "qaudiohelpers_p.h" +#include <QtMultimedia/private/qaudiohelpers_p.h> +#include "qalsaaudiooutput.h" +#include "qalsaaudiodeviceinfo.h" QT_BEGIN_NAMESPACE //#define DEBUG_AUDIO 1 -QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device) +QAlsaAudioOutput::QAlsaAudioOutput(const QByteArray &device) { bytesAvailable = 0; handle = 0; @@ -90,7 +90,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device) connect(timer,SIGNAL(timeout()),SLOT(userFeed())); } -QAudioOutputPrivate::~QAudioOutputPrivate() +QAlsaAudioOutput::~QAlsaAudioOutput() { close(); disconnect(timer, SIGNAL(timeout())); @@ -98,38 +98,38 @@ QAudioOutputPrivate::~QAudioOutputPrivate() delete timer; } -void QAudioOutputPrivate::setVolume(qreal vol) +void QAlsaAudioOutput::setVolume(qreal vol) { m_volume = vol; } -qreal QAudioOutputPrivate::volume() const +qreal QAlsaAudioOutput::volume() const { return m_volume; } -QAudio::Error QAudioOutputPrivate::error() const +QAudio::Error QAlsaAudioOutput::error() const { return errorState; } -QAudio::State QAudioOutputPrivate::state() const +QAudio::State QAlsaAudioOutput::state() const { return deviceState; } -void QAudioOutputPrivate::async_callback(snd_async_handler_t *ahandler) +void QAlsaAudioOutput::async_callback(snd_async_handler_t *ahandler) { - QAudioOutputPrivate* audioOut; + QAlsaAudioOutput* audioOut; - audioOut = static_cast<QAudioOutputPrivate*> + audioOut = static_cast<QAlsaAudioOutput*> (snd_async_handler_get_callback_private(ahandler)); if (audioOut && (audioOut->deviceState == QAudio::ActiveState || audioOut->resuming)) audioOut->feedback(); } -int QAudioOutputPrivate::xrun_recovery(int err) +int QAlsaAudioOutput::xrun_recovery(int err) { int count = 0; bool reset = false; @@ -167,7 +167,7 @@ int QAudioOutputPrivate::xrun_recovery(int err) return err; } -int QAudioOutputPrivate::setFormat() +int QAlsaAudioOutput::setFormat() { snd_pcm_format_t pcmformat = SND_PCM_FORMAT_UNKNOWN; @@ -227,7 +227,7 @@ int QAudioOutputPrivate::setFormat() : -1; } -void QAudioOutputPrivate::start(QIODevice* device) +void QAlsaAudioOutput::start(QIODevice* device) { if(deviceState != QAudio::StoppedState) deviceState = QAudio::StoppedState; @@ -252,7 +252,7 @@ void QAudioOutputPrivate::start(QIODevice* device) emit stateChanged(deviceState); } -QIODevice* QAudioOutputPrivate::start() +QIODevice* QAlsaAudioOutput::start() { if(deviceState != QAudio::StoppedState) deviceState = QAudio::StoppedState; @@ -280,7 +280,7 @@ QIODevice* QAudioOutputPrivate::start() return audioSource; } -void QAudioOutputPrivate::stop() +void QAlsaAudioOutput::stop() { if(deviceState == QAudio::StoppedState) return; @@ -290,7 +290,7 @@ void QAudioOutputPrivate::stop() emit stateChanged(deviceState); } -bool QAudioOutputPrivate::open() +bool QAlsaAudioOutput::open() { if(opened) return true; @@ -324,7 +324,7 @@ bool QAudioOutputPrivate::open() } QString dev = QString(QLatin1String(m_device.constData())); - QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput); + QList<QByteArray> devices = QAlsaAudioDeviceInfo::availableDevices(QAudio::AudioOutput); if(dev.compare(QLatin1String("default")) == 0) { #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) if (devices.size() > 0) @@ -343,11 +343,11 @@ bool QAudioOutputPrivate::open() QString shortName = QLatin1String(m_device.mid(m_device.indexOf('=',0)+1).constData()); - while(snd_card_get_name(idx,&name) == 0) { + while (snd_card_get_name(idx,&name) == 0) { if(qstrncmp(shortName.toLocal8Bit().constData(),name,shortName.length()) == 0) break; idx++; - } + } dev = QString(QLatin1String("hw:%1,0")).arg(idx); #endif } @@ -529,7 +529,7 @@ bool QAudioOutputPrivate::open() return true; } -void QAudioOutputPrivate::close() +void QAlsaAudioOutput::close() { timer->stop(); @@ -547,7 +547,7 @@ void QAudioOutputPrivate::close() opened = false; } -int QAudioOutputPrivate::bytesFree() const +int QAlsaAudioOutput::bytesFree() const { if(resuming) return period_size; @@ -573,7 +573,7 @@ int QAudioOutputPrivate::bytesFree() const return snd_pcm_frames_to_bytes(handle, frames); } -qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) +qint64 QAlsaAudioOutput::write( const char *data, qint64 len ) { // Write out some audio data if ( !handle ) @@ -623,38 +623,38 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) return 0; } -int QAudioOutputPrivate::periodSize() const +int QAlsaAudioOutput::periodSize() const { return period_size; } -void QAudioOutputPrivate::setBufferSize(int value) +void QAlsaAudioOutput::setBufferSize(int value) { if(deviceState == QAudio::StoppedState) buffer_size = value; } -int QAudioOutputPrivate::bufferSize() const +int QAlsaAudioOutput::bufferSize() const { return buffer_size; } -void QAudioOutputPrivate::setNotifyInterval(int ms) +void QAlsaAudioOutput::setNotifyInterval(int ms) { intervalTime = qMax(0, ms); } -int QAudioOutputPrivate::notifyInterval() const +int QAlsaAudioOutput::notifyInterval() const { return intervalTime; } -qint64 QAudioOutputPrivate::processedUSecs() const +qint64 QAlsaAudioOutput::processedUSecs() const { return qint64(1000000) * totalTimeValue / settings.sampleRate(); } -void QAudioOutputPrivate::resume() +void QAlsaAudioOutput::resume() { if(deviceState == QAudio::SuspendedState) { int err = 0; @@ -680,18 +680,18 @@ void QAudioOutputPrivate::resume() } } -void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt) +void QAlsaAudioOutput::setFormat(const QAudioFormat& fmt) { if (deviceState == QAudio::StoppedState) settings = fmt; } -QAudioFormat QAudioOutputPrivate::format() const +QAudioFormat QAlsaAudioOutput::format() const { return settings; } -void QAudioOutputPrivate::suspend() +void QAlsaAudioOutput::suspend() { if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) { timer->stop(); @@ -701,7 +701,7 @@ void QAudioOutputPrivate::suspend() } } -void QAudioOutputPrivate::userFeed() +void QAlsaAudioOutput::userFeed() { if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState) return; @@ -715,13 +715,13 @@ void QAudioOutputPrivate::userFeed() deviceReady(); } -void QAudioOutputPrivate::feedback() +void QAlsaAudioOutput::feedback() { updateAvailable(); } -void QAudioOutputPrivate::updateAvailable() +void QAlsaAudioOutput::updateAvailable() { #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -730,7 +730,7 @@ void QAudioOutputPrivate::updateAvailable() bytesAvailable = bytesFree(); } -bool QAudioOutputPrivate::deviceReady() +bool QAlsaAudioOutput::deviceReady() { if(pullMode) { int l = 0; @@ -805,7 +805,7 @@ bool QAudioOutputPrivate::deviceReady() return true; } -qint64 QAudioOutputPrivate::elapsedUSecs() const +qint64 QAlsaAudioOutput::elapsedUSecs() const { if (deviceState == QAudio::StoppedState) return 0; @@ -813,7 +813,7 @@ qint64 QAudioOutputPrivate::elapsedUSecs() const return clockStamp.elapsed()*1000; } -void QAudioOutputPrivate::reset() +void QAlsaAudioOutput::reset() { if(handle) snd_pcm_reset(handle); @@ -821,9 +821,9 @@ void QAudioOutputPrivate::reset() stop(); } -OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio) +OutputPrivate::OutputPrivate(QAlsaAudioOutput* audio) { - audioDevice = qobject_cast<QAudioOutputPrivate*>(audio); + audioDevice = qobject_cast<QAlsaAudioOutput*>(audio); } OutputPrivate::~OutputPrivate() {} @@ -857,4 +857,4 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len) QT_END_NAMESPACE -#include "moc_qaudiooutput_alsa_p.cpp" +#include "moc_qalsaaudiooutput.cpp" diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/plugins/alsa/qalsaaudiooutput.h index 3bcb94ffc..67976a55b 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/plugins/alsa/qalsaaudiooutput.h @@ -62,22 +62,19 @@ #include <QtCore/qstringlist.h> #include <QtCore/qdatetime.h> -#include "qaudio.h" -#include "qaudiodeviceinfo.h" -#include "qaudiosystem.h" +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudiodeviceinfo.h> +#include <QtMultimedia/qaudiosystem.h> QT_BEGIN_NAMESPACE - -class OutputPrivate; - -class QAudioOutputPrivate : public QAbstractAudioOutput +class QAlsaAudioOutput : public QAbstractAudioOutput { friend class OutputPrivate; Q_OBJECT public: - QAudioOutputPrivate(const QByteArray &device); - ~QAudioOutputPrivate(); + QAlsaAudioOutput(const QByteArray &device); + ~QAlsaAudioOutput(); qint64 write( const char *data, qint64 len ); @@ -154,17 +151,17 @@ private: class OutputPrivate : public QIODevice { - friend class QAudioOutputPrivate; + friend class QAlsaAudioOutput; Q_OBJECT public: - OutputPrivate(QAudioOutputPrivate* audio); + OutputPrivate(QAlsaAudioOutput* audio); ~OutputPrivate(); qint64 readData( char* data, qint64 len); qint64 writeData(const char* data, qint64 len); private: - QAudioOutputPrivate *audioDevice; + QAlsaAudioOutput *audioDevice; }; QT_END_NAMESPACE diff --git a/src/plugins/alsa/qalsaplugin.cpp b/src/plugins/alsa/qalsaplugin.cpp new file mode 100644 index 000000000..6ed36580b --- /dev/null +++ b/src/plugins/alsa/qalsaplugin.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qalsaplugin.h" +#include "qalsaaudiodeviceinfo.h" +#include "qalsaaudioinput.h" +#include "qalsaaudiooutput.h" + +QT_BEGIN_NAMESPACE + +QAlsaPlugin::QAlsaPlugin(QObject *parent) + : QAudioSystemPlugin(parent) +{ +} + +QList<QByteArray> QAlsaPlugin::availableDevices(QAudio::Mode mode) const +{ + return QAlsaAudioDeviceInfo::availableDevices(mode); +} + +QAbstractAudioInput *QAlsaPlugin::createInput(const QByteArray &device) +{ + return new QAlsaAudioInput(device); +} + +QAbstractAudioOutput *QAlsaPlugin::createOutput(const QByteArray &device) +{ + return new QAlsaAudioOutput(device); +} + +QAbstractAudioDeviceInfo *QAlsaPlugin::createDeviceInfo(const QByteArray &device, QAudio::Mode mode) +{ + return new QAlsaAudioDeviceInfo(device, mode); +} + +QT_END_NAMESPACE diff --git a/src/plugins/alsa/qalsaplugin.h b/src/plugins/alsa/qalsaplugin.h new file mode 100644 index 000000000..6f524ac4a --- /dev/null +++ b/src/plugins/alsa/qalsaplugin.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QALSAPLUGIN_H +#define QALSAPLUGIN_H + +#include <QtMultimedia/qaudiosystemplugin.h> + +QT_BEGIN_NAMESPACE + +class QAlsaPlugin : public QAudioSystemPlugin +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID "org.qt-project.qt.audiosystemfactory/5.0" FILE "alsa.json") + +public: + QAlsaPlugin(QObject *parent = 0); + ~QAlsaPlugin() {} + + QList<QByteArray> availableDevices(QAudio::Mode mode) const Q_DECL_OVERRIDE; + QAbstractAudioInput *createInput(const QByteArray &device) Q_DECL_OVERRIDE; + QAbstractAudioOutput *createOutput(const QByteArray &device) Q_DECL_OVERRIDE; + QAbstractAudioDeviceInfo *createDeviceInfo(const QByteArray &device, QAudio::Mode mode) Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif // QALSAPLUGIN_H diff --git a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp index 3962baba8..f40ec2498 100644 --- a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp @@ -389,7 +389,7 @@ void QAndroidCaptureSession::applySettings() } // video settings - if (m_cameraSession && m_videoSettingsDirty) { + if (m_cameraSession && m_cameraSession->camera() && m_videoSettingsDirty) { if (m_videoSettings.resolution().isEmpty()) { m_videoSettings.setResolution(m_defaultSettings.videoResolution); m_resolutionDirty = true; @@ -466,6 +466,8 @@ void QAndroidCaptureSession::onCameraOpened() qSort(m_supportedResolutions.begin(), m_supportedResolutions.end(), qt_sizeLessThan); qSort(m_supportedFramerates.begin(), m_supportedFramerates.end()); + + applySettings(); } QAndroidCaptureSession::CaptureProfile QAndroidCaptureSession::getProfile(int id) diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp index ce73263d3..7b0c58277 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp @@ -63,12 +63,12 @@ QAndroidMediaPlayerControl::QAndroidMediaPlayerControl(QObject *parent) { connect(mMediaPlayer, SIGNAL(bufferingUpdate(qint32)), this, SLOT(onBufferChanged(qint32))); - connect(mMediaPlayer, SIGNAL(info(qint32, qint32)), - this, SLOT(onInfo(qint32, qint32))); - connect(mMediaPlayer, SIGNAL(error(qint32, qint32)), - this, SLOT(onError(qint32, qint32))); - connect(mMediaPlayer, SIGNAL(mediaPlayerInfo(qint32, qint32)), - this, SLOT(onMediaPlayerInfo(qint32, qint32))); + connect(mMediaPlayer, SIGNAL(info(qint32,qint32)), + this, SLOT(onInfo(qint32,qint32))); + connect(mMediaPlayer, SIGNAL(error(qint32,qint32)), + this, SLOT(onError(qint32,qint32))); + connect(mMediaPlayer, SIGNAL(mediaPlayerInfo(qint32,qint32)), + this, SLOT(onMediaPlayerInfo(qint32,qint32))); connect(mMediaPlayer, SIGNAL(videoSizeChanged(qint32,qint32)), this, SLOT(onVideoSizeChanged(qint32,qint32))); } diff --git a/src/plugins/avfoundation/camera/avfcamerasession.h b/src/plugins/avfoundation/camera/avfcamerasession.h index 48681aae7..2630a35f7 100644 --- a/src/plugins/avfoundation/camera/avfcamerasession.h +++ b/src/plugins/avfoundation/camera/avfcamerasession.h @@ -64,6 +64,7 @@ public: void setVideoOutput(AVFVideoRendererControl *output); AVCaptureSession *captureSession() const { return m_captureSession; } + AVCaptureDevice *videoCaptureDevice() const; QCamera::State state() const; QCamera::State requestedState() const { return m_state; } diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm index 5f1385a7e..93c2bacd0 100644 --- a/src/plugins/avfoundation/camera/avfcamerasession.mm +++ b/src/plugins/avfoundation/camera/avfcamerasession.mm @@ -155,7 +155,15 @@ void AVFCameraSession::setVideoOutput(AVFVideoRendererControl *output) { m_videoOutput = output; if (output) - output->configureAVCaptureSession(m_captureSession); + output->configureAVCaptureSession(this); +} + +AVCaptureDevice *AVFCameraSession::videoCaptureDevice() const +{ + if (m_videoInput) + return m_videoInput.device; + + return 0; } QCamera::State AVFCameraSession::state() const diff --git a/src/plugins/avfoundation/camera/avfvideorenderercontrol.h b/src/plugins/avfoundation/camera/avfvideorenderercontrol.h index 57978c05a..c080451c3 100644 --- a/src/plugins/avfoundation/camera/avfvideorenderercontrol.h +++ b/src/plugins/avfoundation/camera/avfvideorenderercontrol.h @@ -66,7 +66,7 @@ public: QAbstractVideoSurface *surface() const; void setSurface(QAbstractVideoSurface *surface); - void configureAVCaptureSession(AVCaptureSession *captureSession); + void configureAVCaptureSession(AVFCameraSession *cameraSession); void syncHandleViewfinderFrame(const QVideoFrame &frame); Q_SIGNALS: @@ -74,13 +74,16 @@ Q_SIGNALS: private Q_SLOTS: void handleViewfinderFrame(); + void updateCaptureConnection(); private: QAbstractVideoSurface *m_surface; AVFCaptureFramesDelegate *m_viewfinderFramesDelegate; - AVCaptureSession *m_captureSession; + AVFCameraSession *m_cameraSession; AVCaptureVideoDataOutput *m_videoDataOutput; + bool m_needsHorizontalMirroring; + QVideoFrame m_lastViewfinderFrame; QMutex m_vfMutex; }; diff --git a/src/plugins/avfoundation/camera/avfvideorenderercontrol.mm b/src/plugins/avfoundation/camera/avfvideorenderercontrol.mm index 6efa3cbf8..1a2054452 100644 --- a/src/plugins/avfoundation/camera/avfvideorenderercontrol.mm +++ b/src/plugins/avfoundation/camera/avfvideorenderercontrol.mm @@ -146,13 +146,14 @@ private: AVFVideoRendererControl::AVFVideoRendererControl(QObject *parent) : QVideoRendererControl(parent) , m_surface(0) + , m_needsHorizontalMirroring(false) { m_viewfinderFramesDelegate = [[AVFCaptureFramesDelegate alloc] initWithRenderer:this]; } AVFVideoRendererControl::~AVFVideoRendererControl() { - [m_captureSession removeOutput:m_videoDataOutput]; + [m_cameraSession->captureSession() removeOutput:m_videoDataOutput]; [m_viewfinderFramesDelegate release]; } @@ -169,9 +170,13 @@ void AVFVideoRendererControl::setSurface(QAbstractVideoSurface *surface) } } -void AVFVideoRendererControl::configureAVCaptureSession(AVCaptureSession *captureSession) +void AVFVideoRendererControl::configureAVCaptureSession(AVFCameraSession *cameraSession) { - m_captureSession = captureSession; + m_cameraSession = cameraSession; + connect(m_cameraSession, SIGNAL(readyToConfigureConnections()), + this, SLOT(updateCaptureConnection())); + + m_needsHorizontalMirroring = false; m_videoDataOutput = [[[AVCaptureVideoDataOutput alloc] init] autorelease]; @@ -188,7 +193,23 @@ void AVFVideoRendererControl::configureAVCaptureSession(AVCaptureSession *captur [NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey]; - [m_captureSession addOutput:m_videoDataOutput]; + [m_cameraSession->captureSession() addOutput:m_videoDataOutput]; +} + +void AVFVideoRendererControl::updateCaptureConnection() +{ + AVCaptureConnection *connection = [m_videoDataOutput connectionWithMediaType:AVMediaTypeVideo]; + if (connection == nil || !m_cameraSession->videoCaptureDevice()) + return; + + // Frames of front-facing cameras should be mirrored horizontally (it's the default when using + // AVCaptureVideoPreviewLayer but not with AVCaptureVideoDataOutput) + if (connection.isVideoMirroringSupported) + connection.videoMirrored = m_cameraSession->videoCaptureDevice().position == AVCaptureDevicePositionFront; + + // If the connection does't support mirroring, we'll have to do it ourselves + m_needsHorizontalMirroring = !connection.isVideoMirrored + && m_cameraSession->videoCaptureDevice().position == AVCaptureDevicePositionFront; } //can be called from non main thread @@ -203,6 +224,22 @@ void AVFVideoRendererControl::syncHandleViewfinderFrame(const QVideoFrame &frame } m_lastViewfinderFrame = frame; + + if (m_needsHorizontalMirroring) { + m_lastViewfinderFrame.map(QAbstractVideoBuffer::ReadOnly); + + // no deep copy + QImage image(m_lastViewfinderFrame.bits(), + m_lastViewfinderFrame.size().width(), + m_lastViewfinderFrame.size().height(), + m_lastViewfinderFrame.bytesPerLine(), + QImage::Format_RGB32); + + QImage mirrored = image.mirrored(true, false); + + m_lastViewfinderFrame.unmap(); + m_lastViewfinderFrame = QVideoFrame(mirrored); + } } void AVFVideoRendererControl::handleViewfinderFrame() diff --git a/src/plugins/directshow/camera/camera.pri b/src/plugins/directshow/camera/camera.pri index 7081abd37..2c0fe55b1 100644 --- a/src/plugins/directshow/camera/camera.pri +++ b/src/plugins/directshow/camera/camera.pri @@ -2,7 +2,7 @@ INCLUDEPATH += $$PWD DEFINES += QMEDIA_DIRECTSHOW_CAMERA -win32-g++: DEFINES += QT_NO_WMSDK +mingw: DEFINES += QT_NO_WMSDK win32: DEFINES += _CRT_SECURE_NO_WARNINGS diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index 801367f68..1ecc368e7 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -81,7 +81,7 @@ public: STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject) { - if (NULL == ppvObject) + if (NULL == ppvObject) return E_POINTER; if (riid == IID_IUnknown /*__uuidof(IUnknown) */ ) { *ppvObject = static_cast<IUnknown*>(this); @@ -382,9 +382,9 @@ QSize DSCameraSession::frameSize() const void DSCameraSession::setFrameSize(const QSize& s) { - if (supportedResolutions(pixelF).contains(s)) + if (supportedResolutions(pixelF).contains(s)) m_windowSize = s; - else + else qWarning() << "frame size if not supported for current pixel format, no change"; } @@ -467,8 +467,8 @@ void DSCameraSession::setPixelFormat(QVideoFrame::PixelFormat fmt) QList<QSize> DSCameraSession::supportedResolutions(QVideoFrame::PixelFormat format) { - if (!resolutions.contains(format)) - return QList<QSize>(); + if (!resolutions.contains(format)) + return QList<QSize>(); return resolutions.value(format); } diff --git a/src/plugins/directshow/camera/dsimagecapturecontrol.cpp b/src/plugins/directshow/camera/dsimagecapturecontrol.cpp index f1332235f..e689b13d1 100644 --- a/src/plugins/directshow/camera/dsimagecapturecontrol.cpp +++ b/src/plugins/directshow/camera/dsimagecapturecontrol.cpp @@ -49,10 +49,10 @@ DSImageCaptureControl::DSImageCaptureControl(DSCameraSession *session) :QCameraImageCaptureControl(session), m_session(session), m_ready(false) { connect(m_session, SIGNAL(stateChanged(QCamera::State)), SLOT(updateState())); - connect(m_session, SIGNAL(imageCaptured(const int, QImage)), - this, SIGNAL(imageCaptured(const int, QImage))); - connect(m_session, SIGNAL(imageSaved(const int, const QString &)), - this, SIGNAL(imageSaved(const int, const QString &))); + connect(m_session, SIGNAL(imageCaptured(int,QImage)), + this, SIGNAL(imageCaptured(int,QImage))); + connect(m_session, SIGNAL(imageSaved(int,QString)), + this, SIGNAL(imageSaved(int,QString))); connect(m_session, SIGNAL(readyForCaptureChanged(bool)), this, SIGNAL(readyForCaptureChanged(bool))); } diff --git a/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp b/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp index fde9f554e..35b795546 100644 --- a/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp +++ b/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp @@ -120,7 +120,7 @@ DSVideoWidgetControl::DSVideoWidgetControl(DSCameraSession* session, QObject *pa m_widget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_widget->setAlignment(Qt::AlignCenter); m_widget->setAttribute(Qt::WA_NoSystemBackground, true); - + surface = new DSVideoWidgetSurface(m_widget); QPalette palette; @@ -157,7 +157,7 @@ bool DSVideoWidgetControl::eventFilter(QObject *object, QEvent *e) case QEvent::PolishRequest: m_widget->ensurePolished(); break; - + default: // Do nothing break; diff --git a/src/plugins/directshow/camera/dsvideowidgetcontrol.h b/src/plugins/directshow/camera/dsvideowidgetcontrol.h index ac40fbd7c..2a8775aee 100644 --- a/src/plugins/directshow/camera/dsvideowidgetcontrol.h +++ b/src/plugins/directshow/camera/dsvideowidgetcontrol.h @@ -82,15 +82,15 @@ class DSVideoWidgetSurface : public QAbstractVideoSurface class DSVideoWidgetControl : public QVideoWidgetControl { Q_OBJECT - + DSVideoWidgetSurface* surface; public: // Constructor & Destructor - + DSVideoWidgetControl(DSCameraSession* session, QObject *parent = 0); virtual ~DSVideoWidgetControl(); public: // QVideoWidgetControl - + QWidget *videoWidget(); // Aspect Ratio @@ -118,10 +118,10 @@ public: // QVideoWidgetControl void setSaturation(int saturation); public: // Internal - + bool eventFilter(QObject *object, QEvent *event); - -/* + +/* Q_SIGNALS: // QVideoWidgetControl void fullScreenChanged(bool fullScreen); diff --git a/src/plugins/directshow/directshow.pro b/src/plugins/directshow/directshow.pro index 97e72a107..4dad97113 100644 --- a/src/plugins/directshow/directshow.pro +++ b/src/plugins/directshow/directshow.pro @@ -16,9 +16,7 @@ qtHaveModule(widgets) { DEFINES += HAVE_WIDGETS } -win32-g++ { - DEFINES += NO_DSHOW_STRSAFE -} +mingw: DEFINES += NO_DSHOW_STRSAFE !config_wmf: include(player/player.pri) include(camera/camera.pri) diff --git a/src/plugins/directshow/player/directshoweventloop.cpp b/src/plugins/directshow/player/directshoweventloop.cpp index 74f210b9a..a8726eddd 100644 --- a/src/plugins/directshow/player/directshoweventloop.cpp +++ b/src/plugins/directshow/player/directshoweventloop.cpp @@ -94,7 +94,7 @@ void DirectShowEventLoop::wait(QMutex *mutex) HANDLE handles[] = { m_eventHandle, m_waitHandle }; while (::WaitForMultipleObjects(2, handles, false, INFINITE) == WAIT_OBJECT_0) processEvents(); - + mutex->lock(); } diff --git a/src/plugins/directshow/player/directshowglobal.h b/src/plugins/directshow/player/directshowglobal.h index b604a8d0e..f2a7fef03 100644 --- a/src/plugins/directshow/player/directshowglobal.h +++ b/src/plugins/directshow/player/directshowglobal.h @@ -76,7 +76,7 @@ DECLARE_INTERFACE_(IFilterGraph2 ,IGraphBuilder) STDMETHOD(ReconnectEx)(THIS_ IPin *, const AM_MEDIA_TYPE *) PURE; STDMETHOD(RenderEx)(IPin *, DWORD, DWORD *) PURE; }; -#undef INTERFACE +#undef INTERFACE #endif #ifndef __IAMFilterMiscFlags_INTERFACE_DEFINED__ @@ -89,7 +89,7 @@ DECLARE_INTERFACE_(IAMFilterMiscFlags ,IUnknown) STDMETHOD_(ULONG,Release)(THIS) PURE; STDMETHOD_(ULONG,GetMiscFlags)(THIS) PURE; }; -#undef INTERFACE +#undef INTERFACE #endif #ifndef __IFileSourceFilter_INTERFACE_DEFINED__ @@ -103,7 +103,7 @@ DECLARE_INTERFACE_(IFileSourceFilter ,IUnknown) STDMETHOD(Load)(THIS_ LPCOLESTR, const AM_MEDIA_TYPE *) PURE; STDMETHOD(GetCurFile)(THIS_ LPOLESTR *ppszFileName, AM_MEDIA_TYPE *) PURE; }; -#undef INTERFACE +#undef INTERFACE #endif #ifndef __IAMOpenProgress_INTERFACE_DEFINED__ @@ -117,7 +117,7 @@ DECLARE_INTERFACE_(IAMOpenProgress ,IUnknown) STDMETHOD(QueryProgress)(THIS_ LONGLONG *, LONGLONG *) PURE; STDMETHOD(AbortOperation)(THIS) PURE; }; -#undef INTERFACE +#undef INTERFACE #endif #ifndef __IFilterChain_INTERFACE_DEFINED__ @@ -133,7 +133,7 @@ DECLARE_INTERFACE_(IFilterChain ,IUnknown) STDMETHOD(StopChain)(IBaseFilter *, IBaseFilter *) PURE; STDMETHOD(RemoveChain)(IBaseFilter *, IBaseFilter *) PURE; }; -#undef INTERFACE +#undef INTERFACE #endif #endif diff --git a/src/plugins/directshow/player/directshowioreader.cpp b/src/plugins/directshow/player/directshowioreader.cpp index c0ea4ebbd..38928f1ae 100644 --- a/src/plugins/directshow/player/directshowioreader.cpp +++ b/src/plugins/directshow/player/directshowioreader.cpp @@ -259,7 +259,7 @@ HRESULT DirectShowIOReader::SyncReadAligned(IMediaSample *pSample) if (SUCCEEDED(hr)) pSample->SetActualDataLength(bytesRead); - + return hr; } else { m_synchronousPosition = position; diff --git a/src/plugins/directshow/player/directshowiosource.cpp b/src/plugins/directshow/player/directshowiosource.cpp index f382b3b9c..acce1de28 100644 --- a/src/plugins/directshow/player/directshowiosource.cpp +++ b/src/plugins/directshow/player/directshowiosource.cpp @@ -336,7 +336,7 @@ HRESULT DirectShowIOSource::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) return VFW_E_NOT_STOPPED; } else if (m_peerPin) { return VFW_E_ALREADY_CONNECTED; - } else { + } else { HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED; m_peerPin = pReceivePin; @@ -424,7 +424,7 @@ HRESULT DirectShowIOSource::tryConnect(IPin *pin, const AM_MEDIA_TYPE *type) || m_allocator->GetProperties(&properties) == S_OK) { if (properties.cbAlign == 0) properties.cbAlign = 1; - + ALLOCATOR_PROPERTIES actualProperties; if (SUCCEEDED(hr = m_allocator->SetProperties(&properties, &actualProperties))) hr = memPin->NotifyAllocator(m_allocator, TRUE); @@ -435,7 +435,7 @@ HRESULT DirectShowIOSource::tryConnect(IPin *pin, const AM_MEDIA_TYPE *type) } } memPin->Release(); - } + } if (!SUCCEEDED(hr)) pin->Disconnect(); } diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.cpp b/src/plugins/directshow/player/directshowmetadatacontrol.cpp index d60bce31a..51d9574ba 100644 --- a/src/plugins/directshow/player/directshowmetadatacontrol.cpp +++ b/src/plugins/directshow/player/directshowmetadatacontrol.cpp @@ -255,7 +255,7 @@ static QVariant getValue(IWMHeaderInfo *header, const wchar_t *key) WORD word; if (header->GetAttributeByName( &streamNumber, - key, + key, &type, reinterpret_cast<BYTE *>(&word), &size) == S_OK) { diff --git a/src/plugins/directshow/player/directshowplayercontrol.h b/src/plugins/directshow/player/directshowplayercontrol.h index 175937169..478389de6 100644 --- a/src/plugins/directshow/player/directshowplayercontrol.h +++ b/src/plugins/directshow/player/directshowplayercontrol.h @@ -79,7 +79,7 @@ public: bool isVideoAvailable() const; bool isSeekable() const; - + QMediaTimeRange availablePlaybackRanges() const; qreal playbackRate() const; @@ -140,7 +140,7 @@ private: bool m_seekable; QMediaContent m_media; QString m_errorString; - + }; #endif diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp index 9d74be592..0afeacb85 100644 --- a/src/plugins/directshow/player/directshowplayerservice.cpp +++ b/src/plugins/directshow/player/directshowplayerservice.cpp @@ -563,7 +563,7 @@ void DirectShowPlayerService::releaseGraph() } m_graph->Abort(); } - + m_pendingTasks = ReleaseGraph; ::SetEvent(m_taskHandle); @@ -803,7 +803,7 @@ void DirectShowPlayerService::doStop(QMutexLocker *locker) m_pendingTasks |= Seek; m_executedTasks &= ~(Play | Pause); - + QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange))); } @@ -852,7 +852,7 @@ void DirectShowPlayerService::doSetRate(QMutexLocker *locker) seeking->Release(); } else if (m_rate != 1.0) { - m_rate = 1.0; + m_rate = 1.0; } QCoreApplication::postEvent(this, new QEvent(QEvent::Type(RateChange))); } @@ -980,7 +980,7 @@ void DirectShowPlayerService::setAudioOutput(IBaseFilter *filter) m_loop->wait(&m_mutex); } m_audioOutput->Release(); - } + } m_audioOutput = filter; diff --git a/src/plugins/directshow/player/directshowsamplescheduler.cpp b/src/plugins/directshow/player/directshowsamplescheduler.cpp index 36aefa049..2f61784a7 100644 --- a/src/plugins/directshow/player/directshowsamplescheduler.cpp +++ b/src/plugins/directshow/player/directshowsamplescheduler.cpp @@ -308,10 +308,10 @@ void DirectShowSampleScheduler::run(REFERENCE_TIME startTime) for (DirectShowTimedSample *sample = m_head; sample; sample = sample->nextSample()) { sample->schedule(m_clock, m_startTime, m_timeoutEvent); } - + if (!(m_state & Flushing)) ::ResetEvent(m_flushEvent); - + if (!m_head) ::SetEvent(m_timeoutEvent); @@ -338,7 +338,7 @@ void DirectShowSampleScheduler::stop() for (DirectShowTimedSample *sample = m_head; sample; sample = sample->remove()) { sample->unschedule(m_clock); - + m_semaphore.release(1); } diff --git a/src/plugins/directshow/player/videosurfacefilter.cpp b/src/plugins/directshow/player/videosurfacefilter.cpp index b8a775bb7..b6cc232ab 100644 --- a/src/plugins/directshow/player/videosurfacefilter.cpp +++ b/src/plugins/directshow/player/videosurfacefilter.cpp @@ -81,7 +81,7 @@ VideoSurfaceFilter::~VideoSurfaceFilter() } HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject) -{ +{ // 2dd74950-a890-11d1-abe8-00a0c905f375 static const GUID iid_IAmFilterMiscFlags = { 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75} }; diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.h b/src/plugins/gstreamer/camerabin/camerabinflash.h index d94b4a87c..f5484101f 100644 --- a/src/plugins/gstreamer/camerabin/camerabinflash.h +++ b/src/plugins/gstreamer/camerabin/camerabinflash.h @@ -66,7 +66,7 @@ public: bool isFlashReady() const; private: - CameraBinSession *m_session; + CameraBinSession *m_session; }; QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp index 464fa8043..cf105d482 100644 --- a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp @@ -54,8 +54,8 @@ CameraBinLocks::CameraBinLocks(CameraBinSession *session) m_session(session), m_focus(m_session->cameraFocusControl()) { - connect(m_focus, SIGNAL(_q_focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)), - this, SLOT(updateFocusStatus(QCamera::LockStatus, QCamera::LockChangeReason))); + connect(m_focus, SIGNAL(_q_focusStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)), + this, SLOT(updateFocusStatus(QCamera::LockStatus,QCamera::LockChangeReason))); } CameraBinLocks::~CameraBinLocks() diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp index d6df4208e..d8f1616d9 100644 --- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp @@ -65,7 +65,7 @@ CamerabinResourcePolicy::CamerabinResourcePolicy(QObject *parent) : m_resource->setAlwaysReply(); m_resource->initAndConnect(); - connect(m_resource, SIGNAL(resourcesGranted(const QList<ResourcePolicy::ResourceType>)), + connect(m_resource, SIGNAL(resourcesGranted(QList<ResourcePolicy::ResourceType>)), SLOT(handleResourcesGranted())); connect(m_resource, SIGNAL(resourcesDenied()), SIGNAL(resourcesDenied())); connect(m_resource, SIGNAL(lostResources()), SLOT(handleResourcesLost())); diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h index 3332f4c78..d77217906 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.h +++ b/src/plugins/gstreamer/camerabin/camerabinsession.h @@ -114,7 +114,7 @@ public: void setCaptureMode(QCamera::CaptureModes mode); QUrl outputLocation() const; - bool setOutputLocation(const QUrl& sink); + bool setOutputLocation(const QUrl& sink); QDir defaultDir(QCamera::CaptureModes mode) const; QString generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const; diff --git a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp index c49539df3..84bcac9fc 100644 --- a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp +++ b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp @@ -54,7 +54,7 @@ CameraButtonListener::CameraButtonListener(QObject *parent) : m_shutterPressed(false) { m_keys = new MeeGo::QmKeys(this); - connect(m_keys, SIGNAL(keyEvent(MeeGo::QmKeys::Key, MeeGo::QmKeys::State)), + connect(m_keys, SIGNAL(keyEvent(MeeGo::QmKeys::Key,MeeGo::QmKeys::State)), this, SLOT(handleQmKeyEvent(MeeGo::QmKeys::Key,MeeGo::QmKeys::State))); } @@ -65,7 +65,7 @@ CameraButtonListener::~CameraButtonListener() void CameraButtonListener::handleQmKeyEvent(MeeGo::QmKeys::Key key, MeeGo::QmKeys::State state) { if (key == MeeGo::QmKeys::Camera) { - QWidget *window = QApplication::focusWidget(); + QWidget *window = QApplication::focusWidget(); bool focusPressed = (state == MeeGo::QmKeys::KeyHalfDown) || (state == MeeGo::QmKeys::KeyDown); diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index d61e6a010..da6120181 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -491,7 +491,7 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) } } - QGstreamerVideoRendererInterface* renderer = qobject_cast<QGstreamerVideoRendererInterface*>(videoOutput); + QGstreamerVideoRendererInterface* renderer = qobject_cast<QGstreamerVideoRendererInterface*>(videoOutput); m_renderer = renderer; @@ -646,7 +646,7 @@ void QGstreamerPlayerSession::finishVideoOutputChange() m_pendingVideoSink = 0; gst_object_unref(GST_OBJECT(srcPad)); return; - } + } if (m_usingColorspaceElement) { gst_element_set_state(m_colorSpace, GST_STATE_NULL); diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index c10759955..2677e269b 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -21,11 +21,10 @@ qnx:!blackberry { SUBDIRS += qnx-audio } -win32 { - SUBDIRS += audiocapture -} +win32:!winrt { + SUBDIRS += audiocapture \ + windowsaudio -win32 { config_directshow: SUBDIRS += directshow config_wmf: SUBDIRS += wmf } @@ -37,12 +36,14 @@ unix:!mac:!android { SUBDIRS += audiocapture } - # v4l is turned off because it is not supported in Qt 5 - # !maemo*:SUBDIRS += v4l - config_pulseaudio { SUBDIRS += pulseaudio + } else:config_alsa { + SUBDIRS += alsa } + + # v4l is turned off because it is not supported in Qt 5 + # !maemo*:SUBDIRS += v4l } mac:!simulator { diff --git a/src/plugins/qnx/camera/bbcamerasession.cpp b/src/plugins/qnx/camera/bbcamerasession.cpp index d673040ab..59db66f4a 100644 --- a/src/plugins/qnx/camera/bbcamerasession.cpp +++ b/src/plugins/qnx/camera/bbcamerasession.cpp @@ -92,10 +92,20 @@ static QString errorToString(camera_error_t error) case CAMERA_EMICINUSE: return QLatin1String("Microphone in use already"); #ifndef Q_OS_BLACKBERRY_TABLET + case CAMERA_ENODATA: + return QLatin1String("Data does not exist"); + case CAMERA_EBUSY: + return QLatin1String("Camera busy"); case CAMERA_EDESKTOPCAMERAINUSE: return QLatin1String("Desktop camera in use already"); case CAMERA_ENOSPC: return QLatin1String("Disk is full"); + case CAMERA_EPOWERDOWN: + return QLatin1String("Camera in power down state"); + case CAMERA_3ALOCKED: + return QLatin1String("3A have been locked"); +// case CAMERA_EVIEWFINDERFROZEN: // not yet available in 10.2 NDK +// return QLatin1String("Freeze flag set"); #endif default: return QLatin1String("Unknown error"); diff --git a/src/plugins/qt7/mediaplayer/qt7playercontrol.mm b/src/plugins/qt7/mediaplayer/qt7playercontrol.mm index c987f6952..c48660778 100644 --- a/src/plugins/qt7/mediaplayer/qt7playercontrol.mm +++ b/src/plugins/qt7/mediaplayer/qt7playercontrol.mm @@ -51,7 +51,7 @@ QT_USE_NAMESPACE QT7PlayerControl::QT7PlayerControl(QObject *parent) : QMediaPlayerControl(parent) -{ +{ } QT7PlayerControl::~QT7PlayerControl() diff --git a/src/plugins/qt7/qcvdisplaylink.h b/src/plugins/qt7/qcvdisplaylink.h index 2d4809c49..f59cc92bf 100644 --- a/src/plugins/qt7/qcvdisplaylink.h +++ b/src/plugins/qt7/qcvdisplaylink.h @@ -73,7 +73,7 @@ public: protected: virtual bool event(QEvent *); - + private: CVDisplayLinkRef m_displayLink; QMutex m_displayLinkMutex; diff --git a/src/plugins/qt7/qt7movierenderer.h b/src/plugins/qt7/qt7movierenderer.h index aed39ad9a..bdc7c5260 100644 --- a/src/plugins/qt7/qt7movierenderer.h +++ b/src/plugins/qt7/qt7movierenderer.h @@ -80,7 +80,7 @@ public: private Q_SLOTS: void updateVideoFrame(const CVTimeStamp &ts); - + private: void setupVideoOutput(); bool createPixelBufferVisualContext(); @@ -92,7 +92,7 @@ private: QCvDisplayLink *m_displayLink; #ifdef QUICKTIME_C_API_AVAILABLE - QTVisualContextRef m_visualContext; + QTVisualContextRef m_visualContext; bool m_usingGLContext; const QGLContext *m_currentGLContext; QSize m_pixelBufferContextGeometry; diff --git a/src/plugins/qt7/qt7movievideowidget.h b/src/plugins/qt7/qt7movievideowidget.h index fd0c3d075..cd61869fa 100644 --- a/src/plugins/qt7/qt7movievideowidget.h +++ b/src/plugins/qt7/qt7movievideowidget.h @@ -95,7 +95,7 @@ public: private Q_SLOTS: void updateVideoFrame(const CVTimeStamp &ts); - + private: void setupVideoOutput(); bool createVisualContext(); @@ -108,7 +108,7 @@ private: QCvDisplayLink *m_displayLink; #ifdef QUICKTIME_C_API_AVAILABLE - QTVisualContextRef m_visualContext; + QTVisualContextRef m_visualContext; #endif bool m_fullscreen; diff --git a/src/plugins/qt7/qt7movievideowidget.mm b/src/plugins/qt7/qt7movievideowidget.mm index 11f2ad32c..ec9367bcc 100644 --- a/src/plugins/qt7/qt7movievideowidget.mm +++ b/src/plugins/qt7/qt7movievideowidget.mm @@ -76,7 +76,7 @@ public: m_nativeSize(640,480), m_aspectRatioMode(Qt::KeepAspectRatio) { - setAutoFillBackground(false); + setAutoFillBackground(false); } void initializeGL() @@ -151,7 +151,7 @@ public: void setNativeSize(const QSize &size) { - m_nativeSize = size; + m_nativeSize = size; } void setAspectRatioMode(Qt::AspectRatioMode mode) @@ -184,8 +184,8 @@ private: QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent) :QT7VideoWidgetControl(parent), - m_movie(0), - m_videoWidget(0), + m_movie(0), + m_videoWidget(0), m_fullscreen(false), m_aspectRatioMode(Qt::KeepAspectRatio), m_brightness(0), @@ -325,7 +325,7 @@ bool QT7MovieVideoWidget::isFullScreen() const void QT7MovieVideoWidget::setFullScreen(bool fullScreen) { - m_fullscreen = fullScreen; + m_fullscreen = fullScreen; } QSize QT7MovieVideoWidget::nativeSize() const @@ -341,7 +341,7 @@ Qt::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const void QT7MovieVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; - m_videoWidget->setAspectRatioMode(mode); + m_videoWidget->setAspectRatioMode(mode); } int QT7MovieVideoWidget::brightness() const @@ -410,7 +410,7 @@ void QT7MovieVideoWidget::updateColors() void QT7MovieVideoWidget::updateVideoFrame(const CVTimeStamp &ts) { #ifdef QUICKTIME_C_API_AVAILABLE - AutoReleasePool pool; + AutoReleasePool pool; // check for new frame if (m_visualContext && QTVisualContextIsNewImageAvailable(m_visualContext, &ts)) { CVOpenGLTextureRef currentFrame = NULL; diff --git a/src/plugins/qt7/qt7movieviewoutput.h b/src/plugins/qt7/qt7movieviewoutput.h index ea3d248f8..2e3ed2c7c 100644 --- a/src/plugins/qt7/qt7movieviewoutput.h +++ b/src/plugins/qt7/qt7movieviewoutput.h @@ -91,7 +91,7 @@ public: int saturation() const; void setSaturation(int saturation); - + private: void setupVideoOutput(); diff --git a/src/plugins/qt7/qt7movieviewoutput.mm b/src/plugins/qt7/qt7movieviewoutput.mm index c6a2bbafe..4fcf01d39 100644 --- a/src/plugins/qt7/qt7movieviewoutput.mm +++ b/src/plugins/qt7/qt7movieviewoutput.mm @@ -166,7 +166,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent) m_contrast(0), m_hue(0), m_saturation(0) -{ +{ } QT7MovieViewOutput::~QT7MovieViewOutput() diff --git a/src/plugins/qt7/qt7movieviewrenderer.mm b/src/plugins/qt7/qt7movieviewrenderer.mm index 0e1571f92..a59031577 100644 --- a/src/plugins/qt7/qt7movieviewrenderer.mm +++ b/src/plugins/qt7/qt7movieviewrenderer.mm @@ -278,7 +278,7 @@ QT7MovieViewRenderer::QT7MovieViewRenderer(QObject *parent) m_fbo(0), m_ciContext(0), m_pendingRenderEvent(false) -{ +{ } QT7MovieViewRenderer::~QT7MovieViewRenderer() diff --git a/src/plugins/qt7/qt7videooutput.mm b/src/plugins/qt7/qt7videooutput.mm index 6c657c279..53486c4e4 100644 --- a/src/plugins/qt7/qt7videooutput.mm +++ b/src/plugins/qt7/qt7videooutput.mm @@ -47,10 +47,10 @@ QT_USE_NAMESPACE /* QT7VideoOutputControl::QT7VideoOutputControl(QObject *parent) - :QVideoOutputControl(parent), + :QVideoOutputControl(parent), m_session(0), m_output(QVideoOutputControl::NoOutput) -{ +{ } QT7VideoOutputControl::~QT7VideoOutputControl() diff --git a/src/plugins/resourcepolicy/resourcepolicyimpl.cpp b/src/plugins/resourcepolicy/resourcepolicyimpl.cpp index aed9ccb09..0acabc001 100644 --- a/src/plugins/resourcepolicy/resourcepolicyimpl.cpp +++ b/src/plugins/resourcepolicy/resourcepolicyimpl.cpp @@ -61,7 +61,7 @@ ResourcePolicyImpl::ResourcePolicyImpl(QObject *parent) m_resourceSet->update(); - connect(m_resourceSet, SIGNAL(resourcesGranted(const QList<ResourcePolicy::ResourceType>)), + connect(m_resourceSet, SIGNAL(resourcesGranted(QList<ResourcePolicy::ResourceType>)), this, SLOT(handleResourcesGranted())); connect(m_resourceSet, SIGNAL(resourcesDenied()), this, SLOT(handleResourcesDenied())); diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp index e9503d4c3..d37056a5f 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp @@ -53,7 +53,7 @@ #include <QtCore/qt_windows.h> #include <mmsystem.h> -#include "qaudiodeviceinfo_win32_p.h" +#include "qwindowsaudiodeviceinfo.h" #if defined(Q_CC_MINGW) && !defined(__MINGW64_VERSION_MAJOR) struct IBaseFilter; // Needed for strmif.h from stock MinGW. @@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE #endif -QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) +QWindowsAudioDeviceInfo::QWindowsAudioDeviceInfo(QByteArray dev, QAudio::Mode mode) { QDataStream ds(&dev, QIODevice::ReadOnly); ds >> devId >> device; @@ -136,17 +136,17 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode updateLists(); } -QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() +QWindowsAudioDeviceInfo::~QWindowsAudioDeviceInfo() { close(); } -bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const +bool QWindowsAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const { return testSettings(format); } -QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const +QAudioFormat QWindowsAudioDeviceInfo::preferredFormat() const { QAudioFormat nearest; if (mode == QAudio::AudioOutput) { @@ -167,58 +167,58 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const return nearest; } -QString QAudioDeviceInfoInternal::deviceName() const +QString QWindowsAudioDeviceInfo::deviceName() const { return device; } -QStringList QAudioDeviceInfoInternal::supportedCodecs() +QStringList QWindowsAudioDeviceInfo::supportedCodecs() { updateLists(); return codecz; } -QList<int> QAudioDeviceInfoInternal::supportedSampleRates() +QList<int> QWindowsAudioDeviceInfo::supportedSampleRates() { updateLists(); return sampleRatez; } -QList<int> QAudioDeviceInfoInternal::supportedChannelCounts() +QList<int> QWindowsAudioDeviceInfo::supportedChannelCounts() { updateLists(); return channelz; } -QList<int> QAudioDeviceInfoInternal::supportedSampleSizes() +QList<int> QWindowsAudioDeviceInfo::supportedSampleSizes() { updateLists(); return sizez; } -QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders() +QList<QAudioFormat::Endian> QWindowsAudioDeviceInfo::supportedByteOrders() { updateLists(); return byteOrderz; } -QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes() +QList<QAudioFormat::SampleType> QWindowsAudioDeviceInfo::supportedSampleTypes() { updateLists(); return typez; } -bool QAudioDeviceInfoInternal::open() +bool QWindowsAudioDeviceInfo::open() { return true; } -void QAudioDeviceInfoInternal::close() +void QWindowsAudioDeviceInfo::close() { } -bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const +bool QWindowsAudioDeviceInfo::testSettings(const QAudioFormat& format) const { // Set nearest to closest settings that do work. // See if what is in settings will work (return value). @@ -305,7 +305,7 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const return false; } -void QAudioDeviceInfoInternal::updateLists() +void QWindowsAudioDeviceInfo::updateLists() { // redo all lists based on current settings bool match = false; @@ -344,7 +344,7 @@ void QAudioDeviceInfoInternal::updateLists() || (fmt & WAVE_FORMAT_96S08) ) { sizez.append(8); - } + } if ((fmt & WAVE_FORMAT_1M16) || (fmt & WAVE_FORMAT_1S16) || (fmt & WAVE_FORMAT_2M16) @@ -357,57 +357,57 @@ void QAudioDeviceInfoInternal::updateLists() || (fmt & WAVE_FORMAT_96S16) ) { sizez.append(16); - } + } if ((fmt & WAVE_FORMAT_1M08) || (fmt & WAVE_FORMAT_1S08) || (fmt & WAVE_FORMAT_1M16) || (fmt & WAVE_FORMAT_1S16)) { sampleRatez.append(11025); - } + } if ((fmt & WAVE_FORMAT_2M08) || (fmt & WAVE_FORMAT_2S08) || (fmt & WAVE_FORMAT_2M16) || (fmt & WAVE_FORMAT_2S16)) { sampleRatez.append(22050); - } + } if ((fmt & WAVE_FORMAT_4M08) || (fmt & WAVE_FORMAT_4S08) || (fmt & WAVE_FORMAT_4M16) || (fmt & WAVE_FORMAT_4S16)) { sampleRatez.append(44100); - } + } if ((fmt & WAVE_FORMAT_48M08) || (fmt & WAVE_FORMAT_48S08) || (fmt & WAVE_FORMAT_48M16) || (fmt & WAVE_FORMAT_48S16)) { sampleRatez.append(48000); - } + } if ((fmt & WAVE_FORMAT_96M08) || (fmt & WAVE_FORMAT_96S08) || (fmt & WAVE_FORMAT_96M16) || (fmt & WAVE_FORMAT_96S16)) { sampleRatez.append(96000); } - channelz.append(1); - channelz.append(2); + channelz.append(1); + channelz.append(2); if (mode == QAudio::AudioOutput) { channelz.append(4); channelz.append(6); channelz.append(8); } - byteOrderz.append(QAudioFormat::LittleEndian); + byteOrderz.append(QAudioFormat::LittleEndian); - typez.append(QAudioFormat::SignedInt); - typez.append(QAudioFormat::UnSignedInt); + typez.append(QAudioFormat::SignedInt); + typez.append(QAudioFormat::UnSignedInt); - codecz.append(QLatin1String("audio/pcm")); + codecz.append(QLatin1String("audio/pcm")); } if (sampleRatez.count() > 0) sampleRatez.prepend(8000); } -QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) +QList<QByteArray> QWindowsAudioDeviceInfo::availableDevices(QAudio::Mode mode) { Q_UNUSED(mode) @@ -467,7 +467,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) return devices; } -QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() +QByteArray QWindowsAudioDeviceInfo::defaultOutputDevice() { QByteArray defaultDevice; QDataStream ds(&defaultDevice, QIODevice::WriteOnly); @@ -477,7 +477,7 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() return defaultDevice; } -QByteArray QAudioDeviceInfoInternal::defaultInputDevice() +QByteArray QWindowsAudioDeviceInfo::defaultInputDevice() { QByteArray defaultDevice; QDataStream ds(&defaultDevice, QIODevice::WriteOnly); diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.h index 6744518c3..817b803f6 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h +++ b/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.h @@ -51,16 +51,16 @@ // -#ifndef QAUDIODEVICEINFOWIN_H -#define QAUDIODEVICEINFOWIN_H +#ifndef QWINDOWSAUDIODEVICEINFO_H +#define QWINDOWSAUDIODEVICEINFO_H #include <QtCore/qbytearray.h> #include <QtCore/qstringlist.h> #include <QtCore/qlist.h> #include <QtCore/qdebug.h> -#include <qaudiodeviceinfo.h> -#include <qaudiosystem.h> +#include <QtMultimedia/qaudiodeviceinfo.h> +#include <QtMultimedia/qaudiosystem.h> QT_BEGIN_NAMESPACE @@ -69,13 +69,13 @@ QT_BEGIN_NAMESPACE const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; -class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo +class QWindowsAudioDeviceInfo : public QAbstractAudioDeviceInfo { Q_OBJECT public: - QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode); - ~QAudioDeviceInfoInternal(); + QWindowsAudioDeviceInfo(QByteArray dev,QAudio::Mode mode); + ~QWindowsAudioDeviceInfo(); bool open(); void close(); @@ -111,4 +111,4 @@ private: QT_END_NAMESPACE -#endif +#endif // QWINDOWSAUDIODEVICEINFO_H diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/plugins/windowsaudio/qwindowsaudioinput.cpp index 6db34adf3..26f0641bf 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/plugins/windowsaudio/qwindowsaudioinput.cpp @@ -51,13 +51,13 @@ // -#include "qaudioinput_win32_p.h" +#include "qwindowsaudioinput.h" QT_BEGIN_NAMESPACE //#define DEBUG_AUDIO 1 -QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device) +QWindowsAudioInput::QWindowsAudioInput(const QByteArray &device) { bytesAvailable = 0; buffer_size = 0; @@ -78,21 +78,21 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device) initMixer(); } -QAudioInputPrivate::~QAudioInputPrivate() +QWindowsAudioInput::~QWindowsAudioInput() { stop(); closeMixer(); } -void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, +void QT_WIN_CALLBACK QWindowsAudioInput::waveInProc( HWAVEIN hWaveIn, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ) { Q_UNUSED(dwParam1) Q_UNUSED(dwParam2) Q_UNUSED(hWaveIn) - QAudioInputPrivate* qAudio; - qAudio = (QAudioInputPrivate*)(dwInstance); + QWindowsAudioInput* qAudio; + qAudio = (QWindowsAudioInput*)(dwInstance); if(!qAudio) return; @@ -114,7 +114,7 @@ void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, } } -WAVEHDR* QAudioInputPrivate::allocateBlocks(int size, int count) +WAVEHDR* QWindowsAudioInput::allocateBlocks(int size, int count) { int i; unsigned char* buffer; @@ -145,7 +145,7 @@ WAVEHDR* QAudioInputPrivate::allocateBlocks(int size, int count) return blocks; } -void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray) +void QWindowsAudioInput::freeBlocks(WAVEHDR* blockArray) { WAVEHDR* blocks = blockArray; @@ -158,12 +158,12 @@ void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray) HeapFree(GetProcessHeap(), 0, blockArray); } -QAudio::Error QAudioInputPrivate::error() const +QAudio::Error QWindowsAudioInput::error() const { return errorState; } -QAudio::State QAudioInputPrivate::state() const +QAudio::State QWindowsAudioInput::state() const { return deviceState; } @@ -181,7 +181,7 @@ QAudio::State QAudioInputPrivate::state() const #define DRVM_MAPPER_CONSOLEVOICECOM_GET (DRVM_MAPPER+23) #endif -void QAudioInputPrivate::setVolume(qreal volume) +void QWindowsAudioInput::setVolume(qreal volume) { for (DWORD i = 0; i < mixerLineControls.cControls; i++) { @@ -202,7 +202,7 @@ void QAudioInputPrivate::setVolume(qreal volume) } } -qreal QAudioInputPrivate::volume() const +qreal QWindowsAudioInput::volume() const { DWORD volume = 0; for (DWORD i = 0; i < mixerLineControls.cControls; i++) { @@ -233,18 +233,18 @@ qreal QAudioInputPrivate::volume() const return volume / 65535.0; } -void QAudioInputPrivate::setFormat(const QAudioFormat& fmt) +void QWindowsAudioInput::setFormat(const QAudioFormat& fmt) { if (deviceState == QAudio::StoppedState) settings = fmt; } -QAudioFormat QAudioInputPrivate::format() const +QAudioFormat QWindowsAudioInput::format() const { return settings; } -void QAudioInputPrivate::start(QIODevice* device) +void QWindowsAudioInput::start(QIODevice* device) { if(deviceState != QAudio::StoppedState) close(); @@ -263,7 +263,7 @@ void QAudioInputPrivate::start(QIODevice* device) emit stateChanged(deviceState); } -QIODevice* QAudioInputPrivate::start() +QIODevice* QWindowsAudioInput::start() { if(deviceState != QAudio::StoppedState) close(); @@ -285,7 +285,7 @@ QIODevice* QAudioInputPrivate::start() return audioSource; } -void QAudioInputPrivate::stop() +void QWindowsAudioInput::stop() { if(deviceState == QAudio::StoppedState) return; @@ -294,7 +294,7 @@ void QAudioInputPrivate::stop() emit stateChanged(deviceState); } -bool QAudioInputPrivate::open() +bool QWindowsAudioInput::open() { #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -398,7 +398,7 @@ bool QAudioInputPrivate::open() return true; } -void QAudioInputPrivate::close() +void QWindowsAudioInput::close() { if(deviceState == QAudio::StoppedState) return; @@ -421,7 +421,7 @@ void QAudioInputPrivate::close() } } -void QAudioInputPrivate::initMixer() +void QWindowsAudioInput::initMixer() { QDataStream ds(&m_device, QIODevice::ReadOnly); quint32 inputDevice; @@ -455,13 +455,13 @@ void QAudioInputPrivate::initMixer() } } -void QAudioInputPrivate::closeMixer() +void QWindowsAudioInput::closeMixer() { delete[] mixerLineControls.pamxctrl; memset(&mixerLineControls, 0, sizeof(mixerLineControls)); } -int QAudioInputPrivate::bytesReady() const +int QWindowsAudioInput::bytesReady() const { if(period_size == 0 || buffer_size == 0) return 0; @@ -472,7 +472,7 @@ int QAudioInputPrivate::bytesReady() const return buf; } -qint64 QAudioInputPrivate::read(char* data, qint64 len) +qint64 QWindowsAudioInput::read(char* data, qint64 len) { bool done = false; @@ -505,7 +505,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) deviceState = QAudio::ActiveState; emit stateChanged(deviceState); } - resuming = false; + resuming = false; } } else { l = qMin<qint64>(len, waveBlocks[header].dwBytesRecorded - waveBlockOffset); @@ -523,7 +523,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) deviceState = QAudio::ActiveState; emit stateChanged(deviceState); } - resuming = false; + resuming = false; } } else { //no data, not ready yet, next time @@ -583,7 +583,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) mutex.unlock(); } - written+=l; + written+=l; } #ifdef DEBUG_AUDIO qDebug()<<"read in len="<<written; @@ -591,7 +591,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) return written; } -void QAudioInputPrivate::resume() +void QWindowsAudioInput::resume() { if(deviceState == QAudio::SuspendedState) { deviceState = QAudio::ActiveState; @@ -611,7 +611,7 @@ void QAudioInputPrivate::resume() mutex.unlock(); header = 0; - resuming = true; + resuming = true; waveBlockOffset = 0; waveInStart(hWaveIn); QTimer::singleShot(20,this,SLOT(feedback())); @@ -619,32 +619,32 @@ void QAudioInputPrivate::resume() } } -void QAudioInputPrivate::setBufferSize(int value) +void QWindowsAudioInput::setBufferSize(int value) { buffer_size = value; } -int QAudioInputPrivate::bufferSize() const +int QWindowsAudioInput::bufferSize() const { return buffer_size; } -int QAudioInputPrivate::periodSize() const +int QWindowsAudioInput::periodSize() const { return period_size; } -void QAudioInputPrivate::setNotifyInterval(int ms) +void QWindowsAudioInput::setNotifyInterval(int ms) { intervalTime = qMax(0, ms); } -int QAudioInputPrivate::notifyInterval() const +int QWindowsAudioInput::notifyInterval() const { return intervalTime; } -qint64 QAudioInputPrivate::processedUSecs() const +qint64 QWindowsAudioInput::processedUSecs() const { if (deviceState == QAudio::StoppedState) return 0; @@ -655,7 +655,7 @@ qint64 QAudioInputPrivate::processedUSecs() const return result; } -void QAudioInputPrivate::suspend() +void QWindowsAudioInput::suspend() { if(deviceState == QAudio::ActiveState) { waveInReset(hWaveIn); @@ -664,7 +664,7 @@ void QAudioInputPrivate::suspend() } } -void QAudioInputPrivate::feedback() +void QWindowsAudioInput::feedback() { #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -674,7 +674,7 @@ void QAudioInputPrivate::feedback() QMetaObject::invokeMethod(this, "deviceReady", Qt::QueuedConnection); } -bool QAudioInputPrivate::deviceReady() +bool QWindowsAudioInput::deviceReady() { bytesAvailable = bytesReady(); #ifdef DEBUG_AUDIO @@ -689,8 +689,8 @@ bool QAudioInputPrivate::deviceReady() read(0, buffer_size); } else { // emits readyRead() so user will call read() on QIODevice to get some audio data - InputPrivate* a = qobject_cast<InputPrivate*>(audioSource); - a->trigger(); + InputPrivate* a = qobject_cast<InputPrivate*>(audioSource); + a->trigger(); } if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { @@ -701,7 +701,7 @@ bool QAudioInputPrivate::deviceReady() return true; } -qint64 QAudioInputPrivate::elapsedUSecs() const +qint64 QWindowsAudioInput::elapsedUSecs() const { if (deviceState == QAudio::StoppedState) return 0; @@ -709,16 +709,16 @@ qint64 QAudioInputPrivate::elapsedUSecs() const return timeStampOpened.elapsed()*1000; } -void QAudioInputPrivate::reset() +void QWindowsAudioInput::reset() { stop(); if (period_size > 0) waveFreeBlockCount = buffer_size / period_size; } -InputPrivate::InputPrivate(QAudioInputPrivate* audio) +InputPrivate::InputPrivate(QWindowsAudioInput* audio) { - audioDevice = qobject_cast<QAudioInputPrivate*>(audio); + audioDevice = qobject_cast<QWindowsAudioInput*>(audio); } InputPrivate::~InputPrivate() {} @@ -749,5 +749,4 @@ void InputPrivate::trigger() QT_END_NAMESPACE -#include "moc_qaudioinput_win32_p.cpp" - +#include "moc_qwindowsaudioinput.cpp" diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/plugins/windowsaudio/qwindowsaudioinput.h index a51d1bbe7..7498bca5d 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/plugins/windowsaudio/qwindowsaudioinput.h @@ -50,8 +50,8 @@ // We mean it. // -#ifndef QAUDIOINPUTWIN_H -#define QAUDIOINPUTWIN_H +#ifndef QWINDOWSAUDIOINPUT_H +#define QWINDOWSAUDIOINPUT_H #include <QtCore/qt_windows.h> #include <mmsystem.h> @@ -64,9 +64,9 @@ #include <QtCore/qdatetime.h> #include <QtCore/qmutex.h> -#include <qaudio.h> -#include <qaudiodeviceinfo.h> -#include <qaudiosystem.h> +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudiodeviceinfo.h> +#include <QtMultimedia/qaudiosystem.h> QT_BEGIN_NAMESPACE @@ -81,12 +81,12 @@ QT_BEGIN_NAMESPACE # endif #endif -class QAudioInputPrivate : public QAbstractAudioInput +class QWindowsAudioInput : public QAbstractAudioInput { Q_OBJECT public: - QAudioInputPrivate(const QByteArray &device); - ~QAudioInputPrivate(); + QWindowsAudioInput(const QByteArray &device); + ~QWindowsAudioInput(); qint64 read(char* data, qint64 len); @@ -163,7 +163,7 @@ class InputPrivate : public QIODevice { Q_OBJECT public: - InputPrivate(QAudioInputPrivate* audio); + InputPrivate(QWindowsAudioInput* audio); ~InputPrivate(); qint64 readData( char* data, qint64 len); @@ -171,10 +171,9 @@ public: void trigger(); private: - QAudioInputPrivate *audioDevice; + QWindowsAudioInput *audioDevice; }; QT_END_NAMESPACE - #endif diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp index 286cecba7..1c8882eeb 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp @@ -50,7 +50,7 @@ // INTERNAL USE ONLY: Do NOT use for any other purpose. // -#include "qaudiooutput_win32_p.h" +#include "qwindowsaudiooutput.h" #include <QtEndian> #ifndef SPEAKER_FRONT_LEFT @@ -104,7 +104,7 @@ QT_BEGIN_NAMESPACE -QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device) +QWindowsAudioOutput::QWindowsAudioOutput(const QByteArray &device) { bytesAvailable = 0; buffer_size = 0; @@ -121,7 +121,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device) volumeCache = (qreal)1.; } -QAudioOutputPrivate::~QAudioOutputPrivate() +QWindowsAudioOutput::~QWindowsAudioOutput() { mutex.lock(); finished = true; @@ -130,15 +130,15 @@ QAudioOutputPrivate::~QAudioOutputPrivate() close(); } -void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, +void CALLBACK QWindowsAudioOutput::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ) { Q_UNUSED(dwParam1) Q_UNUSED(dwParam2) Q_UNUSED(hWaveOut) - QAudioOutputPrivate* qAudio; - qAudio = (QAudioOutputPrivate*)(dwInstance); + QWindowsAudioOutput* qAudio; + qAudio = (QWindowsAudioOutput*)(dwInstance); if(!qAudio) return; @@ -153,7 +153,7 @@ void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, case WOM_DONE: if(qAudio->finished || qAudio->buffer_size == 0 || qAudio->period_size == 0) { return; - } + } qAudio->waveFreeBlockCount++; if(qAudio->waveFreeBlockCount >= qAudio->buffer_size/qAudio->period_size) qAudio->waveFreeBlockCount = qAudio->buffer_size/qAudio->period_size; @@ -164,7 +164,7 @@ void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, } } -WAVEHDR* QAudioOutputPrivate::allocateBlocks(int size, int count) +WAVEHDR* QWindowsAudioOutput::allocateBlocks(int size, int count) { int i; unsigned char* buffer; @@ -186,7 +186,7 @@ WAVEHDR* QAudioOutputPrivate::allocateBlocks(int size, int count) return blocks; } -void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray) +void QWindowsAudioOutput::freeBlocks(WAVEHDR* blockArray) { WAVEHDR* blocks = blockArray; @@ -199,18 +199,18 @@ void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray) HeapFree(GetProcessHeap(), 0, blockArray); } -QAudioFormat QAudioOutputPrivate::format() const +QAudioFormat QWindowsAudioOutput::format() const { return settings; } -void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt) +void QWindowsAudioOutput::setFormat(const QAudioFormat& fmt) { if (deviceState == QAudio::StoppedState) settings = fmt; } -void QAudioOutputPrivate::start(QIODevice* device) +void QWindowsAudioOutput::start(QIODevice* device) { if(deviceState != QAudio::StoppedState) close(); @@ -229,7 +229,7 @@ void QAudioOutputPrivate::start(QIODevice* device) emit stateChanged(deviceState); } -QIODevice* QAudioOutputPrivate::start() +QIODevice* QWindowsAudioOutput::start() { if(deviceState != QAudio::StoppedState) close(); @@ -251,7 +251,7 @@ QIODevice* QAudioOutputPrivate::start() return audioSource; } -void QAudioOutputPrivate::stop() +void QWindowsAudioOutput::stop() { if(deviceState == QAudio::StoppedState) return; @@ -263,7 +263,7 @@ void QAudioOutputPrivate::stop() emit stateChanged(deviceState); } -bool QAudioOutputPrivate::open() +bool QWindowsAudioOutput::open() { #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -394,7 +394,7 @@ bool QAudioOutputPrivate::open() return true; } -void QAudioOutputPrivate::close() +void QWindowsAudioOutput::close() { if(deviceState == QAudio::StoppedState) return; @@ -413,7 +413,7 @@ void QAudioOutputPrivate::close() buffer_size = 0; } -int QAudioOutputPrivate::bytesFree() const +int QWindowsAudioOutput::bytesFree() const { int buf; buf = waveFreeBlockCount*period_size; @@ -421,33 +421,33 @@ int QAudioOutputPrivate::bytesFree() const return buf; } -int QAudioOutputPrivate::periodSize() const +int QWindowsAudioOutput::periodSize() const { return period_size; } -void QAudioOutputPrivate::setBufferSize(int value) +void QWindowsAudioOutput::setBufferSize(int value) { if(deviceState == QAudio::StoppedState) buffer_size = value; } -int QAudioOutputPrivate::bufferSize() const +int QWindowsAudioOutput::bufferSize() const { return buffer_size; } -void QAudioOutputPrivate::setNotifyInterval(int ms) +void QWindowsAudioOutput::setNotifyInterval(int ms) { intervalTime = qMax(0, ms); } -int QAudioOutputPrivate::notifyInterval() const +int QWindowsAudioOutput::notifyInterval() const { return intervalTime; } -qint64 QAudioOutputPrivate::processedUSecs() const +qint64 QWindowsAudioOutput::processedUSecs() const { if (deviceState == QAudio::StoppedState) return 0; @@ -458,7 +458,7 @@ qint64 QAudioOutputPrivate::processedUSecs() const return result; } -qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) +qint64 QWindowsAudioOutput::write( const char *data, qint64 len ) { // Write out some audio data if (deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) @@ -539,7 +539,7 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) return (len-l); } -void QAudioOutputPrivate::resume() +void QWindowsAudioOutput::resume() { if(deviceState == QAudio::SuspendedState) { deviceState = QAudio::ActiveState; @@ -550,7 +550,7 @@ void QAudioOutputPrivate::resume() } } -void QAudioOutputPrivate::suspend() +void QWindowsAudioOutput::suspend() { if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState) { int delay = (buffer_size-bytesFree())*1000/(settings.sampleRate() @@ -563,7 +563,7 @@ void QAudioOutputPrivate::suspend() } } -void QAudioOutputPrivate::feedback() +void QWindowsAudioOutput::feedback() { #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -577,7 +577,7 @@ void QAudioOutputPrivate::feedback() } } -bool QAudioOutputPrivate::deviceReady() +bool QWindowsAudioOutput::deviceReady() { if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState) return false; @@ -590,28 +590,28 @@ bool QAudioOutputPrivate::deviceReady() #endif bool startup = false; if(totalTimeValue == 0) - startup = true; + startup = true; - bool full=false; + bool full=false; mutex.lock(); - if(waveFreeBlockCount==0) full = true; + if (waveFreeBlockCount==0) full = true; mutex.unlock(); - if (full){ + if (full) { #ifdef DEBUG_AUDIO qDebug() << "Skipping data as unable to write"; #endif - if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime ) { + if ((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); - elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; - timeStamp.restart(); - } - return true; - } + elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; + timeStamp.restart(); + } + return true; + } if(startup) - waveOutPause(hWaveOut); + waveOutPause(hWaveOut); int input = period_size*chunks; int l = audioSource->read(audioBuffer,input); if(l > 0) { @@ -626,8 +626,8 @@ bool QAudioOutputPrivate::deviceReady() // Didn't write all data audioSource->seek(audioSource->pos()-(l-out)); } - if(startup) - waveOutRestart(hWaveOut); + if (startup) + waveOutRestart(hWaveOut); } else if(l == 0) { bytesAvailable = bytesFree(); @@ -654,7 +654,7 @@ bool QAudioOutputPrivate::deviceReady() int buffered; mutex.lock(); - buffered = waveFreeBlockCount; + buffered = waveFreeBlockCount; mutex.unlock(); if (buffered >= buffer_size/period_size && deviceState == QAudio::ActiveState) { @@ -670,14 +670,14 @@ bool QAudioOutputPrivate::deviceReady() if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); - elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; + elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; timeStamp.restart(); } return true; } -qint64 QAudioOutputPrivate::elapsedUSecs() const +qint64 QWindowsAudioOutput::elapsedUSecs() const { if (deviceState == QAudio::StoppedState) return 0; @@ -685,17 +685,17 @@ qint64 QAudioOutputPrivate::elapsedUSecs() const return timeStampOpened.elapsed()*1000; } -QAudio::Error QAudioOutputPrivate::error() const +QAudio::Error QWindowsAudioOutput::error() const { return errorState; } -QAudio::State QAudioOutputPrivate::state() const +QAudio::State QWindowsAudioOutput::state() const { return deviceState; } -void QAudioOutputPrivate::setVolume(qreal v) +void QWindowsAudioOutput::setVolume(qreal v) { const qreal normalizedVolume = qBound(qreal(0.0), v, qreal(1.0)); if (deviceState != QAudio::ActiveState) { @@ -709,19 +709,19 @@ void QAudioOutputPrivate::setVolume(qreal v) volumeCache = normalizedVolume; } -qreal QAudioOutputPrivate::volume() const +qreal QWindowsAudioOutput::volume() const { return volumeCache; } -void QAudioOutputPrivate::reset() +void QWindowsAudioOutput::reset() { close(); } -OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio) +OutputPrivate::OutputPrivate(QWindowsAudioOutput* audio) { - audioDevice = qobject_cast<QAudioOutputPrivate*>(audio); + audioDevice = qobject_cast<QWindowsAudioOutput*>(audio); } OutputPrivate::~OutputPrivate() {} @@ -759,4 +759,4 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len) QT_END_NAMESPACE -#include "moc_qaudiooutput_win32_p.cpp" +#include "moc_qwindowsaudiooutput.cpp" diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/plugins/windowsaudio/qwindowsaudiooutput.h index cdff12821..77f23f701 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/plugins/windowsaudio/qwindowsaudiooutput.h @@ -50,8 +50,8 @@ // We mean it. // -#ifndef QAUDIOOUTPUTWIN_H -#define QAUDIOOUTPUTWIN_H +#ifndef QWINDOWSAUDIOOUTPUT_H +#define QWINDOWSAUDIOOUTPUT_H #include <QtCore/qt_windows.h> #include <mmsystem.h> @@ -63,9 +63,9 @@ #include <QtCore/qdatetime.h> #include <QtCore/qmutex.h> -#include <qaudio.h> -#include <qaudiodeviceinfo.h> -#include <qaudiosystem.h> +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudiodeviceinfo.h> +#include <QtMultimedia/qaudiosystem.h> // For compat with 4.6 #if !defined(QT_WIN_CALLBACK) @@ -78,13 +78,12 @@ QT_BEGIN_NAMESPACE - -class QAudioOutputPrivate : public QAbstractAudioOutput +class QWindowsAudioOutput : public QAbstractAudioOutput { Q_OBJECT public: - QAudioOutputPrivate(const QByteArray &device); - ~QAudioOutputPrivate(); + QWindowsAudioOutput(const QByteArray &device); + ~QWindowsAudioOutput(); qint64 write( const char *data, qint64 len ); @@ -156,17 +155,17 @@ class OutputPrivate : public QIODevice { Q_OBJECT public: - OutputPrivate(QAudioOutputPrivate* audio); + OutputPrivate(QWindowsAudioOutput* audio); ~OutputPrivate(); qint64 readData( char* data, qint64 len); qint64 writeData(const char* data, qint64 len); private: - QAudioOutputPrivate *audioDevice; + QWindowsAudioOutput *audioDevice; }; QT_END_NAMESPACE -#endif +#endif // QWINDOWSAUDIOOUTPUT_H diff --git a/src/plugins/windowsaudio/qwindowsaudioplugin.cpp b/src/plugins/windowsaudio/qwindowsaudioplugin.cpp new file mode 100644 index 000000000..79aabdbf9 --- /dev/null +++ b/src/plugins/windowsaudio/qwindowsaudioplugin.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsaudioplugin.h" +#include "qwindowsaudiodeviceinfo.h" +#include "qwindowsaudioinput.h" +#include "qwindowsaudiooutput.h" + +QT_BEGIN_NAMESPACE + +QWindowsAudioPlugin::QWindowsAudioPlugin(QObject *parent) + : QAudioSystemPlugin(parent) +{ +} + +QList<QByteArray> QWindowsAudioPlugin::availableDevices(QAudio::Mode mode) const +{ + return QWindowsAudioDeviceInfo::availableDevices(mode); +} + +QAbstractAudioInput *QWindowsAudioPlugin::createInput(const QByteArray &device) +{ + return new QWindowsAudioInput(device); +} + +QAbstractAudioOutput *QWindowsAudioPlugin::createOutput(const QByteArray &device) +{ + return new QWindowsAudioOutput(device); +} + +QAbstractAudioDeviceInfo *QWindowsAudioPlugin::createDeviceInfo(const QByteArray &device, QAudio::Mode mode) +{ + return new QWindowsAudioDeviceInfo(device, mode); +} + +QT_END_NAMESPACE diff --git a/src/plugins/windowsaudio/qwindowsaudioplugin.h b/src/plugins/windowsaudio/qwindowsaudioplugin.h new file mode 100644 index 000000000..3305f0553 --- /dev/null +++ b/src/plugins/windowsaudio/qwindowsaudioplugin.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSAUDIOPLUGIN_H +#define QWINDOWSAUDIOPLUGIN_H + +#include <QtMultimedia/qaudiosystemplugin.h> + +QT_BEGIN_NAMESPACE + +class QWindowsAudioPlugin : public QAudioSystemPlugin +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID "org.qt-project.qt.audiosystemfactory/5.0" FILE "windowsaudio.json") + +public: + QWindowsAudioPlugin(QObject *parent = 0); + ~QWindowsAudioPlugin() {} + + QList<QByteArray> availableDevices(QAudio::Mode mode) const Q_DECL_OVERRIDE; + QAbstractAudioInput *createInput(const QByteArray &device) Q_DECL_OVERRIDE; + QAbstractAudioOutput *createOutput(const QByteArray &device) Q_DECL_OVERRIDE; + QAbstractAudioDeviceInfo *createDeviceInfo(const QByteArray &device, QAudio::Mode mode) Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSAUDIOPLUGIN_H diff --git a/src/plugins/windowsaudio/windowsaudio.json b/src/plugins/windowsaudio/windowsaudio.json new file mode 100644 index 000000000..a31d52107 --- /dev/null +++ b/src/plugins/windowsaudio/windowsaudio.json @@ -0,0 +1,3 @@ +{ + "Keys": ["default"] +} diff --git a/src/plugins/windowsaudio/windowsaudio.pro b/src/plugins/windowsaudio/windowsaudio.pro new file mode 100644 index 000000000..a1a327953 --- /dev/null +++ b/src/plugins/windowsaudio/windowsaudio.pro @@ -0,0 +1,23 @@ +TARGET = qtaudio_windows +QT += multimedia-private + +PLUGIN_TYPE = audio +PLUGIN_CLASS_NAME = QWindowsAudioPlugin +load(qt_plugin) + +LIBS += -lwinmm -lstrmiids -lole32 -loleaut32 + +HEADERS += \ + qwindowsaudioplugin.h \ + qwindowsaudiodeviceinfo.h \ + qwindowsaudioinput.h \ + qwindowsaudiooutput.h + +SOURCES += \ + qwindowsaudioplugin.cpp \ + qwindowsaudiodeviceinfo.cpp \ + qwindowsaudioinput.cpp \ + qwindowsaudiooutput.cpp + +OTHER_FILES += \ + windowsaudio.json diff --git a/src/plugins/wmf/decoder/mfdecoderservice.cpp b/src/plugins/wmf/decoder/mfdecoderservice.cpp index 9a06eed81..7e9175d7a 100644 --- a/src/plugins/wmf/decoder/mfdecoderservice.cpp +++ b/src/plugins/wmf/decoder/mfdecoderservice.cpp @@ -64,4 +64,4 @@ void MFAudioDecoderService::releaseControl(QMediaControl *control) if (control && control->inherits("MFAudioDecoderControl")) { delete control; } -}
\ No newline at end of file +} diff --git a/src/plugins/wmf/decoder/mfdecodersourcereader.cpp b/src/plugins/wmf/decoder/mfdecodersourcereader.cpp index 0aa2cafb8..c26e3518f 100644 --- a/src/plugins/wmf/decoder/mfdecodersourcereader.cpp +++ b/src/plugins/wmf/decoder/mfdecodersourcereader.cpp @@ -196,4 +196,4 @@ STDMETHODIMP MFDecoderSourceReader::OnFlush(DWORD) STDMETHODIMP MFDecoderSourceReader::OnEvent(DWORD, IMFMediaEvent*) { return S_OK; -}
\ No newline at end of file +} diff --git a/src/plugins/wmf/player/mfplayercontrol.cpp b/src/plugins/wmf/player/mfplayercontrol.cpp index 68ffa7b6f..a50c213c4 100644 --- a/src/plugins/wmf/player/mfplayercontrol.cpp +++ b/src/plugins/wmf/player/mfplayercontrol.cpp @@ -58,7 +58,7 @@ MFPlayerControl::MFPlayerControl(MFPlayerSession *session) QObject::connect(m_session, SIGNAL(audioAvailable()), this, SLOT(handleAudioAvailable())); QObject::connect(m_session, SIGNAL(durationUpdate(qint64)), this, SLOT(handleDurationUpdate(qint64))); QObject::connect(m_session, SIGNAL(seekableUpdate(bool)), this, SLOT(handleSeekableUpdate(bool))); - QObject::connect(m_session, SIGNAL(error(QMediaPlayer::Error, QString, bool)), this, SLOT(handleError(QMediaPlayer::Error, QString, bool))); + QObject::connect(m_session, SIGNAL(error(QMediaPlayer::Error,QString,bool)), this, SLOT(handleError(QMediaPlayer::Error,QString,bool))); QObject::connect(m_session, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged(qint64))); QObject::connect(m_session, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int))); QObject::connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp index 04b46ec0d..183f0231d 100644 --- a/src/plugins/wmf/player/mfplayersession.cpp +++ b/src/plugins/wmf/player/mfplayersession.cpp @@ -93,7 +93,7 @@ MFPlayerSession::MFPlayerSession(MFPlayerService *playerService) , m_audioSampleGrabberNode(0) , m_videoProbeMFT(0) { - QObject::connect(this, SIGNAL(sessionEvent(IMFMediaEvent *)), this, SLOT(handleSessionEvent(IMFMediaEvent *))); + QObject::connect(this, SIGNAL(sessionEvent(IMFMediaEvent*)), this, SLOT(handleSessionEvent(IMFMediaEvent*))); m_pendingState = NoPending; ZeroMemory(&m_state, sizeof(m_state)); diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp index 321fd5e81..a04b38ceb 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp @@ -247,7 +247,10 @@ bool QDeclarativeVideoOutput::createBackend(QMediaService *service) if (!backendAvailable) { qWarning() << Q_FUNC_INFO << "Media service has neither renderer nor window control available."; m_backend.reset(); + } else if (!m_geometryDirty) { + m_backend->updateGeometry(); } + return backendAvailable; } |