[][src]Type Definition libmpv_sys::mpv_stream_cb_read_fn

type mpv_stream_cb_read_fn = Option<unsafe extern "C" fn(cookie: *mut c_void, buf: *mut c_char, nbytes: u64) -> i64>;

Read callback used to implement a custom stream. The semantics of the callback match read(2) in blocking mode. Short reads are allowed (you can return less bytes than requested, and libmpv will retry reading the rest with another call). If no data can be immediately read, the callback must block until there is new data. A return of 0 will be interpreted as final EOF, although libmpv might retry the read, or seek to a different position.

@param cookie opaque cookie identifying the stream, returned from mpv_stream_cb_open_fn @param buf buffer to read data into @param size of the buffer @return number of bytes read into the buffer @return 0 on EOF @return -1 on error