![]() |
Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
|
Owns the FFmpeg decode and SDL presentation state for one stream. More...
#include <src/streaming/ffmpeg_stream_backend.h>
Public Member Functions | |
| std::string | build_overlay_status_line () const |
| Build a short user-visible media status line. | |
| void | cleanup_audio_decoder () |
| Clean up all FFmpeg audio decode resources. | |
| void | cleanup_video_decoder () |
| Clean up all FFmpeg video decode resources. | |
| void | decode_and_play_audio_sample (const char *sampleData, int sampleLength) |
| Decode and queue one Moonlight Opus audio payload. | |
| bool | ensure_audio_resampler () |
| Ensure the audio resampler matches the current decoded frame. | |
| FfmpegStreamBackend ()=default | |
| Construct an empty backend. | |
| FfmpegStreamBackend (const FfmpegStreamBackend &)=delete | |
| bool | has_decoded_video () const |
| Report whether at least one decoded video frame is available. | |
| bool | has_unrendered_video_frame () const |
| Report whether a newly decoded video frame has not been presented yet. | |
| int | initialize_audio_decoder (int audioConfiguration, const OPUS_MULTISTREAM_CONFIGURATION *opusConfig, int arFlags) |
| Initialize the FFmpeg Opus decoder and SDL playback device. | |
| void | initialize_callbacks (DECODER_RENDERER_CALLBACKS *videoCallbacks, AUDIO_RENDERER_CALLBACKS *audioCallbacks) const |
| Populate Moonlight callback tables for this backend. | |
| std::uint64_t | milliseconds_since_last_decoded_video_frame (std::uint64_t nowMicroseconds) const |
| Return how long it has been since FFmpeg published a decoded video frame. | |
| FfmpegStreamBackend & | operator= (const FfmpegStreamBackend &)=delete |
| bool | render_latest_video_frame (SDL_Renderer *renderer, int screenWidth, int screenHeight, bool allowDirectFramebuffer=true) |
| Render the latest decoded video frame to the supplied renderer. | |
| void | set_audio_playback_enabled (bool enabled) |
| Configure whether streamed audio should be decoded and played locally. | |
| int | setup_video_decoder (int videoFormat, int width, int height, int redrawRate, int drFlags) |
| Initialize the FFmpeg H.264 decoder for Moonlight video callbacks. | |
| void | shutdown () |
| Release all FFmpeg, SDL, and cached frame resources. | |
| void | start_audio_playback () |
| Start SDL audio playback. | |
| void | start_video_decoder () |
| Start the video decode path. | |
| void | stop_audio_playback () |
| Stop SDL audio playback. | |
| void | stop_video_decoder () |
| Stop the video decode path. | |
| ~FfmpegStreamBackend () | |
| Destroy the backend and release all resources. | |
Owns the FFmpeg decode and SDL presentation state for one stream.
The backend exposes Moonlight-compatible callback tables for video and audio, decodes H.264 video and Opus stereo audio with FFmpeg, presents the most recent decoded frame through SDL, and queues decoded PCM samples to SDL audio.
| std::string streaming::FfmpegStreamBackend::build_overlay_status_line | ( | ) | const |
Build a short user-visible media status line.
| void streaming::FfmpegStreamBackend::decode_and_play_audio_sample | ( | const char * | sampleData, |
| int | sampleLength ) |
Decode and queue one Moonlight Opus audio payload.
| sampleData | Encoded Opus payload. |
| sampleLength | Encoded payload size in bytes. |
| bool streaming::FfmpegStreamBackend::ensure_audio_resampler | ( | ) |
Ensure the audio resampler matches the current decoded frame.
| bool streaming::FfmpegStreamBackend::has_decoded_video | ( | ) | const |
Report whether at least one decoded video frame is available.
| bool streaming::FfmpegStreamBackend::has_unrendered_video_frame | ( | ) | const |
Report whether a newly decoded video frame has not been presented yet.
| int streaming::FfmpegStreamBackend::initialize_audio_decoder | ( | int | audioConfiguration, |
| const OPUS_MULTISTREAM_CONFIGURATION * | opusConfig, | ||
| int | arFlags ) |
Initialize the FFmpeg Opus decoder and SDL playback device.
| audioConfiguration | Negotiated Moonlight audio configuration. |
| opusConfig | Negotiated Opus multistream parameters. |
| arFlags | Moonlight audio renderer flags. |
| void streaming::FfmpegStreamBackend::initialize_callbacks | ( | DECODER_RENDERER_CALLBACKS * | videoCallbacks, |
| AUDIO_RENDERER_CALLBACKS * | audioCallbacks ) const |
Populate Moonlight callback tables for this backend.
| videoCallbacks | Output video callback table. |
| audioCallbacks | Output audio callback table. |
| std::uint64_t streaming::FfmpegStreamBackend::milliseconds_since_last_decoded_video_frame | ( | std::uint64_t | nowMicroseconds | ) | const |
Return how long it has been since FFmpeg published a decoded video frame.
| nowMicroseconds | Current platform monotonic time. |
| bool streaming::FfmpegStreamBackend::render_latest_video_frame | ( | SDL_Renderer * | renderer, |
| int | screenWidth, | ||
| int | screenHeight, | ||
| bool | allowDirectFramebuffer = true ) |
Render the latest decoded video frame to the supplied renderer.
| renderer | SDL renderer used by the stream session. |
| screenWidth | Current renderer output width. |
| screenHeight | Current renderer output height. |
| allowDirectFramebuffer | True when platform-specific direct presentation may bypass SDL's renderer. |
| void streaming::FfmpegStreamBackend::set_audio_playback_enabled | ( | bool | enabled | ) |
Configure whether streamed audio should be decoded and played locally.
| enabled | True to decode and play Opus audio on the Xbox. |
| int streaming::FfmpegStreamBackend::setup_video_decoder | ( | int | videoFormat, |
| int | width, | ||
| int | height, | ||
| int | redrawRate, | ||
| int | drFlags ) |
Initialize the FFmpeg H.264 decoder for Moonlight video callbacks.
| videoFormat | Negotiated Moonlight video format. |
| width | Negotiated stream width. |
| height | Negotiated stream height. |
| redrawRate | Negotiated redraw rate. |
| drFlags | Moonlight decoder flags. |