media: fix whitespace
							parent
							
								
									b4346a2573
								
							
						
					
					
						commit
						a1d51ebb7a
					
				
							
								
								
									
										22
									
								
								src/media.rs
								
								
								
								
							
							
						
						
									
										22
									
								
								src/media.rs
								
								
								
								
							| 
						 | 
					@ -13,44 +13,44 @@ pub struct Media {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl 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> {
 | 
					    pub fn new_location(instance: &Instance, mrl: &str) -> Option<Media> {
 | 
				
			||||||
        let cstr = to_cstr(mrl);
 | 
					        let cstr = to_cstr(mrl);
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
        unsafe{
 | 
					        unsafe{
 | 
				
			||||||
            let p = sys::libvlc_media_new_location(instance.ptr, cstr.as_ptr());
 | 
					            let p = sys::libvlc_media_new_location(instance.ptr, cstr.as_ptr());
 | 
				
			||||||
            if p.is_null() {
 | 
					            if p.is_null() {
 | 
				
			||||||
                return None;
 | 
					                return None;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					
 | 
				
			||||||
            Some(Media{ptr: p})
 | 
					            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> {
 | 
					    pub fn new_path<T: AsRef<Path>>(instance: &Instance, path: T) -> Option<Media> {
 | 
				
			||||||
        let cstr = match path_to_cstr(path.as_ref()) {
 | 
					        let cstr = match path_to_cstr(path.as_ref()) {
 | 
				
			||||||
            Ok(s) => s,
 | 
					            Ok(s) => s,
 | 
				
			||||||
            Err(_) => { return None; },
 | 
					            Err(_) => { return None; },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
        unsafe{
 | 
					        unsafe{
 | 
				
			||||||
            let p = sys::libvlc_media_new_path(instance.ptr, cstr.as_ptr());
 | 
					            let p = sys::libvlc_media_new_path(instance.ptr, cstr.as_ptr());
 | 
				
			||||||
            if p.is_null() {
 | 
					            if p.is_null() {
 | 
				
			||||||
                return None;
 | 
					                return None;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					
 | 
				
			||||||
            Some(Media{ptr: p})
 | 
					            Some(Media{ptr: p})
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
    pub fn new_fd(instance: &Instance, fd: i32) -> Option<Media> {
 | 
					    pub fn new_fd(instance: &Instance, fd: i32) -> Option<Media> {
 | 
				
			||||||
        unsafe{
 | 
					        unsafe{
 | 
				
			||||||
            let p = sys::libvlc_media_new_fd(instance.ptr, fd);
 | 
					            let p = sys::libvlc_media_new_fd(instance.ptr, fd);
 | 
				
			||||||
            if p.is_null() {
 | 
					            if p.is_null() {
 | 
				
			||||||
                return None;
 | 
					                return None;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					
 | 
				
			||||||
            Some(Media{ptr: p})
 | 
					            Some(Media{ptr: p})
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,7 @@ impl Media {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Set the meta of the 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) {
 | 
					    pub fn set_meta(&self, meta: Meta, value: &str) {
 | 
				
			||||||
        unsafe{
 | 
					        unsafe{
 | 
				
			||||||
            sys::libvlc_media_set_meta(self.ptr, meta, to_cstr(value).as_ptr());
 | 
					            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 }
 | 
					        if time != -1 { Some(time) }else{ None }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Parse a media. 
 | 
					    /// Parse a media.
 | 
				
			||||||
    pub fn parse(&self) {
 | 
					    pub fn parse(&self) {
 | 
				
			||||||
        unsafe{ sys::libvlc_media_parse(self.ptr) };
 | 
					        unsafe{ sys::libvlc_media_parse(self.ptr) };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -233,4 +233,4 @@ pub struct VideoTrack {
 | 
				
			||||||
pub struct SubtitleTrack {
 | 
					pub struct SubtitleTrack {
 | 
				
			||||||
    pub encoding: Option<String>,
 | 
					    pub encoding: Option<String>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue