Exemplo n.º 1
0
QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format)
{
    if (deviceInfo.isNull())
        return new QNullInputDevice();
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
    if (deviceInfo.realm() == QLatin1String("builtin"))
        return new QAudioInputPrivate(deviceInfo.handle(), format);
#endif
    QAudioEngineFactoryInterface* plugin =
        qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));

    if (plugin)
        return plugin->createInput(deviceInfo.handle(), format);

    return new QNullInputDevice();
}
QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format)
{
    if (deviceInfo.isNull())
        return new QNullInputDevice();
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
    if (deviceInfo.realm() == QLatin1String("builtin"))
        return new QAudioInputPrivate(deviceInfo.handle(), format);
#endif
#endif
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
    QAudioEngineFactoryInterface* plugin =
        qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));

    if (plugin)
        return plugin->createInput(deviceInfo.handle(), format);
#endif
    return new QNullInputDevice();
}