Expand description
ยงmpvipc-async
NOTE: This is a fork of gitlab.com/mpv-ipc/mpvipc, which introduces a lot of changes to be able to use the library asynchronously with tokio.
A small library which provides bindings to control existing mpv instances through sockets.
ยงDependencies
mpv(runtime dependency)cargo-nextest(optional test depencency)grcov(optional test depencency)
ยงExample
Make sure mpv is started with the following option:
$ mpv --input-ipc-server=/tmp/mpv.sock --idleHere is a small code example which connects to the socket /tmp/mpv.sock and toggles playback.
use mpvipc_async::*;
#[tokio::main]
async fn main() -> Result<(), MpvError> {
let mpv = Mpv::connect("/tmp/mpv.sock").await?;
let paused: bool = mpv.get_property("pause").await?;
mpv.set_property("pause", !paused).await.expect("Error pausing");
}Modulesยง
- core_
api ๐The core API for interacting withMpv. - error ๐Library specific error messages.
- event_
parser ๐JSON parsing logic for events fromMpvIpc. - High-level API extension for
Mpv. - ipc ๐IPC handling thread/task. Handles communication between
Mpvinstances and mpvโs unix socket - message_
parser ๐JSON parsing logic for command responses fromMpvIpc. - property_
parser ๐JSON parsing logic for properties returned by [Event::PropertyChange], and used internally inMpvExtto parse the response fromMpv::get_property().
Structsยง
- The main struct for interacting with mpv.
- A mpv playlist.
- A single entry in the mpv playlist.
Enumsยง
- All possible events that can be sent by mpv.
- All possible commands that can be sent to mpv.
- Generic data type representing all possible data types that mpv can return.
- Any error that can occur when interacting with mpv.
- Generic high-level command for changing a number property.
- Options for
MpvCommand::LoadFileandMpvCommand::LoadList. - Options for
MpvExt::playlist_add. - An incomplete list of properties that mpv can return.
- Options for
MpvCommand::Seek. - Generic high-level switch for toggling boolean properties.
Traitsยง
- A trait for specifying how to extract and parse a value returned through
Mpv::get_property. - A set of typesafe high-level functions to interact with
Mpv. - A trait for specifying how to serialize and set a value through
Mpv::set_property.
Functionsยง
- Parse a highlevel
Propertyobject from mpv data.