Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
ffmpeg_stream_backend.cpp File Reference

Implements the FFmpeg-backed streaming decode backend for Xbox sessions. More...

#include "src/streaming/ffmpeg_stream_backend.h"
#include <algorithm>
#include <array>
#include <cstdarg>
#include <cstring>
#include <mutex>
#include <string>
#include <utility>
#include <vector>
#include <libavcodec/avcodec.h>
#include <libavutil/channel_layout.h>
#include <libavutil/error.h>
#include <libavutil/frame.h>
#include <libavutil/imgutils.h>
#include <libavutil/log.h>
#include <libavutil/mem.h>
#include <libavutil/samplefmt.h>
#include <libswresample/swresample.h>
#include <libswscale/swscale.h>
#include "src/logging/logger.h"
#include <hal/video.h>
Include dependency graph for ffmpeg_stream_backend.cpp:

Functions

std::uint64_t PltGetMicroseconds (void)
 Return the platform monotonic clock value in microseconds.
 
bool streaming::rectangles_match (const SDL_Rect &left, const SDL_Rect &right)
 Return whether two SDL rectangles describe the same area.
 
int streaming::xbox_framebuffer_bytes_per_pixel (int bitsPerPixel)
 Return bytes per pixel for one Xbox framebuffer mode.
 
AVPixelFormat streaming::xbox_framebuffer_pixel_format (int bitsPerPixel)
 Convert the active Xbox framebuffer bpp to FFmpeg's packed RGB format.
 

Detailed Description

Implements the FFmpeg-backed streaming decode backend for Xbox sessions.

Function Documentation

◆ PltGetMicroseconds()

std::uint64_t PltGetMicroseconds ( void )

Return the platform monotonic clock value in microseconds.

Returns
Microseconds from the platform timer used by moonlight-common-c.

◆ rectangles_match()

bool streaming::rectangles_match ( const SDL_Rect & left,
const SDL_Rect & right )

Return whether two SDL rectangles describe the same area.

Parameters
leftFirst rectangle.
rightSecond rectangle.
Returns
True when every rectangle field matches.

◆ xbox_framebuffer_bytes_per_pixel()

int streaming::xbox_framebuffer_bytes_per_pixel ( int bitsPerPixel)

Return bytes per pixel for one Xbox framebuffer mode.

Parameters
bitsPerPixelActive framebuffer bits per pixel.
Returns
Bytes per pixel, or zero when unsupported.

◆ xbox_framebuffer_pixel_format()

AVPixelFormat streaming::xbox_framebuffer_pixel_format ( int bitsPerPixel)

Convert the active Xbox framebuffer bpp to FFmpeg's packed RGB format.

Parameters
bitsPerPixelActive framebuffer bits per pixel.
Returns
Matching FFmpeg pixel format, or none when unsupported.