Declarations for audio capture and encoding. More...
#include "platform/common.h"#include "thread_safe.h"#include "utility.h"#include <array>#include <bitset>#include <string_view>#include <vector>Go to the source code of this file.
Classes | |
| struct | audio::audio_ctx_t |
| Shared audio device state used while streams are active. More... | |
| struct | audio::config_t |
| Audio capture and encoder settings for a stream. More... | |
| struct | audio::opus_stream_config_t |
| Static Opus encoder layout for one advertised audio mode. More... | |
| struct | audio::stream_params_t |
| Custom Opus channel layout supplied by configuration. More... | |
Typedefs | |
| using | audio::audio_ctx_ref_t = safe::shared_t<audio_ctx_t>::ptr_t |
| Shared mailbox reference to the global audio context. | |
| using | audio::buffer_t = util::buffer_t<std::uint8_t> |
| Byte buffer used for encoded audio packet payloads. | |
| using | audio::packet_t = std::pair<stream::session_t *, buffer_t> |
| Encoded audio packet paired with its owning stream session. | |
Enumerations | |
| enum class | audio::dolby_codec_e { opus , ac3 , eac3 } |
| Audio codec selected by RTSP Dolby offer/accept negotiation. More... | |
| enum | audio::stream_config_e : int { audio::STEREO , audio::HIGH_STEREO , audio::SURROUND51 , audio::HIGH_SURROUND51 , audio::SURROUND71 , audio::HIGH_SURROUND71 , audio::MAX_STREAM_CONFIG } |
| Supported Opus channel layouts advertised to Moonlight clients. More... | |
Functions | |
| bool | audio::ac3_available () |
| Check whether the linked FFmpeg build provides the AC-3 encoder. | |
| void | audio::capture (safe::mail_t mail, config_t config, stream::session_t *channel_data) |
| Run the capture loop for this backend. | |
| dolby_codec_e | audio::configure_dolby_audio (config_t &config, std::string_view offered, std::string_view accepted, bool ac3_encoder_available, bool eac3_encoder_available, bool high_quality) |
| Configure a Dolby stream only for an exact, supported client acceptance. | |
| int | audio::dolby_bitrate_kbps (bool eac3, bool high_quality, int channels) |
| Select a channel-aware bitrate for Dolby audio encoding. | |
| std::string_view | audio::dolby_codec_name (dolby_codec_e codec) |
| Return the codec label for the RTSP audio-codec response header. | |
| bool | audio::eac3_available () |
| Check whether the linked FFmpeg build provides the E-AC-3 encoder. | |
| audio_ctx_ref_t | audio::get_audio_ctx_ref () |
| Get the reference to the audio context. | |
| bool | audio::is_audio_ctx_sink_available (const audio_ctx_t &ctx) |
| Check if the audio sink held by audio context is available. | |
Declarations for audio capture and encoding.
|
strong |
| enum audio::stream_config_e : int |
| bool audio::ac3_available | ( | ) |
Check whether the linked FFmpeg build provides the AC-3 encoder.
Check whether a compatible optional FFmpeg AC-3 encoder is available.
| void audio::capture | ( | safe::mail_t | mail, |
| config_t | config, | ||
| stream::session_t * | channel_data ) |
Run the capture loop for this backend.
Capture, encode, and publish audio packets for a stream.
| Mailbox used to publish encoded audio packets. | |
| config | Audio capture and encoder settings. |
| channel_data | Stream session that receives the encoded packets. |
| dolby_codec_e audio::configure_dolby_audio | ( | config_t & | config, |
| std::string_view | offered, | ||
| std::string_view | accepted, | ||
| bool | ac3_encoder_available, | ||
| bool | eac3_encoder_available, | ||
| bool | high_quality ) |
Configure a Dolby stream only for an exact, supported client acceptance.
| config | Audio configuration to update for the negotiated stream. |
| offered | Codec offered by Sunshine, or empty when using Opus. |
| accepted | Codec explicitly accepted by the client. |
| ac3_encoder_available | Whether the AC-3 encoder is available. |
| eac3_encoder_available | Whether the E-AC-3 encoder is available. |
| high_quality | Whether the higher Dolby bitrate was requested. |
| int audio::dolby_bitrate_kbps | ( | bool | eac3, |
| bool | high_quality, | ||
| int | channels ) |
Select a channel-aware bitrate for Dolby audio encoding.
| eac3 | True to select E-AC-3; false to select AC-3. |
| high_quality | Whether to use the higher Dolby bitrate. |
| channels | Number of output audio channels (stereo or 5.1). |
| std::string_view audio::dolby_codec_name | ( | dolby_codec_e | codec | ) |
Return the codec label for the RTSP audio-codec response header.
| codec | Selected audio codec. |
| bool audio::eac3_available | ( | ) |
Check whether the linked FFmpeg build provides the E-AC-3 encoder.
Check whether a compatible optional FFmpeg E-AC-3 encoder is available.
| audio_ctx_ref_t audio::get_audio_ctx_ref | ( | ) |
Get the reference to the audio context.
Examples
| bool audio::is_audio_ctx_sink_available | ( | const audio_ctx_t & | ctx | ) |
Check if the audio sink held by audio context is available.
Examples
| ctx | Native context object used by the operation or callback. |