From e188c69030afebdbbe70bd2e9bf1e5e9f43915b8 Mon Sep 17 00:00:00 2001 From: meh Date: Mon, 8 Jun 2015 20:41:32 +0200 Subject: [PATCH] format/context: use AsRef instead of Path --- src/format/context.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/format/context.rs b/src/format/context.rs index aaff539..9d685fc 100644 --- a/src/format/context.rs +++ b/src/format/context.rs @@ -206,10 +206,10 @@ impl<'a> Iterator for PacketIter<'a> { } } -pub fn open(path: &Path) -> Result { +pub fn open>(path: &T) -> Result { unsafe { let mut ps = ptr::null_mut(); - let path = path.as_os_str().to_cstring().unwrap().as_ptr(); + let path = path.as_ref().as_os_str().to_cstring().unwrap().as_ptr(); let status = avformat_open_input(&mut ps, path, ptr::null_mut(), ptr::null_mut()); match status { @@ -227,10 +227,10 @@ pub fn open(path: &Path) -> Result { } } -pub fn open_with(path: &Path, options: Dictionary) -> Result { +pub fn open_with>(path: &T, options: Dictionary) -> Result { unsafe { let mut ps = ptr::null_mut(); - let path = path.as_os_str().to_cstring().unwrap().as_ptr(); + let path = path.as_ref().as_os_str().to_cstring().unwrap().as_ptr(); let mut opts = options.take(); let status = avformat_open_input(&mut ps, path, ptr::null_mut(), &mut opts); @@ -251,11 +251,11 @@ pub fn open_with(path: &Path, options: Dictionary) -> Result { } } -pub fn open_as(path: &Path, format: &Format) -> Result { +pub fn open_as>(path: &T, format: &Format) -> Result { if let &Format::Input(ref format) = format { unsafe { let mut ps = ptr::null_mut(); - let path = path.as_os_str().to_cstring().unwrap().as_ptr(); + let path = path.as_ref().as_os_str().to_cstring().unwrap().as_ptr(); let status = avformat_open_input(&mut ps, path, format.as_ptr(), ptr::null_mut()); match status { @@ -277,11 +277,11 @@ pub fn open_as(path: &Path, format: &Format) -> Result { } } -pub fn open_as_with(path: &Path, format: &Format, options: Dictionary) -> Result { +pub fn open_as_with>(path: &T, format: &Format, options: Dictionary) -> Result { if let &Format::Input(ref format) = format { unsafe { let mut ps = ptr::null_mut(); - let path = path.as_os_str().to_cstring().unwrap().as_ptr(); + let path = path.as_ref().as_os_str().to_cstring().unwrap().as_ptr(); let mut opts = options.take(); let status = avformat_open_input(&mut ps, path, format.as_ptr(), &mut opts);