Class: AVAssetImageGenerator

Inherits:
NSObject show all

Overview

An AVAssetImageGenerator object provides thumbnail or preview images of assets independently of playback.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (String) apertureMode

Specifies the aperture mode for the generated image. The default value is AVAssetImageGeneratorApertureModeCleanAperture.

Returns:

- (Boolean) appliesPreferredTrackTransform

Specifies whether to apply the track matrix (or matrices) when extracting an image from the asset. The default is NO. AVAssetImageGenerator only supports rotation by 90, 180, or 270 degrees.This property is ignored if you set a value for the videoComposition property.

Returns:

  • (Boolean)

- (AVAsset) asset (readonly)

The instance of AVAsset with which the AVAssetImageGenerator was initialized. (read-only)

Returns:

- (CGSize) maximumSize

Specifies the maximum dimensions for generated image. The default value is CGSizeZero, which specifies the asset’s unscaled dimensions.AVAssetImageGenerator scales images such that they fit within the defined bounding box. Images are never scaled up. The aspect ratio of the scaled image is defined by the apertureMode property.

Returns:

- (CMTime) requestedTimeToleranceAfter

The maximum length of time after a requested time for which an image may be generated. The default value is kCMTimePositiveInfinity.Set the values of requestedTimeToleranceBefore and requestedTimeToleranceAfter to kCMTimeZero to request frame-accurate image generation; this may incur additional decoding delay.

Returns:

  • (CMTime)

- (CMTime) requestedTimeToleranceBefore

The maximum length of time before a requested time for which an image may be generated. The default value is kCMTimePositiveInfinity.Set the values of requestedTimeToleranceBefore and requestedTimeToleranceAfter to kCMTimeZero to request frame-accurate image generation; this may incur additional decoding delay.

Returns:

  • (CMTime)

- (Object) videoComposition

The video composition to use when extracting images from assets with multiple video tracks. If no video composition is specified, only the first enabled video track will be used. If a video composition is specified, the appliesPreferredTrackTransform property is ignored.

Returns:

Class Method Details

+ (AVAssetImageGenerator) assetImageGeneratorWithAsset(asset)

Returns an image generator for use with a specified asset. This method may succeed even if the asset possesses no visual tracks at the time of initialization.

Parameters:

  • asset (AVAsset)

    The asset from which images will be extracted.

Returns:

Instance Method Details

- (Object) cancelAllCGImageGeneration

Cancels all pending image generation requests. This method calls the handler block with AVAssetImageGeneratorCancelled for each image time in every previous invocation of generateCGImagesAsynchronouslyForTimes:completionHandler: for which images have not yet been supplied.

Returns:

- (CGImageRef) copyCGImageAtTime(requestedTime, actualTime:actualTime, error:outError)

Returns a CGImage for the asset at or near a specified time. This method returns the image synchronously.

Parameters:

  • requestedTime (CMTime)

    The time at which the image of the asset is to be created.

  • actualTime (CMTime)

    Upon return, contains the time at which the image was actually generated.If you are not interested in this information, pass NULL.

  • outError (Pointer)

    If an error occurs, upon return contains an NSError object that describes the problem.If you are not interested in this information, pass NULL.

Returns:

  • (CGImageRef)

    A CGImage for the asset at or near a specified time, or NULL if the image could not be created.This method follows “The Create Rule” in Memory Management Programming Guide for Core Foundation.

- (Object) generateCGImagesAsynchronouslyForTimes(requestedTimes, completionHandler:handler)

Creates a series of CGImage objects for an asset at or near specified times. This method uses an efficient “batch mode” to get images in time order.The client receives exactly one handler callback for each requested time in requestedTimes. Changes to the generator’s properties (snap behavior, maximum size, and so on) do not affect pending asynchronous image generation requests.

Parameters:

  • requestedTimes (Array)

    An array of NSValue objects, each containing a CMTime, specifying the asset times at which an image is requested.

  • handler (AVAssetImageGeneratorCompletionHandler)

    A block that is called when an image request is complete.

Returns:

- (Object) initWithAsset(asset)

Initializes an image generator for use with a specified asset. This method may succeed even if the asset possesses no visual tracks at the time of initialization.

Parameters:

  • asset (AVAsset)

    The asset from which images will be extracted.

Returns:

  • (Object)

    An image generator initialized for use with asset.