3 * Copyright (C) 2010-2013 Team XBMC
6 * This Program 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 2, or (at your option)
11 * This Program 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.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
24 #include "cores/AudioEngine/Interfaces/AESink.h"
25 #include "Utils/AEDeviceInfo.h"
26 #include "Utils/AEUtil.h"
27 #include <pulse/pulseaudio.h>
29 class CAESinkPULSE : public IAESink
32 virtual const char *GetName() { return "PULSE"; }
35 virtual ~CAESinkPULSE();
37 virtual bool Initialize(AEAudioFormat &format, std::string &device);
38 virtual void Deinitialize();
40 virtual double GetDelay ();
41 virtual double GetCacheTotal ();
42 virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false);
43 virtual void Drain ();
45 virtual bool HasVolume() { return true; };
46 virtual void SetVolume(float volume);
48 static void EnumerateDevicesEx(AEDeviceInfoList &list, bool force = false);
50 bool Pause(bool pause);
51 static inline bool WaitForOperation(pa_operation *op, pa_threaded_mainloop *mainloop, const char *LogEntry);
52 static bool SetupContext(const char *host, pa_context **context, pa_threaded_mainloop **mainloop);
57 AEAudioFormat m_format;
58 unsigned int m_BytesPerSecond;
59 unsigned int m_BufferSize;
60 unsigned int m_Channels;
65 pa_context *m_Context;
66 pa_threaded_mainloop *m_MainLoop;