forked from rFlex/SCRecorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCAssetExportSession.h
105 lines (78 loc) · 2.78 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
//
// 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"
@class SCAssetExportSession;
@protocol SCAssetExportSessionDelegate <NSObject>
@optional
- (void)assetExportSessionDidProgress:(SCAssetExportSession *)assetExportSession;
- (BOOL)assetExportSession:(SCAssetExportSession *)assetExportSession shouldReginReadWriteOnInput:(AVAssetWriterInput *)writerInput fromOutput:(AVAssetReaderOutput *)output;
- (BOOL)assetExportSessionNeedsInputPixelBufferAdaptor:(SCAssetExportSession *)assetExportSession;
@end
@interface SCAssetExportSession : NSObject
/**
The input asset to use
*/
@property (strong, nonatomic) AVAsset *inputAsset;
/**
The outputUrl to which the asset will be exported
*/
@property (strong, nonatomic) NSURL *outputUrl;
/**
The type of file to be written by the export session
*/
@property (strong, nonatomic) NSString *outputFileType;
/**
If true, the export session will use the GPU for rendering the filters
*/
@property (assign, nonatomic) BOOL useGPUForRenderingFilters;
/**
Access the configuration for the video.
*/
@property (readonly, nonatomic) SCVideoConfiguration *videoConfiguration;
/**
Access the configuration for the audio.
*/
@property (readonly, nonatomic) SCAudioConfiguration *audioConfiguration;
/**
If an error occured during the export, this will contain that error
*/
@property (readonly, nonatomic) NSError *error;
/**
The timeRange to read from the inputAsset
*/
@property (assign, nonatomic) CMTimeRange timeRange;
/**
The current progress
*/
@property (readonly, nonatomic) float progress;
@property (weak, nonatomic) id<SCAssetExportSessionDelegate> delegate;
- (id)init;
// Init with the inputAsset
- (id)initWithAsset:(AVAsset*)inputAsset;
/**
Starts the asynchronous execution of the export session
*/
- (void)exportAsynchronouslyWithCompletionHandler:(void(^)())completionHandler;
//////////////////
// PRIVATE API
////
// These are only exposed for inheritance purpose
@property (readonly, nonatomic) dispatch_queue_t dispatchQueue;
@property (readonly, nonatomic) dispatch_group_t dispatchGroup;
@property (readonly, nonatomic) AVAssetWriterInput *audioInput;
@property (readonly, nonatomic) AVAssetWriterInput *videoInput;
- (void)markInputComplete:(AVAssetWriterInput *)input error:(NSError *)error;
- (BOOL)processSampleBuffer:(CMSampleBufferRef)sampleBuffer;
- (BOOL)processPixelBuffer:(CVPixelBufferRef)pixelBuffer presentationTime:(CMTime)presentationTime;
- (void)beginReadWriteOnInput:(AVAssetWriterInput *)input fromOutput:(AVAssetReaderOutput *)output;
- (BOOL)needsInputPixelBufferAdaptor;
@end