MythTV master
audiooutputpulse.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008 Alan Calvert
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 */
19
20#ifndef AUDIOOUTPUTPULSE
21#define AUDIOOUTPUTPULSE
22
23#include <pulse/pulseaudio.h>
24
25#include "audiooutputbase.h"
26
28{
29 public:
30 explicit AudioOutputPulseAudio(const AudioSettings &settings);
31 ~AudioOutputPulseAudio() override;
32
33 int GetVolumeChannel(int channel) const override; // VolumeBase
34 void SetVolumeChannel(int channel, int volume) override; // VolumeBase
35 void Drain(void) override; // AudioOutputBase
36
37 protected:
38 AudioOutputSettings* GetOutputSettings(bool digital) override; // AudioOutputBase
39 bool OpenDevice(void) override; // AudioOutputBase
40 void CloseDevice(void) override; // AudioOutputBase
41 void WriteAudio(unsigned char *aubuf, int size) override; // AudioOutputBase
42 int GetBufferedOnSoundcard(void) const override; // AudioOutputBase
43
44 private:
45 QString ChooseHost(void);
46 bool MapChannels(void);
47 bool ContextConnect(void);
48 bool ConnectPlaybackStream(void);
49 void FlushStream(const char *caller);
50
51 static void ContextDrainCallback(pa_context *c, void *arg);
52 static void ContextStateCallback(pa_context *c, void *arg);
53 static void StreamStateCallback(pa_stream *s, void *arg);
54 static void OpCompletionCallback(pa_context *c, int ok, void *arg);
55 static void WriteCallback(pa_stream *s, size_t size, void *arg);
56 static void BufferFlowCallback(pa_stream *s, void *tag);
57 static void ServerInfoCallback(pa_context *context,
58 const pa_server_info *inf, void *arg);
59 static void SinkInfoCallback(pa_context *c, const pa_sink_info *info,
60 int eol, void *arg);
61
62 pa_proplist *m_ctproplist {nullptr};
63 pa_proplist *m_stproplist {nullptr};
64 pa_context *m_pcontext {nullptr};
65 pa_stream *m_pstream {nullptr};
66 pa_threaded_mainloop *m_mainloop {nullptr};
67 pa_sample_spec m_sampleSpec {};
68 pa_channel_map m_channelMap {};
69 pa_cvolume m_volumeControl {};
70 pa_buffer_attr m_bufferSettings {};
72};
73#endif
74
75/* vim: set expandtab tabstop=4 shiftwidth=4: */
int GetBufferedOnSoundcard(void) const override
Return the size in bytes of frames currently in the audio buffer adjusted with the audio playback lat...
void SetVolumeChannel(int channel, int volume) override
void WriteAudio(unsigned char *aubuf, int size) override
pa_proplist * m_ctproplist
pa_channel_map m_channelMap
pa_sample_spec m_sampleSpec
static void BufferFlowCallback(pa_stream *s, void *tag)
void Drain(void) override
Block until all available frames have been written to the device.
static void SinkInfoCallback(pa_context *c, const pa_sink_info *info, int eol, void *arg)
static void ServerInfoCallback(pa_context *context, const pa_server_info *inf, void *arg)
static void ContextDrainCallback(pa_context *c, void *arg)
void FlushStream(const char *caller)
AudioOutputPulseAudio(const AudioSettings &settings)
pa_proplist * m_stproplist
AudioOutputSettings * m_aoSettings
static void WriteCallback(pa_stream *s, size_t size, void *arg)
static void OpCompletionCallback(pa_context *c, int ok, void *arg)
static void StreamStateCallback(pa_stream *s, void *arg)
AudioOutputSettings * GetOutputSettings(bool digital) override
pa_threaded_mainloop * m_mainloop
int GetVolumeChannel(int channel) const override
static void ContextStateCallback(pa_context *c, void *arg)
bool OpenDevice(void) override
pa_buffer_attr m_bufferSettings
void CloseDevice(void) override
dictionary info
Definition: azlyrics.py:7