crates/camera-directshow/README.md
Ergonomic Rust wrapper around Windows DirectShow API for legacy camera capture, providing safe abstractions over COM interfaces while maintaining compatibility with older camera devices and drivers that don't support Media Foundation. Aims to mirror how Chromium consumes DirectShow.
Provides safe access to Windows camera devices through DirectShow's filter graph architecture, handling COM initialization, device enumeration through monikers, format negotiation via IAMStreamConfig, and synchronous frame delivery through custom sink filters.
VideoInputDeviceIterator for enumerating video capture devices via COM monikersAM_MEDIA_TYPE formats and frame rates through IAMStreamConfigSinkFilter implementationinitialize_directshow() - Initialize DirectShow COM subsystemVideoInputDeviceIterator::new() - Enumerate available cameras via system device enumeratorVideoInputDevice::name(), VideoInputDevice::id(), VideoInputDevice::model_id() - Device metadataVideoInputDevice::media_types() - Iterator over supported AMMediaType formatsVideoInputDevice::start_capturing(format, callback) - Begin sync capture with specified formatCaptureHandle::stop_capturing() - Stop capture session and disconnect filter graphSinkCallback - Frame processing callback receiving IMediaSample and media typeAMMediaType - Safe wrapper around AM_MEDIA_TYPE with automatic memory managementAM_MEDIA_TYPEExt::subtype_str() - Convert format GUIDs to readable stringsAM_MEDIA_TYPEVideoExt::video_info() - Access video format details and dimensionsIBaseFilterExt::get_pin() - Find pins by direction, category, and media typeIAMStreamConfigExt::media_types() - Enumerate supported capture formatsIPinExt::matches_category() - Pin category matching for capture pin discoveryBridges DirectShow's COM-based filter graph model to Rust's ownership system using custom sink filter implementation, RAII for COM resource management, and comprehensive trait extensions for ergonomic API access. Designed for maximum compatibility with legacy camera hardware while maintaining memory safety.
Comprehensive StartCapturingError enum covering:
The crate provides robust error propagation while maintaining the callback-based architecture required for real-time video capture scenarios.