Class AVAssetReader

  • All Implemented Interfaces:
    NSObject

    public class AVAssetReader
    extends NSObject
    AVAssetReader AVAssetReader provides services for obtaining media data from an asset. Instances of AVAssetReader read media data from an instance of AVAsset, whether the asset is file-based or represents an assembly of media data from multiple sources, as is the case with AVComposition. Clients of AVAssetReader can read data from specific tracks of an asset and in specific formats by adding concrete instances of AVAssetReaderOutput to an AVAssetReader instance. AVAssetReaderTrackOutput, a concrete subclass of AVAssetReaderOutput, can either read the track's media samples in the format in which they are stored by the asset or convert the media samples to a different format. AVAssetReaderAudioMixOutput mixes multiple audio tracks of the asset after reading them, while AVAssetReaderVideoCompositionOutput composites multiple video tracks after reading them. API-Since: 4.1
    • Constructor Detail

      • AVAssetReader

        protected AVAssetReader​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static AVAssetReader allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • assetReaderWithAssetError

        public static AVAssetReader assetReaderWithAssetError​(@NotNull
                                                              @NotNull AVAsset asset,
                                                              @Nullable
                                                              @Nullable org.moe.natj.general.ptr.Ptr<NSError> outError)
        assetReaderWithAsset:error: Returns an instance of AVAssetReader for reading media data from the specified asset. If the specified asset belongs to a mutable subclass of AVAsset, AVMutableComposition or AVMutableMovie, the results of any asset reading operation are undefined if you mutate the asset after invoking -startReading.
        Parameters:
        asset - The asset from which media data is to be read.
        outError - On return, if initialization of the AVAssetReader fails, points to an NSError describing the nature of the failure.
        Returns:
        An instance of AVAssetReader.
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • addOutput

        public void addOutput​(@NotNull
                              @NotNull AVAssetReaderOutput output)
        addOutput: Adds an output to the receiver. Outputs are created with a reference to one or more AVAssetTrack objects. These tracks must be owned by the asset returned by the receiver's asset property. This method throws an exception if the output has already been added to an AVAssetReader or if reading has started (`status` has progressed beyond AVAssetReaderStatusUnknown).
        Parameters:
        output - The AVAssetReaderOutput object to be added.
      • asset

        @NotNull
        public @NotNull AVAsset asset()
        [@property] asset The asset from which the receiver's outputs read sample buffers. The value of this property is an AVAsset. Concrete instances of AVAssetReader that are created with specific AVAssetTrack instances must obtain those tracks from the asset returned by this property.
      • canAddOutput

        public boolean canAddOutput​(@NotNull
                                    @NotNull AVAssetReaderOutput output)
        canAddOutput: Tests whether an output can be added to the receiver. An output that reads from a track of an asset other than the asset used to initialize the receiver cannot be added.
        Parameters:
        output - The AVAssetReaderOutput object to be tested.
        Returns:
        A BOOL indicating whether the output can be added to the receiver.
      • cancelReading

        public void cancelReading()
        cancelReading Cancels any background work and prevents the receiver's outputs from reading more samples. Clients that want to stop reading samples from the receiver before reaching the end of its time range should call this method to stop any background read ahead operations that the may have been in progress. This method should not be called concurrently with any calls to -[AVAssetReaderOutput copyNextSampleBuffer].
      • error

        @Nullable
        public @Nullable NSError error()
        [@property] error If the receiver's status is AVAssetReaderStatusFailed, this describes the error that caused the failure. The value of this property is an NSError that describes what caused the receiver to no longer be able to read its asset. If the receiver's status is not AVAssetReaderStatusFailed, the value of this property is nil. This property is thread safe.
      • initWithAssetError

        public AVAssetReader initWithAssetError​(@NotNull
                                                @NotNull AVAsset asset,
                                                @Nullable
                                                @Nullable org.moe.natj.general.ptr.Ptr<NSError> outError)
        initWithAsset:error: Creates an instance of AVAssetReader for reading media data from the specified asset. If the specified asset belongs to a mutable subclass of AVAsset, AVMutableComposition or AVMutableMovie, the results of any asset reading operation are undefined if you mutate the asset after invoking -startReading.
        Parameters:
        asset - The asset from which media data is to be read.
        outError - On return, if initialization of the AVAssetReader fails, points to an NSError describing the nature of the failure.
        Returns:
        An instance of AVAssetReader.
      • outputs

        @NotNull
        public @NotNull NSArray<? extends AVAssetReaderOutput> outputs()
        [@property] outputs The outputs from which clients of receiver can read media data. The value of this property is an NSArray containing concrete instances of AVAssetReaderOutput. Outputs can be added to the receiver using the addOutput: method.
      • setTimeRange

        public void setTimeRange​(CMTimeRange value)
        [@property] timeRange Specifies a range of time that may limit the temporal portion of the receiver's asset from which media data will be read. The intersection of the value of timeRange and CMTimeRangeMake(kCMTimeZero, asset.duration) will determine the time range of the asset from which media data will be read. The default value of timeRange is CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity). This property throws an exception if a value is set after reading has started.
      • startReading

        public boolean startReading()
        startReading Prepares the receiver for reading sample buffers from the asset. This method validates the entire collection of settings for outputs for tracks, for audio mixing, and for video composition and initiates reading from the receiver's asset. If this method returns NO, clients can determine the nature of the failure by checking the value of the status and error properties. This method throws an exception if reading has already started (`status` has progressed beyond AVAssetReaderStatusUnknown).
        Returns:
        A BOOL indicating whether reading could be started.
      • status

        public long status()
        [@property] status The status of reading sample buffers from the receiver's asset. The value of this property is an AVAssetReaderStatus that indicates whether reading is in progress, has completed successfully, has been canceled, or has failed. Clients of AVAssetReaderOutput objects should check the value of this property after -[AVAssetReaderOutput copyNextSampleBuffer] returns NULL to determine why no more samples could be read. This property is thread safe.
      • timeRange

        public CMTimeRange timeRange()
        [@property] timeRange Specifies a range of time that may limit the temporal portion of the receiver's asset from which media data will be read. The intersection of the value of timeRange and CMTimeRangeMake(kCMTimeZero, asset.duration) will determine the time range of the asset from which media data will be read. The default value of timeRange is CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity). This property throws an exception if a value is set after reading has started.
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.