Class: AVMutableCompositionTrack

Inherits:
AVCompositionTrack show all

Overview

AVMutableCompositionTrack is a mutable subclass of AVCompositionTrack that lets you for insert, remove, and scale track segments without affecting their low-level representation (that is, the operations you perform are non-destructive on the original).

Instance Attribute Summary (collapse)

Attributes inherited from AVAssetTrack

#asset, #availableMetadataFormats, #commonMetadata, #enabled, #estimatedDataRate, #formatDescriptions, #mediaType, #naturalSize, #nominalFrameRate, #playable, #selfContained, #timeRange, #totalSampleDataLength, #trackID

Instance Method Summary (collapse)

Methods inherited from AVAssetTrack

#hasMediaCharacteristic:, #metadataForFormat:, #samplePresentationTimeForTrackTime:, #segmentForTrackTime:

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) extendedLanguageTag

The language tag associated with the track, as an RFC 4646 language tag. If not set, the value is nil.

Returns:

- (String) languageCode

The language associated with the track, as an ISO 639-2/T language code. If not set, the value is nil.

Returns:

- (CMTimeScale) naturalTimeScale

The timescale in which time values for the track can be operated upon without extraneous numerical conversion. If not set, the value is the natural time scale of the first non-empty edit, or 600 if there are no non-empty edits.Set the value to 0 to revert to the default behavior.

Returns:

  • (CMTimeScale)

- (CGAffineTransform) preferredTransform

The preferred transformation of the visual media data for display purposes. If not set, the value is CGAffineTransformIdentity.

Returns:

- (Float) preferredVolume

The preferred volume of the audible media data. If not set, the value is 1.0.

Returns:

- (Array) segments

The composition track’s array of track segments.

Returns:

Instance Method Details

- (Object) insertEmptyTimeRange(timeRange)

Adds or extends an empty time range within the receiver. If you insert an empty time range into the track, any media that was presented during that interval prior to the insertion will be presented instead immediately afterward.The nature of the data inserted depends upon the media type of the track. For example, an empty time range in a sound track presents silence.

Parameters:

  • timeRange (CMTimeRange)

    The empty time range to be inserted.

Returns:

- (Boolean) insertTimeRange(timeRange, ofTrack:track, atTime:startTime, error:error)

Inserts a time range of a source track. By default, the inserted track’s time range is presented at its natural duration and rate. You can scale it to a different duration (so that it is presented at a different rate) using scaleTimeRange:toDuration:.Insertion might fail if, for example, the asset that you try to insert is restricted by copy-protection.

Parameters:

  • timeRange (CMTimeRange)

    The time range of the track to be inserted.

  • track (AVAssetTrack)

    The source track to be inserted.

  • startTime (CMTime)

    The time at which track is to be presented by the composition track.

  • error (Pointer)

    If track is not inserted successfully, contains an NSError object that describes the problem.

Returns:

  • (Boolean)

    YES if track was inserted successfully, otherwise NO.

- (Boolean) insertTimeRanges(timeRanges, ofTracks:tracks, atTime:startTime, error:error)

Inserts the timeRanges of multiple source tracks into a track of a composition.

This method is equivalent to (but more efficient than) calling -insertTimeRange:ofTrack:atTime:error

for each timeRange/track pair.If this method returns an error, none of the time ranges will be inserted into the composition track.To specify an empty time range, pass an NSNull object for the track and a time range of starting at kCMTimeInvalid with a duration of the desired empty edit.

Parameters:

  • timeRanges (Array)

    An array of NSValue objects containing CMTimeRange structures indicating the time ranges to be inserted.

  • tracks (Array)

    The source tracks to be inserted.Only instances of AVURLAsset are supported.

  • startTime (CMTime)

    The time at which the inserted tracks are to be presented by the composition track.

  • error (Pointer)

    In an error occurs, upon return contains an NSError object that describes the problem.(For example, the asset that was selected for insertion in the composition is restricted by copy-protection.)

Returns:

  • (Boolean)

    YES if the insertions were successful, otherwise NO.

- (Object) removeTimeRange(timeRange)

Removes a specified time range from the receiver. Removing a time range does not cause the track to be removed from the composition. Instead it removes or truncates track segments that intersect with the time range.

Parameters:

  • timeRange (CMTimeRange)

    The time range to be removed.

Returns:

- (Object) scaleTimeRange(timeRange, toDuration:duration)

Changes the duration of a time range in the receiver. Each track segment affected by the scaling operation will be presented at a rate equal to source.duration / target.duration of its resulting timeMapping.

Parameters:

  • timeRange (CMTimeRange)

    The time range of the track to be scaled.

  • duration (CMTime)

    The new duration of timeRange.

Returns:

- (Boolean) validateTrackSegments(trackSegments, error:error)

Returns a Boolean value that indicates whether a given array of track segments conform to the timing rules for a composition track. You can use this method to ensure that an array of track segments is suitable for setting as the value of the trackSegments property. The timeMapping.target.start of the first track segment must be kCMTimeZero, and the timeMapping.target.start of each subsequent track segment must equal CMTimeRangeGetEnd(.timeMapping.target).If you want to modify the existing trackSegments array, you can create a mutable copy of it, modify the mutable array, and then validate the mutable array using this method.

Parameters:

Returns:

  • (Boolean)

    YES if the track segments in trackSegments conform to the timing rules for a composition track, otherwise NO.