Crate streamkit_core

Crate streamkit_core 

Source
Expand description

StreamKit Core - Fundamental traits and data structures for real-time media processing.

This crate defines the core abstractions for building StreamKit pipelines:

§Core Modules

  • types: Core data types (Packet, AudioFrame, PacketType, etc.)
  • node: ProcessorNode trait and execution context
  • registry: Node factory and discovery system
  • pins: Pin system for graph validation and type checking
  • state: Node state machine and lifecycle tracking
  • stats: Node statistics collection and reporting
  • telemetry: Telemetry event emission for observability
  • control: Control messages for node and engine management
  • error: Error types and handling
  • resource_manager: Shared resource management (ML models, GPU contexts)
  • packet_meta: Packet type metadata and compatibility checking
  • moq_gateway: MoQ WebTransport routing infrastructure
  • helpers: Utility functions for configuration and packet processing

§Quick Start

use streamkit_core::node::{ProcessorNode, NodeContext};
use streamkit_core::types::{Packet, AudioFrame};
use streamkit_core::pins::{InputPin, OutputPin};
use streamkit_core::registry::NodeRegistry;

// Define a custom node
struct GainNode { gain: f32 }

#[async_trait]
impl ProcessorNode for GainNode {
    fn input_pins(&self) -> Vec<InputPin> { /* ... */ }
    fn output_pins(&self) -> Vec<OutputPin> { /* ... */ }
    async fn run(self: Box<Self>, ctx: NodeContext) { /* ... */ }
}

// Register with the factory
let mut registry = NodeRegistry::new();
registry.register_static(/* ... */);

Re-exports§

pub use error::StreamKitError;
pub use node::InitContext;
pub use node::NodeContext;
pub use node::OutputSendError;
pub use node::OutputSender;
pub use node::ProcessorNode;
pub use node::RoutedPacketMessage;
pub use registry::NodeDefinition;
pub use registry::NodeRegistry;
pub use resource_manager::Resource;
pub use resource_manager::ResourceError;
pub use resource_manager::ResourceKey;
pub use resource_manager::ResourceManager;
pub use resource_manager::ResourcePolicy;
pub use state::NodeState;
pub use state::NodeStateUpdate;
pub use state::StopReason;
pub use stats::NodeStats;
pub use stats::NodeStatsUpdate;
pub use telemetry::TelemetryConfig;
pub use telemetry::TelemetryEmitter;
pub use telemetry::TelemetryEvent;
pub use pins::InputPin;
pub use pins::OutputPin;
pub use pins::PinCardinality;
pub use helpers::config_helpers;
pub use helpers::packet_helpers;
pub use state::state_helpers;
pub use telemetry::telemetry_helpers;
pub use frame_pool::AudioFramePool;
pub use frame_pool::FramePool;
pub use frame_pool::PooledFrameData;
pub use frame_pool::PooledSamples;
pub use node_config::get_codec_channel_capacity;
pub use node_config::get_demuxer_buffer_size;
pub use node_config::get_moq_peer_channel_capacity;
pub use node_config::get_stream_channel_capacity;
pub use node_config::set_node_buffer_config;
pub use node_config::NodeBufferConfig;

Modules§

control
Control messages for node and engine management.
error
Structured error types for StreamKit.
frame_pool
Generic buffer pooling for frame/sample reuse.
helpers
Utility functions for node configuration and packet processing.
moq_gateway
Gateway trait for MoQ WebTransport routing
node
Core node abstractions and ProcessorNode trait.
node_config
Runtime configuration for internal node buffers.
packet_meta
pins
Pin system for graph validation and type checking.
registry
Node factory registry and discovery.
resource_manager
Resource management for plugins.
state
Node state management and lifecycle tracking.
stats
Node statistics tracking and reporting.
telemetry
Telemetry event emission and tracking.
types
Core data types that flow through StreamKit pipelines.

Attribute Macros§

async_trait