macOS zero-copy encode device that forwards NV12 frames from AVFoundation to FFmpeg.
More...
#include <src/platform/macos/nv12_zero_device.h>
|
|
using | pixel_format_fn_t = std::function<void(AVVideo *display, int pixelFormat)> |
| | Callback signature used to update the opaque AVFoundation pixel format.
|
|
using | resolution_fn_t = std::function<void(AVVideo *display, int width, int height)> |
| | Callback signature used to update the opaque AVFoundation display resolution.
|
|
using | init_hw_device_fn_t = int (*)(avcodec_encode_device_t *encode_device, AVBufferRef **hw_device_buf) |
| | Callback signature for backend-specific FFmpeg hardware device initialization.
|
|
| int | convert (img_t &img) override |
| | Forward a captured AVFoundation frame to FFmpeg without copying.
|
| int | init (AVVideo *capture_display, pix_fmt_e pix_fmt, resolution_fn_t set_resolution, const pixel_format_fn_t &pixel_format_fn) |
| | Initialize zero-copy NV12 encoding for an AVFoundation display.
|
| int | set_frame (AVFrame *new_frame, AVBufferRef *hw_frames_ctx) override |
| | Attach frame resources used by the next conversion or encode operation.
|
| virtual void | apply_colorspace () |
| | Apply the configured colorspace metadata to the active frame.
|
| virtual void | init_codec_options (AVCodecContext *ctx, AVDictionary **options) |
| | Provides a hook for allow platform-specific code to adjust codec options.
|
| virtual void | init_hwframes (AVHWFramesContext *frames) |
| | Initialize the hwframes context.
|
| virtual int | prepare_to_derive_context (int hw_device_type) |
| | Prepare to derive a context.
|
|
|
resolution_fn_t | resolution_fn |
| | Callback stored for later AVFoundation resolution updates.
|
|
ID3D11Device * | d3d11_device = nullptr |
| | Native D3D11 device borrowed while the encode device is alive.
|
|
AVFrame * | frame {} |
| | FFmpeg frame currently owned by the encode device.
|
|
bool | hardware = false |
| | Whether this device supplies hardware frames instead of software conversion.
|
|
init_hw_device_fn_t | init_hw_device = nullptr |
| | Optional backend-specific hardware device initializer.
|
|
video::sunshine_colorspace_t | colorspace |
| | Colorspace metadata expected by the encoder.
|
macOS zero-copy encode device that forwards NV12 frames from AVFoundation to FFmpeg.
◆ convert()
Forward a captured AVFoundation frame to FFmpeg without copying.
- Parameters
-
| img | Image or frame object to read from or populate. |
- Returns
- Conversion status.
Reimplemented from platf::avcodec_encode_device_t.
◆ init()
Initialize zero-copy NV12 encoding for an AVFoundation display.
- Parameters
-
| capture_display | Display object or identifier associated with the operation. |
| pix_fmt | Sunshine pixel format to convert or allocate for. |
| set_resolution | Callback used to resize the AVFoundation capture output. |
| pixel_format_fn | Pixel format. |
- Returns
- 0 on success; nonzero or negative platform status on failure.
◆ set_frame()
| int platf::nv12_zero_device::set_frame |
( |
AVFrame * | new_frame, |
|
|
AVBufferRef * | hw_frames_ctx ) |
|
overridevirtual |
Attach frame resources used by the next conversion or encode operation.
- Parameters
-
| new_frame | Video or graphics frame being processed. |
| hw_frames_ctx | FFmpeg hardware frames context associated with the frame. |
- Returns
- Status from updating frame.
Reimplemented from platf::avcodec_encode_device_t.
The documentation for this class was generated from the following files: