Showing the changes to plugins/pcmCodec/src/PCMCodecProvider.cpp (1 of 12 files). Show all
Unified · Split
| @@ -0,0 +1,44 @@ | ||
| 1 | +// | |
| 2 | +// Created by Brad Hefta-Gaub on 6/9/2016 | |
| 3 | +// Copyright 2016 High Fidelity, Inc. | |
| 4 | +// | |
| 5 | +// Distributed under the Apache License, Version 2.0. | |
| 6 | +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
| 7 | +// | |
| 8 | + | |
| 9 | +#include <mutex> | |
| 10 | + | |
| 11 | +#include <QtCore/QObject> | |
| 12 | +#include <QtCore/QtPlugin> | |
| 13 | +#include <QtCore/QStringList> | |
| 14 | + | |
| 15 | +#include <plugins/RuntimePlugin.h> | |
| 16 | +#include <plugins/CodecPlugin.h> | |
| 17 | + | |
| 18 | +#include "PCMCodecManager.h" | |
| 19 | + | |
| 20 | +class PCMCodecProvider : public QObject, public CodecProvider { | |
| 21 | + Q_OBJECT | |
| 22 | + Q_PLUGIN_METADATA(IID CodecProvider_iid FILE "plugin.json") | |
| 23 | + Q_INTERFACES(CodecProvider) | |
| 24 | + | |
| 25 | +public: | |
| 26 | + PCMCodecProvider(QObject* parent = nullptr) : QObject(parent) {} | |
| 27 | + virtual ~PCMCodecProvider() {} | |
| 28 | + | |
| 29 | + virtual CodecPluginList getCodecPlugins() override { | |
| 30 | + static std::once_flag once; | |
| 31 | + std::call_once(once, [&] { | |
| 32 | + CodecPluginPointer plugin(new PCMCodecManager()); | |
| 33 | + if (plugin->isSupported()) { | |
| 34 | + _codecPlugins.push_back(plugin); | |
| 35 | + } | |
| 36 | + }); | |
| 37 | + return _codecPlugins; | |
| 38 | + } | |
| 39 | + | |
| 40 | +private: | |
| 41 | + CodecPluginList _codecPlugins; | |
| 42 | +}; | |
| 43 | + | |
| 44 | +#include "PCMCodecProvider.moc" | |