CVDisplayLink

Struct CVDisplayLink 

Source
pub struct CVDisplayLink { /* private fields */ }
Available on crate feature CVDisplayLink only.
Expand description

Implementations§

Source

pub unsafe fn create_with_cg_displays( display_array: NonNull<CGDirectDisplayID>, count: CFIndex, display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVReturn and objc2-core-graphics only.

General call to create a CVDisplayLink

Use this call to create a CVDisplayLink for a set of displays indentified by the CGDirectDisplayIDs.

Parameter displayArray: array of CGDirectDisplayIDs

Parameter count: number of displays in the displayArray

Parameter displayLinkOut: The new display link will be returned here

Returns: returns kCVReturnSuccess on success.

§Safety
  • display_array must be a valid pointer.
  • display_link_out must be a valid pointer.
Source

pub unsafe fn create_with_open_gl_display_mask( mask: CGOpenGLDisplayMask, display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVReturn and objc2-core-graphics only.

Convenience call to create a CVDisplayLink from an OpenGL display mask.

Use this call to create a CVDisplayLink for a CGOpenGLDisplayMask.

Parameter mask: CGOpenGLDisplayMask describing the display

Parameter displayLinkOut: The new display link will be returned here

Returns: returns kCVReturnSuccess on success.

§Safety

display_link_out must be a valid pointer.

Source

pub unsafe fn create_with_cg_display( display_id: CGDirectDisplayID, display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVReturn and objc2-core-graphics only.

Convenience call to create a CVDisplayLink for a single CGDirectDisplay.

Use this call to create a CVDisplayLink for a single CGDirectDisplay.

Parameter displayID: CGDirectDisplayID of the target display

Parameter displayLinkOut: The new display link will be returned here

Returns: returns kCVReturnSuccess on success.

§Safety

display_link_out must be a valid pointer.

Source

pub unsafe fn create_with_active_cg_displays( display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate feature CVReturn only.

Convenience function to create a CVDisplayLink capable of being used with all active CGDisplays

Parameter displayLinkOut: The newly created CVDisplayLink

Returns: kCVReturnSuccess if the device was created, or failure

§Safety

display_link_out must be a valid pointer.

Source

pub fn set_current_cg_display(&self, display_id: CGDirectDisplayID) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVReturn and objc2-core-graphics only.

Sets the current display of a DisplayLink

It is safe to call this with a running display link, but be aware that there will likely be a timestamp discontinuity in the video time stamp

Parameter displayLink: target CVDisplayLinkRef

Parameter displayID: target CGDirectDisplayID

Returns: CVReturn. kCVReturnSuccess if successfull.

Source

pub unsafe fn set_current_cg_display_from_open_gl_context( &self, cgl_context: CGLContextObj, cgl_pixel_format: CGLPixelFormatObj, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate feature CVReturn and crate feature objc2-open-gl and macOS only.

Convenience function to select a CVDisplayLink most optimal for the current renderer of the passed in OpenGL context

Parameter displayLink: The CVDisplayLink for which you want to set the current CGDisplay

Parameter cglContext: The OpenGL context to retrieve the current renderer from.

Parameter cglPixelFormat: The OpenGL pixel format used to create the passed in OpenGL context

Returns: kCVReturnSuccess if a device was found, or failure.

§Safety
  • cgl_context must be a valid pointer.
  • cgl_pixel_format must be a valid pointer.
Source

pub fn current_cg_display(&self) -> CGDirectDisplayID

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate feature objc2-core-graphics only.

Gets the current display of a DisplayLink

(description)

Parameter displayLink: target CVDisplayLinkRef

Returns: CGDirectDisplayID

Source

pub unsafe fn set_output_callback( &self, callback: CVDisplayLinkOutputCallback, user_info: *mut c_void, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVBase and CVReturn only.

Set the renderer output callback function

The DisplayLink will invoke this callback whenever it wants you to output a frame.

Parameter displayLink: target CVDisplayLinkRef

Parameter callback: CVDisplayLinkOutputCallback function

Parameter userInfo: User data for the callback to identify the context.

Returns: CVReturn. kCVReturnSuccess if successfull.

§Safety
  • callback must be implemented correctly.
  • user_info must be a valid pointer or null.
Source

pub unsafe fn set_output_handler( &self, handler: CVDisplayLinkOutputHandler, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVBase and CVReturn and block2 only.

Set the renderer output callback block

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.

Parameter displayLink: target CVDisplayLinkRef

Parameter handler: CVDisplayLinkOutputHandler block

Returns: CVReturn. kCVReturnSuccess if successful.

§Safety

handler must be a valid pointer.

Source

pub fn start(&self) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate feature CVReturn only.

Start timer for DisplayLink

This call should not be made from inside the CVDisplayLinkOutputCallback

Parameter displayLink: target CVDisplayLinkRef

Returns: CVReturn. kCVReturnSuccess if successfull. kCVReturnDisplayLinkCallbacksNotSet The DisplayLink cannot be started until the output callback is set.

Source

pub fn stop(&self) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate feature CVReturn only.

Stop timer for DisplayLink

(description)

Parameter displayLink: target CVDisplayLinkRef

Returns: CVReturn. kCVReturnSuccess if successfull.

Source

pub fn nominal_output_video_refresh_period(&self) -> CVTime

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate feature CVBase only.

Retrieves the nominal refresh period of a CVDisplayLink.

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.

Parameter displayLink: The CVDisplayLink to get the refresh period from.

Returns: A CVTime struct that holds the nominal refresh period. This value may be indefinite.

Source

pub fn output_video_latency(&self) -> CVTime

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate feature CVBase only.

Retrieves the nominal latency of a CVDisplayLink.

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.

Parameter displayLink: The CVDisplayLink to get the latency period from.

Returns: A CVTime struct that holds the latency. This value may be indefinite.

Source

pub fn actual_output_video_refresh_period(&self) -> c_double

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)

Retrieves the actual output refresh period of a display as measured by the host timebase.

This call returns the actual output refresh period (in seconds) as computed relative to the host’s timebase.

Parameter displayLink: The CVDisplayLink to get the refresh period from.

Returns: A double containing the actual refresh period. This value may be zero if the device is not running, or is otherwise unavailable.

Source

pub fn is_running(&self) -> bool

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)

Retrieves the running state of a CVDisplayLink.

This call queries the running state of the given CVDisplayLink.

Parameter displayLink: The CVDisplayLink to get the running state from.

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.

Source

pub unsafe fn current_time(&self, out_time: NonNull<CVTimeStamp>) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVBase and CVReturn only.

Retrieves the current (“now”) time of a given CVDisplayLink

This call may be used to get the current time of a running CVDisplayLink, outside of the output callback.

Parameter displayLink: The CVDisplayLink to get the current time from.

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.

Returns: kCVReturnSuccess if the current time could be retrieved, otherwise an error indicating why the operation failed.

§Safety

out_time must be a valid pointer.

Source

pub unsafe fn translate_time( &self, in_time: NonNull<CVTimeStamp>, out_time: NonNull<CVTimeStamp>, ) -> CVReturn

👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
Available on crate features CVBase and CVReturn only.

Translates the time in the CVDisplayLink’s time base from one representation to another. Note that the device has to be running for this call to succeed.

Parameter displayLink: The CVDisplayLink who’s timebase should be used to do the translation.

Parameter inTime: A CVTimeStamp containing the source time to be translated.

Parameter outTime: A CVTimeStamp into which the target time will be written. This struct’s version field must currently be set correctly (currently 0) to indicate which version of the timestamp struct is desired. As well, the flags field should be used to specify which representations to translate to.

Returns: kCVReturnSuccess if the time could be translated, otherwise an error indicating why the operation failed.

§Safety
  • in_time must be a valid pointer.
  • out_time must be a valid pointer.

Methods from Deref<Target = CFType>§

Source

pub fn downcast_ref<T>(&self) -> Option<&T>
where T: ConcreteType,

Attempt to downcast the type to that of type T.

This is the reference-variant. Use CFRetained::downcast if you want to convert a retained type. See also ConcreteType for more details on which types support being converted to.

Source

pub fn retain_count(&self) -> usize

Get the reference count of the object.

This function may be useful for debugging. You normally do not use this function otherwise.

Beware that some things (like CFNumbers, small CFStrings etc.) may not have a normal retain count for optimization purposes, and can return usize::MAX in that case.

Trait Implementations§

Source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

fn as_ref(&self) -> &CFType

Converts this type into a shared reference of the (usually inferred) input type.
Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

fn borrow(&self) -> &CFType

Immutably borrows from an owned value. Read more
Source§

fn type_id() -> CFTypeID

Get the unique CFTypeID identifier for the type. Read more
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

type Target = CFType

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

fn retain(&self) -> Retained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

const ENCODING_REF: Encoding

The Objective-C type-encoding for a reference of this type. Read more
Source§

fn retain(&self) -> CFRetained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

fn as_concrete_TypeRef(&self) -> &Self

👎Deprecated: this is redundant
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::retain
Helper for easier transition from the core-foundation crate. Read more
Source§

fn as_CFTypeRef(&self) -> &CFType
where Self: AsRef<CFType>,

👎Deprecated: this is redundant (CF types deref to CFType)
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::from_raw
Helper for easier transition from the core-foundation crate. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,