mpv-client

Example

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.1.3" ```

And then the code src/lib.rs:

```rust use mpv_client::{Event, Handle, RawHandle};

[no_mangle]

extern "C" fn mpvopencplugin(handle: RawHandle) -> std::os::raw::cint { let mpvhandle = Handle::from_ptr(handle);

println!("Hello world from Rust plugin {}!", mpvhandle.clientname());

loop { match mpvhandle.waitevent(-1.) { (, Ok(Event::Shutdown)) => { return 0; }, (, Ok(event)) => { println!("Got event: {}", event); }, (_, _) => {}, } } } ```

You can find more examples in C and Rust.