/// Create and initialize a libvlc instance with specified args.
/// Note: args.len() has to be less or equal to i32::MAX
/// Note: libvlc discourages using arguments as these are not guaranteed to be stable between different versions of libvlc
Create and initialize a libvlc instance with specified args.
Note: args.len() has to be less or equal to i32::MAX
Note: libvlc discourages using arguments as these are not guaranteed to be stable between different versions of libvlc
Create and initialize a libvlc instance with specified args . Note : args . len () has to be less or equal to i32 :: MAX Note : libvlc discourages using arguments as these are not guaranteed to be stable between different versions of libvlc
pub fn with_args(args: Option<Vec<String>>) -> Option<Instance> {
        let args_c_ptr: Vec<*const c_char> ;
        let args_c: Vec<CString>;
        if let Some(argv) = args {
            args_c = argv.into_iter()
                .map(|x| CString::new(x).expect("Error: Unexpected null byte")).collect();
            args_c_ptr = args_c.iter().map(|x| x.as_ptr()).collect();
        } else {
            args_c_ptr = Vec::new();
        }
        unsafe{
            let p = if args_c_ptr.is_empty() {
                sys::libvlc_new(0, ptr::null())
            } else {
                sys::libvlc_new(args_c_ptr.len() as i32, args_c_ptr.as_ptr())
            };
            if p.is_null() {
                return None;
            }
            Some(Instance{ptr: p})
        }
    }
pub fn with_args ( args : Option < Vec < String > > ) -> Option < Instance > { let args_c_ptr : Vec < * const c_char > ; let args_c : Vec < CString > ; if let Some ( argv ) = args { args_c = argv . into_iter ( ) . map ( | x | CString :: new ( x ) . expect ( " " ) ) . collect ( ) ; args_c_ptr = args_c . iter ( ) . map ( | x | x . as_ptr ( ) ) . collect ( ) ; } else { args_c_ptr = Vec :: new ( ) ; } unsafe { let p = if args_c_ptr . is_empty ( ) { sys :: libvlc_new ( 0 , ptr :: null ( ) ) } else { sys :: libvlc_new ( args_c_ptr . len ( ) as i32 , args_c_ptr . as_ptr ( ) ) } ; if p . is_null ( ) { return None ; } Some ( Instance { ptr : p } ) } }
Create and initialize a libvlc instance with specified args.
Create and initialize a libvlc instance with specified args .
args
Option<Vec<String>>