forked from rFlex/SCRecorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCAssetExportSession.h
111 lines (85 loc) · 2.86 KB
/
SCAssetExportSession.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//
// SCAssetExportSession.h
// SCRecorder
//
// Created by Simon CORSIN on 14/05/14.
// Copyright (c) 2014 rFlex. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "SCFilter.h"
#import "SCVideoConfiguration.h"
#import "SCAudioConfiguration.h"
#import "SCContext.h"
@class SCAssetExportSession;
@protocol SCAssetExportSessionDelegate <NSObject>
@optional
- (void)assetExportSessionDidProgress:(SCAssetExportSession *__nonnull)assetExportSession;
- (BOOL)assetExportSession:(SCAssetExportSession *__nonnull)assetExportSession shouldReginReadWriteOnInput:(AVAssetWriterInput *__nonnull)writerInput fromOutput:(AVAssetReaderOutput *__nonnull)output;
- (BOOL)assetExportSessionNeedsInputPixelBufferAdaptor:(SCAssetExportSession *__nonnull)assetExportSession;
@end
@interface SCAssetExportSession : NSObject
/**
The input asset to use
*/
@property (strong, nonatomic) AVAsset *__nullable inputAsset;
/**
The outputUrl to which the asset will be exported
*/
@property (strong, nonatomic) NSURL *__nullable outputUrl;
/**
The type of file to be written by the export session
*/
@property (strong, nonatomic) NSString *__nullable outputFileType;
/**
The context type to use for rendering the images through a filter
*/
@property (assign, nonatomic) SCContextType contextType;
/**
Access the configuration for the video.
*/
@property (readonly, nonatomic) SCVideoConfiguration *__nonnull videoConfiguration;
/**
Access the configuration for the audio.
*/
@property (readonly, nonatomic) SCAudioConfiguration *__nonnull audioConfiguration;
/**
If an error occurred during the export, this will contain that error
*/
@property (readonly, nonatomic) NSError *__nullable error;
/**
Will be set to YES if cancelExport was called
*/
@property (readonly, atomic) BOOL cancelled;
/**
The timeRange to read from the inputAsset
*/
@property (assign, nonatomic) CMTimeRange timeRange;
/**
Whether the assetExportSession should automatically translate the filter into an AVVideoComposition.
This won't be done if a composition has already been set in the videoConfiguration.
Default is YES
*/
@property (assign, nonatomic) BOOL translatesFilterIntoComposition;
/**
Indicates whether the movie should be optimized for network use.
Default is NO
*/
@property (assign, nonatomic) BOOL shouldOptimizeForNetworkUse;
/**
The current progress
*/
@property (readonly, nonatomic) float progress;
@property (weak, nonatomic) __nullable id<SCAssetExportSessionDelegate> delegate;
- (nonnull instancetype)init;
// Init with the inputAsset
- (nonnull instancetype)initWithAsset:(AVAsset *__nonnull)inputAsset;
/**
Cancels exportAsynchronouslyWithCompletionHandler
*/
- (void)cancelExport;
/**
Starts the asynchronous execution of the export session
*/
- (void)exportAsynchronouslyWithCompletionHandler:(void(^__nullable)())completionHandler;
@end