NativeGlFrameProducer
struct · ferroui-media-opengl · v0.5.0
struct NativeGlFrameProducer
Members
import_nativefrom_interopbudgetwith_budgetdevicedevice_generationretirement_wakeupinvokeproduceproduce_owned
import_native
unsafe fn import_native(self: &Self, metadata: FrameMetadata, import: impl FnOnce(&Rc<dyn IGlContext>) -> Result<NativeTextureView, MediaError> + Send + 'static) -> MediaFuture<Option<ReadyGlFrame>>
Creates a lease-backed alias without allocating/copying image storage. Admission reserves retained native bytes before importing. Saturation drops the captured native frame without queuing a render job.
Safety
The callback must obey NativeTextureView::new's contract. Native producer storage must remain immutable until the callback releases it. Metadata must describe the sampled alias and count all retained native allocation.
from_interop
fn from_interop(interop: &dyn ICompositionGpuInterop, budget: FrameBudget) -> Result<Self, MediaError>
budget
fn budget(self: &Self) -> FrameBudget
with_budget
fn with_budget(self: &Self, budget: FrameBudget) -> Self
device
fn device(self: &Self) -> DeviceIdentity
device_generation
fn device_generation(self: &Self) -> u64
retirement_wakeup
fn retirement_wakeup(self: &Self) -> Arc<dyn Fn() -> () + Send + Sync>
invoke
fn invoke<T: Send + 'static>(self: &Self, job: impl FnOnce(&Rc<dyn IGlContext>) -> Result<T, MediaError> + Send + 'static) -> MediaFuture<T>
Runs a narrow native operation on the render thread with the admitted GL context current. The closure must restore any GL state it changes. Captures and results must be Send; the context never leaves its thread.
produce
fn produce(self: &Self, metadata: FrameMetadata, draw: impl FnOnce(&Rc<dyn IGlContext>, u32) -> Result<(), MediaError> + Send + 'static) -> MediaFuture<Option<ReadyGlFrame>>
Reserves before allocation. Saturation returns None without queuing a
draw. draw must write the complete image and preserve GL state. A GPU
fence retains storage even if this future is canceled after submission.
produce_owned
fn produce_owned<T: std::any::Any + Send + Sync>(self: &Self, metadata: FrameMetadata, producer_owner: T, draw: impl FnOnce(&Rc<dyn IGlContext>, u32) -> Result<(), MediaError> + Send + 'static) -> MediaFuture<Option<ReadyGlFrame>>
producer_owner keeps borrowed native input alive through conversion
completion, even when the session is replaced while the job is queued.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedClassDefaultsErasedDestructorIntoEitherClone
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.