File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed
Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ pub struct AudioFormat {
7373}
7474
7575impl AudioInfo {
76+ /// # Safety
77+ /// The pointer must be valid and point to a [ffi::VSAudioInfo]
7678 pub unsafe fn from_ptr ( from : * const ffi:: VSAudioInfo ) -> Self {
7779 let from = & * from;
7880 Self {
@@ -94,6 +96,8 @@ impl AudioInfo {
9496}
9597
9698impl AudioFormat {
99+ /// # Safety
100+ /// The pointer must be valid and point to a [ffi::VSAudioFormat]
97101 pub unsafe fn from_ptr ( from : * const ffi:: VSAudioFormat ) -> Self {
98102 let from = & * from;
99103 let sample_type = if from. sampleType == 0 {
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ use crate::{
55use rustsynth_sys as ffi;
66
77impl VideoFormat {
8+ /// # Safety
9+ /// The pointer must be valid and point to a [ffi::VSVideoFormat]
810 pub unsafe fn from_ptr ( from : * const ffi:: VSVideoFormat ) -> Self {
911 let info = & * from;
1012
@@ -149,6 +151,8 @@ impl VideoFormat {
149151}
150152
151153impl VideoInfo {
154+ /// # Safety
155+ /// The pointer must be valid and point to a [ffi::VSVideoInfo]
152156 pub unsafe fn from_ptr ( from : * const ffi:: VSVideoInfo ) -> Self {
153157 let from = & * from;
154158
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ impl FrameContext {
4040 /// Creates a FrameContext from a raw pointer.
4141 ///
4242 /// # Safety
43- /// The pointer must be valid and point to a ` VSFrameContext` .
43+ /// The pointer must be valid and point to a [ffi:: VSFrameContext] .
4444 #[ inline]
4545 pub unsafe fn from_ptr ( ptr : * mut ffi:: VSFrameContext ) -> Self {
4646 Self {
@@ -65,6 +65,8 @@ impl FrameContext {
6565}
6666
6767impl < ' core > Frame < ' core > {
68+ /// # Safety
69+ /// The pointer must be valid and point to a [ffi::VSFrame]
6870 #[ inline]
6971 pub unsafe fn from_ptr ( ptr : * const ffi:: VSFrame ) -> Self {
7072 Self {
@@ -217,13 +219,13 @@ impl<'core> Frame<'core> {
217219 }
218220
219221 /// Get read-only access to plane data
220- #[ inline]
222+ #[ inline( always ) ]
221223 pub fn get_read_ptr ( & self , plane : i32 ) -> * const u8 {
222224 unsafe { API :: get_cached ( ) . get_frame_read_ptr ( self . handle . as_ref ( ) , plane) }
223225 }
224226
225227 /// Get mutable access to plane data (only for owned frames)
226- #[ inline]
228+ #[ inline( always ) ]
227229 pub fn get_write_ptr ( & mut self , plane : i32 ) -> * mut u8 {
228230 unsafe { API :: get_cached ( ) . get_frame_write_ptr ( self . handle . as_ptr ( ) , plane) }
229231 }
Original file line number Diff line number Diff line change @@ -162,8 +162,8 @@ impl<'elem> OwnedMap<'elem> {
162162 }
163163 }
164164
165- pub fn as_ptr ( & self ) -> * mut ffi:: VSMap {
166- self . handle . as_ptr ( )
165+ pub const fn as_ptr ( & self ) -> * mut ffi:: VSMap {
166+ self . map . as_ptr ( )
167167 }
168168}
169169
@@ -231,6 +231,10 @@ impl<'elem> Default for OwnedMap<'elem> {
231231}
232232
233233impl < ' elem > Map < ' elem > {
234+ pub const fn as_ptr ( & self ) -> * mut ffi:: VSMap {
235+ self . handle . as_ptr ( )
236+ }
237+
234238 /// Wraps pointer into `Map`.
235239 ///
236240 /// # Safety
You can’t perform that action at this time.
0 commit comments