File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,45 @@ impl AVFilterContext {
9494 Ok ( ( ) )
9595 }
9696
97+ /// Add, replace, or remove elements for an array option.
98+ ///
99+ /// This is a safe wrapper around `av_opt_set_array`.
100+ /// - key: option name
101+ /// - start_elem: index of the first array element to modify
102+ /// - vals: None to remove elements, Some(&[T]) to insert/replace elements
103+ /// - val_type: the `AVOptionType` corresponding to T (e.g. AV_OPT_TYPE_INT)
104+ ///
105+ /// Note: This wrapper always searches children (AV_OPT_SEARCH_CHILDREN).
106+ #[ cfg( feature = "ffmpeg7_1" ) ]
107+ pub fn opt_set_array < T > (
108+ & mut self ,
109+ key : & CStr ,
110+ start_elem : u32 ,
111+ vals : Option < & [ T ] > ,
112+ val_type : ffi:: AVOptionType ,
113+ ) -> Result < ( ) > {
114+ let ( nb_elems, val_ptr) = match vals {
115+ Some ( slice) => (
116+ slice. len ( ) as u32 ,
117+ slice. as_ptr ( ) as * const std:: os:: raw:: c_void ,
118+ ) ,
119+ None => ( 0u32 , std:: ptr:: null ( ) ) ,
120+ } ;
121+ unsafe {
122+ ffi:: av_opt_set_array (
123+ self . as_mut_ptr ( ) . cast ( ) ,
124+ key. as_ptr ( ) ,
125+ ffi:: AV_OPT_SEARCH_CHILDREN as i32 ,
126+ start_elem,
127+ nb_elems,
128+ val_type,
129+ val_ptr,
130+ )
131+ }
132+ . upgrade ( ) ?;
133+ Ok ( ( ) )
134+ }
135+
97136 /// Add a frame to the buffer source.
98137 pub fn buffersrc_add_frame (
99138 & mut self ,
You can’t perform that action at this time.
0 commit comments