@@ -35,15 +35,10 @@ pub fn license() -> &'static str {
3535 unsafe { utils:: str_from_c_ptr ( avformat_license ( ) ) }
3636}
3737
38- // XXX: use to_cstring when stable
39- fn from_path < P : AsRef < Path > > ( path : P ) -> CString {
40- CString :: new ( path. as_ref ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) ) . unwrap ( )
41- }
42-
4338pub fn input < P : AsRef < Path > > ( path : P ) -> Result < context:: Input , Error > {
4439 unsafe {
4540 let mut ps = ptr:: null_mut ( ) ;
46- let path = from_path ( path) ;
41+ let path = utils :: from_path ( path) ;
4742
4843 match avformat_open_input ( & mut ps, path. as_ptr ( ) , ptr:: null_mut ( ) , ptr:: null_mut ( ) ) {
4944 0 => match avformat_find_stream_info ( ps, ptr:: null_mut ( ) ) {
@@ -65,7 +60,7 @@ pub fn input_with_dictionary<P: AsRef<Path>>(
6560) -> Result < context:: Input , Error > {
6661 unsafe {
6762 let mut ps = ptr:: null_mut ( ) ;
68- let path = from_path ( path) ;
63+ let path = utils :: from_path ( path) ;
6964 let mut opts = options. disown ( ) ;
7065 let res = avformat_open_input ( & mut ps, path. as_ptr ( ) , ptr:: null_mut ( ) , & mut opts) ;
7166
9186{
9287 unsafe {
9388 let mut ps = avformat_alloc_context ( ) ;
94- let path = from_path ( path) ;
89+ let path = utils :: from_path ( path) ;
9590 ( * ps) . interrupt_callback = interrupt:: new ( Box :: new ( closure) ) . interrupt ;
9691
9792 match avformat_open_input ( & mut ps, path. as_ptr ( ) , ptr:: null_mut ( ) , ptr:: null_mut ( ) ) {
@@ -111,7 +106,7 @@ where
111106pub fn output < P : AsRef < Path > > ( path : P ) -> Result < context:: Output , Error > {
112107 unsafe {
113108 let mut ps = ptr:: null_mut ( ) ;
114- let path = from_path ( path) ;
109+ let path = utils :: from_path ( path) ;
115110
116111 match avformat_alloc_output_context2 ( & mut ps, ptr:: null_mut ( ) , ptr:: null ( ) , path. as_ptr ( ) ) {
117112 0 => match avio_open ( & mut ( * ps) . pb , path. as_ptr ( ) , AVIO_FLAG_WRITE ) {
@@ -127,7 +122,7 @@ pub fn output<P: AsRef<Path>>(path: P) -> Result<context::Output, Error> {
127122pub fn output_with < P : AsRef < Path > > ( path : P , options : Dictionary ) -> Result < context:: Output , Error > {
128123 unsafe {
129124 let mut ps = ptr:: null_mut ( ) ;
130- let path = from_path ( path) ;
125+ let path = utils :: from_path ( path) ;
131126 let mut opts = options. disown ( ) ;
132127
133128 match avformat_alloc_output_context2 ( & mut ps, ptr:: null_mut ( ) , ptr:: null ( ) , path. as_ptr ( ) ) {
@@ -156,7 +151,7 @@ pub fn output_with<P: AsRef<Path>>(path: P, options: Dictionary) -> Result<conte
156151pub fn output_as < P : AsRef < Path > > ( path : P , format : & str ) -> Result < context:: Output , Error > {
157152 unsafe {
158153 let mut ps = ptr:: null_mut ( ) ;
159- let path = from_path ( path) ;
154+ let path = utils :: from_path ( path) ;
160155 let format = CString :: new ( format) . unwrap ( ) ;
161156
162157 match avformat_alloc_output_context2 (
@@ -182,7 +177,7 @@ pub fn output_as_with<P: AsRef<Path>>(
182177) -> Result < context:: Output , Error > {
183178 unsafe {
184179 let mut ps = ptr:: null_mut ( ) ;
185- let path = from_path ( path) ;
180+ let path = utils :: from_path ( path) ;
186181 let format = CString :: new ( format) . unwrap ( ) ;
187182 let mut opts = options. disown ( ) ;
188183
0 commit comments