media: fix whitespace

merge-requests/7/merge
Alexandre Janniaux 2019-11-15 13:21:55 +01:00
parent b4346a2573
commit a1d51ebb7a
1 changed files with 11 additions and 11 deletions

View File

@ -13,44 +13,44 @@ pub struct Media {
}
impl Media {
/// Create a media with a certain given media resource location, for instance a valid URL.
/// Create a media with a certain given media resource location, for instance a valid URL.
pub fn new_location(instance: &Instance, mrl: &str) -> Option<Media> {
let cstr = to_cstr(mrl);
unsafe{
let p = sys::libvlc_media_new_location(instance.ptr, cstr.as_ptr());
if p.is_null() {
return None;
}
Some(Media{ptr: p})
}
}
/// Create a media for a certain file path.
/// Create a media for a certain file path.
pub fn new_path<T: AsRef<Path>>(instance: &Instance, path: T) -> Option<Media> {
let cstr = match path_to_cstr(path.as_ref()) {
Ok(s) => s,
Err(_) => { return None; },
};
unsafe{
let p = sys::libvlc_media_new_path(instance.ptr, cstr.as_ptr());
if p.is_null() {
return None;
}
Some(Media{ptr: p})
}
}
pub fn new_fd(instance: &Instance, fd: i32) -> Option<Media> {
unsafe{
let p = sys::libvlc_media_new_fd(instance.ptr, fd);
if p.is_null() {
return None;
}
Some(Media{ptr: p})
}
}
@ -84,7 +84,7 @@ impl Media {
}
/// Set the meta of the media.
/// (This function will not save the meta, call save_meta in order to save the meta)
/// (This function will not save the meta, call save_meta in order to save the meta)
pub fn set_meta(&self, meta: Meta, value: &str) {
unsafe{
sys::libvlc_media_set_meta(self.ptr, meta, to_cstr(value).as_ptr());
@ -109,7 +109,7 @@ impl Media {
if time != -1 { Some(time) }else{ None }
}
/// Parse a media.
/// Parse a media.
pub fn parse(&self) {
unsafe{ sys::libvlc_media_parse(self.ptr) };
}
@ -233,4 +233,4 @@ pub struct VideoTrack {
pub struct SubtitleTrack {
pub encoding: Option<String>,
}