Thank you for your interest in contributing to grafton-ndi! This document provides guidelines and information for contributors.
By participating in this project, you agree to abide by our code of conduct: be respectful, constructive, and professional.
- Fork the repository on GitHub
- Clone your fork locally
- Create a new branch for your feature or fix
- Make your changes
- Run tests and ensure they pass
- Submit a pull request
- Rust 1.87 or later
- NDI SDK 6.x installed (see README for platform-specific instructions)
- Git
# Clone the repository
git clone https://github.com/GrantSparks/grafton-ndi.git
cd grafton-ndi
# Build the project
cargo build
# Run tests
cargo test
# Run examples
cargo run --example NDIlib_Find- Follow Rust idioms and conventions
- Use
cargo fmtto format code - Run
cargo clippyand address warnings - Add rustdoc comments for all public APIs
- Include examples in documentation where helpful
- Use conventional commit format:
type(scope): description - Types:
feat,fix,docs,style,refactor,test,chore - Keep the first line under 72 characters
- Reference issues when applicable
Examples:
feat(recv): add support for compressed video formats
fix(send): prevent panic on invalid frame dimensions
docs(api): improve VideoFrame builder documentation
- Title: Use a clear, descriptive title
- Description: Explain what changes you made and why
- Testing: Describe how you tested your changes
- Breaking Changes: Clearly mark any breaking API changes
- Add tests for new functionality
- Ensure all existing tests pass
- Include integration tests for complex features
- Test on multiple platforms if possible
Zero-copy receive and async-send lifetime guarantees are enforced with
trybuild compile tests in tests/compile_contracts.rs.
Run the compile contracts directly:
cargo test --test compile_contractsRefresh expected compiler diagnostics after intentionally changing the contract fixtures or after stable rustc diagnostic wording changes:
TRYBUILD=overwrite cargo test --test compile_contractsThe project uses the stable Rust toolchain with clippy, rustfmt, and
rust-src components via rust-toolchain.toml. The rust-src component keeps
standard-library diagnostics consistent in local and CI runs. Treat .stderr
snapshot updates as part of normal stable-compiler-upgrade maintenance, and
review them to confirm they still fail for the intended lifetime or auto-trait
reason.
The CI/CD pipeline requires the NDI SDK to build and test the project. You can configure the SDK version in two ways:
- Default: Uses the hardcoded NDI 6 SDK URL in the workflow
- Custom: Set the
NDI_SDK_URLrepository secret to use a different SDK version
To update the NDI SDK version for CI/CD:
- Go to Settings → Secrets and variables → Actions in your GitHub repository
- Create or update the
NDI_SDK_URLsecret with the new SDK download URL - The cache will automatically invalidate when the URL changes
Example URLs:
- NDI 6:
https://downloads.ndi.tv/SDK/NDI_SDK/NDI%206%20SDK.exe - NDI 5:
https://downloads.ndi.tv/SDK/NDI_SDK/NDI%205%20SDK.exe
- Update relevant documentation for any API changes
- Add rustdoc comments for new public items
- Update README if adding new features
- Include code examples where appropriate
- macOS platform testing and fixes
- Performance optimizations
- Additional examples
- Documentation improvements
- Async/await support
- Additional color format conversions
- Enhanced metadata handling
- Debugging and diagnostic tools
Check the issue tracker for current bugs and feature requests.
grafton-ndi/
├── src/
│ ├── lib.rs # Main library interface
│ ├── error.rs # Error types
│ └── ndi_lib.rs # Generated FFI bindings
├── build.rs # Build script for bindgen
├── examples/ # Example applications
└── tests/ # Integration tests
- Safety First: Wrap all unsafe FFI in safe Rust APIs
- Zero-Cost Abstractions: Minimize overhead over raw NDI SDK
- Idiomatic Rust: Follow Rust conventions and patterns
- Thread Safety: Properly implement Send/Sync where appropriate
- Open an issue for bugs or feature requests
- Start a discussion for design questions
- Check existing issues before creating new ones
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.