|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Definitions for audio control on Linux. More...
#include <bitset>#include <sstream>#include <thread>#include <boost/regex.hpp>#include <pulse/error.h>#include <pulse/pulseaudio.h>#include <pulse/simple.h>#include "src/config.h"#include "src/logging.h"#include "src/platform/common.h"#include "src/thread_safe.h"Classes | |
| struct | platf::pa::add_const_helper< false, T > |
| Template helper that leaves non-const inputs mutable. More... | |
| struct | platf::pa::add_const_helper< true, T > |
| Template helper that preserves constness for const inputs. More... | |
| struct | platf::mic_attr_t |
| PulseAudio recording stream and channel metadata. More... | |
| class | platf::pa::server_t |
| PulseAudio server controller that creates and removes Sunshine sinks. More... | |
Typedefs | |
| template<class T > | |
| using | platf::pa::add_const_t = typename add_const_helper<std::is_pointer_v<T>, T>::type |
| PulseAudio callback info type with pointer constness normalized. | |
| template<class T > | |
| using | platf::pa::cb_simple_t = std::function<void(ctx_t::pointer, add_const_t<T> i)> |
| Callback wrapper for PulseAudio introspection results without an end marker. | |
| template<class T > | |
| using | platf::pa::cb_t = std::function<void(ctx_t::pointer, add_const_t<T> i, int eol)> |
| Callback wrapper for PulseAudio introspection results with an end marker. | |
| using | platf::pa::ctx_t = util::safe_ptr<pa_context, pa_context_unref> |
| Owning pointer for a PulseAudio context. | |
| using | platf::pa::loop_t = util::safe_ptr<pa_mainloop, pa_mainloop_free> |
| Owning pointer for a PulseAudio mainloop. | |
| using | platf::pa::op_t = util::safe_ptr<pa_operation, pa_operation_unref> |
| Owning pointer for a PulseAudio asynchronous operation. | |
| using | platf::pa::string_t = util::safe_ptr<char, pa_free<char>> |
Owning pointer for PulseAudio strings allocated with pa_xmalloc. | |
Functions | |
| std::unique_ptr< audio_control_t > | platf::audio_control () |
| Create the platform audio controller. | |
| template<class T > | |
| void | platf::pa::cb (ctx_t::pointer ctx, add_const_t< T > i, int eol, void *userdata) |
| Handle PulseAudio source introspection results. | |
| template<class T > | |
| void | platf::pa::cb (ctx_t::pointer ctx, add_const_t< T > i, void *userdata) |
| Handle PulseAudio sink-input introspection results. | |
| void | platf::pa::cb_i (ctx_t::pointer ctx, std::uint32_t i, void *userdata) |
| Forward a PulseAudio integer callback value into a Sunshine alarm. | |
| void | platf::pa::ctx_state_cb (ctx_t::pointer ctx, void *userdata) |
| Translate PulseAudio context state changes into server events. | |
| std::unique_ptr< mic_t > | platf::microphone (const std::uint8_t *mapping, int channels, std::uint32_t sample_rate, std::uint32_t frame_size, std::string source_name) |
| Create a microphone capture stream for the requested layout. | |
| template<class T > | |
| void | platf::pa::pa_free (T *p) |
| Release memory allocated by PulseAudio. | |
| void | platf::pa::success_cb (ctx_t::pointer ctx, int status, void *userdata) |
| Record completion of a PulseAudio asynchronous operation. | |
| std::string | platf::to_string (const char *name, const std::uint8_t *mapping, int channels) |
| Convert a PulseAudio operation result to a log string. | |
Variables | |
| constexpr pa_channel_position_t | platf::position_mapping [] |
| Position mapping. | |
Definitions for audio control on Linux.
| std::unique_ptr< audio_control_t > platf::audio_control | ( | ) |
Create the platform audio controller.
| void platf::pa::cb | ( | ctx_t::pointer | ctx, |
| add_const_t< T > | i, | ||
| int | eol, | ||
| void * | userdata ) |
Handle PulseAudio source introspection results.
| ctx | Native context object used by the operation or callback. |
| i | PulseAudio introspection info supplied to the callback. |
| eol | PulseAudio end-of-list marker. |
| userdata | Caller-provided pointer passed through the callback. |
| void platf::pa::cb | ( | ctx_t::pointer | ctx, |
| add_const_t< T > | i, | ||
| void * | userdata ) |
Handle PulseAudio sink-input introspection results.
| ctx | Native context object used by the operation or callback. |
| i | PulseAudio introspection info supplied to the callback. |
| userdata | Caller-provided pointer passed through the callback. |
| void platf::pa::cb_i | ( | ctx_t::pointer | ctx, |
| std::uint32_t | i, | ||
| void * | userdata ) |
Forward a PulseAudio integer callback value into a Sunshine alarm.
| ctx | PulseAudio context that emitted the callback. |
| i | Integer value returned by the PulseAudio operation. |
| userdata | Caller-provided pointer passed through the callback. |
| void platf::pa::ctx_state_cb | ( | ctx_t::pointer | ctx, |
| void * | userdata ) |
Translate PulseAudio context state changes into server events.
| ctx | Native context object used by the operation or callback. |
| userdata | Caller-provided pointer passed through the callback. |
| std::unique_ptr< mic_t > platf::microphone | ( | const std::uint8_t * | mapping, |
| int | channels, | ||
| std::uint32_t | sample_rate, | ||
| std::uint32_t | frame_size, | ||
| std::string | source_name ) |
Create a microphone capture stream for the requested layout.
| mapping | Opus channel mapping table for the requested layout. |
| channels | Number of audio channels in the stream. |
| sample_rate | Audio sample rate in hertz. |
| frame_size | Number of samples captured per audio frame. |
| source_name | Source name. |
| void platf::pa::pa_free | ( | T * | p | ) |
Release memory allocated by PulseAudio.
| p | Pointer allocated by PulseAudio and released with pa_xfree. |
| void platf::pa::success_cb | ( | ctx_t::pointer | ctx, |
| int | status, | ||
| void * | userdata ) |
Record completion of a PulseAudio asynchronous operation.
| ctx | Native context object used by the operation or callback. |
| status | Native status code returned by the platform API. |
| userdata | Caller-provided pointer passed through the callback. |
| std::string platf::to_string | ( | const char * | name, |
| const std::uint8_t * | mapping, | ||
| int | channels ) |
Convert a PulseAudio operation result to a log string.
| name | Human-readable name to assign. |
| mapping | Opus channel mapping table for the requested layout. |
| channels | Number of audio channels in the stream. |
|
constexpr |
Position mapping.