#ifndef A83739DB_6BC9_4B7C_8FA0_11DC60C05AA3 #define A83739DB_6BC9_4B7C_8FA0_11DC60C05AA3 /* ******************************************************************************* * INCLUDE ******************************************************************************* */ #include #include #include #include namespace Video { namespace ALSA { /* ******************************************************************************* * CLASS DECLARE ******************************************************************************* */ class SoundCard { public: struct Info { std::string id; std::string device; std::string name; std::string longname; std::string driver; std::string components; std::string mixername; bool access[SND_PCM_ACCESS_LAST + 1]; std::vector formats; int channels; std::vector sampleRates; std::vector bufferSizes; bool supportCapture; bool supportPlayback; bool operator==(const Info& other) { return components == other.components; } }; using Ptr = Poco::SharedPtr; using SoundCards = std::vector; private: SoundCard(int index); void initialize(); public: ~SoundCard(); Info& info(); private: int _index; Info _info; public: static SoundCards getSoundCards(); template static SoundCards getSoundCards(F&& filter); }; template inline SoundCard::SoundCards SoundCard::getSoundCards(F&& filter) { SoundCard::SoundCards cards; for (auto& card : ALSA::SoundCard::getSoundCards()) { if (filter(card)) cards.push_back(card); } return cards; } } } #endif