Skip to main content

NodeContext

Trait NodeContext 

Source
pub trait NodeContext: Send + Sync {
    // Required methods
    fn add_audio_input(&self) -> AudioInputId;
    fn add_video_input(&self) -> VideoInputId;
    fn add_audio_output(&self) -> AudioOutput;
    fn add_video_output(&self) -> VideoOutput;
    fn create_to_rgba(
        &self,
        video_format: &VideoFormat,
        colour_space: &ColourSpec,
        width: usize,
        height: usize,
    ) -> ToRGBA;
    fn create_from_rgba(
        &self,
        video_format: &VideoFormat,
        colour_space: &ColourSpec,
        width: usize,
        height: usize,
        interlace: InterlaceMode,
    ) -> FromRGBA;
    fn create_to_audio_f32(
        &self,
        audio_format: AudioFormat,
        channel_layout: AudioChannelLayout,
    ) -> ToAudioF32;
    fn create_from_audio_f32(
        &self,
        audio_format: AudioFormat,
        channel_layout: AudioChannelLayout,
    ) -> FromAudioF32;
    fn create_process_shader(
        &self,
        kernel: RStr<'_>,
        program_name: RStr<'_>,
    ) -> ProcessShader;
}
Expand description

Context provided to nodes when they are initialized.

Required Methods§

Source

fn add_audio_input(&self) -> AudioInputId

Add an audio input to the node.

Source

fn add_video_input(&self) -> VideoInputId

Add a video input to the node.

Source

fn add_audio_output(&self) -> AudioOutput

Add an audio output to the node.

Source

fn add_video_output(&self) -> VideoOutput

Add a video output to the node.

Source

fn create_to_rgba( &self, video_format: &VideoFormat, colour_space: &ColourSpec, width: usize, height: usize, ) -> ToRGBA

Create a ToRGBA that can be used to load video frames onto the GPU.

Source

fn create_from_rgba( &self, video_format: &VideoFormat, colour_space: &ColourSpec, width: usize, height: usize, interlace: InterlaceMode, ) -> FromRGBA

Create a [’FromRGBA`] that can be used to consume video frames from the GPU.

Source

fn create_to_audio_f32( &self, audio_format: AudioFormat, channel_layout: AudioChannelLayout, ) -> ToAudioF32

Create a ToAudioF32 that can be used to load audio in 32 bit floating-point format.

Source

fn create_from_audio_f32( &self, audio_format: AudioFormat, channel_layout: AudioChannelLayout, ) -> FromAudioF32

Create a FromAudioF32 that can be used to consume 32 bit floating-point audio in other formats.

Source

fn create_process_shader( &self, kernel: RStr<'_>, program_name: RStr<'_>, ) -> ProcessShader

Create a shader from a source string.

  • kernel - Shader code.
  • program_name - Name of the kernel function.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'lt, _ErasedPtr> NodeContext for NodeContext_TO<'lt, _ErasedPtr>
where Self: Send + Sync, _ErasedPtr: AsPtr<PtrTarget = ()>,