[WASAPI] set stream audio category
[xbmc.git] / xbmc / cores / AudioEngine / Sinks / alsa / ALSAHControlMonitor.h
blob165f3758085df9f1d2c072416e5da988d6b4e71a
1 /*
2 * Copyright (C) 2014-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "platform/Platform.h"
13 #include <map>
14 #include <string>
15 #include <vector>
17 #include <alsa/asoundlib.h>
19 class CALSAHControlMonitor : public IPlatformService
21 public:
22 CALSAHControlMonitor();
23 ~CALSAHControlMonitor();
25 bool Add(const std::string& ctlHandleName,
26 snd_ctl_elem_iface_t interface,
27 unsigned int device,
28 const std::string& name);
30 void Clear();
32 void Start();
33 void Stop();
35 private:
36 static int HCTLCallback(snd_hctl_elem_t *elem, unsigned int mask);
37 static void FDEventCallback(int id, int fd, short revents, void *data);
39 snd_hctl_t* GetHandle(const std::string& ctlHandleName);
40 void PutHandle(const std::string& ctlHandleName);
42 struct CTLHandle
44 snd_hctl_t *handle;
45 int useCount = 0;
47 explicit CTLHandle(snd_hctl_t *handle_) : handle(handle_) {}
48 CTLHandle() : handle(NULL) {}
51 std::map<std::string, CTLHandle> m_ctlHandles;
53 std::vector<int> m_fdMonitorIds;