Struct mpv::MpvHandler [] [src]

pub struct MpvHandler {
    // some fields omitted
}

The main struct of the mpv-rs crate

Almost every function from the libmpv API needs a context, which is stored in this struct.

Methods

impl MpvHandler
[src]

fn set_property<T: MpvFormat>(&mut self, property: &str, value: T) -> Result<()>

Set a property synchronously

fn set_property_async<T: MpvFormat>(&mut self, property: &str, value: T, userdata: u32) -> Result<()>

Set a property asynchronously

fn get_property<T: MpvFormat>(&self, property: &str) -> Result<T>

Get a property synchronously

fn get_property_async<T: MpvFormat>(&self, property: &str, userdata: u32) -> Result<()>

Get a property asynchronously

fn set_option<T: MpvFormat>(&mut self, property: &str, option: T) -> Result<()>

Set an option. Note that you can't normally set options during runtime : changing options at runtime does not always work. For some options, attempts to change them simply fails. Many other options may require reloading the file for changes to take effect. In general, you should prefer calling mpv.set_property() to change settings during playback, because the property mechanism guarantees that changes take effect immediately.

It is preferred that you initialize your options with the Builder instead

fn command(&mut self, command: &[&str]) -> Result<()>

Send a command synchronously

fn command_async(&mut self, command: &[&str], userdata: u32) -> Result<()>

Send a command asynchronously

fn wait_event<'a>(&mut self, timeout: f64) -> Option<Event<'a>>

Returns an Event if there is an Event available. Returns None if the event pool is empty.

It is still necessary to empty the event pool even if you don't use the events, since the event pool is not limited and will be full if you don't empty it.

Panics

Will panic if a null pointer is received from the libmpv API (should never happen)

fn observe_property<T: MpvFormat>(&mut self, name: &str, userdata: u32) -> Result<()>

Observe a property change. The property change will be returned via an Event PropertyChange

fn unobserve_property(&mut self, userdata: u32) -> Result<()>

Unobserve a previously observed property change

fn raw(&self) -> *mut mpv_handle

Get the raw pointer for the mpv_handle. Use with care.

Trait Implementations

impl Drop for MpvHandler
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more