Sunshine v2025.118.151840
Self-hosted game stream host for Moonlight.
nv12_zero_device.h
Go to the documentation of this file.
1
5#pragma once
6
8
9struct AVFrame;
10
11namespace platf {
12 void
13 free_frame(AVFrame *frame);
14
16 // display holds a pointer to an av_video object. Since the namespaces of AVFoundation
17 // and FFMPEG collide, we need this opaque pointer and cannot use the definition
18 void *display;
19
20 public:
21 // this function is used to set the resolution on an av_video object that we cannot
22 // call directly because of namespace collisions between AVFoundation and FFMPEG
23 using resolution_fn_t = std::function<void(void *display, int width, int height)>;
24 resolution_fn_t resolution_fn;
25 using pixel_format_fn_t = std::function<void(void *display, int pixelFormat)>;
26
27 int
28 init(void *display, pix_fmt_e pix_fmt, resolution_fn_t resolution_fn, const pixel_format_fn_t &pixel_format_fn);
29
30 int
31 convert(img_t &img) override;
32 int
33 set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) override;
34
35 private:
37 };
38
39} // namespace platf
Definition nv12_zero_device.h:15
int set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) override
Set the frame to be encoded.
Definition nv12_zero_device.cpp:51
Definition utility.h:496
Declarations for common platform specific utilities.
std::shared_ptr< display_t > display(mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config)
Get the display_t instance for the given hwdevice_type. If display_name is empty, use the first monit...
Definition misc.cpp:909
pix_fmt_e
Definition common.h:213
Definition common.h:386
Definition common.h:341