pub struct AVSampleBufferDisplayLayer { /* private fields */ }AVSampleBufferDisplayLayer and crate feature objc2-quartz-core and non-watchOS only.Expand description
Implementations§
Source§impl AVSampleBufferDisplayLayer
impl AVSampleBufferDisplayLayer
Sourcepub unsafe fn controlTimebase(&self) -> Option<Retained<CMTimebase>>
Available on crate feature objc2-core-media only.
pub unsafe fn controlTimebase(&self) -> Option<Retained<CMTimebase>>
objc2-core-media only.The layer’s control timebase, which governs how time stamps are interpreted.
By default, this property is NULL, in which case time stamps will be interpreted according to the host time clock (mach_absolute_time with the appropriate timescale conversion; this is the same as Core Animation’s CACurrentMediaTime). With no control timebase, once frames are enqueued, it is not possible to adjust exactly when they are displayed.
If a non-NULL control timebase is set, it will be used to interpret time stamps. You can control the timing of frame display by setting the rate and time of the control timebase. If you are synchronizing video to audio, you can use a timebase whose source clock is a CMAudioDeviceClock for the appropriate audio device to prevent drift.
Note that prior to OSX 10.10 and iOS 8.0, the control timebase could not be changed after enqueueSampleBuffer: was called. As of OSX 10.10 and iOS 8.0, the control timebase may be changed at any time.
Sourcepub unsafe fn setControlTimebase(&self, control_timebase: Option<&CMTimebase>)
Available on crate feature objc2-core-media only.
pub unsafe fn setControlTimebase(&self, control_timebase: Option<&CMTimebase>)
objc2-core-media only.Setter for controlTimebase.
Sourcepub unsafe fn videoGravity(&self) -> Retained<AVLayerVideoGravity>
Available on crate feature AVAnimation only.
pub unsafe fn videoGravity(&self) -> Retained<AVLayerVideoGravity>
AVAnimation only.A string defining how the video is displayed within an AVSampleBufferDisplayLayer bounds rect.
Options are AVLayerVideoGravityResizeAspect, AVLayerVideoGravityResizeAspectFill and AVLayerVideoGravityResize. AVLayerVideoGravityResizeAspect is default. See <AVFoundation /AVAnimation.h> for a description of these options.
Sourcepub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity)
Available on crate feature AVAnimation only.
pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity)
AVAnimation only.Setter for videoGravity.
This is copied when set.
Sourcepub unsafe fn isReadyForDisplay(&self) -> bool
pub unsafe fn isReadyForDisplay(&self) -> bool
Boolean indicating that the first video frame has been made ready for display.
Use this property as an indicator of when best to show or animate-in an AVSampleBufferDisplayLayer into view. An AVSampleBufferDisplayLayer may be displayed, or made visible, while this property is NO, however the layer will not have any user-visible content until the value becomes YES. Note that if an animation is added to an AVSampleBufferDisplayLayer before it becomes readyForDisplay the video image displayed inside might not animate with the receiver. readyForDisplay will change to NO when the layer can no longer display frames. readyForDisplay will be YES when the first video frame has been made ready for display. This property is not key-value observable. AVSampleBufferDisplayLayerReadyForDisplayDidChangeNotification is posted when this value changes.
Source§impl AVSampleBufferDisplayLayer
Methods declared on superclass CALayer.
impl AVSampleBufferDisplayLayer
Methods declared on superclass CALayer.
Source§impl AVSampleBufferDisplayLayer
Methods declared on superclass NSObject.
impl AVSampleBufferDisplayLayer
Methods declared on superclass NSObject.
Source§impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerQueueManagement.
impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerQueueManagement.
Sourcepub unsafe fn timebase(&self) -> Retained<CMTimebase>
👎Deprecated: Use sampleBufferRenderer’s timebase insteadAvailable on crate feature objc2-core-media only.
pub unsafe fn timebase(&self) -> Retained<CMTimebase>
objc2-core-media only.The renderer’s timebase, which governs how time stamps are interpreted.
The timebase is used to interpret time stamps.
The timebase is read-only. Use the AVSampleBufferRenderSynchronizer to set the rate or time.
Sourcepub unsafe fn status(&self) -> AVQueuedSampleBufferRenderingStatus
👎Deprecated: Use sampleBufferRenderer’s status insteadAvailable on crate feature AVQueuedSampleBufferRendering only.
pub unsafe fn status(&self) -> AVQueuedSampleBufferRenderingStatus
AVQueuedSampleBufferRendering only.The ability of the display layer to be used for enqueuing sample buffers.
The value of this property is an AVQueuedSampleBufferRenderingStatus that indicates whether the receiver can be used for enqueuing and rendering sample buffers. When the value of this property is AVQueuedSampleBufferRenderingStatusFailed, clients can check the value of the error property to determine the failure. To resume rendering sample buffers using the display layer after a failure, clients must first reset the status to AVQueuedSampleBufferRenderingStatusUnknown. This can be achieved by invoking -flush on the display layer.
This property is key value observable.
Sourcepub unsafe fn error(&self) -> Option<Retained<NSError>>
👎Deprecated: Use sampleBufferRenderer’s error instead
pub unsafe fn error(&self) -> Option<Retained<NSError>>
If the display layer’s status is AVQueuedSampleBufferRenderingStatusFailed, this describes the error that caused the failure.
The value of this property is an NSError that describes what caused the display layer to no longer be able to enqueue sample buffers. If the status is not AVQueuedSampleBufferRenderingStatusFailed, the value of this property is nil.
Sourcepub unsafe fn enqueueSampleBuffer(&self, sample_buffer: &CMSampleBuffer)
👎Deprecated: Use sampleBufferRenderer’s enqueueSampleBuffer: insteadAvailable on crate feature objc2-core-media only.
pub unsafe fn enqueueSampleBuffer(&self, sample_buffer: &CMSampleBuffer)
objc2-core-media only.Sends a sample buffer for display.
If sampleBuffer has the kCMSampleAttachmentKey_DoNotDisplay attachment set to kCFBooleanTrue, the frame will be decoded but not displayed. Otherwise, if sampleBuffer has the kCMSampleAttachmentKey_DisplayImmediately attachment set to kCFBooleanTrue, the decoded image will be displayed as soon as possible, replacing all previously enqueued images regardless of their timestamps. Otherwise, the decoded image will be displayed at sampleBuffer’s output presentation timestamp, as interpreted by the control timebase (or the mach_absolute_time timeline if there is no control timebase).
To schedule the removal of previous images at a specific timestamp, enqueue a marker sample buffer containing no samples, with the kCMSampleBufferAttachmentKey_EmptyMedia attachment set to kCFBooleanTrue.
IMPORTANT NOTE: attachments with the kCMSampleAttachmentKey_ prefix must be set via CMSampleBufferGetSampleAttachmentsArray and CFDictionarySetValue. Attachments with the kCMSampleBufferAttachmentKey_ prefix must be set via CMSetAttachment.
IMPORTANT NOTE: When using CMSampleBuffers that wrap CVPixelBuffer, it is important that such CVPixelBuffers be IOSurface-backed. CoreVideo allocates IOSurface-backed CVPixelBuffers when the pixel buffer attribute dictionary passed to CVPixelBufferPoolCreate contains an entry with key kCVPixelBufferIOSurfacePropertiesKey and value being a dictionary (which can be an empty dictionary).
The combination of either a non-NULL controlTimebase or an AVSampleBufferRenderSynchronizer with the use of kCMSampleAttachmentKey_DisplayImmediately as an attachment to the CMSampleBuffers that are enqueued for display is not recommended.
Sourcepub unsafe fn flush(&self)
👎Deprecated: Use sampleBufferRenderer’s flush instead
pub unsafe fn flush(&self)
Instructs the layer to discard pending enqueued sample buffers.
It is not possible to determine which sample buffers have been decoded, so the next frame passed to enqueueSampleBuffer: should be an IDR frame (also known as a key frame or sync sample).
Sourcepub unsafe fn flushAndRemoveImage(&self)
👎Deprecated: Use sampleBufferRenderer’s flushWithRemovalOfDisplayedImage:completionHandler: instead
pub unsafe fn flushAndRemoveImage(&self)
Instructs the layer to discard pending enqueued sample buffers and remove any currently displayed image.
It is not possible to determine which sample buffers have been decoded, so the next frame passed to enqueueSampleBuffer: should be an IDR frame (also known as a key frame or sync sample).
Sourcepub unsafe fn requiresFlushToResumeDecoding(&self) -> bool
👎Deprecated: Use sampleBufferRenderer’s requiresFlushToResumeDecoding instead
pub unsafe fn requiresFlushToResumeDecoding(&self) -> bool
Indicates that the receiver is in a state where it requires a call to -flush to continue decoding frames.
When the application enters a state where use of video decoder resources is not permissible, the value of this property changes to YES along with the display layer’s status changing to AVQueuedSampleBufferRenderingStatusFailed. To resume rendering sample buffers using the display layer after this property’s value is YES, clients must first reset the display layer’s status to AVQueuedSampleBufferRenderingStatusUnknown. This can be achieved by invoking -flush on the display layer. Clients can track changes to this property via AVSampleBufferDisplayLayerRequiresFlushToResumeDecodingDidChangeNotification. This property is not key value observable.
Sourcepub unsafe fn isReadyForMoreMediaData(&self) -> bool
👎Deprecated: Use sampleBufferRenderer’s readyForMoreMediaData instead
pub unsafe fn isReadyForMoreMediaData(&self) -> bool
Indicates the readiness of the layer to accept more sample buffers.
AVSampleBufferDisplayLayer keeps track of the occupancy levels of its internal queues for the benefit of clients that enqueue sample buffers from non-real-time sources – i.e., clients that can supply sample buffers faster than they are consumed, and so need to decide when to hold back.
Clients enqueueing sample buffers from non-real-time sources may hold off from generating or obtaining more sample buffers to enqueue when the value of readyForMoreMediaData is NO.
It is safe to call enqueueSampleBuffer: when readyForMoreMediaData is NO, but it is a bad idea to enqueue sample buffers without bound.
To help with control of the non-real-time supply of sample buffers, such clients can use -requestMediaDataWhenReadyOnQueue:usingBlock in order to specify a block that the layer should invoke whenever it’s ready for sample buffers to be appended.
The value of readyForMoreMediaData will often change from NO to YES asynchronously, as previously supplied sample buffers are decoded and displayed.
This property is not key value observable.
Sourcepub unsafe fn requestMediaDataWhenReadyOnQueue_usingBlock(
&self,
queue: &DispatchQueue,
block: &DynBlock<dyn Fn()>,
)
👎Deprecated: Use sampleBufferRenderer’s requestMediaDataWhenReadyOnQueue:usingBlock: insteadAvailable on crate features block2 and dispatch2 only.
pub unsafe fn requestMediaDataWhenReadyOnQueue_usingBlock( &self, queue: &DispatchQueue, block: &DynBlock<dyn Fn()>, )
block2 and dispatch2 only.Instructs the target to invoke a client-supplied block repeatedly, at its convenience, in order to gather sample buffers for display.
The block should enqueue sample buffers to the layer either until the layer’s readyForMoreMediaData property becomes NO or until there is no more data to supply. When the layer has decoded enough of the media data it has received that it becomes ready for more media data again, it will invoke the block again in order to obtain more. If this function is called multiple times, only the last call is effective. Call stopRequestingMediaData to cancel this request. Each call to requestMediaDataWhenReadyOnQueue:usingBlock: should be paired with a corresponding call to stopRequestingMediaData:. Releasing the AVSampleBufferDisplayLayer without a call to stopRequestingMediaData will result in undefined behavior.
§Safety
queuepossibly has additional threading requirements.blockblock must be sendable.
Sourcepub unsafe fn stopRequestingMediaData(&self)
👎Deprecated: Use sampleBufferRenderer’s stopRequestingMediaData instead
pub unsafe fn stopRequestingMediaData(&self)
Cancels any current requestMediaDataWhenReadyOnQueue:usingBlock: call.
This method may be called from outside the block or from within the block.
Sourcepub unsafe fn hasSufficientMediaDataForReliablePlaybackStart(&self) -> bool
👎Deprecated: Use sampleBufferRenderer’s hasSufficientMediaDataForReliablePlaybackStart instead
pub unsafe fn hasSufficientMediaDataForReliablePlaybackStart(&self) -> bool
Indicates whether the enqueued media data meets the renderer’s preroll level.
Clients should fetch the value of this property to learn if the renderer has had enough media data enqueued to start playback reliably. Starting playback when this property is NO may prevent smooth playback following an immediate start.
Source§impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerImageProtection.
impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerImageProtection.
Sourcepub unsafe fn preventsCapture(&self) -> bool
pub unsafe fn preventsCapture(&self) -> bool
Indicates that image data should be protected from capture.
Sourcepub unsafe fn setPreventsCapture(&self, prevents_capture: bool)
pub unsafe fn setPreventsCapture(&self, prevents_capture: bool)
Setter for preventsCapture.
Source§impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerVideoDisplaySleepPrevention.
impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerVideoDisplaySleepPrevention.
Sourcepub unsafe fn preventsDisplaySleepDuringVideoPlayback(&self) -> bool
pub unsafe fn preventsDisplaySleepDuringVideoPlayback(&self) -> bool
Indicates whether video playback prevents display and device sleep.
Default is YES on iOS, tvOS and in Mac Catalyst apps. Default is NO on macOS. Setting this property to NO does not force the display to sleep, it simply stops preventing display sleep. Other apps or frameworks within your app may still be preventing display sleep for various reasons. Note: If sample buffers are being enqueued for playback at the user’s request, you should ensure that the value of this property is set to YES. If video is not being displayed as part of the user’s primary focus, you should ensure that the value of this property is set to NO.
Sourcepub unsafe fn setPreventsDisplaySleepDuringVideoPlayback(
&self,
prevents_display_sleep_during_video_playback: bool,
)
pub unsafe fn setPreventsDisplaySleepDuringVideoPlayback( &self, prevents_display_sleep_during_video_playback: bool, )
Setter for preventsDisplaySleepDuringVideoPlayback.
Source§impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerAutomaticBackgroundPrevention.
impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerAutomaticBackgroundPrevention.
Sourcepub unsafe fn preventsAutomaticBackgroundingDuringVideoPlayback(&self) -> bool
pub unsafe fn preventsAutomaticBackgroundingDuringVideoPlayback(&self) -> bool
Indicates whether video playback prevents the app from automatically getting backgrounded.
Default is YES. Setting this property to YES prevents an application that is playing video from automatically getting backgrounded. This property does not prevent the user from backgrounding the application. Note: If sample buffers are being enqueued for playback at the user’s request, you should ensure that the value of this property is set to YES. If video is not being displayed as part of the user’s primary focus, you should ensure that the value of this property is set to NO.
Sourcepub unsafe fn setPreventsAutomaticBackgroundingDuringVideoPlayback(
&self,
prevents_automatic_backgrounding_during_video_playback: bool,
)
pub unsafe fn setPreventsAutomaticBackgroundingDuringVideoPlayback( &self, prevents_automatic_backgrounding_during_video_playback: bool, )
Source§impl AVSampleBufferDisplayLayer
ProtectedContent.
impl AVSampleBufferDisplayLayer
ProtectedContent.
Sourcepub unsafe fn outputObscuredDueToInsufficientExternalProtection(&self) -> bool
pub unsafe fn outputObscuredDueToInsufficientExternalProtection(&self) -> bool
Whether or not decoded output is being obscured due to insufficient external protection.
The value of this property indicates whether the layer is purposefully obscuring its visual output because the requirement for an external protection mechanism is not met by the current device configuration. The change of this property can be observed through AVSampleBufferDisplayLayerOutputObscuredDueToInsufficientExternalProtectionDidChangeNotification
It is highly recommended that clients whose content requires external protection observe this property and set the playback rate to zero and display an appropriate user interface when the value changes to YES.
Note that the value of this property is dependent on the external protection requirements of the media being displayed by the layer. These requirements are inherent to the content itself and cannot be externally specified. If the content does not require external protection, the value of this property will be NO.
Source§impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerRenderer.
impl AVSampleBufferDisplayLayer
AVSampleBufferDisplayLayerRenderer.
Sourcepub unsafe fn sampleBufferRenderer(
&self,
) -> Retained<AVSampleBufferVideoRenderer>
Available on crate feature AVSampleBufferVideoRenderer only.
pub unsafe fn sampleBufferRenderer( &self, ) -> Retained<AVSampleBufferVideoRenderer>
AVSampleBufferVideoRenderer only.An AVSampleBufferVideoRenderer instance that allows enqueuing sample buffers for rendering.
Although AVSampleBufferDisplayLayer conforms to the AVQueuedSampleBufferRendering protocol, the sampleBufferRenderer should be used to enqueue sample buffers. sampleBufferRenderer allows the client to safely enqueue sample buffers from a background thread. NOTE: Do not use AVSampleBufferDisplayLayer’s AVQueuedSampleBufferRendering functions when using sampleBufferRenderer.
Methods from Deref<Target = CALayer>§
pub unsafe fn presentationLayer(&self) -> Option<Retained<CALayer>>
pub unsafe fn modelLayer(&self) -> Retained<CALayer>
pub fn shouldArchiveValueForKey(&self, key: &NSString) -> bool
pub fn isHidden(&self) -> bool
pub fn isDoubleSided(&self) -> bool
Sourcepub fn setDoubleSided(&self, double_sided: bool)
pub fn setDoubleSided(&self, double_sided: bool)
Setter for isDoubleSided.
pub fn isGeometryFlipped(&self) -> bool
Sourcepub fn setGeometryFlipped(&self, geometry_flipped: bool)
pub fn setGeometryFlipped(&self, geometry_flipped: bool)
Setter for isGeometryFlipped.
pub fn contentsAreFlipped(&self) -> bool
pub fn superlayer(&self) -> Option<Retained<CALayer>>
pub fn removeFromSuperlayer(&self)
pub unsafe fn sublayers(&self) -> Option<Retained<NSArray<CALayer>>>
Sourcepub unsafe fn setSublayers(&self, sublayers: Option<&NSArray<CALayer>>)
pub unsafe fn setSublayers(&self, sublayers: Option<&NSArray<CALayer>>)
pub fn addSublayer(&self, layer: &CALayer)
pub fn insertSublayer_atIndex(&self, layer: &CALayer, idx: u32)
pub fn insertSublayer_below(&self, layer: &CALayer, sibling: Option<&CALayer>)
pub fn insertSublayer_above(&self, layer: &CALayer, sibling: Option<&CALayer>)
pub unsafe fn replaceSublayer_with( &self, old_layer: &CALayer, new_layer: &CALayer, )
pub fn mask(&self) -> Option<Retained<CALayer>>
pub fn masksToBounds(&self) -> bool
Sourcepub fn setMasksToBounds(&self, masks_to_bounds: bool)
pub fn setMasksToBounds(&self, masks_to_bounds: bool)
Setter for masksToBounds.
Sourcepub unsafe fn contents(&self) -> Option<Retained<AnyObject>>
pub unsafe fn contents(&self) -> Option<Retained<AnyObject>>
Layer content properties and methods. *
Sourcepub unsafe fn setContents(&self, contents: Option<&AnyObject>)
pub unsafe fn setContents(&self, contents: Option<&AnyObject>)
pub fn contentsGravity(&self) -> Retained<NSString>
Sourcepub fn setContentsGravity(&self, contents_gravity: &NSString)
pub fn setContentsGravity(&self, contents_gravity: &NSString)
Setter for contentsGravity.
This is copied when set.
pub fn contentsFormat(&self) -> Retained<NSString>
Sourcepub fn setContentsFormat(&self, contents_format: &NSString)
pub fn setContentsFormat(&self, contents_format: &NSString)
Setter for contentsFormat.
This is copied when set.
pub fn wantsExtendedDynamicRangeContent(&self) -> bool
Sourcepub fn setWantsExtendedDynamicRangeContent(
&self,
wants_extended_dynamic_range_content: bool,
)
👎Deprecated: Use preferredDynamicRange instead
pub fn setWantsExtendedDynamicRangeContent( &self, wants_extended_dynamic_range_content: bool, )
Setter for wantsExtendedDynamicRangeContent.
pub fn toneMapMode(&self) -> Retained<NSString>
Sourcepub fn setToneMapMode(&self, tone_map_mode: &NSString)
pub fn setToneMapMode(&self, tone_map_mode: &NSString)
Setter for toneMapMode.
This is copied when set.
pub fn preferredDynamicRange(&self) -> Retained<NSString>
Sourcepub fn setPreferredDynamicRange(&self, preferred_dynamic_range: &NSString)
pub fn setPreferredDynamicRange(&self, preferred_dynamic_range: &NSString)
Setter for preferredDynamicRange.
This is copied when set.
pub fn wantsDynamicContentScaling(&self) -> bool
Sourcepub fn setWantsDynamicContentScaling(&self, wants_dynamic_content_scaling: bool)
pub fn setWantsDynamicContentScaling(&self, wants_dynamic_content_scaling: bool)
Setter for wantsDynamicContentScaling.
pub fn minificationFilter(&self) -> Retained<NSString>
Sourcepub fn setMinificationFilter(&self, minification_filter: &NSString)
pub fn setMinificationFilter(&self, minification_filter: &NSString)
Setter for minificationFilter.
This is copied when set.
pub fn magnificationFilter(&self) -> Retained<NSString>
Sourcepub fn setMagnificationFilter(&self, magnification_filter: &NSString)
pub fn setMagnificationFilter(&self, magnification_filter: &NSString)
Setter for magnificationFilter.
This is copied when set.
pub fn minificationFilterBias(&self) -> f32
Sourcepub fn setMinificationFilterBias(&self, minification_filter_bias: f32)
pub fn setMinificationFilterBias(&self, minification_filter_bias: f32)
Setter for minificationFilterBias.
pub fn isOpaque(&self) -> bool
pub fn display(&self)
pub fn setNeedsDisplay(&self)
pub fn needsDisplay(&self) -> bool
pub fn displayIfNeeded(&self)
pub fn needsDisplayOnBoundsChange(&self) -> bool
Sourcepub fn setNeedsDisplayOnBoundsChange(
&self,
needs_display_on_bounds_change: bool,
)
pub fn setNeedsDisplayOnBoundsChange( &self, needs_display_on_bounds_change: bool, )
Setter for needsDisplayOnBoundsChange.
pub fn drawsAsynchronously(&self) -> bool
Sourcepub fn setDrawsAsynchronously(&self, draws_asynchronously: bool)
pub fn setDrawsAsynchronously(&self, draws_asynchronously: bool)
Setter for drawsAsynchronously.
pub fn edgeAntialiasingMask(&self) -> CAEdgeAntialiasingMask
Sourcepub fn setEdgeAntialiasingMask(
&self,
edge_antialiasing_mask: CAEdgeAntialiasingMask,
)
pub fn setEdgeAntialiasingMask( &self, edge_antialiasing_mask: CAEdgeAntialiasingMask, )
Setter for edgeAntialiasingMask.
pub fn allowsEdgeAntialiasing(&self) -> bool
Sourcepub fn setAllowsEdgeAntialiasing(&self, allows_edge_antialiasing: bool)
pub fn setAllowsEdgeAntialiasing(&self, allows_edge_antialiasing: bool)
Setter for allowsEdgeAntialiasing.
pub fn maskedCorners(&self) -> CACornerMask
Sourcepub fn setMaskedCorners(&self, masked_corners: CACornerMask)
pub fn setMaskedCorners(&self, masked_corners: CACornerMask)
Setter for maskedCorners.
pub fn cornerCurve(&self) -> Retained<NSString>
Sourcepub fn setCornerCurve(&self, corner_curve: &NSString)
pub fn setCornerCurve(&self, corner_curve: &NSString)
Setter for cornerCurve.
This is copied when set.
pub fn opacity(&self) -> f32
Sourcepub fn setOpacity(&self, opacity: f32)
pub fn setOpacity(&self, opacity: f32)
Setter for opacity.
pub fn allowsGroupOpacity(&self) -> bool
Sourcepub fn setAllowsGroupOpacity(&self, allows_group_opacity: bool)
pub fn setAllowsGroupOpacity(&self, allows_group_opacity: bool)
Setter for allowsGroupOpacity.
pub fn compositingFilter(&self) -> Option<Retained<AnyObject>>
Sourcepub unsafe fn setCompositingFilter(
&self,
compositing_filter: Option<&AnyObject>,
)
pub unsafe fn setCompositingFilter( &self, compositing_filter: Option<&AnyObject>, )
pub fn filters(&self) -> Option<Retained<NSArray>>
Sourcepub unsafe fn setFilters(&self, filters: Option<&NSArray>)
pub unsafe fn setFilters(&self, filters: Option<&NSArray>)
pub fn backgroundFilters(&self) -> Option<Retained<NSArray>>
Sourcepub unsafe fn setBackgroundFilters(&self, background_filters: Option<&NSArray>)
pub unsafe fn setBackgroundFilters(&self, background_filters: Option<&NSArray>)
Setter for backgroundFilters.
This is copied when set.
§Safety
background_filters generic should be of the correct type.
pub fn shouldRasterize(&self) -> bool
Sourcepub fn setShouldRasterize(&self, should_rasterize: bool)
pub fn setShouldRasterize(&self, should_rasterize: bool)
Setter for shouldRasterize.
pub fn shadowOpacity(&self) -> f32
Sourcepub fn setShadowOpacity(&self, shadow_opacity: f32)
pub fn setShadowOpacity(&self, shadow_opacity: f32)
Setter for shadowOpacity.
Sourcepub fn autoresizingMask(&self) -> CAAutoresizingMask
pub fn autoresizingMask(&self) -> CAAutoresizingMask
Layout methods. *
Sourcepub fn setAutoresizingMask(&self, autoresizing_mask: CAAutoresizingMask)
pub fn setAutoresizingMask(&self, autoresizing_mask: CAAutoresizingMask)
Setter for autoresizingMask.
pub fn layoutManager( &self, ) -> Option<Retained<ProtocolObject<dyn CALayoutManager>>>
Sourcepub fn setLayoutManager(
&self,
layout_manager: Option<&ProtocolObject<dyn CALayoutManager>>,
)
pub fn setLayoutManager( &self, layout_manager: Option<&ProtocolObject<dyn CALayoutManager>>, )
Setter for layoutManager.
pub fn setNeedsLayout(&self)
pub fn needsLayout(&self) -> bool
pub fn layoutIfNeeded(&self)
pub fn layoutSublayers(&self)
pub fn actionForKey( &self, event: &NSString, ) -> Option<Retained<ProtocolObject<dyn CAAction>>>
pub fn actions( &self, ) -> Option<Retained<NSDictionary<NSString, ProtocolObject<dyn CAAction>>>>
Sourcepub fn setActions(
&self,
actions: Option<&NSDictionary<NSString, ProtocolObject<dyn CAAction>>>,
)
pub fn setActions( &self, actions: Option<&NSDictionary<NSString, ProtocolObject<dyn CAAction>>>, )
pub fn removeAllAnimations(&self)
pub fn removeAnimationForKey(&self, key: &NSString)
pub fn animationKeys(&self) -> Option<Retained<NSArray<NSString>>>
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn CALayerDelegate>>>
Sourcepub fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn CALayerDelegate>>,
)
pub fn setDelegate( &self, delegate: Option<&ProtocolObject<dyn CALayerDelegate>>, )
Setter for delegate.
This is a weak property.
pub fn style(&self) -> Option<Retained<NSDictionary>>
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init/new methods).
§Example
Check that an instance of NSObject has the precise class NSObject.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load instead.Use Ivar::load instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T.
See Ivar::load_ptr for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T.
This is the reference-variant. Use Retained::downcast if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString to a NSMutableString,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass: for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject.
§Panics
This works internally by calling isKindOfClass:. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject and
NSProxy implement this method.
§Examples
Cast an NSString back and forth from NSObject.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();Try (and fail) to cast an NSObject to an NSString.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}Trait Implementations§
Source§impl AVQueuedSampleBufferRendering for AVSampleBufferDisplayLayer
impl AVQueuedSampleBufferRendering for AVSampleBufferDisplayLayer
Source§unsafe fn timebase(&self) -> Retained<CMTimebase>
unsafe fn timebase(&self) -> Retained<CMTimebase>
AVQueuedSampleBufferRendering and objc2-core-media only.Source§unsafe fn enqueueSampleBuffer(&self, sample_buffer: &CMSampleBuffer)
unsafe fn enqueueSampleBuffer(&self, sample_buffer: &CMSampleBuffer)
AVQueuedSampleBufferRendering and objc2-core-media only.Source§unsafe fn flush(&self)
unsafe fn flush(&self)
AVQueuedSampleBufferRendering only.Source§unsafe fn isReadyForMoreMediaData(&self) -> bool
unsafe fn isReadyForMoreMediaData(&self) -> bool
AVQueuedSampleBufferRendering only.Source§unsafe fn requestMediaDataWhenReadyOnQueue_usingBlock(
&self,
queue: &DispatchQueue,
block: &DynBlock<dyn Fn()>,
)
unsafe fn requestMediaDataWhenReadyOnQueue_usingBlock( &self, queue: &DispatchQueue, block: &DynBlock<dyn Fn()>, )
block2 and dispatch2 and AVQueuedSampleBufferRendering only.Source§unsafe fn stopRequestingMediaData(&self)
unsafe fn stopRequestingMediaData(&self)
AVQueuedSampleBufferRendering only.Source§impl AsRef<AnyObject> for AVSampleBufferDisplayLayer
impl AsRef<AnyObject> for AVSampleBufferDisplayLayer
Source§impl AsRef<CALayer> for AVSampleBufferDisplayLayer
impl AsRef<CALayer> for AVSampleBufferDisplayLayer
Source§impl AsRef<NSObject> for AVSampleBufferDisplayLayer
impl AsRef<NSObject> for AVSampleBufferDisplayLayer
Source§impl Borrow<AnyObject> for AVSampleBufferDisplayLayer
impl Borrow<AnyObject> for AVSampleBufferDisplayLayer
Source§impl Borrow<CALayer> for AVSampleBufferDisplayLayer
impl Borrow<CALayer> for AVSampleBufferDisplayLayer
Source§impl Borrow<NSObject> for AVSampleBufferDisplayLayer
impl Borrow<NSObject> for AVSampleBufferDisplayLayer
Source§impl CAMediaTiming for AVSampleBufferDisplayLayer
impl CAMediaTiming for AVSampleBufferDisplayLayer
fn speed(&self) -> f32
fn repeatCount(&self) -> f32
Source§fn setRepeatCount(&self, repeat_count: f32)
fn setRepeatCount(&self, repeat_count: f32)
repeatCount.fn autoreverses(&self) -> bool
Source§fn setAutoreverses(&self, autoreverses: bool)
fn setAutoreverses(&self, autoreverses: bool)
autoreverses.fn fillMode(&self) -> Retained<NSString>
Source§impl ClassType for AVSampleBufferDisplayLayer
impl ClassType for AVSampleBufferDisplayLayer
Source§const NAME: &'static str = "AVSampleBufferDisplayLayer"
const NAME: &'static str = "AVSampleBufferDisplayLayer"
Source§type ThreadKind = <<AVSampleBufferDisplayLayer as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<AVSampleBufferDisplayLayer as ClassType>::Super as ClassType>::ThreadKind
Source§impl Debug for AVSampleBufferDisplayLayer
impl Debug for AVSampleBufferDisplayLayer
Source§impl Deref for AVSampleBufferDisplayLayer
impl Deref for AVSampleBufferDisplayLayer
Source§impl Hash for AVSampleBufferDisplayLayer
impl Hash for AVSampleBufferDisplayLayer
Source§impl Message for AVSampleBufferDisplayLayer
impl Message for AVSampleBufferDisplayLayer
Source§impl NSObjectProtocol for AVSampleBufferDisplayLayer
impl NSObjectProtocol for AVSampleBufferDisplayLayer
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass directly, or cast your objects with AnyObject::downcast_ref