Sunshine latest
Self-hosted game stream host for Moonlight.
nv12_zero_device.h
Go to the documentation of this file.
1
5#pragma once
6
7// local includes
9
10struct AVFrame;
11
12namespace platf {
13 void 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 init(void *display, pix_fmt_e pix_fmt, resolution_fn_t resolution_fn, const pixel_format_fn_t &pixel_format_fn);
28
29 int convert(img_t &img) override;
30 int set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) override;
31
32 private:
34 };
35
36} // 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:48
Definition utility.h:530
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:864
pix_fmt_e
Definition common.h:220
Definition common.h:390
Definition common.h:347