objc2_core_video/generated/
CVDisplayLink.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12#[cfg(feature = "objc2-open-gl")]
13#[cfg(target_os = "macos")]
14use objc2_open_gl::*;
15
16use crate::*;
17
18/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvdisplaylink?language=objc)
19#[doc(alias = "CVDisplayLinkRef")]
20#[repr(C)]
21pub struct CVDisplayLink {
22    inner: [u8; 0],
23    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
24}
25
26cf_type!(
27    unsafe impl CVDisplayLink {}
28);
29#[cfg(feature = "objc2")]
30cf_objc2_type!(
31    unsafe impl RefEncode<"__CVDisplayLink"> for CVDisplayLink {}
32);
33
34/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvdisplaylinkoutputcallback?language=objc)
35#[cfg(all(feature = "CVBase", feature = "CVReturn"))]
36pub type CVDisplayLinkOutputCallback = Option<
37    unsafe extern "C-unwind" fn(
38        NonNull<CVDisplayLink>,
39        NonNull<CVTimeStamp>,
40        NonNull<CVTimeStamp>,
41        CVOptionFlags,
42        NonNull<CVOptionFlags>,
43        *mut c_void,
44    ) -> CVReturn,
45>;
46
47/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvdisplaylinkoutputhandler?language=objc)
48#[cfg(all(feature = "CVBase", feature = "CVReturn", feature = "block2"))]
49pub type CVDisplayLinkOutputHandler = *mut block2::DynBlock<
50    dyn Fn(
51        NonNull<CVDisplayLink>,
52        NonNull<CVTimeStamp>,
53        NonNull<CVTimeStamp>,
54        CVOptionFlags,
55        NonNull<CVOptionFlags>,
56    ) -> CVReturn,
57>;
58
59unsafe impl ConcreteType for CVDisplayLink {
60    #[doc(alias = "CVDisplayLinkGetTypeID")]
61    #[inline]
62    fn type_id() -> CFTypeID {
63        extern "C-unwind" {
64            fn CVDisplayLinkGetTypeID() -> CFTypeID;
65        }
66        unsafe { CVDisplayLinkGetTypeID() }
67    }
68}
69
70impl CVDisplayLink {
71    /// General call to create a CVDisplayLink
72    ///
73    /// Use this call to create a CVDisplayLink for a set of displays indentified by the CGDirectDisplayIDs.
74    ///
75    /// Parameter `displayArray`: array of CGDirectDisplayIDs
76    ///
77    /// Parameter `count`: number of displays in the displayArray
78    ///
79    /// Parameter `displayLinkOut`: The new display link will be returned here
80    ///
81    /// Returns: returns kCVReturnSuccess on success.
82    ///
83    /// # Safety
84    ///
85    /// - `display_array` must be a valid pointer.
86    /// - `display_link_out` must be a valid pointer.
87    #[doc(alias = "CVDisplayLinkCreateWithCGDisplays")]
88    #[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
89    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
90    #[inline]
91    pub unsafe fn create_with_cg_displays(
92        display_array: NonNull<CGDirectDisplayID>,
93        count: CFIndex,
94        display_link_out: NonNull<*mut CVDisplayLink>,
95    ) -> CVReturn {
96        extern "C-unwind" {
97            fn CVDisplayLinkCreateWithCGDisplays(
98                display_array: NonNull<CGDirectDisplayID>,
99                count: CFIndex,
100                display_link_out: NonNull<*mut CVDisplayLink>,
101            ) -> CVReturn;
102        }
103        unsafe { CVDisplayLinkCreateWithCGDisplays(display_array, count, display_link_out) }
104    }
105
106    /// Convenience call to create a CVDisplayLink from an OpenGL display mask.
107    ///
108    /// Use this call to create a CVDisplayLink for a CGOpenGLDisplayMask.
109    ///
110    /// Parameter `mask`: CGOpenGLDisplayMask describing the display
111    ///
112    /// Parameter `displayLinkOut`: The new display link will be returned here
113    ///
114    /// Returns: returns kCVReturnSuccess on success.
115    ///
116    /// # Safety
117    ///
118    /// `display_link_out` must be a valid pointer.
119    #[doc(alias = "CVDisplayLinkCreateWithOpenGLDisplayMask")]
120    #[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
121    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
122    #[inline]
123    pub unsafe fn create_with_open_gl_display_mask(
124        mask: CGOpenGLDisplayMask,
125        display_link_out: NonNull<*mut CVDisplayLink>,
126    ) -> CVReturn {
127        extern "C-unwind" {
128            fn CVDisplayLinkCreateWithOpenGLDisplayMask(
129                mask: CGOpenGLDisplayMask,
130                display_link_out: NonNull<*mut CVDisplayLink>,
131            ) -> CVReturn;
132        }
133        unsafe { CVDisplayLinkCreateWithOpenGLDisplayMask(mask, display_link_out) }
134    }
135
136    /// Convenience call to create a CVDisplayLink for a single CGDirectDisplay.
137    ///
138    /// Use this call to create a CVDisplayLink for a single CGDirectDisplay.
139    ///
140    /// Parameter `displayID`: CGDirectDisplayID of the target display
141    ///
142    /// Parameter `displayLinkOut`: The new display link will be returned here
143    ///
144    /// Returns: returns kCVReturnSuccess on success.
145    ///
146    /// # Safety
147    ///
148    /// `display_link_out` must be a valid pointer.
149    #[doc(alias = "CVDisplayLinkCreateWithCGDisplay")]
150    #[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
151    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
152    #[inline]
153    pub unsafe fn create_with_cg_display(
154        display_id: CGDirectDisplayID,
155        display_link_out: NonNull<*mut CVDisplayLink>,
156    ) -> CVReturn {
157        extern "C-unwind" {
158            fn CVDisplayLinkCreateWithCGDisplay(
159                display_id: CGDirectDisplayID,
160                display_link_out: NonNull<*mut CVDisplayLink>,
161            ) -> CVReturn;
162        }
163        unsafe { CVDisplayLinkCreateWithCGDisplay(display_id, display_link_out) }
164    }
165
166    /// Convenience function to create a CVDisplayLink capable of being used with all active CGDisplays
167    ///
168    /// Parameter `displayLinkOut`: The newly created CVDisplayLink
169    ///
170    /// Returns: kCVReturnSuccess if the device was created, or failure
171    ///
172    /// # Safety
173    ///
174    /// `display_link_out` must be a valid pointer.
175    #[doc(alias = "CVDisplayLinkCreateWithActiveCGDisplays")]
176    #[cfg(feature = "CVReturn")]
177    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
178    #[inline]
179    pub unsafe fn create_with_active_cg_displays(
180        display_link_out: NonNull<*mut CVDisplayLink>,
181    ) -> CVReturn {
182        extern "C-unwind" {
183            fn CVDisplayLinkCreateWithActiveCGDisplays(
184                display_link_out: NonNull<*mut CVDisplayLink>,
185            ) -> CVReturn;
186        }
187        unsafe { CVDisplayLinkCreateWithActiveCGDisplays(display_link_out) }
188    }
189
190    /// Sets the current display of a DisplayLink
191    ///
192    /// It is safe to call this with a running display link, but be aware that there will likely be a timestamp
193    /// discontinuity in the video time stamp
194    ///
195    /// Parameter `displayLink`: target CVDisplayLinkRef
196    ///
197    /// Parameter `displayID`: target CGDirectDisplayID
198    ///
199    /// Returns: CVReturn. kCVReturnSuccess if successfull.
200    #[doc(alias = "CVDisplayLinkSetCurrentCGDisplay")]
201    #[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
202    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
203    #[inline]
204    pub fn set_current_cg_display(&self, display_id: CGDirectDisplayID) -> CVReturn {
205        extern "C-unwind" {
206            fn CVDisplayLinkSetCurrentCGDisplay(
207                display_link: &CVDisplayLink,
208                display_id: CGDirectDisplayID,
209            ) -> CVReturn;
210        }
211        unsafe { CVDisplayLinkSetCurrentCGDisplay(self, display_id) }
212    }
213
214    /// Convenience function to select a CVDisplayLink most optimal for the current renderer of the passed in OpenGL context
215    ///
216    /// Parameter `displayLink`: The CVDisplayLink for which you want to set the current CGDisplay
217    ///
218    /// Parameter `cglContext`: The OpenGL context to retrieve the current renderer from.
219    ///
220    /// Parameter `cglPixelFormat`: The OpenGL pixel format used to create the passed in OpenGL context
221    ///
222    /// Returns: kCVReturnSuccess if a device was found, or failure.
223    ///
224    /// # Safety
225    ///
226    /// - `cgl_context` must be a valid pointer.
227    /// - `cgl_pixel_format` must be a valid pointer.
228    #[doc(alias = "CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext")]
229    #[cfg(all(feature = "CVReturn", feature = "objc2-open-gl"))]
230    #[cfg(target_os = "macos")]
231    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
232    #[inline]
233    pub unsafe fn set_current_cg_display_from_open_gl_context(
234        &self,
235        cgl_context: CGLContextObj,
236        cgl_pixel_format: CGLPixelFormatObj,
237    ) -> CVReturn {
238        extern "C-unwind" {
239            fn CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(
240                display_link: &CVDisplayLink,
241                cgl_context: CGLContextObj,
242                cgl_pixel_format: CGLPixelFormatObj,
243            ) -> CVReturn;
244        }
245        unsafe {
246            CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self, cgl_context, cgl_pixel_format)
247        }
248    }
249
250    /// Gets the current display of a DisplayLink
251    ///
252    /// (description)
253    ///
254    /// Parameter `displayLink`: target CVDisplayLinkRef
255    ///
256    /// Returns: CGDirectDisplayID
257    #[doc(alias = "CVDisplayLinkGetCurrentCGDisplay")]
258    #[cfg(feature = "objc2-core-graphics")]
259    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
260    #[inline]
261    pub fn current_cg_display(&self) -> CGDirectDisplayID {
262        extern "C-unwind" {
263            fn CVDisplayLinkGetCurrentCGDisplay(display_link: &CVDisplayLink) -> CGDirectDisplayID;
264        }
265        unsafe { CVDisplayLinkGetCurrentCGDisplay(self) }
266    }
267
268    /// Set the renderer output callback function
269    ///
270    /// The DisplayLink will invoke this callback whenever it wants you to output a frame.
271    ///
272    /// Parameter `displayLink`: target CVDisplayLinkRef
273    ///
274    /// Parameter `callback`: CVDisplayLinkOutputCallback function
275    ///
276    /// Parameter `userInfo`: User data for the callback to identify the context.
277    ///
278    /// Returns: CVReturn. kCVReturnSuccess if successfull.
279    ///
280    /// # Safety
281    ///
282    /// - `callback` must be implemented correctly.
283    /// - `user_info` must be a valid pointer or null.
284    #[doc(alias = "CVDisplayLinkSetOutputCallback")]
285    #[cfg(all(feature = "CVBase", feature = "CVReturn"))]
286    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
287    #[inline]
288    pub unsafe fn set_output_callback(
289        &self,
290        callback: CVDisplayLinkOutputCallback,
291        user_info: *mut c_void,
292    ) -> CVReturn {
293        extern "C-unwind" {
294            fn CVDisplayLinkSetOutputCallback(
295                display_link: &CVDisplayLink,
296                callback: CVDisplayLinkOutputCallback,
297                user_info: *mut c_void,
298            ) -> CVReturn;
299        }
300        unsafe { CVDisplayLinkSetOutputCallback(self, callback, user_info) }
301    }
302
303    /// Set the renderer output callback block
304    ///
305    /// The DisplayLink will invoke this block whenever it wants you to output a frame. You can only have a block or a callback function; not both.
306    ///
307    /// Parameter `displayLink`: target CVDisplayLinkRef
308    ///
309    /// Parameter `handler`: CVDisplayLinkOutputHandler block
310    ///
311    /// Returns: CVReturn. kCVReturnSuccess if successful.
312    ///
313    /// # Safety
314    ///
315    /// `handler` must be a valid pointer.
316    #[doc(alias = "CVDisplayLinkSetOutputHandler")]
317    #[cfg(all(feature = "CVBase", feature = "CVReturn", feature = "block2"))]
318    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
319    #[inline]
320    pub unsafe fn set_output_handler(&self, handler: CVDisplayLinkOutputHandler) -> CVReturn {
321        extern "C-unwind" {
322            fn CVDisplayLinkSetOutputHandler(
323                display_link: &CVDisplayLink,
324                handler: CVDisplayLinkOutputHandler,
325            ) -> CVReturn;
326        }
327        unsafe { CVDisplayLinkSetOutputHandler(self, handler) }
328    }
329
330    /// Start timer for DisplayLink
331    ///
332    /// This call should not be made from inside the CVDisplayLinkOutputCallback
333    ///
334    /// Parameter `displayLink`: target CVDisplayLinkRef
335    ///
336    /// Returns: CVReturn. kCVReturnSuccess if successfull.
337    /// kCVReturnDisplayLinkCallbacksNotSet The DisplayLink cannot be started until the output callback is set.
338    #[doc(alias = "CVDisplayLinkStart")]
339    #[cfg(feature = "CVReturn")]
340    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
341    #[inline]
342    pub fn start(&self) -> CVReturn {
343        extern "C-unwind" {
344            fn CVDisplayLinkStart(display_link: &CVDisplayLink) -> CVReturn;
345        }
346        unsafe { CVDisplayLinkStart(self) }
347    }
348
349    /// Stop timer for DisplayLink
350    ///
351    /// (description)
352    ///
353    /// Parameter `displayLink`: target CVDisplayLinkRef
354    ///
355    /// Returns: CVReturn. kCVReturnSuccess if successfull.
356    #[doc(alias = "CVDisplayLinkStop")]
357    #[cfg(feature = "CVReturn")]
358    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
359    #[inline]
360    pub fn stop(&self) -> CVReturn {
361        extern "C-unwind" {
362            fn CVDisplayLinkStop(display_link: &CVDisplayLink) -> CVReturn;
363        }
364        unsafe { CVDisplayLinkStop(self) }
365    }
366
367    /// Retrieves the nominal refresh period of a CVDisplayLink.
368    ///
369    /// This call allows one to retrieve the device's "ideal" refresh period.   For example, an NTSC output device might report 1001/60000 to represent the exact NTSC vertial refresh rate.
370    ///
371    /// Parameter `displayLink`: The CVDisplayLink to get the refresh period from.
372    ///
373    /// Returns: A CVTime struct that holds the nominal refresh period.    This value may be indefinite.
374    #[doc(alias = "CVDisplayLinkGetNominalOutputVideoRefreshPeriod")]
375    #[cfg(feature = "CVBase")]
376    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
377    #[inline]
378    pub fn nominal_output_video_refresh_period(&self) -> CVTime {
379        extern "C-unwind" {
380            fn CVDisplayLinkGetNominalOutputVideoRefreshPeriod(
381                display_link: &CVDisplayLink,
382            ) -> CVTime;
383        }
384        unsafe { CVDisplayLinkGetNominalOutputVideoRefreshPeriod(self) }
385    }
386
387    /// Retrieves the nominal latency of a CVDisplayLink.
388    ///
389    /// This call allows one to retrieve the device's built in output latency. An NTSC device with one frame of latency might report back 1001/30000 or 2002/60000, for example.
390    ///
391    /// Parameter `displayLink`: The CVDisplayLink to get the latency period from.
392    ///
393    /// Returns: A CVTime struct that holds the latency.   This value may be indefinite.
394    #[doc(alias = "CVDisplayLinkGetOutputVideoLatency")]
395    #[cfg(feature = "CVBase")]
396    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
397    #[inline]
398    pub fn output_video_latency(&self) -> CVTime {
399        extern "C-unwind" {
400            fn CVDisplayLinkGetOutputVideoLatency(display_link: &CVDisplayLink) -> CVTime;
401        }
402        unsafe { CVDisplayLinkGetOutputVideoLatency(self) }
403    }
404
405    /// Retrieves the actual output refresh period of a display as measured by the host timebase.
406    ///
407    /// This call returns the actual output refresh period (in seconds) as computed relative to the host's timebase.
408    ///
409    /// Parameter `displayLink`: The CVDisplayLink to get the refresh period from.
410    ///
411    /// Returns: A double containing the actual refresh period.   This value may be zero if the device is not running, or is otherwise unavailable.
412    #[doc(alias = "CVDisplayLinkGetActualOutputVideoRefreshPeriod")]
413    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
414    #[inline]
415    pub fn actual_output_video_refresh_period(&self) -> c_double {
416        extern "C-unwind" {
417            fn CVDisplayLinkGetActualOutputVideoRefreshPeriod(
418                display_link: &CVDisplayLink,
419            ) -> c_double;
420        }
421        unsafe { CVDisplayLinkGetActualOutputVideoRefreshPeriod(self) }
422    }
423
424    /// Retrieves the running state of a CVDisplayLink.
425    ///
426    /// This call queries the running state of the given CVDisplayLink.
427    ///
428    /// Parameter `displayLink`: The CVDisplayLink to get the running state from.
429    ///
430    /// Returns: A boolean describing the running state. It returns true if it is running and false if it is not running or the CVDisplayLink is invalid.
431    #[doc(alias = "CVDisplayLinkIsRunning")]
432    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
433    #[inline]
434    pub fn is_running(&self) -> bool {
435        extern "C-unwind" {
436            fn CVDisplayLinkIsRunning(display_link: &CVDisplayLink) -> Boolean;
437        }
438        let ret = unsafe { CVDisplayLinkIsRunning(self) };
439        ret != 0
440    }
441
442    /// Retrieves the current ("now") time of a given CVDisplayLink
443    ///
444    /// This call may be used to get the current time of a running CVDisplayLink, outside of the output callback.
445    ///
446    /// Parameter `displayLink`: The CVDisplayLink to get the current time from.
447    ///
448    /// Parameter `outTime`: A pointer to a CVTimeStamp struct.  This struct's version field must currently be set correctly (currently 0) to indicate which version of the timestamp struct is desired.
449    ///
450    /// Returns: kCVReturnSuccess if the current time could be retrieved, otherwise an error indicating why the operation failed.
451    ///
452    /// # Safety
453    ///
454    /// `out_time` must be a valid pointer.
455    #[doc(alias = "CVDisplayLinkGetCurrentTime")]
456    #[cfg(all(feature = "CVBase", feature = "CVReturn"))]
457    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
458    #[inline]
459    pub unsafe fn current_time(&self, out_time: NonNull<CVTimeStamp>) -> CVReturn {
460        extern "C-unwind" {
461            fn CVDisplayLinkGetCurrentTime(
462                display_link: &CVDisplayLink,
463                out_time: NonNull<CVTimeStamp>,
464            ) -> CVReturn;
465        }
466        unsafe { CVDisplayLinkGetCurrentTime(self, out_time) }
467    }
468
469    /// Translates the time in the CVDisplayLink's time base from one representation to
470    /// another. Note that the device has to be running for this call to succeed.
471    ///
472    /// Parameter `displayLink`: The CVDisplayLink who's timebase should be used to do the translation.
473    ///
474    /// Parameter `inTime`: A CVTimeStamp containing the source time to be translated.
475    ///
476    /// Parameter `outTime`: A CVTimeStamp into which the target time will be written. This struct's version field must currently be set correctly
477    /// (currently 0) to indicate which version of the timestamp struct is desired.  As well, the flags field should be used to specify
478    /// which representations to translate to.
479    ///
480    /// Returns: kCVReturnSuccess if the time could be translated, otherwise an error indicating why the operation failed.
481    ///
482    /// # Safety
483    ///
484    /// - `in_time` must be a valid pointer.
485    /// - `out_time` must be a valid pointer.
486    #[doc(alias = "CVDisplayLinkTranslateTime")]
487    #[cfg(all(feature = "CVBase", feature = "CVReturn"))]
488    #[deprecated = "use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) "]
489    #[inline]
490    pub unsafe fn translate_time(
491        &self,
492        in_time: NonNull<CVTimeStamp>,
493        out_time: NonNull<CVTimeStamp>,
494    ) -> CVReturn {
495        extern "C-unwind" {
496            fn CVDisplayLinkTranslateTime(
497                display_link: &CVDisplayLink,
498                in_time: NonNull<CVTimeStamp>,
499                out_time: NonNull<CVTimeStamp>,
500            ) -> CVReturn;
501        }
502        unsafe { CVDisplayLinkTranslateTime(self, in_time, out_time) }
503    }
504}
505
506extern "C-unwind" {
507    #[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
508    #[deprecated = "renamed to `CVDisplayLink::create_with_cg_displays`"]
509    pub fn CVDisplayLinkCreateWithCGDisplays(
510        display_array: NonNull<CGDirectDisplayID>,
511        count: CFIndex,
512        display_link_out: NonNull<*mut CVDisplayLink>,
513    ) -> CVReturn;
514}
515
516extern "C-unwind" {
517    #[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
518    #[deprecated = "renamed to `CVDisplayLink::create_with_open_gl_display_mask`"]
519    pub fn CVDisplayLinkCreateWithOpenGLDisplayMask(
520        mask: CGOpenGLDisplayMask,
521        display_link_out: NonNull<*mut CVDisplayLink>,
522    ) -> CVReturn;
523}
524
525extern "C-unwind" {
526    #[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
527    #[deprecated = "renamed to `CVDisplayLink::create_with_cg_display`"]
528    pub fn CVDisplayLinkCreateWithCGDisplay(
529        display_id: CGDirectDisplayID,
530        display_link_out: NonNull<*mut CVDisplayLink>,
531    ) -> CVReturn;
532}
533
534extern "C-unwind" {
535    #[cfg(feature = "CVReturn")]
536    #[deprecated = "renamed to `CVDisplayLink::create_with_active_cg_displays`"]
537    pub fn CVDisplayLinkCreateWithActiveCGDisplays(
538        display_link_out: NonNull<*mut CVDisplayLink>,
539    ) -> CVReturn;
540}
541
542#[cfg(all(feature = "CVReturn", feature = "objc2-core-graphics"))]
543#[deprecated = "renamed to `CVDisplayLink::set_current_cg_display`"]
544#[inline]
545pub extern "C-unwind" fn CVDisplayLinkSetCurrentCGDisplay(
546    display_link: &CVDisplayLink,
547    display_id: CGDirectDisplayID,
548) -> CVReturn {
549    extern "C-unwind" {
550        fn CVDisplayLinkSetCurrentCGDisplay(
551            display_link: &CVDisplayLink,
552            display_id: CGDirectDisplayID,
553        ) -> CVReturn;
554    }
555    unsafe { CVDisplayLinkSetCurrentCGDisplay(display_link, display_id) }
556}
557
558extern "C-unwind" {
559    #[cfg(all(feature = "CVReturn", feature = "objc2-open-gl"))]
560    #[cfg(target_os = "macos")]
561    #[deprecated = "renamed to `CVDisplayLink::set_current_cg_display_from_open_gl_context`"]
562    pub fn CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(
563        display_link: &CVDisplayLink,
564        cgl_context: CGLContextObj,
565        cgl_pixel_format: CGLPixelFormatObj,
566    ) -> CVReturn;
567}
568
569#[cfg(feature = "objc2-core-graphics")]
570#[deprecated = "renamed to `CVDisplayLink::current_cg_display`"]
571#[inline]
572pub extern "C-unwind" fn CVDisplayLinkGetCurrentCGDisplay(
573    display_link: &CVDisplayLink,
574) -> CGDirectDisplayID {
575    extern "C-unwind" {
576        fn CVDisplayLinkGetCurrentCGDisplay(display_link: &CVDisplayLink) -> CGDirectDisplayID;
577    }
578    unsafe { CVDisplayLinkGetCurrentCGDisplay(display_link) }
579}
580
581extern "C-unwind" {
582    #[cfg(all(feature = "CVBase", feature = "CVReturn"))]
583    #[deprecated = "renamed to `CVDisplayLink::set_output_callback`"]
584    pub fn CVDisplayLinkSetOutputCallback(
585        display_link: &CVDisplayLink,
586        callback: CVDisplayLinkOutputCallback,
587        user_info: *mut c_void,
588    ) -> CVReturn;
589}
590
591extern "C-unwind" {
592    #[cfg(all(feature = "CVBase", feature = "CVReturn", feature = "block2"))]
593    #[deprecated = "renamed to `CVDisplayLink::set_output_handler`"]
594    pub fn CVDisplayLinkSetOutputHandler(
595        display_link: &CVDisplayLink,
596        handler: CVDisplayLinkOutputHandler,
597    ) -> CVReturn;
598}
599
600#[cfg(feature = "CVReturn")]
601#[deprecated = "renamed to `CVDisplayLink::start`"]
602#[inline]
603pub extern "C-unwind" fn CVDisplayLinkStart(display_link: &CVDisplayLink) -> CVReturn {
604    extern "C-unwind" {
605        fn CVDisplayLinkStart(display_link: &CVDisplayLink) -> CVReturn;
606    }
607    unsafe { CVDisplayLinkStart(display_link) }
608}
609
610#[cfg(feature = "CVReturn")]
611#[deprecated = "renamed to `CVDisplayLink::stop`"]
612#[inline]
613pub extern "C-unwind" fn CVDisplayLinkStop(display_link: &CVDisplayLink) -> CVReturn {
614    extern "C-unwind" {
615        fn CVDisplayLinkStop(display_link: &CVDisplayLink) -> CVReturn;
616    }
617    unsafe { CVDisplayLinkStop(display_link) }
618}
619
620#[cfg(feature = "CVBase")]
621#[deprecated = "renamed to `CVDisplayLink::nominal_output_video_refresh_period`"]
622#[inline]
623pub extern "C-unwind" fn CVDisplayLinkGetNominalOutputVideoRefreshPeriod(
624    display_link: &CVDisplayLink,
625) -> CVTime {
626    extern "C-unwind" {
627        fn CVDisplayLinkGetNominalOutputVideoRefreshPeriod(display_link: &CVDisplayLink) -> CVTime;
628    }
629    unsafe { CVDisplayLinkGetNominalOutputVideoRefreshPeriod(display_link) }
630}
631
632#[cfg(feature = "CVBase")]
633#[deprecated = "renamed to `CVDisplayLink::output_video_latency`"]
634#[inline]
635pub extern "C-unwind" fn CVDisplayLinkGetOutputVideoLatency(
636    display_link: &CVDisplayLink,
637) -> CVTime {
638    extern "C-unwind" {
639        fn CVDisplayLinkGetOutputVideoLatency(display_link: &CVDisplayLink) -> CVTime;
640    }
641    unsafe { CVDisplayLinkGetOutputVideoLatency(display_link) }
642}
643
644#[deprecated = "renamed to `CVDisplayLink::actual_output_video_refresh_period`"]
645#[inline]
646pub extern "C-unwind" fn CVDisplayLinkGetActualOutputVideoRefreshPeriod(
647    display_link: &CVDisplayLink,
648) -> c_double {
649    extern "C-unwind" {
650        fn CVDisplayLinkGetActualOutputVideoRefreshPeriod(display_link: &CVDisplayLink)
651            -> c_double;
652    }
653    unsafe { CVDisplayLinkGetActualOutputVideoRefreshPeriod(display_link) }
654}
655
656#[deprecated = "renamed to `CVDisplayLink::is_running`"]
657#[inline]
658pub extern "C-unwind" fn CVDisplayLinkIsRunning(display_link: &CVDisplayLink) -> bool {
659    extern "C-unwind" {
660        fn CVDisplayLinkIsRunning(display_link: &CVDisplayLink) -> Boolean;
661    }
662    let ret = unsafe { CVDisplayLinkIsRunning(display_link) };
663    ret != 0
664}
665
666extern "C-unwind" {
667    #[cfg(all(feature = "CVBase", feature = "CVReturn"))]
668    #[deprecated = "renamed to `CVDisplayLink::current_time`"]
669    pub fn CVDisplayLinkGetCurrentTime(
670        display_link: &CVDisplayLink,
671        out_time: NonNull<CVTimeStamp>,
672    ) -> CVReturn;
673}
674
675extern "C-unwind" {
676    #[cfg(all(feature = "CVBase", feature = "CVReturn"))]
677    #[deprecated = "renamed to `CVDisplayLink::translate_time`"]
678    pub fn CVDisplayLinkTranslateTime(
679        display_link: &CVDisplayLink,
680        in_time: NonNull<CVTimeStamp>,
681        out_time: NonNull<CVTimeStamp>,
682    ) -> CVReturn;
683}