Bindings for libmpv client API that allow you to create plugins for MPV in Rust.
Here is an example for your Cargo.toml
:
```toml [package] name = "mpv-plugin" version = "0.1.0" edition = "2021"
[lib] name = "mpv_plugin" crate-type = ["cdylib"]
[dependencies] mpv-client = "0.5.0" ```
And then the code src/lib.rs
:
```rust use mpvclient::{mpvhandle, Event, Handle};
extern "C" fn mpvopencplugin(handle: *mut mpvhandle) -> std::os::raw::cint { let mpv = Handle::from_ptr(handle);
println!("Hello world from Rust plugin {}!", mpv.client_name());
loop { match mpv.wait_event(-1.) { Event::Shutdown => { return 0; }, event => { println!("Got event: {}", event); }, } } } ```