public class AVSampleBufferAudioRenderer extends NSObject implements AVQueuedSampleBufferRendering
AVSampleBufferAudioRenderer can decompress and play compressed or uncompressed audio.
An instance of AVSampleBufferAudioRenderer must be added to an AVSampleBufferRenderSynchronizer before the first sample buffer is enqueued.
| Modifier and Type | Class and Description |
|---|---|
static interface |
AVSampleBufferAudioRenderer.Block_flushFromSourceTimeCompletionHandler |
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_retAVQueuedSampleBufferRendering.Block_requestMediaDataWhenReadyOnQueueUsingBlock| Modifier | Constructor and Description |
|---|---|
protected |
AVSampleBufferAudioRenderer(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
static AVSampleBufferAudioRenderer |
alloc() |
static AVSampleBufferAudioRenderer |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
long |
allowedAudioSpatializationFormats()
[@property] allowedAudioSpatializationFormats
|
java.lang.String |
audioTimePitchAlgorithm()
[@property] audioTimePitchAlgorithm
|
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument) |
static NSArray<java.lang.String> |
classFallbacksForKeyedArchiver() |
static org.moe.natj.objc.Class |
classForKeyedUnarchiver() |
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
void |
enqueueSampleBuffer(CMSampleBufferRef sampleBuffer)
enqueueSampleBuffer:
|
NSError |
error()
[@property] error
|
void |
flush()
flush
|
void |
flushFromSourceTimeCompletionHandler(CMTime time,
AVSampleBufferAudioRenderer.Block_flushFromSourceTimeCompletionHandler completionHandler)
flushFromSourceTime:completionHandler:
|
static long |
hash_static() |
boolean |
hasSufficientMediaDataForReliablePlaybackStart()
[@property] hasSufficientMediaDataForReliablePlaybackStart
|
AVSampleBufferAudioRenderer |
init() |
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
boolean |
isMuted()
[@property] muted
|
boolean |
isReadyForMoreMediaData()
[@property] readyForMoreMediaData
|
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
static AVSampleBufferAudioRenderer |
new_objc() |
void |
requestMediaDataWhenReadyOnQueueUsingBlock(NSObject queue,
AVQueuedSampleBufferRendering.Block_requestMediaDataWhenReadyOnQueueUsingBlock block)
requestMediaDataWhenReadyOnQueue:usingBlock:
|
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
void |
setAllowedAudioSpatializationFormats(long value)
[@property] allowedAudioSpatializationFormats
|
void |
setAudioTimePitchAlgorithm(java.lang.String value)
[@property] audioTimePitchAlgorithm
|
void |
setMuted(boolean value)
[@property] muted
|
static void |
setVersion_static(long aVersion) |
void |
setVolume(float value)
[@property] volume
|
long |
status()
[@property] status
|
void |
stopRequestingMediaData()
stopRequestingMediaData
|
static org.moe.natj.objc.Class |
superclass_static() |
CMTimebaseRef |
timebase()
[@property] timebase
|
static long |
version_static() |
float |
volume()
[@property] volume
|
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKeyprotected AVSampleBufferAudioRenderer(org.moe.natj.general.Pointer peer)
public static boolean accessInstanceVariablesDirectly()
public static AVSampleBufferAudioRenderer alloc()
public static AVSampleBufferAudioRenderer allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public java.lang.String audioTimePitchAlgorithm()
Indicates the processing algorithm used to manage audio pitch at varying rates.
Constants for various time pitch algorithms, e.g. AVAudioTimePitchSpectral, are defined in AVAudioProcessingSettings.h.
The default value for applications linked on or after iOS 15.0 or macOS 12.0 is AVAudioTimePitchAlgorithmTimeDomain. For iOS versions prior to 15.0 the default value is AVAudioTimePitchAlgorithmLowQualityZeroLatency. For macOS versions prior to 12.0 the default value is AVAudioTimePitchAlgorithmSpectral.
If the timebase's rate is not supported by the audioTimePitchAlgorithm, audio will be muted.
Modifying this property while the timebase's rate is not 0.0 may cause the rate to briefly change to 0.0.
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public void enqueueSampleBuffer(CMSampleBufferRef sampleBuffer)
AVQueuedSampleBufferRenderingSends a sample buffer in order to render its contents.
Video-specific notes:
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 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.
enqueueSampleBuffer in interface AVQueuedSampleBufferRenderingpublic NSError error()
If the renderer'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 renderer to no longer be able to render sample buffers. The value of this property is nil unless the value of status is AVQueuedSampleBufferRenderingStatusFailed.
public void flush()
AVQueuedSampleBufferRenderingInstructs the receiver to discard pending enqueued sample buffers.
Additional sample buffers can be appended after -flush.
Video-specific notes:
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).
flush in interface AVQueuedSampleBufferRenderingpublic void flushFromSourceTimeCompletionHandler(CMTime time, AVSampleBufferAudioRenderer.Block_flushFromSourceTimeCompletionHandler completionHandler)
Flushes enqueued sample buffers with presentation time stamps later than or equal to the specified time.
This method can be used to replace media data scheduled to be rendered in the future, without interrupting playback. One example of this is when the data that has already been enqueued is from a sequence of two songs and the second song is swapped for a new song. In this case, this method would be called with the time stamp of the first sample buffer from the second song. After the completion handler is executed with a YES parameter, media data may again be enqueued with timestamps at the specified time.
If NO is provided to the completion handler, the flush did not succeed and the set of enqueued sample buffers remains unchanged. A flush can fail becuse the source time was too close to (or earlier than) the current time or because the current configuration of the receiver does not support flushing at a particular time. In these cases, the caller can choose to flush all enqueued media data by invoking the -flush method.
completionHandler - A block that is invoked, possibly asynchronously, after the flush operation completes or fails.public static long hash_static()
public AVSampleBufferAudioRenderer init()
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public boolean isMuted()
Indicates whether or not audio output of the AVSampleBufferAudioRenderer is muted.
Setting this property only affects audio muting for the renderer instance and not for the device.
public boolean isReadyForMoreMediaData()
AVQueuedSampleBufferRenderingIndicates the readiness of the receiver to accept more sample buffers.
An object conforming to AVQueuedSampleBufferRendering 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 receiver 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 rendered.
This property is not key value observable.
isReadyForMoreMediaData in interface AVQueuedSampleBufferRenderingpublic static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public static AVSampleBufferAudioRenderer new_objc()
public void requestMediaDataWhenReadyOnQueueUsingBlock(NSObject queue, AVQueuedSampleBufferRendering.Block_requestMediaDataWhenReadyOnQueueUsingBlock block)
AVQueuedSampleBufferRenderingInstructs the target to invoke a client-supplied block repeatedly, at its convenience, in order to gather sample buffers for playback.
The block should enqueue sample buffers to the receiver either until the receiver's readyForMoreMediaData property becomes NO or until there is no more data to supply. When the receiver 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 method 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 AVQueuedSampleBufferRendering object without a call to stopRequestingMediaData will result in undefined behavior.
requestMediaDataWhenReadyOnQueueUsingBlock in interface AVQueuedSampleBufferRenderingpublic static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public void setAudioTimePitchAlgorithm(java.lang.String value)
Indicates the processing algorithm used to manage audio pitch at varying rates.
Constants for various time pitch algorithms, e.g. AVAudioTimePitchSpectral, are defined in AVAudioProcessingSettings.h.
The default value for applications linked on or after iOS 15.0 or macOS 12.0 is AVAudioTimePitchAlgorithmTimeDomain. For iOS versions prior to 15.0 the default value is AVAudioTimePitchAlgorithmLowQualityZeroLatency. For macOS versions prior to 12.0 the default value is AVAudioTimePitchAlgorithmSpectral.
If the timebase's rate is not supported by the audioTimePitchAlgorithm, audio will be muted.
Modifying this property while the timebase's rate is not 0.0 may cause the rate to briefly change to 0.0.
public void setMuted(boolean value)
Indicates whether or not audio output of the AVSampleBufferAudioRenderer is muted.
Setting this property only affects audio muting for the renderer instance and not for the device.
public static void setVersion_static(long aVersion)
public void setVolume(float value)
Indicates the current audio volume of the AVSampleBufferAudioRenderer.
A value of 0.0 means "silence all audio", while 1.0 means "play at the full volume of the audio media".
This property should be used for frequent volume changes, for example via a volume knob or fader.
This property is most useful on iOS to control the volume of the AVSampleBufferAudioRenderer relative to other audio output, not for setting absolute volume.
public long status()
Indicates the status of the audio renderer.
A renderer begins with status AVQueuedSampleBufferRenderingStatusUnknown.
As sample buffers are enqueued for rendering using -enqueueSampleBuffer:, the renderer will transition to either AVQueuedSampleBufferRenderingStatusRendering or AVQueuedSampleBufferRenderingStatusFailed.
If the status is AVQueuedSampleBufferRenderingStatusFailed, check the value of the renderer's error property for information on the error encountered. This is terminal status from which recovery is not always possible.
This property is key value observable.
public void stopRequestingMediaData()
AVQueuedSampleBufferRenderingCancels any current requestMediaDataWhenReadyOnQueue:usingBlock: call.
This method may be called from outside the block or from within the block.
stopRequestingMediaData in interface AVQueuedSampleBufferRenderingpublic static org.moe.natj.objc.Class superclass_static()
public CMTimebaseRef timebase()
AVQueuedSampleBufferRenderingThe 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.
timebase in interface AVQueuedSampleBufferRenderingpublic static long version_static()
public float volume()
Indicates the current audio volume of the AVSampleBufferAudioRenderer.
A value of 0.0 means "silence all audio", while 1.0 means "play at the full volume of the audio media".
This property should be used for frequent volume changes, for example via a volume knob or fader.
This property is most useful on iOS to control the volume of the AVSampleBufferAudioRenderer relative to other audio output, not for setting absolute volume.
public long allowedAudioSpatializationFormats()
Indicates the source audio channel layouts allowed by the receiver for spatialization.
Spatialization uses psychoacoustic methods to create a more immersive audio rendering when the content is played on specialized headphones and speaker arrangements. When an AVSampleBufferAudioRenderer's allowedAudioSpatializationFormats property is set to AVAudioSpatializationFormatMonoAndStereo the AVSampleBufferAudioRenderer will attempt to spatialize content tagged with a stereo channel layout, two-channel content with no layout specified as well as mono. It is considered incorrect to render a binaural recording with spatialization. A binaural recording is captured using two carefully placed microphones at each ear where the intent, when played on headphones, is to reproduce a naturally occurring spatial effect. Content tagged with a binaural channel layout will ignore this property value. When an AVSampleBufferAudioRenderer's allowedAudioSpatializationFormats property is set to AVAudioSpatializationFormatMultichannel the AVSampleBufferAudioRenderer will attempt to spatialize any decodable multichannel layout. Setting this property to AVAudioSpatializationFormatMonoStereoAndMultichannel indicates that the sender allows the AVSampleBufferAudioRenderer to spatialize any decodable mono, stereo or multichannel layout. This property is not observable. The default value for this property is AVAudioSpatializationFormatMultichannel.
public boolean hasSufficientMediaDataForReliablePlaybackStart()
AVQueuedSampleBufferRenderingIndicates 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.
hasSufficientMediaDataForReliablePlaybackStart in interface AVQueuedSampleBufferRenderingpublic void setAllowedAudioSpatializationFormats(long value)
Indicates the source audio channel layouts allowed by the receiver for spatialization.
Spatialization uses psychoacoustic methods to create a more immersive audio rendering when the content is played on specialized headphones and speaker arrangements. When an AVSampleBufferAudioRenderer's allowedAudioSpatializationFormats property is set to AVAudioSpatializationFormatMonoAndStereo the AVSampleBufferAudioRenderer will attempt to spatialize content tagged with a stereo channel layout, two-channel content with no layout specified as well as mono. It is considered incorrect to render a binaural recording with spatialization. A binaural recording is captured using two carefully placed microphones at each ear where the intent, when played on headphones, is to reproduce a naturally occurring spatial effect. Content tagged with a binaural channel layout will ignore this property value. When an AVSampleBufferAudioRenderer's allowedAudioSpatializationFormats property is set to AVAudioSpatializationFormatMultichannel the AVSampleBufferAudioRenderer will attempt to spatialize any decodable multichannel layout. Setting this property to AVAudioSpatializationFormatMonoStereoAndMultichannel indicates that the sender allows the AVSampleBufferAudioRenderer to spatialize any decodable mono, stereo or multichannel layout. This property is not observable. The default value for this property is AVAudioSpatializationFormatMultichannel.