-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMIMovieVideoSampleAccessor.h
More file actions
54 lines (43 loc) · 1.91 KB
/
MIMovieVideoSampleAccessor.h
File metadata and controls
54 lines (43 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// MIMovieVideoSampleAccessor.h
// MovieMaker
//
// Copyright (c) 2015 Zukini Ltd. All rights reserved.
@import Foundation;
@import AVFoundation;
@class MICMSampleBuffer;
/**
@brief A class for accessing frames from 1 or more video tracks of a movie.
@discussion This class allows for random access of video frames but performance
is much better if samples are requested in time order and frame times are not
too far apart. You can also iterate through each sample using the next sample.
*/
@interface MIMovieVideoSampleAccessor : NSObject
// The last requested buffer.
@property (readonly) MICMSampleBuffer *currentBuffer;
// The time of the last requested buffer.
@property (readonly) CMTime currentTime;
// Can no longer use this sample accessor.
@property (readonly) BOOL isBroken;
/**
@brief Designated initializer. Can return nil.
@param movie The movie asset from which to obtain the video samples
@param firstSampleTime The time from which to get the first sample.
@param tracks An array of AVAssetTracks. If nil, then defaults to all video tracks
@param videoSettings The settings used to create the CVPixelBuffer from sample.
If nil, settings appropriate for creating a CGImageRef via a CGContext
will be used.
@param videoComposition The video composition to be used. If nil then the
composition will use the movie asset composition.
*/
-(instancetype)initWithMovie:(AVURLAsset *)movie
firstSampleTime:(CMTime)firstTime
tracks:(NSArray *)tracks
videoSettings:(NSDictionary *)videoSettings
videoComposition:(AVVideoComposition *)composition;
/// Get the sample buffer at the specified time.
-(MICMSampleBuffer *)sampleBufferAtTime:(CMTime)time;
/// Get the next sample buffer.
-(MICMSampleBuffer *)nextSampleBuffer;
/// Is the array of tracks the same as the sample accessor's list of tracks.
-(BOOL)equalTracks:(NSArray *)tracks;
@end