Merge remote-tracking branch 'origin/dev' into stable
Change-Id: I84b36fa41f3d5f8fea2dec2545f72ebe6a0c7908
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
load(qt_build_config)
|
||||
CONFIG += qt_example_installs
|
||||
|
||||
MODULE_VERSION = 5.2.2
|
||||
MODULE_VERSION = 5.3.0
|
||||
|
||||
@@ -8,7 +8,7 @@ win32:INCLUDEPATH += $$PWD
|
||||
HEADERS = \
|
||||
audiorecorder.h \
|
||||
qaudiolevel.h
|
||||
|
||||
|
||||
SOURCES = \
|
||||
main.cpp \
|
||||
audiorecorder.cpp \
|
||||
|
||||
@@ -301,7 +301,7 @@ void Camera::updateLockStatus(QCamera::LockStatus status, QCamera::LockChangeRea
|
||||
ui->lockButton->setText(tr("Focusing..."));
|
||||
break;
|
||||
case QCamera::Locked:
|
||||
indicationColor = Qt::darkGreen;
|
||||
indicationColor = Qt::darkGreen;
|
||||
ui->lockButton->setText(tr("Unlock"));
|
||||
ui->statusbar->showMessage(tr("Focused"), 2000);
|
||||
break;
|
||||
@@ -352,7 +352,7 @@ void Camera::updateCaptureMode()
|
||||
|
||||
void Camera::updateCameraState(QCamera::State state)
|
||||
{
|
||||
switch (state) {
|
||||
switch (state) {
|
||||
case QCamera::ActiveState:
|
||||
ui->actionStartCamera->setEnabled(false);
|
||||
ui->actionStopCamera->setEnabled(true);
|
||||
|
||||
@@ -71,24 +71,24 @@
|
||||
slider) or the QVideoWidget object will update the other object.
|
||||
|
||||
\code
|
||||
connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
SLOT(setBrightness(int)));
|
||||
connect(videoWidget, SIGNAL(brightnessChanged(int)),
|
||||
connect(videoWidget, SIGNAL(brightnessChanged(int)),
|
||||
brightnessSlider, SLOT(setValue(int)));
|
||||
|
||||
connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
SLOT(setContrast(int)));
|
||||
connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider,
|
||||
connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider,
|
||||
SLOT(setValue(int)));
|
||||
|
||||
connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
SLOT(setHue(int)));
|
||||
connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider,
|
||||
connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider,
|
||||
SLOT(setValue(int)));
|
||||
|
||||
connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget,
|
||||
SLOT(setSaturation(int)));
|
||||
connect(videoWidget, SIGNAL(saturationChanged(int)),
|
||||
connect(videoWidget, SIGNAL(saturationChanged(int)),
|
||||
saturationSlider, SLOT(setValue(int)));
|
||||
\endcode
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ Player::Player(QWidget *parent)
|
||||
|
||||
labelDuration = new QLabel(this);
|
||||
connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int)));
|
||||
|
||||
|
||||
labelHistogram = new QLabel(this);
|
||||
labelHistogram->setText("Histogram:");
|
||||
histogram = new HistogramWidget(this);
|
||||
|
||||
@@ -49,6 +49,6 @@ int main(int argc, char **argv)
|
||||
VideoPlayer player;
|
||||
player.show();
|
||||
|
||||
return app.exec();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
int card = -1;
|
||||
|
||||
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");
|
||||
while (snd_card_next(&card) == 0 && card >= 0) {
|
||||
if (snd_device_name_hint(card, "pcm", &hints) < 0)
|
||||
continue;
|
||||
|
||||
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));
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent)
|
||||
, m_videoSink(0)
|
||||
, m_widget(0)
|
||||
, m_fullScreen(false)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
|
||||
|
||||
@@ -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)));
|
||||
|
||||
|
||||
@@ -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)));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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)),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
int bufferStatus() const;
|
||||
|
||||
bool isSeekable() const;
|
||||
qreal playbackRate() const;
|
||||
qreal playbackRate() const;
|
||||
|
||||
Error error() const;
|
||||
QString errorString() const;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
QVideoWidgetPrivate()
|
||||
: q_ptr(0)
|
||||
, mediaObject(0)
|
||||
, service(0)
|
||||
, service(0)
|
||||
, widgetBackend(0)
|
||||
, windowBackend(0)
|
||||
, rendererBackend(0)
|
||||
|
||||
3
src/plugins/alsa/alsa.json
Normal file
3
src/plugins/alsa/alsa.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Keys": ["alsa"]
|
||||
}
|
||||
23
src/plugins/alsa/alsa.pro
Normal file
23
src/plugins/alsa/alsa.pro
Normal file
@@ -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
|
||||
@@ -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");
|
||||
while (snd_card_next(&card) == 0 && card >= 0) {
|
||||
if (snd_device_name_hint(card, "pcm", &hints) < 0)
|
||||
continue;
|
||||
|
||||
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());
|
||||
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
|
||||
@@ -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
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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"
|
||||
@@ -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
|
||||
74
src/plugins/alsa/qalsaplugin.cpp
Normal file
74
src/plugins/alsa/qalsaplugin.cpp
Normal file
@@ -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
|
||||
67
src/plugins/alsa/qalsaplugin.h
Normal file
67
src/plugins/alsa/qalsaplugin.h
Normal file
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -259,7 +259,7 @@ HRESULT DirectShowIOReader::SyncReadAligned(IMediaSample *pSample)
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
pSample->SetActualDataLength(bytesRead);
|
||||
|
||||
|
||||
return hr;
|
||||
} else {
|
||||
m_synchronousPosition = position;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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} };
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
bool isFlashReady() const;
|
||||
|
||||
private:
|
||||
CameraBinSession *m_session;
|
||||
CameraBinSession *m_session;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -51,7 +51,7 @@ QT_USE_NAMESPACE
|
||||
|
||||
QT7PlayerControl::QT7PlayerControl(QObject *parent)
|
||||
: QMediaPlayerControl(parent)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
QT7PlayerControl::~QT7PlayerControl()
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent *);
|
||||
|
||||
|
||||
private:
|
||||
CVDisplayLinkRef m_displayLink;
|
||||
QMutex m_displayLinkMutex;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
int saturation() const;
|
||||
void setSaturation(int saturation);
|
||||
|
||||
|
||||
private:
|
||||
void setupVideoOutput();
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent)
|
||||
m_contrast(0),
|
||||
m_hue(0),
|
||||
m_saturation(0)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
QT7MovieViewOutput::~QT7MovieViewOutput()
|
||||
|
||||
@@ -278,7 +278,7 @@ QT7MovieViewRenderer::QT7MovieViewRenderer(QObject *parent)
|
||||
m_fbo(0),
|
||||
m_ciContext(0),
|
||||
m_pendingRenderEvent(false)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
QT7MovieViewRenderer::~QT7MovieViewRenderer()
|
||||
|
||||
@@ -47,10 +47,10 @@ QT_USE_NAMESPACE
|
||||
|
||||
/*
|
||||
QT7VideoOutputControl::QT7VideoOutputControl(QObject *parent)
|
||||
:QVideoOutputControl(parent),
|
||||
:QVideoOutputControl(parent),
|
||||
m_session(0),
|
||||
m_output(QVideoOutputControl::NoOutput)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
QT7VideoOutputControl::~QT7VideoOutputControl()
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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);
|
||||
@@ -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
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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"
|
||||
@@ -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
|
||||
74
src/plugins/windowsaudio/qwindowsaudioplugin.cpp
Normal file
74
src/plugins/windowsaudio/qwindowsaudioplugin.cpp
Normal file
@@ -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
|
||||
67
src/plugins/windowsaudio/qwindowsaudioplugin.h
Normal file
67
src/plugins/windowsaudio/qwindowsaudioplugin.h
Normal file
@@ -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
|
||||
3
src/plugins/windowsaudio/windowsaudio.json
Normal file
3
src/plugins/windowsaudio/windowsaudio.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Keys": ["default"]
|
||||
}
|
||||
23
src/plugins/windowsaudio/windowsaudio.pro
Normal file
23
src/plugins/windowsaudio/windowsaudio.pro
Normal file
@@ -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
|
||||
@@ -64,4 +64,4 @@ void MFAudioDecoderService::releaseControl(QMediaControl *control)
|
||||
if (control && control->inherits("MFAudioDecoderControl")) {
|
||||
delete control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,4 +196,4 @@ STDMETHODIMP MFDecoderSourceReader::OnFlush(DWORD)
|
||||
STDMETHODIMP MFDecoderSourceReader::OnEvent(DWORD, IMFMediaEvent*)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -694,16 +694,14 @@ void tst_QDeclarativeVideoOutput::contentRect_data()
|
||||
QRectF tst_QDeclarativeVideoOutput::invokeR2R(QObject *object, const char *signature, const QRectF &rect)
|
||||
{
|
||||
QRectF r;
|
||||
const QMetaObject *meta = object->metaObject();
|
||||
meta->invokeMethod(object, signature, Q_RETURN_ARG(QRectF, r), Q_ARG(QRectF, rect));
|
||||
QMetaObject::invokeMethod(object, signature, Q_RETURN_ARG(QRectF, r), Q_ARG(QRectF, rect));
|
||||
return r;
|
||||
}
|
||||
|
||||
QPointF tst_QDeclarativeVideoOutput::invokeP2P(QObject *object, const char *signature, const QPointF &point)
|
||||
{
|
||||
QPointF p;
|
||||
const QMetaObject *meta = object->metaObject();
|
||||
meta->invokeMethod(object, signature, Q_RETURN_ARG(QPointF, p), Q_ARG(QPointF, point));
|
||||
QMetaObject::invokeMethod(object, signature, Q_RETURN_ARG(QPointF, p), Q_ARG(QPointF, point));
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -630,8 +630,9 @@ void tst_QMediaPlayerBackend::seekPauseSeek()
|
||||
QVERIFY(surface->m_frameList.isEmpty()); // frame must not appear until we call pause() or play()
|
||||
|
||||
positionSpy.clear();
|
||||
player.setPosition((qint64)7000);
|
||||
QTRY_VERIFY(!positionSpy.isEmpty() && qAbs(player.position() - (qint64)7000) < (qint64)500);
|
||||
qint64 position = 7000;
|
||||
player.setPosition(position);
|
||||
QTRY_VERIFY(!positionSpy.isEmpty() && qAbs(player.position() - position) < (qint64)500);
|
||||
QCOMPARE(player.state(), QMediaPlayer::StoppedState);
|
||||
QTest::qWait(250); // wait a bit to ensure the frame is not rendered
|
||||
QVERIFY(surface->m_frameList.isEmpty()); // still no frame, we must call pause() or play() to see a frame
|
||||
@@ -642,7 +643,8 @@ void tst_QMediaPlayerBackend::seekPauseSeek()
|
||||
|
||||
{
|
||||
QVideoFrame frame = surface->m_frameList.back();
|
||||
QVERIFY(qAbs(frame.startTime() - (qint64)7000) < (qint64)500);
|
||||
const qint64 elapsed = frame.startTime() - position;
|
||||
QVERIFY2(qAbs(elapsed) < (qint64)500, QByteArray::number(elapsed).constData());
|
||||
QCOMPARE(frame.width(), 160);
|
||||
QCOMPARE(frame.height(), 120);
|
||||
|
||||
@@ -657,14 +659,16 @@ void tst_QMediaPlayerBackend::seekPauseSeek()
|
||||
}
|
||||
|
||||
positionSpy.clear();
|
||||
player.setPosition((qint64)12000);
|
||||
QTRY_VERIFY(!positionSpy.isEmpty() && qAbs(player.position() - (qint64)12000) < (qint64)500);
|
||||
position = 12000;
|
||||
player.setPosition(position);
|
||||
QTRY_VERIFY(!positionSpy.isEmpty() && qAbs(player.position() - position) < (qint64)500);
|
||||
QCOMPARE(player.state(), QMediaPlayer::PausedState);
|
||||
QCOMPARE(surface->m_frameList.size(), 2);
|
||||
|
||||
{
|
||||
QVideoFrame frame = surface->m_frameList.back();
|
||||
QVERIFY(qAbs(frame.startTime() - (qint64)12000) < (qint64)500);
|
||||
const qint64 elapsed = frame.startTime() - position;
|
||||
QVERIFY2(qAbs(elapsed) < (qint64)500, QByteArray::number(elapsed).constData());
|
||||
QCOMPARE(frame.width(), 160);
|
||||
QCOMPARE(frame.height(), 120);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ tst_QAudioBuffer::tst_QAudioBuffer()
|
||||
mFormat.setSampleRate(10000);
|
||||
mFormat.setCodec("audio/pcm");
|
||||
|
||||
QByteArray b(4000, 0x80);
|
||||
QByteArray b(4000, char(0x80));
|
||||
mNull = new QAudioBuffer;
|
||||
mEmpty = new QAudioBuffer(500, mFormat); // 500 stereo frames of 16 bits -> 2KB
|
||||
mFromArray = new QAudioBuffer(b, mFormat);
|
||||
|
||||
@@ -274,7 +274,7 @@ void tst_QCamera::testSimpleCameraExposure()
|
||||
cameraExposure->setAutoShutterSpeed();
|
||||
QVERIFY(cameraExposure->shutterSpeed() < 0);
|
||||
cameraExposure->setManualShutterSpeed(1/128.0);
|
||||
QVERIFY(cameraExposure->shutterSpeed() < 0);
|
||||
QVERIFY(cameraExposure->shutterSpeed() < 0);
|
||||
}
|
||||
|
||||
void tst_QCamera::testSimpleCameraFocus()
|
||||
@@ -292,7 +292,7 @@ void tst_QCamera::testSimpleCameraFocus()
|
||||
QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
|
||||
QTest::ignoreMessage(QtWarningMsg, "Focus mode selection is not supported");
|
||||
cameraFocus->setFocusMode(QCameraFocus::ContinuousFocus);
|
||||
QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
|
||||
QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
|
||||
|
||||
QCOMPARE(cameraFocus->maximumOpticalZoom(), 1.0);
|
||||
QCOMPARE(cameraFocus->maximumDigitalZoom(), 1.0);
|
||||
@@ -459,7 +459,7 @@ void tst_QCamera::testCameraCapture()
|
||||
|
||||
QVERIFY(!imageCapture.isReadyForCapture());
|
||||
|
||||
QSignalSpy capturedSignal(&imageCapture, SIGNAL(imageCaptured(int,QImage)));
|
||||
QSignalSpy capturedSignal(&imageCapture, SIGNAL(imageCaptured(int,QImage)));
|
||||
QSignalSpy errorSignal(&imageCapture, SIGNAL(error(int, QCameraImageCapture::Error,QString)));
|
||||
|
||||
imageCapture.capture(QString::fromLatin1("/dev/null"));
|
||||
@@ -504,7 +504,8 @@ void tst_QCamera::testCameraCaptureMetadata()
|
||||
QCOMPARE(metadata[0].toInt(), id);
|
||||
QCOMPARE(metadata[1].toString(), QMediaMetaData::DateTimeOriginal);
|
||||
QDateTime captureTime = metadata[2].value<QVariant>().value<QDateTime>();
|
||||
QVERIFY(qAbs(captureTime.secsTo(QDateTime::currentDateTime()) < 5)); //it should not takes more than 5 seconds for signal to arrive here
|
||||
const qint64 dt = captureTime.secsTo(QDateTime::currentDateTime());
|
||||
QVERIFY2(qAbs(dt) < 5, QByteArray::number(dt).constData()); // it should not take more than 5 seconds for signal to arrive here
|
||||
|
||||
metadata = metadataSignal[2];
|
||||
QCOMPARE(metadata[0].toInt(), id);
|
||||
|
||||
@@ -271,7 +271,7 @@ void tst_QGraphicsVideoItem::serviceDestroyed()
|
||||
object.testService = 0;
|
||||
|
||||
delete service;
|
||||
|
||||
|
||||
QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(&object));
|
||||
QVERIFY(item.boundingRect().isEmpty());
|
||||
}
|
||||
@@ -330,7 +330,7 @@ void tst_QGraphicsVideoItem::setMediaObject()
|
||||
}
|
||||
|
||||
void tst_QGraphicsVideoItem::show()
|
||||
{
|
||||
{
|
||||
QtTestVideoObject object(new QtTestRendererControl);
|
||||
QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
|
||||
object.bind(item);
|
||||
@@ -630,7 +630,7 @@ void tst_QGraphicsVideoItem::paint()
|
||||
QtTestVideoObject object(new QtTestRendererControl);
|
||||
QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
|
||||
object.bind(item);
|
||||
|
||||
|
||||
QGraphicsScene graphicsScene;
|
||||
graphicsScene.addItem(item);
|
||||
QGraphicsView graphicsView(&graphicsScene);
|
||||
|
||||
@@ -560,7 +560,7 @@ void tst_QMediaPlaylist::readOnlyPlaylist()
|
||||
buffer.seek(0);
|
||||
|
||||
QSignalSpy errorSignal(&playlist, SIGNAL(loadFailed()));
|
||||
playlist.load(&buffer, "m3u");
|
||||
playlist.load(&buffer, "m3u");
|
||||
QCOMPARE(errorSignal.size(), 1);
|
||||
QCOMPARE(playlist.error(), QMediaPlaylist::AccessDeniedError);
|
||||
QVERIFY(!playlist.errorString().isEmpty());
|
||||
|
||||
@@ -96,7 +96,7 @@ void tst_QMediaServiceProvider::initTestCase()
|
||||
|
||||
void tst_QMediaServiceProvider::testDefaultProviderAvailable()
|
||||
{
|
||||
// Must always be a default provider available
|
||||
// Must always be a default provider available
|
||||
QVERIFY(QMediaServiceProvider::defaultServiceProvider() != 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ void tst_QMediaTimeRange::testEarliestLatest()
|
||||
}
|
||||
|
||||
void tst_QMediaTimeRange::testContains()
|
||||
{
|
||||
{
|
||||
// Test over a single interval
|
||||
QMediaTimeRange x(10, 20);
|
||||
|
||||
@@ -282,7 +282,7 @@ void tst_QMediaTimeRange::testContains()
|
||||
|
||||
// Test over multiple intervals
|
||||
x.addInterval(40, 50);
|
||||
|
||||
|
||||
QVERIFY(!x.isEmpty());
|
||||
QVERIFY(!x.isContinuous());
|
||||
QVERIFY(x.contains(15));
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
{
|
||||
glGenTextures(1, &m_textureId);
|
||||
}
|
||||
|
||||
|
||||
~QtTestGLVideoBuffer()
|
||||
{
|
||||
glDeleteTextures(1, &m_textureId);
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
uchar *map(MapMode, int *, int *) { return 0; }
|
||||
void unmap() {}
|
||||
MapMode mapMode() const { return NotMapped; }
|
||||
MapMode mapMode() const { return NotMapped; }
|
||||
|
||||
private:
|
||||
GLuint m_textureId;
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
|
||||
uchar *map(MapMode, int *, int *) { return 0; }
|
||||
void unmap() {}
|
||||
MapMode mapMode() const { return NotMapped; }
|
||||
MapMode mapMode() const { return NotMapped; }
|
||||
};
|
||||
|
||||
void tst_QPainterVideoSurface::colors()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user