Struct mpv::MpvHandlerWithGl [] [src]

pub struct MpvHandlerWithGl {
    // some fields omitted
}

This struct is a decorator of MpvHandler, and can use all the functions from MpvHandler. It is only used when you must embed mpv somewhere else using openGL.

Methods

impl MpvHandlerWithGl
[src]

fn draw(&mut self, fbo: i32, width: i32, heigth: i32) -> Result<()>

Render video

The video will use the full provided framebuffer. Options like "panscan" are applied to determine which part of the video should be visible and how the video should be scaled. You can change these options at runtime by using the mpv property API.

fbo is the framebuffer object to render on. Because the renderer might manage multiple FBOs internally for the purpose of video postprocessing, it will always bind and unbind FBOs itself. If you want mpv to render on the main framebuffer, pass 0.

width is the width of the framebuffer. This is either the video size if the fbo parameter is 0, or the allocated size of the texture backing the fbo. The renderer will always use the full size of the fbo.

height is the height of the framebuffer. Same as with the w parameter, except that this parameter can be negative. In this case, the video frame will be rendered flipped.

Errors

If the external video module has not been configured correctly, libmpv can send various errors such as MPV_ERROR_UNSUPPORTED

fn is_update_available(&self) -> bool

returns true if another frame is available

Methods from Deref<Target=MpvHandler>

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 Deref for MpvHandlerWithGl
[src]

type Target = MpvHandler

The resulting type after dereferencing

fn deref(&self) -> &MpvHandler

The method called to dereference a value

impl DerefMut for MpvHandlerWithGl
[src]

fn deref_mut(&mut self) -> &mut MpvHandler

The method called to mutably dereference a value

impl Drop for MpvHandlerWithGl
[src]

fn drop(&mut self)

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