Struct Mpv

Source
pub struct Mpv {
    pub ctx: NonNull<mpv_handle>,
    /* private fields */
}
Expand description

The central mpv context.

Fields§

§ctx: NonNull<mpv_handle>

The handle to the mpv core

Implementations§

Source§

impl Mpv

Source

pub fn create_protocol_context<T, U>(&self) -> ProtocolContext<'_, T, U>

Create a context with which custom protocols can be registered.

§Panics

Panics if a context already exists

Source§

impl Mpv

Source

pub fn new() -> Result<Mpv>

Create a new Mpv. The default settings can be probed by running: $ mpv --show-profile=libmpv.

Source

pub fn with_initializer<F: FnOnce(MpvInitializer) -> Result<()>>( initializer: F, ) -> Result<Mpv>

Create a new Mpv. The same as Mpv::new, but you can set properties before Mpv is initialized.

Source

pub fn load_config(&self, path: &str) -> Result<()>

Load a configuration file. The path has to be absolute, and a file.

Source

pub fn event_context(&self) -> &EventContext

Source

pub fn event_context_mut(&mut self) -> &mut EventContext

Source

pub fn command(&self, name: &str, args: &[&str]) -> Result<()>

Send a command to the Mpv instance. This uses mpv_command_string internally, so that the syntax is the same as described in the manual for the input.conf.

Note that you may have to escape strings with "" when they contain spaces.

§Examples
mpv.command("loadfile", &["test-data/jellyfish.mp4", "append-play"]).unwrap();
Source

pub fn set_property<T: SetData>(&self, name: &str, data: T) -> Result<()>

Set the value of a property.

Source

pub fn get_property<T: GetData>(&self, name: &str) -> Result<T>

Get the value of a property.

Source

pub fn get_internal_time(&self) -> i64

Internal time in microseconds, this has an arbitrary offset, and will never go backwards.

This can be called at any time, even if it was stated that no API function should be called.

Trait Implementations§

Source§

impl Drop for Mpv

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Mpv

Source§

impl Sync for Mpv

Auto Trait Implementations§

§

impl !Freeze for Mpv

§

impl !RefUnwindSafe for Mpv

§

impl Unpin for Mpv

§

impl !UnwindSafe for Mpv

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.