1 /* 2 * Strawberry Music Player 3 * This file was part of Clementine. 4 * Copyright 2014, David Sansome <me@davidsansome.com> 5 * 6 * Strawberry is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Strawberry is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Strawberry. If not, see <http://www.gnu.org/licenses/>. 18 * 19 */ 20 21 #ifndef PULSEDEVICEFINDER_H 22 #define PULSEDEVICEFINDER_H 23 24 #include "config.h" 25 26 #include <pulse/context.h> 27 #include <pulse/introspect.h> 28 #include <pulse/mainloop.h> 29 30 #include <QList> 31 32 #include "devicefinder.h" 33 34 class PulseDeviceFinder : public DeviceFinder { 35 public: 36 explicit PulseDeviceFinder(); 37 ~PulseDeviceFinder() override; 38 39 bool Initialize() override; 40 QList<Device> ListDevices() override; 41 42 private: 43 struct ListDevicesState { ListDevicesStateListDevicesState44 ListDevicesState() : finished(false) {} 45 46 bool finished; 47 QList<Device> devices; 48 }; 49 50 bool Reconnect(); 51 52 static void GetSinkInfoCallback(pa_context *c, const pa_sink_info *info, int eol, void *state_voidptr); 53 54 pa_mainloop *mainloop_; 55 pa_context *context_; 56 57 Q_DISABLE_COPY(PulseDeviceFinder) 58 }; 59 60 #endif // PULSEDEVICEFINDER_H 61