Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 12e1066cae | |||
| 05ca0f4f4b | |||
| 9e536d2291 | |||
| 7bb976d4ae | |||
| 934d3f29ad | |||
| 87b3244ba5 | |||
| 23824e2b74 | |||
| 71d68c3e6e | |||
| d9887180c3 | |||
| 30eac1282c | |||
| 77d6a5b85b | |||
| 73c9adeb71 | |||
| 7dcda23bf4 | |||
| aa4f259edc | |||
| bc5dcef3b7 | |||
| 782b0c3c71 |
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.3</string>
|
||||
<string>2.4.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -500,10 +500,6 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/../Vendor/GPUImage.framework/Headers\"",
|
||||
"\"$(SRCROOT)/../Vendor/pili-librtmp.framework/Headers\"",
|
||||
);
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
@@ -523,10 +519,6 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"\"$(SRCROOT)/../Vendor/GPUImage.framework/Headers\"",
|
||||
"\"$(SRCROOT)/../Vendor/pili-librtmp.framework/Headers\"",
|
||||
);
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
|
||||
+3
-4
@@ -2,7 +2,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "LFLiveKit"
|
||||
s.version = "2.3"
|
||||
s.version = "2.4.1"
|
||||
s.summary = "LaiFeng ios Live. LFLiveKit."
|
||||
s.homepage = "https://github.com/chenliming777"
|
||||
s.license = { :type => "MIT", :file => "LICENSE" }
|
||||
@@ -17,7 +17,6 @@ Pod::Spec.new do |s|
|
||||
s.libraries = "c++", "z"
|
||||
|
||||
s.requires_arc = true
|
||||
s.ios.vendored_frameworks = 'Vendor/GPUImage.framework','Vendor/pili-librtmp.framework'
|
||||
#s.dependency 'LMGPUImage'
|
||||
#s.dependency 'pili-librtmp', '1.0.3.1'
|
||||
s.dependency 'GPUImage'
|
||||
s.dependency 'pili-librtmp', '1.0.3.1'
|
||||
end
|
||||
|
||||
@@ -127,7 +127,15 @@ typedef NS_ENUM(NSInteger,LFLiveCaptureTypeMask) {
|
||||
*.*/
|
||||
@property (nonatomic, strong, nullable) UIView *warterMarkView;
|
||||
|
||||
/* The currentImage is videoCapture shot */
|
||||
@property (nonatomic, strong,readonly ,nullable) UIImage *currentImage;
|
||||
|
||||
/* The saveLocalVideo is save the local video */
|
||||
@property (nonatomic, assign) BOOL saveLocalVideo;
|
||||
|
||||
/* The saveLocalVideoPath is save the local video path */
|
||||
@property (nonatomic, strong, nullable) NSURL *saveLocalVideoPath;
|
||||
|
||||
#pragma mark - Initializer
|
||||
///=============================================================================
|
||||
/// @name Initializer
|
||||
|
||||
@@ -251,6 +251,23 @@
|
||||
[self didChangeValueForKey:@"beautyFace"];
|
||||
}
|
||||
|
||||
- (BOOL)saveLocalVideo{
|
||||
return self.videoCaptureSource.saveLocalVideo;
|
||||
}
|
||||
|
||||
- (void)setSaveLocalVideo:(BOOL)saveLocalVideo{
|
||||
[self.videoCaptureSource setSaveLocalVideo:saveLocalVideo];
|
||||
}
|
||||
|
||||
|
||||
- (NSURL*)saveLocalVideoPath{
|
||||
return self.videoCaptureSource.saveLocalVideoPath;
|
||||
}
|
||||
|
||||
- (void)setSaveLocalVideoPath:(NSURL*)saveLocalVideoPath{
|
||||
[self.videoCaptureSource setSaveLocalVideoPath:saveLocalVideoPath];
|
||||
}
|
||||
|
||||
- (BOOL)beautyFace {
|
||||
return self.videoCaptureSource.beautyFace;
|
||||
}
|
||||
|
||||
@@ -98,8 +98,9 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
dispatch_sync(self.taskQueue, ^{
|
||||
dispatch_async(self.taskQueue, ^{
|
||||
if (self.componetInstance) {
|
||||
self.isRunning = NO;
|
||||
AudioOutputUnitStop(self.componetInstance);
|
||||
AudioComponentInstanceDispose(self.componetInstance);
|
||||
self.componetInstance = nil;
|
||||
@@ -120,7 +121,11 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
|
||||
AudioOutputUnitStart(self.componetInstance);
|
||||
});
|
||||
} else {
|
||||
self.isRunning = NO;
|
||||
dispatch_async(self.taskQueue, ^{
|
||||
self.isRunning = NO;
|
||||
NSLog(@"MicrophoneSource: stopRunning");
|
||||
AudioOutputUnitStop(self.componetInstance);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +182,7 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
|
||||
reason = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] integerValue];
|
||||
if (reason == AVAudioSessionInterruptionTypeBegan) {
|
||||
if (self.isRunning) {
|
||||
dispatch_sync(self.taskQueue, ^{
|
||||
dispatch_async(self.taskQueue, ^{
|
||||
NSLog(@"MicrophoneSource: stopRunning");
|
||||
AudioOutputUnitStop(self.componetInstance);
|
||||
});
|
||||
@@ -191,7 +196,7 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
|
||||
case AVAudioSessionInterruptionOptionShouldResume:
|
||||
if (self.isRunning) {
|
||||
dispatch_async(self.taskQueue, ^{
|
||||
NSLog(@"MicrophoneSource: stopRunning");
|
||||
NSLog(@"MicrophoneSource: startRunning");
|
||||
AudioOutputUnitStart(self.componetInstance);
|
||||
});
|
||||
}
|
||||
@@ -234,15 +239,6 @@ static OSStatus handleInputBuffer(void *inRefCon,
|
||||
inNumberFrames,
|
||||
&buffers);
|
||||
|
||||
if (!source.isRunning) {
|
||||
dispatch_sync(source.taskQueue, ^{
|
||||
NSLog(@"MicrophoneSource: stopRunning");
|
||||
AudioOutputUnitStop(source.componetInstance);
|
||||
});
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
if (source.muted) {
|
||||
for (int i = 0; i < buffers.mNumberBuffers; i++) {
|
||||
AudioBuffer ab = buffers.mBuffers[i];
|
||||
|
||||
@@ -64,7 +64,15 @@
|
||||
/*** The warterMarkView control whether the watermark is displayed or not ,if set ni,will remove watermark,otherwise add *.*/
|
||||
@property (nonatomic, strong, nullable) UIView *warterMarkView;
|
||||
|
||||
/* The currentImage is videoCapture shot */
|
||||
@property (nonatomic, strong, nullable) UIImage *currentImage;
|
||||
|
||||
/* The saveLocalVideo is save the local video */
|
||||
@property (nonatomic, assign) BOOL saveLocalVideo;
|
||||
|
||||
/* The saveLocalVideoPath is save the local video path */
|
||||
@property (nonatomic, strong, nullable) NSURL *saveLocalVideoPath;
|
||||
|
||||
#pragma mark - Initializer
|
||||
///=============================================================================
|
||||
/// @name Initializer
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
@property (nonatomic, strong) GPUImageUIElement *uiElementInput;
|
||||
@property (nonatomic, strong) UIView *waterMarkContentView;
|
||||
|
||||
@property (nonatomic, strong) GPUImageMovieWriter *movieWriter;
|
||||
|
||||
@end
|
||||
|
||||
@implementation LFVideoCapture
|
||||
@@ -88,10 +90,12 @@
|
||||
if (!_running) {
|
||||
[UIApplication sharedApplication].idleTimerDisabled = NO;
|
||||
[self.videoCamera stopCameraCapture];
|
||||
if(self.saveLocalVideo) [self.movieWriter finishRecording];
|
||||
} else {
|
||||
[UIApplication sharedApplication].idleTimerDisabled = YES;
|
||||
[self reloadFilter];
|
||||
[self.videoCamera startCameraCapture];
|
||||
if(self.saveLocalVideo) [self.movieWriter startRecording];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,15 +256,25 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (GPUImageMovieWriter*)movieWriter{
|
||||
if(!_movieWriter){
|
||||
_movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:self.saveLocalVideoPath size:self.configuration.videoSize];
|
||||
_movieWriter.encodingLiveVideo = YES;
|
||||
_movieWriter.shouldPassthroughAudio = YES;
|
||||
self.videoCamera.audioEncodingTarget = self.movieWriter;
|
||||
}
|
||||
return _movieWriter;
|
||||
}
|
||||
|
||||
#pragma mark -- Custom Method
|
||||
- (void)processVideo:(GPUImageOutput *)output {
|
||||
__weak typeof(self) _self = self;
|
||||
@autoreleasepool {
|
||||
GPUImageFramebuffer *imageFramebuffer = output.framebufferForOutput;
|
||||
CVPixelBufferRef pixelBuffer = [imageFramebuffer pixelBuffer];
|
||||
if (pixelBuffer && _self.delegate && [_self.delegate respondsToSelector:@selector(captureOutput:pixelBuffer:)]) {
|
||||
[_self.delegate captureOutput:_self pixelBuffer:pixelBuffer];
|
||||
}
|
||||
//CVPixelBufferRef pixelBuffer = [imageFramebuffer pixelBuffer];
|
||||
//if (pixelBuffer && _self.delegate && [_self.delegate respondsToSelector:@selector(captureOutput:pixelBuffer:)]) {
|
||||
//[_self.delegate captureOutput:_self pixelBuffer:pixelBuffer];
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,11 +314,13 @@
|
||||
[self.filter addTarget:self.blendFilter];
|
||||
[self.uiElementInput addTarget:self.blendFilter];
|
||||
[self.blendFilter addTarget:self.gpuImageView];
|
||||
if(self.saveLocalVideo) [self.blendFilter addTarget:self.movieWriter];
|
||||
[self.filter addTarget:self.output];
|
||||
[self.uiElementInput update];
|
||||
}else{
|
||||
[self.filter addTarget:self.output];
|
||||
[self.output addTarget:self.gpuImageView];
|
||||
if(self.saveLocalVideo) [self.output addTarget:self.movieWriter];
|
||||
}
|
||||
|
||||
[self.filter forceProcessingAtSize:self.configuration.videoSize];
|
||||
@@ -323,9 +339,9 @@
|
||||
|
||||
- (void)reloadMirror{
|
||||
if(self.mirror && self.captureDevicePosition == AVCaptureDevicePositionFront){
|
||||
[self.gpuImageView setInputRotation:kGPUImageFlipHorizonal atIndex:0];
|
||||
self.videoCamera.horizontallyMirrorFrontFacingCamera = YES;
|
||||
}else{
|
||||
[self.gpuImageView setInputRotation:kGPUImageNoRotation atIndex:0];
|
||||
self.videoCamera.horizontallyMirrorFrontFacingCamera = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
- (void)dealloc {
|
||||
if (aacBuf) free(aacBuf);
|
||||
if (leftBuf) free(leftBuf);
|
||||
if(m_converter) AudioConverterDispose(m_converter);
|
||||
}
|
||||
|
||||
#pragma mark -- LFAudioEncoder
|
||||
@@ -75,12 +76,13 @@
|
||||
[self encodeBuffer:p timeStamp:timeStamp];
|
||||
p += self.configuration.bufferLength;
|
||||
}
|
||||
free(totalBuf);
|
||||
|
||||
leftLength = totalSize%self.configuration.bufferLength;
|
||||
memset(leftBuf, 0, self.configuration.bufferLength);
|
||||
memcpy(leftBuf, totalBuf + (totalSize -leftLength), leftLength);
|
||||
|
||||
free(totalBuf);
|
||||
|
||||
}else{
|
||||
///< 积累
|
||||
memcpy(leftBuf+leftLength, audioData.bytes, audioData.length);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
@property (nonatomic, strong) LFLiveVideoConfiguration *configuration;
|
||||
@property (nonatomic, weak) id<LFVideoEncodingDelegate> h264Delegate;
|
||||
@property (nonatomic) BOOL isBackGround;
|
||||
@property (nonatomic) NSInteger currentVideoBitRate;
|
||||
|
||||
@end
|
||||
@@ -32,20 +31,18 @@
|
||||
if (self = [super init]) {
|
||||
NSLog(@"USE LFHardwareVideoEncoder");
|
||||
_configuration = configuration;
|
||||
[self initCompressionSession];
|
||||
[self resetCompressionSession];
|
||||
|
||||
#ifdef DEBUG
|
||||
enabledWriteVideoFile = NO;
|
||||
[self initForFilePath];
|
||||
#endif
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initCompressionSession {
|
||||
- (void)resetCompressionSession {
|
||||
if (compressionSession) {
|
||||
VTCompressionSessionCompleteFrames(compressionSession, kCMTimeInvalid);
|
||||
|
||||
@@ -75,7 +72,6 @@
|
||||
}
|
||||
|
||||
- (void)setVideoBitRate:(NSInteger)videoBitRate {
|
||||
if (_isBackGround) return;
|
||||
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_AverageBitRate, (__bridge CFTypeRef)@(videoBitRate));
|
||||
NSArray *limit = @[@(videoBitRate * 1.5/8), @(1)];
|
||||
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_DataRateLimits, (__bridge CFArrayRef)limit);
|
||||
@@ -94,13 +90,11 @@
|
||||
CFRelease(compressionSession);
|
||||
compressionSession = NULL;
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
#pragma mark -- LFVideoEncoder
|
||||
- (void)encodeVideoData:(CVPixelBufferRef)pixelBuffer timeStamp:(uint64_t)timeStamp {
|
||||
if (_isBackGround) return;
|
||||
|
||||
|
||||
frameCount++;
|
||||
CMTime presentationTimeStamp = CMTimeMake(frameCount, (int32_t)_configuration.videoFrameRate);
|
||||
VTEncodeInfoFlags flags;
|
||||
@@ -112,7 +106,10 @@
|
||||
}
|
||||
NSNumber *timeNumber = @(timeStamp);
|
||||
|
||||
VTCompressionSessionEncodeFrame(compressionSession, pixelBuffer, presentationTimeStamp, duration, (__bridge CFDictionaryRef)properties, (__bridge_retained void *)timeNumber, &flags);
|
||||
OSStatus status = VTCompressionSessionEncodeFrame(compressionSession, pixelBuffer, presentationTimeStamp, duration, (__bridge CFDictionaryRef)properties, (__bridge_retained void *)timeNumber, &flags);
|
||||
if(status != noErr){
|
||||
[self resetCompressionSession];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopEncoder {
|
||||
@@ -123,16 +120,6 @@
|
||||
_h264Delegate = delegate;
|
||||
}
|
||||
|
||||
#pragma mark -- NSNotification
|
||||
- (void)willEnterBackground:(NSNotification *)notification {
|
||||
_isBackGround = YES;
|
||||
}
|
||||
|
||||
- (void)willEnterForeground:(NSNotification *)notification {
|
||||
[self initCompressionSession];
|
||||
_isBackGround = NO;
|
||||
}
|
||||
|
||||
#pragma mark -- VideoCallBack
|
||||
static void VideoCompressonOutputCallback(void *VTref, void *VTFrameRef, OSStatus status, VTEncodeInfoFlags infoFlags, CMSampleBufferRef sampleBuffer){
|
||||
if (!sampleBuffer) return;
|
||||
|
||||
@@ -29,7 +29,9 @@ typedef NS_ENUM (NSUInteger, LFLiveState){
|
||||
/// 已断开
|
||||
LFLiveStop = 3,
|
||||
/// 连接出错
|
||||
LFLiveError = 4
|
||||
LFLiveError = 4,
|
||||
/// 正在刷新
|
||||
LFLiveRefresh = 5
|
||||
};
|
||||
|
||||
typedef NS_ENUM (NSUInteger, LFLiveSocketErrorCode) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#import "rtmp.h"
|
||||
#endif
|
||||
|
||||
static const NSInteger RetryTimesBreaken = 20; ///< 重连1分钟 3秒一次 一共20次
|
||||
static const NSInteger RetryTimesBreaken = 5; ///< 重连1分钟 3秒一次 一共20次
|
||||
static const NSInteger RetryTimesMargin = 3;
|
||||
|
||||
|
||||
@@ -112,12 +112,24 @@ SAVC(mp4a);
|
||||
self.debugInfo.streamId = self.stream.streamId;
|
||||
self.debugInfo.uploadUrl = self.stream.url;
|
||||
self.debugInfo.isRtmp = YES;
|
||||
if (_isConnecting) return;
|
||||
|
||||
_isConnecting = YES;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
|
||||
[self.delegate socketStatus:self status:LFLivePending];
|
||||
}
|
||||
|
||||
if (_rtmp != NULL) {
|
||||
PILI_RTMP_Close(_rtmp, &_error);
|
||||
PILI_RTMP_Free(_rtmp);
|
||||
}
|
||||
[self RTMP264_Connect:(char *)[_stream.url cStringUsingEncoding:NSASCIIStringEncoding]];
|
||||
}
|
||||
|
||||
- (void)stop {
|
||||
dispatch_async(self.rtmpSendQueue, ^{
|
||||
[self _stop];
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -131,12 +143,12 @@ SAVC(mp4a);
|
||||
_rtmp = NULL;
|
||||
}
|
||||
[self clean];
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
}
|
||||
|
||||
- (void)sendFrame:(LFFrame *)frame {
|
||||
if (!frame) return;
|
||||
[self.buffer appendObject:frame];
|
||||
|
||||
if(!self.isSending){
|
||||
[self sendFrame];
|
||||
}
|
||||
@@ -148,74 +160,75 @@ SAVC(mp4a);
|
||||
|
||||
#pragma mark -- CustomMethod
|
||||
- (void)sendFrame {
|
||||
__weak typeof(self) _self = self;
|
||||
dispatch_async(self.rtmpSendQueue, ^{
|
||||
if (!self.isSending && self.buffer.list.count > 0) {
|
||||
self.isSending = YES;
|
||||
if (!_self.isSending && _self.buffer.list.count > 0) {
|
||||
_self.isSending = YES;
|
||||
|
||||
if (!_isConnected || _isReconnecting || _isConnecting || !_rtmp){
|
||||
self.isSending = NO;
|
||||
if (!_self.isConnected || _self.isReconnecting || _self.isConnecting || !_rtmp){
|
||||
_self.isSending = NO;
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用发送接口
|
||||
LFFrame *frame = [self.buffer popFirstObject];
|
||||
LFFrame *frame = [_self.buffer popFirstObject];
|
||||
if ([frame isKindOfClass:[LFVideoFrame class]]) {
|
||||
if (!self.sendVideoHead) {
|
||||
self.sendVideoHead = YES;
|
||||
if (!_self.sendVideoHead) {
|
||||
_self.sendVideoHead = YES;
|
||||
if(!((LFVideoFrame*)frame).sps || !((LFVideoFrame*)frame).pps){
|
||||
self.isSending = NO;
|
||||
_self.isSending = NO;
|
||||
return;
|
||||
}
|
||||
[self sendVideoHeader:(LFVideoFrame *)frame];
|
||||
[_self sendVideoHeader:(LFVideoFrame *)frame];
|
||||
} else {
|
||||
[self sendVideo:(LFVideoFrame *)frame];
|
||||
[_self sendVideo:(LFVideoFrame *)frame];
|
||||
}
|
||||
} else {
|
||||
if (!self.sendAudioHead) {
|
||||
self.sendAudioHead = YES;
|
||||
if (!_self.sendAudioHead) {
|
||||
_self.sendAudioHead = YES;
|
||||
if(!((LFAudioFrame*)frame).audioInfo){
|
||||
self.isSending = NO;
|
||||
_self.isSending = NO;
|
||||
return;
|
||||
}
|
||||
[self sendAudioHeader:(LFAudioFrame *)frame];
|
||||
[_self sendAudioHeader:(LFAudioFrame *)frame];
|
||||
} else {
|
||||
[self sendAudio:frame];
|
||||
[_self sendAudio:frame];
|
||||
}
|
||||
}
|
||||
|
||||
//debug更新
|
||||
self.debugInfo.totalFrame++;
|
||||
self.debugInfo.dropFrame += self.buffer.lastDropFrames;
|
||||
self.buffer.lastDropFrames = 0;
|
||||
_self.debugInfo.totalFrame++;
|
||||
_self.debugInfo.dropFrame += _self.buffer.lastDropFrames;
|
||||
_self.buffer.lastDropFrames = 0;
|
||||
|
||||
self.debugInfo.dataFlow += frame.data.length;
|
||||
self.debugInfo.elapsedMilli = CACurrentMediaTime() * 1000 - self.debugInfo.timeStamp;
|
||||
if (self.debugInfo.elapsedMilli < 1000) {
|
||||
self.debugInfo.bandwidth += frame.data.length;
|
||||
_self.debugInfo.dataFlow += frame.data.length;
|
||||
_self.debugInfo.elapsedMilli = CACurrentMediaTime() * 1000 - _self.debugInfo.timeStamp;
|
||||
if (_self.debugInfo.elapsedMilli < 1000) {
|
||||
_self.debugInfo.bandwidth += frame.data.length;
|
||||
if ([frame isKindOfClass:[LFAudioFrame class]]) {
|
||||
self.debugInfo.capturedAudioCount++;
|
||||
_self.debugInfo.capturedAudioCount++;
|
||||
} else {
|
||||
self.debugInfo.capturedVideoCount++;
|
||||
_self.debugInfo.capturedVideoCount++;
|
||||
}
|
||||
|
||||
self.debugInfo.unSendCount = self.buffer.list.count;
|
||||
_self.debugInfo.unSendCount = _self.buffer.list.count;
|
||||
} else {
|
||||
self.debugInfo.currentBandwidth = self.debugInfo.bandwidth;
|
||||
self.debugInfo.currentCapturedAudioCount = self.debugInfo.capturedAudioCount;
|
||||
self.debugInfo.currentCapturedVideoCount = self.debugInfo.capturedVideoCount;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketDebug:debugInfo:)]) {
|
||||
[self.delegate socketDebug:self debugInfo:self.debugInfo];
|
||||
_self.debugInfo.currentBandwidth = _self.debugInfo.bandwidth;
|
||||
_self.debugInfo.currentCapturedAudioCount = _self.debugInfo.capturedAudioCount;
|
||||
_self.debugInfo.currentCapturedVideoCount = _self.debugInfo.capturedVideoCount;
|
||||
if (_self.delegate && [_self.delegate respondsToSelector:@selector(socketDebug:debugInfo:)]) {
|
||||
[_self.delegate socketDebug:_self debugInfo:_self.debugInfo];
|
||||
}
|
||||
self.debugInfo.bandwidth = 0;
|
||||
self.debugInfo.capturedAudioCount = 0;
|
||||
self.debugInfo.capturedVideoCount = 0;
|
||||
self.debugInfo.timeStamp = CACurrentMediaTime() * 1000;
|
||||
_self.debugInfo.bandwidth = 0;
|
||||
_self.debugInfo.capturedAudioCount = 0;
|
||||
_self.debugInfo.capturedVideoCount = 0;
|
||||
_self.debugInfo.timeStamp = CACurrentMediaTime() * 1000;
|
||||
}
|
||||
|
||||
//修改发送状态
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
//< 这里只为了不循环调用sendFrame方法 调用栈是保证先出栈再进栈
|
||||
self.isSending = NO;
|
||||
_self.isSending = NO;
|
||||
});
|
||||
|
||||
}
|
||||
@@ -237,18 +250,6 @@ SAVC(mp4a);
|
||||
- (NSInteger)RTMP264_Connect:(char *)push_url {
|
||||
//由于摄像头的timestamp是一直在累加,需要每次得到相对时间戳
|
||||
//分配与初始化
|
||||
if (_isConnecting) return -1;
|
||||
|
||||
_isConnecting = YES;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
|
||||
[self.delegate socketStatus:self status:LFLivePending];
|
||||
}
|
||||
|
||||
if (_rtmp != NULL) {
|
||||
PILI_RTMP_Close(_rtmp, &_error);
|
||||
PILI_RTMP_Free(_rtmp);
|
||||
}
|
||||
|
||||
_rtmp = PILI_RTMP_Alloc();
|
||||
PILI_RTMP_Init(_rtmp);
|
||||
|
||||
@@ -287,19 +288,13 @@ SAVC(mp4a);
|
||||
_isConnecting = NO;
|
||||
_isReconnecting = NO;
|
||||
_isSending = NO;
|
||||
_retryTimes4netWorkBreaken = 0;
|
||||
return 0;
|
||||
|
||||
Failed:
|
||||
PILI_RTMP_Close(_rtmp, &_error);
|
||||
PILI_RTMP_Free(_rtmp);
|
||||
_rtmp = NULL;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketDidError:errorCode:)]) {
|
||||
[self.delegate socketDidError:self errorCode:LFLiveSocketError_ConnectSocket];
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
|
||||
[self.delegate socketStatus:self status:LFLiveError];
|
||||
}
|
||||
[self reconnect];
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -491,36 +486,62 @@ Failed:
|
||||
// 断线重连
|
||||
- (void)reconnect {
|
||||
dispatch_async(self.rtmpSendQueue, ^{
|
||||
_isReconnecting = NO;
|
||||
if (_isConnected) return;
|
||||
|
||||
[self _stop];
|
||||
[self _start];
|
||||
if (self.retryTimes4netWorkBreaken++ < self.reconnectCount && !self.isReconnecting) {
|
||||
self.isConnected = NO;
|
||||
self.isConnecting = NO;
|
||||
self.isReconnecting = YES;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self performSelector:@selector(_reconnect) withObject:nil afterDelay:self.reconnectInterval];
|
||||
});
|
||||
|
||||
} else if (self.retryTimes4netWorkBreaken >= self.reconnectCount) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
|
||||
[self.delegate socketStatus:self status:LFLiveError];
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketDidError:errorCode:)]) {
|
||||
[self.delegate socketDidError:self errorCode:LFLiveSocketError_ReConnectTimeOut];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)_reconnect{
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
|
||||
_isReconnecting = NO;
|
||||
if(_isConnected) return;
|
||||
|
||||
_isReconnecting = NO;
|
||||
if (_isConnected) return;
|
||||
if (_rtmp != NULL) {
|
||||
PILI_RTMP_Close(_rtmp, &_error);
|
||||
PILI_RTMP_Free(_rtmp);
|
||||
_rtmp = NULL;
|
||||
}
|
||||
_sendAudioHead = NO;
|
||||
_sendVideoHead = NO;
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
|
||||
[self.delegate socketStatus:self status:LFLiveRefresh];
|
||||
}
|
||||
|
||||
if (_rtmp != NULL) {
|
||||
PILI_RTMP_Close(_rtmp, &_error);
|
||||
PILI_RTMP_Free(_rtmp);
|
||||
}
|
||||
[self RTMP264_Connect:(char *)[_stream.url cStringUsingEncoding:NSASCIIStringEncoding]];
|
||||
}
|
||||
|
||||
#pragma mark -- CallBack
|
||||
void RTMPErrorCallback(RTMPError *error, void *userData) {
|
||||
LFStreamRTMPSocket *socket = (__bridge LFStreamRTMPSocket *)userData;
|
||||
if (error->code < 0) {
|
||||
if (socket.retryTimes4netWorkBreaken++ < socket.reconnectCount && !socket.isReconnecting) {
|
||||
socket.isConnected = NO;
|
||||
socket.isConnecting = NO;
|
||||
socket.isReconnecting = YES;
|
||||
[socket performSelectorOnMainThread:@selector(reconnect) withObject:nil waitUntilDone:socket.reconnectInterval];
|
||||
} else if (socket.retryTimes4netWorkBreaken >= socket.reconnectCount) {
|
||||
if (socket.delegate && [socket.delegate respondsToSelector:@selector(socketStatus:status:)]) {
|
||||
[socket.delegate socketStatus:socket status:LFLiveError];
|
||||
}
|
||||
if (socket.delegate && [socket.delegate respondsToSelector:@selector(socketDidError:errorCode:)]) {
|
||||
[socket.delegate socketDidError:socket errorCode:LFLiveSocketError_ReConnectTimeOut];
|
||||
}
|
||||
}
|
||||
[socket reconnect];
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionTimeCallback(PILI_CONNECTION_TIME *conn_time, void *userData) {
|
||||
//LFStreamRTMPSocket *socket = (__bridge LFStreamRTMPSocket*)userData;
|
||||
LFStreamRTMPSocket *socket = (__bridge LFStreamRTMPSocket*)userData;
|
||||
}
|
||||
|
||||
#pragma mark -- LFStreamingBufferDelegate
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import "LFStreamingBuffer.h"
|
||||
#import "NSMutableArray+LFAdd.h"
|
||||
|
||||
static const NSUInteger defaultSortBufferMaxCount = 10;///< 排序10个内
|
||||
static const NSUInteger defaultSortBufferMaxCount = 5;///< 排序10个内
|
||||
static const NSUInteger defaultUpdateInterval = 1;///< 更新频率为1s
|
||||
static const NSUInteger defaultCallBackInterval = 5;///< 5s计时一次
|
||||
static const NSUInteger defaultSendBufferMaxCount = 600;///< 最大缓冲区为600
|
||||
|
||||
@@ -25,30 +25,13 @@
|
||||
84D8B4631D75782700752B56 /* close_preview@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B4581D75782700752B56 /* close_preview@2x.png */; };
|
||||
84D8B4641D75782700752B56 /* close_preview@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B4591D75782700752B56 /* close_preview@3x.png */; };
|
||||
84D8B4651D75782700752B56 /* ios-29x29.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B45A1D75782700752B56 /* ios-29x29.png */; };
|
||||
84D8B4681D75783F00752B56 /* GPUImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4661D75783F00752B56 /* GPUImage.framework */; };
|
||||
84D8B4CF1D757F0700752B56 /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4CE1D757F0700752B56 /* libstdc++.tbd */; };
|
||||
84D8B5541D76822C00752B56 /* pili-librtmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B5531D76822C00752B56 /* pili-librtmp.framework */; };
|
||||
84D8B5F41D768B9E00752B56 /* LFLiveKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B5F11D768B8300752B56 /* LFLiveKit.framework */; };
|
||||
BC8B37EEE1CEEF9B5614DC91 /* libPods-LFLiveKitDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B1CCEEE06FCFAF75D105A51 /* libPods-LFLiveKitDemo.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
84D8B5F01D768B8300752B56 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 84D8B3901D7574D600752B56;
|
||||
remoteInfo = LFLiveKit;
|
||||
};
|
||||
84D8B5F21D768B9700752B56 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 84D8B38F1D7574D600752B56;
|
||||
remoteInfo = LFLiveKit;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
289A9C4510CD7EA6F4CE9897 /* Pods-LFLiveKitDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
5B1CCEEE06FCFAF75D105A51 /* libPods-LFLiveKitDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-LFLiveKitDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
84D8B4261D75778B00752B56 /* LFLiveKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LFLiveKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
84D8B42A1D75778B00752B56 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
84D8B42C1D75778B00752B56 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
@@ -74,10 +57,8 @@
|
||||
84D8B4581D75782700752B56 /* close_preview@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@2x.png"; sourceTree = "<group>"; };
|
||||
84D8B4591D75782700752B56 /* close_preview@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@3x.png"; sourceTree = "<group>"; };
|
||||
84D8B45A1D75782700752B56 /* ios-29x29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ios-29x29.png"; sourceTree = "<group>"; };
|
||||
84D8B4661D75783F00752B56 /* GPUImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GPUImage.framework; path = ../Vendor/GPUImage.framework; sourceTree = "<group>"; };
|
||||
84D8B4CE1D757F0700752B56 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
|
||||
84D8B5531D76822C00752B56 /* pili-librtmp.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "pili-librtmp.framework"; path = "../Vendor/pili-librtmp.framework"; sourceTree = "<group>"; };
|
||||
84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LFLiveKit.xcodeproj; path = ../FrameWork/LFLiveKit.xcodeproj; sourceTree = "<group>"; };
|
||||
96E1231310083A3881AD2AB6 /* Pods-LFLiveKitDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo.release.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -85,25 +66,30 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
84D8B5F41D768B9E00752B56 /* LFLiveKit.framework in Frameworks */,
|
||||
84D8B5541D76822C00752B56 /* pili-librtmp.framework in Frameworks */,
|
||||
84D8B4CF1D757F0700752B56 /* libstdc++.tbd in Frameworks */,
|
||||
84D8B4681D75783F00752B56 /* GPUImage.framework in Frameworks */,
|
||||
BC8B37EEE1CEEF9B5614DC91 /* libPods-LFLiveKitDemo.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
65E0CF98FF954863E543A0E1 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5B1CCEEE06FCFAF75D105A51 /* libPods-LFLiveKitDemo.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
84D8B41D1D75778B00752B56 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */,
|
||||
84D8B5531D76822C00752B56 /* pili-librtmp.framework */,
|
||||
84D8B4CE1D757F0700752B56 /* libstdc++.tbd */,
|
||||
84D8B4661D75783F00752B56 /* GPUImage.framework */,
|
||||
84D8B4281D75778B00752B56 /* LFLiveKitDemo */,
|
||||
84D8B4271D75778B00752B56 /* Products */,
|
||||
F3E359B8A7561F963C47A62F /* Pods */,
|
||||
65E0CF98FF954863E543A0E1 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -170,12 +156,13 @@
|
||||
path = images;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
84D8B5ED1D768B8300752B56 /* Products */ = {
|
||||
F3E359B8A7561F963C47A62F /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
84D8B5F11D768B8300752B56 /* LFLiveKit.framework */,
|
||||
289A9C4510CD7EA6F4CE9897 /* Pods-LFLiveKitDemo.debug.xcconfig */,
|
||||
96E1231310083A3881AD2AB6 /* Pods-LFLiveKitDemo.release.xcconfig */,
|
||||
);
|
||||
name = Products;
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@@ -185,14 +172,16 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 84D8B43D1D75778B00752B56 /* Build configuration list for PBXNativeTarget "LFLiveKitDemo" */;
|
||||
buildPhases = (
|
||||
A819C09CC049A57DC5C97E12 /* 📦 Check Pods Manifest.lock */,
|
||||
84D8B4221D75778B00752B56 /* Sources */,
|
||||
84D8B4231D75778B00752B56 /* Frameworks */,
|
||||
84D8B4241D75778B00752B56 /* Resources */,
|
||||
883533331BE4DCC0DB5075CF /* 📦 Embed Pods Frameworks */,
|
||||
4CC4C37B93D109913E475307 /* 📦 Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
84D8B5F31D768B9700752B56 /* PBXTargetDependency */,
|
||||
);
|
||||
name = LFLiveKitDemo;
|
||||
productName = LFLiveKitDemo;
|
||||
@@ -210,6 +199,7 @@
|
||||
TargetAttributes = {
|
||||
84D8B4251D75778B00752B56 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = G497YX6CBT;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -224,12 +214,6 @@
|
||||
mainGroup = 84D8B41D1D75778B00752B56;
|
||||
productRefGroup = 84D8B4271D75778B00752B56 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 84D8B5ED1D768B8300752B56 /* Products */;
|
||||
ProjectRef = 84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
84D8B4251D75778B00752B56 /* LFLiveKitDemo */,
|
||||
@@ -237,16 +221,6 @@
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
84D8B5F11D768B8300752B56 /* LFLiveKit.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = LFLiveKit.framework;
|
||||
remoteRef = 84D8B5F01D768B8300752B56 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
84D8B4241D75778B00752B56 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
@@ -269,6 +243,54 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
4CC4C37B93D109913E475307 /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
883533331BE4DCC0DB5075CF /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
A819C09CC049A57DC5C97E12 /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
84D8B4221D75778B00752B56 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
@@ -285,14 +307,6 @@
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
84D8B5F31D768B9700752B56 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = LFLiveKit;
|
||||
targetProxy = 84D8B5F21D768B9700752B56 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
84D8B4321D75778B00752B56 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
@@ -397,38 +411,36 @@
|
||||
};
|
||||
84D8B43E1D75778B00752B56 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 289A9C4510CD7EA6F4CE9897 /* Pods-LFLiveKitDemo.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../Vendor\"/**",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
DEVELOPMENT_TEAM = G497YX6CBT;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = LFLiveKitDemo/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
OTHER_LDFLAGS = "-all_load";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitDemo;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LaiFeng;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
84D8B43F1D75778B00752B56 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 96E1231310083A3881AD2AB6 /* Pods-LFLiveKitDemo.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../Vendor\"/**",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
DEVELOPMENT_TEAM = G497YX6CBT;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = LFLiveKitDemo/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
OTHER_LDFLAGS = "-all_load";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitDemo;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LaiFeng;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
BIN
Binary file not shown.
@@ -26,6 +26,10 @@
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>cameraDesciption</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>microphoneDesciption</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import "LFLivePreview.h"
|
||||
#import "UIControl+YYAdd.h"
|
||||
#import "UIView+YYAdd.h"
|
||||
#import <LFLiveKit/LFLiveKit.h>
|
||||
#import "LFLiveKit.h"
|
||||
|
||||
inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
|
||||
if (elapsed_milli <= 0) {
|
||||
@@ -255,11 +255,19 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
|
||||
_session.showDebugInfo = NO;
|
||||
_session.preView = self;
|
||||
|
||||
/*本地存储*/
|
||||
// _session.saveLocalVideo = YES;
|
||||
// NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.mp4"];
|
||||
// unlink([pathToMovie UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie
|
||||
// NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
|
||||
// _session.saveLocalVideoPath = movieURL;
|
||||
|
||||
/*
|
||||
UIImageView *imageView = [[UIImageView alloc] init];
|
||||
imageView.alpha = 0.8;
|
||||
imageView.frame = CGRectMake(100, 100, 29, 29);
|
||||
imageView.image = [UIImage imageNamed:@"ios-29x29"];
|
||||
_session.warterMarkView = imageView;
|
||||
_session.warterMarkView = imageView;*/
|
||||
|
||||
}
|
||||
return _session;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios,'7.0'
|
||||
|
||||
target “LFLiveKitDemo” do
|
||||
pod 'LFLiveKit', :path => '../.'
|
||||
end
|
||||
@@ -20,30 +20,13 @@
|
||||
84D8B4B11D757DBB00752B56 /* camra_preview@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B4A91D757DBB00752B56 /* camra_preview@3x.png */; };
|
||||
84D8B4B21D757DBB00752B56 /* close_preview@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B4AA1D757DBB00752B56 /* close_preview@2x.png */; };
|
||||
84D8B4B31D757DBB00752B56 /* close_preview@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B4AB1D757DBB00752B56 /* close_preview@3x.png */; };
|
||||
84D8B4BA1D757DED00752B56 /* GPUImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4B81D757DED00752B56 /* GPUImage.framework */; };
|
||||
84D8B4BD1D757E0E00752B56 /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4BC1D757E0E00752B56 /* libstdc++.tbd */; };
|
||||
84D8B5571D76824700752B56 /* pili-librtmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B5561D76824700752B56 /* pili-librtmp.framework */; };
|
||||
84D8B5FE1D768BBE00752B56 /* LFLiveKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B5FB1D768BB200752B56 /* LFLiveKit.framework */; };
|
||||
9CA0546A1BD4E74670872B9B /* libPods-LFLiveKitSwiftDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E0C4364E65B82DECF3326D9 /* libPods-LFLiveKitSwiftDemo.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
84D8B5FA1D768BB200752B56 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 84D8B5F61D768BB200752B56 /* LFLiveKit.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 84D8B3901D7574D600752B56;
|
||||
remoteInfo = LFLiveKit;
|
||||
};
|
||||
84D8B5FC1D768BB800752B56 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 84D8B5F61D768BB200752B56 /* LFLiveKit.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 84D8B38F1D7574D600752B56;
|
||||
remoteInfo = LFLiveKit;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
4E0C4364E65B82DECF3326D9 /* libPods-LFLiveKitSwiftDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-LFLiveKitSwiftDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7265B07B4B6CEE8ECE8F7A63 /* Pods-LFLiveKitSwiftDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitSwiftDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitSwiftDemo/Pods-LFLiveKitSwiftDemo.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
84D8B4881D757D4000752B56 /* LFLiveKitSwiftDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LFLiveKitSwiftDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
84D8B48B1D757D4000752B56 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
84D8B48D1D757D4000752B56 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
@@ -59,10 +42,8 @@
|
||||
84D8B4A91D757DBB00752B56 /* camra_preview@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camra_preview@3x.png"; sourceTree = "<group>"; };
|
||||
84D8B4AA1D757DBB00752B56 /* close_preview@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@2x.png"; sourceTree = "<group>"; };
|
||||
84D8B4AB1D757DBB00752B56 /* close_preview@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@3x.png"; sourceTree = "<group>"; };
|
||||
84D8B4B81D757DED00752B56 /* GPUImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GPUImage.framework; path = ../Vendor/GPUImage.framework; sourceTree = "<group>"; };
|
||||
84D8B4BC1D757E0E00752B56 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
|
||||
84D8B5561D76824700752B56 /* pili-librtmp.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "pili-librtmp.framework"; path = "../Vendor/pili-librtmp.framework"; sourceTree = "<group>"; };
|
||||
84D8B5F61D768BB200752B56 /* LFLiveKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LFLiveKit.xcodeproj; path = ../FrameWork/LFLiveKit.xcodeproj; sourceTree = "<group>"; };
|
||||
DAC498DB742E949DED005ECE /* Pods-LFLiveKitSwiftDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitSwiftDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitSwiftDemo/Pods-LFLiveKitSwiftDemo.release.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -70,25 +51,30 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
84D8B5FE1D768BBE00752B56 /* LFLiveKit.framework in Frameworks */,
|
||||
84D8B5571D76824700752B56 /* pili-librtmp.framework in Frameworks */,
|
||||
84D8B4BD1D757E0E00752B56 /* libstdc++.tbd in Frameworks */,
|
||||
84D8B4BA1D757DED00752B56 /* GPUImage.framework in Frameworks */,
|
||||
9CA0546A1BD4E74670872B9B /* libPods-LFLiveKitSwiftDemo.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
23FA2B0543E0C2A8E7C84D9E /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4E0C4364E65B82DECF3326D9 /* libPods-LFLiveKitSwiftDemo.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
84D8B47F1D757D4000752B56 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
84D8B5F61D768BB200752B56 /* LFLiveKit.xcodeproj */,
|
||||
84D8B5561D76824700752B56 /* pili-librtmp.framework */,
|
||||
84D8B4BC1D757E0E00752B56 /* libstdc++.tbd */,
|
||||
84D8B4B81D757DED00752B56 /* GPUImage.framework */,
|
||||
84D8B48A1D757D4000752B56 /* LFLiveKitSwiftDemo */,
|
||||
84D8B4891D757D4000752B56 /* Products */,
|
||||
B19B532AA669846CC85D50E3 /* Pods */,
|
||||
23FA2B0543E0C2A8E7C84D9E /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -129,12 +115,13 @@
|
||||
path = images;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
84D8B5F71D768BB200752B56 /* Products */ = {
|
||||
B19B532AA669846CC85D50E3 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
84D8B5FB1D768BB200752B56 /* LFLiveKit.framework */,
|
||||
7265B07B4B6CEE8ECE8F7A63 /* Pods-LFLiveKitSwiftDemo.debug.xcconfig */,
|
||||
DAC498DB742E949DED005ECE /* Pods-LFLiveKitSwiftDemo.release.xcconfig */,
|
||||
);
|
||||
name = Products;
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@@ -144,14 +131,16 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 84D8B49A1D757D4000752B56 /* Build configuration list for PBXNativeTarget "LFLiveKitSwiftDemo" */;
|
||||
buildPhases = (
|
||||
FC46EAD69B9F095AB7372DB6 /* 📦 Check Pods Manifest.lock */,
|
||||
84D8B4841D757D4000752B56 /* Sources */,
|
||||
84D8B4851D757D4000752B56 /* Frameworks */,
|
||||
84D8B4861D757D4000752B56 /* Resources */,
|
||||
951756CA4F11963EE3622ADB /* 📦 Embed Pods Frameworks */,
|
||||
1D8289CE7990A09D5E67FA15 /* 📦 Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
84D8B5FD1D768BB800752B56 /* PBXTargetDependency */,
|
||||
);
|
||||
name = LFLiveKitSwiftDemo;
|
||||
productName = LFLiveKitSwiftDemo;
|
||||
@@ -170,6 +159,8 @@
|
||||
TargetAttributes = {
|
||||
84D8B4871D757D4000752B56 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = G497YX6CBT;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -184,12 +175,6 @@
|
||||
mainGroup = 84D8B47F1D757D4000752B56;
|
||||
productRefGroup = 84D8B4891D757D4000752B56 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 84D8B5F71D768BB200752B56 /* Products */;
|
||||
ProjectRef = 84D8B5F61D768BB200752B56 /* LFLiveKit.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
84D8B4871D757D4000752B56 /* LFLiveKitSwiftDemo */,
|
||||
@@ -197,16 +182,6 @@
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
84D8B5FB1D768BB200752B56 /* LFLiveKit.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = LFLiveKit.framework;
|
||||
remoteRef = 84D8B5FA1D768BB200752B56 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
84D8B4861D757D4000752B56 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
@@ -228,6 +203,54 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
1D8289CE7990A09D5E67FA15 /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitSwiftDemo/Pods-LFLiveKitSwiftDemo-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
951756CA4F11963EE3622ADB /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitSwiftDemo/Pods-LFLiveKitSwiftDemo-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FC46EAD69B9F095AB7372DB6 /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
84D8B4841D757D4000752B56 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
@@ -240,14 +263,6 @@
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
84D8B5FD1D768BB800752B56 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = LFLiveKit;
|
||||
targetProxy = 84D8B5FC1D768BB800752B56 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
84D8B48F1D757D4000752B56 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
@@ -353,29 +368,41 @@
|
||||
};
|
||||
84D8B49B1D757D4000752B56 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7265B07B4B6CEE8ECE8F7A63 /* Pods-LFLiveKitSwiftDemo.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
|
||||
DEVELOPMENT_TEAM = G497YX6CBT;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = LFLiveKitSwiftDemo/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitSwiftDemo;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-all_load";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LaiFeng;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
84D8B49C1D757D4000752B56 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = DAC498DB742E949DED005ECE /* Pods-LFLiveKitSwiftDemo.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
|
||||
DEVELOPMENT_TEAM = G497YX6CBT;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = LFLiveKitSwiftDemo/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitSwiftDemo;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-all_load";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LaiFeng;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(application: UIApplication) {
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(application: UIApplication) {
|
||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(application: UIApplication) {
|
||||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(application: UIApplication) {
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(application: UIApplication) {
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class ViewController: UIViewController, LFLiveSessionDelegate {
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
self.requestAccessForVideo()
|
||||
self.requestAccessForAudio()
|
||||
self.view.backgroundColor = UIColor.clearColor()
|
||||
self.view.backgroundColor = UIColor.clear
|
||||
self.view.addSubview(containerView)
|
||||
containerView.addSubview(stateLabel)
|
||||
containerView.addSubview(closeButton)
|
||||
@@ -79,15 +79,15 @@ class ViewController: UIViewController, LFLiveSessionDelegate {
|
||||
//MARK: - Callbacks
|
||||
|
||||
// 回调
|
||||
func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?) {
|
||||
func liveSession(_ session: LFLiveSession?, debugInfo: LFLiveDebug?) {
|
||||
print("debugInfo: \(debugInfo?.currentBandwidth)")
|
||||
}
|
||||
|
||||
func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode) {
|
||||
func liveSession(_ session: LFLiveSession?, errorCode: LFLiveSocketErrorCode) {
|
||||
print("errorCode: \(errorCode.rawValue)")
|
||||
}
|
||||
|
||||
func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState) {
|
||||
func liveSession(_ session: LFLiveSession?, liveStateDidChange state: LFLiveState) {
|
||||
print("liveStateDidChange: \(state.rawValue)")
|
||||
switch state {
|
||||
case LFLiveState.Ready:
|
||||
@@ -105,42 +105,39 @@ class ViewController: UIViewController, LFLiveSessionDelegate {
|
||||
case LFLiveState.Stop:
|
||||
stateLabel.text = "未连接"
|
||||
break;
|
||||
default:
|
||||
stateLabel.text = "未知"
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Events
|
||||
|
||||
// 开始直播
|
||||
func didTappedStartLiveButton(button: UIButton) -> Void {
|
||||
startLiveButton.selected = !startLiveButton.selected;
|
||||
if (startLiveButton.selected) {
|
||||
startLiveButton.setTitle("结束直播", forState: UIControlState.Normal)
|
||||
func didTappedStartLiveButton(_ button: UIButton) -> Void {
|
||||
startLiveButton.isSelected = !startLiveButton.isSelected;
|
||||
if (startLiveButton.isSelected) {
|
||||
startLiveButton.setTitle("结束直播", for: UIControlState())
|
||||
let stream = LFLiveStreamInfo()
|
||||
stream.url = "rtmp://30.96.179.95:1935/live/1234"
|
||||
stream.url = "rtmp://live.hkstv.hk.lxdns.com:1935/live/stream153"
|
||||
session.startLive(stream)
|
||||
} else {
|
||||
startLiveButton.setTitle("开始直播", forState: UIControlState.Normal)
|
||||
startLiveButton.setTitle("开始直播", for: UIControlState())
|
||||
session.stopLive()
|
||||
}
|
||||
}
|
||||
|
||||
// 美颜
|
||||
func didTappedBeautyButton(button: UIButton) -> Void {
|
||||
func didTappedBeautyButton(_ button: UIButton) -> Void {
|
||||
session.beautyFace = !session.beautyFace;
|
||||
beautyButton.selected = !session.beautyFace;
|
||||
}
|
||||
|
||||
// 摄像头
|
||||
func didTappedCameraButton(button: UIButton) -> Void {
|
||||
func didTappedCameraButton(_ button: UIButton) -> Void {
|
||||
let devicePositon = session.captureDevicePosition;
|
||||
session.captureDevicePosition = (devicePositon == AVCaptureDevicePosition.Back) ? AVCaptureDevicePosition.Front : AVCaptureDevicePosition.Back;
|
||||
}
|
||||
|
||||
// 关闭
|
||||
func didTappedCloseButton(button: UIButton) -> Void {
|
||||
func didTappedCloseButton(_ button: UIButton) -> Void {
|
||||
|
||||
}
|
||||
|
||||
@@ -149,7 +146,7 @@ class ViewController: UIViewController, LFLiveSessionDelegate {
|
||||
// 默认分辨率368 * 640 音频:44.1 iphone6以上48 双声道 方向竖屏
|
||||
lazy var session: LFLiveSession = {
|
||||
let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration()
|
||||
let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false)
|
||||
let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3)
|
||||
let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration)
|
||||
|
||||
session?.delegate = self
|
||||
@@ -160,8 +157,8 @@ class ViewController: UIViewController, LFLiveSessionDelegate {
|
||||
// 视图
|
||||
lazy var containerView: UIView = {
|
||||
let containerView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height))
|
||||
containerView.backgroundColor = UIColor.clearColor()
|
||||
containerView.autoresizingMask = [UIViewAutoresizing.FlexibleHeight, UIViewAutoresizing.FlexibleHeight]
|
||||
containerView.backgroundColor = UIColor.clear
|
||||
containerView.autoresizingMask = [UIViewAutoresizing.flexibleHeight, UIViewAutoresizing.flexibleHeight]
|
||||
return containerView
|
||||
}()
|
||||
|
||||
@@ -169,33 +166,33 @@ class ViewController: UIViewController, LFLiveSessionDelegate {
|
||||
lazy var stateLabel: UILabel = {
|
||||
let stateLabel = UILabel(frame: CGRect(x: 20, y: 20, width: 80, height: 40))
|
||||
stateLabel.text = "未连接"
|
||||
stateLabel.textColor = UIColor.whiteColor()
|
||||
stateLabel.font = UIFont.systemFontOfSize(14)
|
||||
stateLabel.textColor = UIColor.white
|
||||
stateLabel.font = UIFont.systemFont(ofSize: 14)
|
||||
return stateLabel
|
||||
}()
|
||||
|
||||
// 关闭按钮
|
||||
lazy var closeButton: UIButton = {
|
||||
let closeButton = UIButton(frame: CGRect(x: self.view.frame.width - 10 - 44, y: 20, width: 44, height: 44))
|
||||
closeButton.setImage(UIImage(named: "close_preview"), forState: UIControlState.Normal)
|
||||
closeButton.addTarget(self, action: #selector(didTappedCloseButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
|
||||
closeButton.setImage(UIImage(named: "close_preview"), for: UIControlState())
|
||||
closeButton.addTarget(self, action: #selector(didTappedCloseButton(_:)), for: UIControlEvents.touchUpInside)
|
||||
return closeButton
|
||||
}()
|
||||
|
||||
// 摄像头
|
||||
lazy var cameraButton: UIButton = {
|
||||
let cameraButton = UIButton(frame: CGRect(x: self.view.frame.width - 54 * 2, y: 20, width: 44, height: 44))
|
||||
cameraButton.setImage(UIImage(named: "camra_preview"), forState: UIControlState.Normal)
|
||||
cameraButton.addTarget(self, action: #selector(didTappedCameraButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
|
||||
cameraButton.setImage(UIImage(named: "camra_preview"), for: UIControlState())
|
||||
cameraButton.addTarget(self, action: #selector(didTappedCameraButton(_:)), for: UIControlEvents.touchUpInside)
|
||||
return cameraButton
|
||||
}()
|
||||
|
||||
// 摄像头
|
||||
lazy var beautyButton: UIButton = {
|
||||
let beautyButton = UIButton(frame: CGRect(x: self.view.frame.width - 54 * 3, y: 20, width: 44, height: 44))
|
||||
beautyButton.setImage(UIImage(named: "camra_preview"), forState: UIControlState.Selected)
|
||||
beautyButton.setImage(UIImage(named: "camra_beauty_close"), forState: UIControlState.Normal)
|
||||
beautyButton.addTarget(self, action: #selector(didTappedBeautyButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
|
||||
beautyButton.setImage(UIImage(named: "camra_preview"), for: UIControlState.selected)
|
||||
beautyButton.setImage(UIImage(named: "camra_beauty_close"), for: UIControlState())
|
||||
beautyButton.addTarget(self, action: #selector(didTappedBeautyButton(_:)), for: UIControlEvents.touchUpInside)
|
||||
return beautyButton
|
||||
}()
|
||||
|
||||
@@ -203,20 +200,20 @@ class ViewController: UIViewController, LFLiveSessionDelegate {
|
||||
lazy var startLiveButton: UIButton = {
|
||||
let startLiveButton = UIButton(frame: CGRect(x: 30, y: self.view.frame.height - 50, width: self.view.frame.width - 10 - 44, height: 44))
|
||||
startLiveButton.layer.cornerRadius = 22
|
||||
startLiveButton.setTitleColor(UIColor.blackColor(), forState:UIControlState.Normal)
|
||||
startLiveButton.setTitle("开始直播", forState: UIControlState.Normal)
|
||||
startLiveButton.titleLabel!.font = UIFont.systemFontOfSize(14)
|
||||
startLiveButton.setTitleColor(UIColor.black, for:UIControlState())
|
||||
startLiveButton.setTitle("开始直播", for: UIControlState())
|
||||
startLiveButton.titleLabel!.font = UIFont.systemFont(ofSize: 14)
|
||||
startLiveButton.backgroundColor = UIColor(colorLiteralRed: 50, green: 32, blue: 245, alpha: 1)
|
||||
startLiveButton.addTarget(self, action: #selector(didTappedStartLiveButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
|
||||
startLiveButton.addTarget(self, action: #selector(didTappedStartLiveButton(_:)), for: UIControlEvents.touchUpInside)
|
||||
return startLiveButton
|
||||
}()
|
||||
|
||||
// 转屏
|
||||
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
|
||||
return UIInterfaceOrientationMask.Portrait
|
||||
override var supportedInterfaceOrientations : UIInterfaceOrientationMask {
|
||||
return UIInterfaceOrientationMask.portrait
|
||||
}
|
||||
|
||||
override func shouldAutorotate() -> Bool {
|
||||
override var shouldAutorotate : Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios,'7.0'
|
||||
|
||||
target “LFLiveKitSwiftDemo” do
|
||||
pod 'LFLiveKit', :path => '../.'
|
||||
end
|
||||
@@ -71,63 +71,63 @@ LFLiveKit
|
||||
## Usage example
|
||||
|
||||
#### Objective-C
|
||||
```objc
|
||||
- (LFLiveSession*)session {
|
||||
if (!_session) {
|
||||
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
|
||||
_session.preView = self;
|
||||
_session.delegate = self;
|
||||
}
|
||||
return _session;
|
||||
}
|
||||
|
||||
- (LFLiveSession*)session {
|
||||
if (!_session) {
|
||||
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
|
||||
_session.preView = self;
|
||||
_session.delegate = self;
|
||||
}
|
||||
return _session;
|
||||
}
|
||||
|
||||
- (void)startLive {
|
||||
LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new];
|
||||
streamInfo.url = @"your server rtmp url";
|
||||
[self.session startLive:streamInfo];
|
||||
}
|
||||
- (void)startLive {
|
||||
LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new];
|
||||
streamInfo.url = @"your server rtmp url";
|
||||
[self.session startLive:streamInfo];
|
||||
}
|
||||
|
||||
- (void)stopLive {
|
||||
[self.session stopLive];
|
||||
}
|
||||
|
||||
//MARK: - CallBack:
|
||||
- (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state;
|
||||
- (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo;
|
||||
- (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode;
|
||||
- (void)stopLive {
|
||||
[self.session stopLive];
|
||||
}
|
||||
|
||||
//MARK: - CallBack:
|
||||
- (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state;
|
||||
- (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo;
|
||||
- (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode;
|
||||
```
|
||||
#### Swift
|
||||
```swift
|
||||
// import LFLiveKit in [ProjectName]-Bridging-Header.h
|
||||
#import <LFLiveKit.h>
|
||||
|
||||
// import LFLiveKit in [ProjectName]-Bridging-Header.h
|
||||
import <LFLiveKit.h>
|
||||
//MARK: - Getters and Setters
|
||||
lazy var session: LFLiveSession = {
|
||||
let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration()
|
||||
let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false)
|
||||
let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration)
|
||||
|
||||
session?.delegate = self
|
||||
session?.preView = self.view
|
||||
return session!
|
||||
}()
|
||||
|
||||
//MARK: - Getters and Setters
|
||||
lazy var session: LFLiveSession = {
|
||||
let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration()
|
||||
let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false)
|
||||
let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration)
|
||||
|
||||
session?.delegate = self
|
||||
session?.preView = self.view
|
||||
return session!
|
||||
}()
|
||||
//MARK: - Event
|
||||
func startLive() -> Void {
|
||||
let stream = LFLiveStreamInfo()
|
||||
stream.url = "your server rtmp url";
|
||||
session.startLive(stream)
|
||||
}
|
||||
|
||||
//MARK: - Event
|
||||
func startLive() -> Void {
|
||||
let stream = LFLiveStreamInfo()
|
||||
stream.url = "your server rtmp url";
|
||||
session.startLive(stream)
|
||||
}
|
||||
|
||||
func stopLive() -> Void {
|
||||
session.stopLive()
|
||||
}
|
||||
|
||||
//MARK: - Callback
|
||||
func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?)
|
||||
func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode)
|
||||
func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState)
|
||||
func stopLive() -> Void {
|
||||
session.stopLive()
|
||||
}
|
||||
|
||||
//MARK: - Callback
|
||||
func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?)
|
||||
func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode)
|
||||
func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState)
|
||||
```
|
||||
|
||||
## Release History
|
||||
* 2.0.0
|
||||
|
||||
Vendored
BIN
Binary file not shown.
-42
@@ -1,42 +0,0 @@
|
||||
// This is Jeff LaMarche's GLProgram OpenGL shader wrapper class from his OpenGL ES 2.0 book.
|
||||
// A description of this can be found at his page on the topic:
|
||||
// http://iphonedevelopment.blogspot.com/2010/11/opengl-es-20-for-ios-chapter-4.html
|
||||
// I've extended this to be able to take programs as NSStrings in addition to files, for baked-in shaders
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
|
||||
#import <OpenGLES/ES2/gl.h>
|
||||
#import <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#import <OpenGL/OpenGL.h>
|
||||
#import <OpenGL/gl.h>
|
||||
#endif
|
||||
|
||||
@interface GLProgram : NSObject
|
||||
{
|
||||
NSMutableArray *attributes;
|
||||
NSMutableArray *uniforms;
|
||||
GLuint program,
|
||||
vertShader,
|
||||
fragShader;
|
||||
}
|
||||
|
||||
@property(readwrite, nonatomic) BOOL initialized;
|
||||
@property(readwrite, copy, nonatomic) NSString *vertexShaderLog;
|
||||
@property(readwrite, copy, nonatomic) NSString *fragmentShaderLog;
|
||||
@property(readwrite, copy, nonatomic) NSString *programLog;
|
||||
|
||||
- (id)initWithVertexShaderString:(NSString *)vShaderString
|
||||
fragmentShaderString:(NSString *)fShaderString;
|
||||
- (id)initWithVertexShaderString:(NSString *)vShaderString
|
||||
fragmentShaderFilename:(NSString *)fShaderFilename;
|
||||
- (id)initWithVertexShaderFilename:(NSString *)vShaderFilename
|
||||
fragmentShaderFilename:(NSString *)fShaderFilename;
|
||||
- (void)addAttribute:(NSString *)attributeName;
|
||||
- (GLuint)attributeIndex:(NSString *)attributeName;
|
||||
- (GLuint)uniformIndex:(NSString *)uniformName;
|
||||
- (BOOL)link;
|
||||
- (void)use;
|
||||
- (void)validate;
|
||||
@end
|
||||
-170
@@ -1,170 +0,0 @@
|
||||
#import "GLProgram.h"
|
||||
|
||||
// Base classes
|
||||
#import "GPUImageContext.h"
|
||||
#import "GPUImageOutput.h"
|
||||
#import "GPUImageView.h"
|
||||
#import "GPUImageVideoCamera.h"
|
||||
#import "GPUImageStillCamera.h"
|
||||
#import "GPUImageMovie.h"
|
||||
#import "GPUImagePicture.h"
|
||||
#import "GPUImageRawDataInput.h"
|
||||
#import "GPUImageRawDataOutput.h"
|
||||
#import "GPUImageMovieWriter.h"
|
||||
#import "GPUImageFilterPipeline.h"
|
||||
#import "GPUImageTextureOutput.h"
|
||||
#import "GPUImageFilterGroup.h"
|
||||
#import "GPUImageTextureInput.h"
|
||||
#import "GPUImageUIElement.h"
|
||||
#import "GPUImageBuffer.h"
|
||||
#import "GPUImageFramebuffer.h"
|
||||
#import "GPUImageFramebufferCache.h"
|
||||
|
||||
// Filters
|
||||
#import "GPUImageFilter.h"
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
#import "GPUImagePixellateFilter.h"
|
||||
#import "GPUImagePixellatePositionFilter.h"
|
||||
#import "GPUImageSepiaFilter.h"
|
||||
#import "GPUImageColorInvertFilter.h"
|
||||
#import "GPUImageSaturationFilter.h"
|
||||
#import "GPUImageContrastFilter.h"
|
||||
#import "GPUImageExposureFilter.h"
|
||||
#import "GPUImageBrightnessFilter.h"
|
||||
#import "GPUImageLevelsFilter.h"
|
||||
#import "GPUImageSharpenFilter.h"
|
||||
#import "GPUImageGammaFilter.h"
|
||||
#import "GPUImageSobelEdgeDetectionFilter.h"
|
||||
#import "GPUImageSketchFilter.h"
|
||||
#import "GPUImageToonFilter.h"
|
||||
#import "GPUImageSmoothToonFilter.h"
|
||||
#import "GPUImageMultiplyBlendFilter.h"
|
||||
#import "GPUImageDissolveBlendFilter.h"
|
||||
#import "GPUImageKuwaharaFilter.h"
|
||||
#import "GPUImageKuwaharaRadius3Filter.h"
|
||||
#import "GPUImageVignetteFilter.h"
|
||||
#import "GPUImageGaussianBlurFilter.h"
|
||||
#import "GPUImageGaussianBlurPositionFilter.h"
|
||||
#import "GPUImageGaussianSelectiveBlurFilter.h"
|
||||
#import "GPUImageOverlayBlendFilter.h"
|
||||
#import "GPUImageDarkenBlendFilter.h"
|
||||
#import "GPUImageLightenBlendFilter.h"
|
||||
#import "GPUImageSwirlFilter.h"
|
||||
#import "GPUImageSourceOverBlendFilter.h"
|
||||
#import "GPUImageColorBurnBlendFilter.h"
|
||||
#import "GPUImageColorDodgeBlendFilter.h"
|
||||
#import "GPUImageScreenBlendFilter.h"
|
||||
#import "GPUImageExclusionBlendFilter.h"
|
||||
#import "GPUImageDifferenceBlendFilter.h"
|
||||
#import "GPUImageSubtractBlendFilter.h"
|
||||
#import "GPUImageHardLightBlendFilter.h"
|
||||
#import "GPUImageSoftLightBlendFilter.h"
|
||||
#import "GPUImageColorBlendFilter.h"
|
||||
#import "GPUImageHueBlendFilter.h"
|
||||
#import "GPUImageSaturationBlendFilter.h"
|
||||
#import "GPUImageLuminosityBlendFilter.h"
|
||||
#import "GPUImageCropFilter.h"
|
||||
#import "GPUImageGrayscaleFilter.h"
|
||||
#import "GPUImageTransformFilter.h"
|
||||
#import "GPUImageChromaKeyBlendFilter.h"
|
||||
#import "GPUImageHazeFilter.h"
|
||||
#import "GPUImageLuminanceThresholdFilter.h"
|
||||
#import "GPUImagePosterizeFilter.h"
|
||||
#import "GPUImageBoxBlurFilter.h"
|
||||
#import "GPUImageAdaptiveThresholdFilter.h"
|
||||
#import "GPUImageSolarizeFilter.h"
|
||||
#import "GPUImageUnsharpMaskFilter.h"
|
||||
#import "GPUImageBulgeDistortionFilter.h"
|
||||
#import "GPUImagePinchDistortionFilter.h"
|
||||
#import "GPUImageCrosshatchFilter.h"
|
||||
#import "GPUImageCGAColorspaceFilter.h"
|
||||
#import "GPUImagePolarPixellateFilter.h"
|
||||
#import "GPUImageStretchDistortionFilter.h"
|
||||
#import "GPUImagePerlinNoiseFilter.h"
|
||||
#import "GPUImageJFAVoronoiFilter.h"
|
||||
#import "GPUImageVoronoiConsumerFilter.h"
|
||||
#import "GPUImageMosaicFilter.h"
|
||||
#import "GPUImageTiltShiftFilter.h"
|
||||
#import "GPUImage3x3ConvolutionFilter.h"
|
||||
#import "GPUImageEmbossFilter.h"
|
||||
#import "GPUImageCannyEdgeDetectionFilter.h"
|
||||
#import "GPUImageThresholdEdgeDetectionFilter.h"
|
||||
#import "GPUImageMaskFilter.h"
|
||||
#import "GPUImageHistogramFilter.h"
|
||||
#import "GPUImageHistogramGenerator.h"
|
||||
#import "GPUImageHistogramEqualizationFilter.h"
|
||||
#import "GPUImagePrewittEdgeDetectionFilter.h"
|
||||
#import "GPUImageXYDerivativeFilter.h"
|
||||
#import "GPUImageHarrisCornerDetectionFilter.h"
|
||||
#import "GPUImageAlphaBlendFilter.h"
|
||||
#import "GPUImageNormalBlendFilter.h"
|
||||
#import "GPUImageNonMaximumSuppressionFilter.h"
|
||||
#import "GPUImageRGBFilter.h"
|
||||
#import "GPUImageMedianFilter.h"
|
||||
#import "GPUImageBilateralFilter.h"
|
||||
#import "GPUImageCrosshairGenerator.h"
|
||||
#import "GPUImageToneCurveFilter.h"
|
||||
#import "GPUImageNobleCornerDetectionFilter.h"
|
||||
#import "GPUImageShiTomasiFeatureDetectionFilter.h"
|
||||
#import "GPUImageErosionFilter.h"
|
||||
#import "GPUImageRGBErosionFilter.h"
|
||||
#import "GPUImageDilationFilter.h"
|
||||
#import "GPUImageRGBDilationFilter.h"
|
||||
#import "GPUImageOpeningFilter.h"
|
||||
#import "GPUImageRGBOpeningFilter.h"
|
||||
#import "GPUImageClosingFilter.h"
|
||||
#import "GPUImageRGBClosingFilter.h"
|
||||
#import "GPUImageColorPackingFilter.h"
|
||||
#import "GPUImageSphereRefractionFilter.h"
|
||||
#import "GPUImageMonochromeFilter.h"
|
||||
#import "GPUImageOpacityFilter.h"
|
||||
#import "GPUImageHighlightShadowFilter.h"
|
||||
#import "GPUImageFalseColorFilter.h"
|
||||
#import "GPUImageHSBFilter.h"
|
||||
#import "GPUImageHueFilter.h"
|
||||
#import "GPUImageGlassSphereFilter.h"
|
||||
#import "GPUImageLookupFilter.h"
|
||||
#import "GPUImageAmatorkaFilter.h"
|
||||
#import "GPUImageMissEtikateFilter.h"
|
||||
#import "GPUImageSoftEleganceFilter.h"
|
||||
#import "GPUImageAddBlendFilter.h"
|
||||
#import "GPUImageDivideBlendFilter.h"
|
||||
#import "GPUImagePolkaDotFilter.h"
|
||||
#import "GPUImageLocalBinaryPatternFilter.h"
|
||||
#import "GPUImageColorLocalBinaryPatternFilter.h"
|
||||
#import "GPUImageLanczosResamplingFilter.h"
|
||||
#import "GPUImageAverageColor.h"
|
||||
#import "GPUImageSolidColorGenerator.h"
|
||||
#import "GPUImageLuminosity.h"
|
||||
#import "GPUImageAverageLuminanceThresholdFilter.h"
|
||||
#import "GPUImageWhiteBalanceFilter.h"
|
||||
#import "GPUImageChromaKeyFilter.h"
|
||||
#import "GPUImageLowPassFilter.h"
|
||||
#import "GPUImageHighPassFilter.h"
|
||||
#import "GPUImageMotionDetector.h"
|
||||
#import "GPUImageHalftoneFilter.h"
|
||||
#import "GPUImageThresholdedNonMaximumSuppressionFilter.h"
|
||||
#import "GPUImageHoughTransformLineDetector.h"
|
||||
#import "GPUImageParallelCoordinateLineTransformFilter.h"
|
||||
#import "GPUImageThresholdSketchFilter.h"
|
||||
#import "GPUImageLineGenerator.h"
|
||||
#import "GPUImageLinearBurnBlendFilter.h"
|
||||
#import "GPUImageGaussianBlurPositionFilter.h"
|
||||
#import "GPUImagePixellatePositionFilter.h"
|
||||
#import "GPUImageTwoInputCrossTextureSamplingFilter.h"
|
||||
#import "GPUImagePoissonBlendFilter.h"
|
||||
#import "GPUImageMotionBlurFilter.h"
|
||||
#import "GPUImageZoomBlurFilter.h"
|
||||
#import "GPUImageLaplacianFilter.h"
|
||||
#import "GPUImageiOSBlurFilter.h"
|
||||
#import "GPUImageLuminanceRangeFilter.h"
|
||||
#import "GPUImageDirectionalNonMaximumSuppressionFilter.h"
|
||||
#import "GPUImageDirectionalSobelEdgeDetectionFilter.h"
|
||||
#import "GPUImageSingleComponentGaussianBlurFilter.h"
|
||||
#import "GPUImageThreeInputFilter.h"
|
||||
#import "GPUImageFourInputFilter.h"
|
||||
#import "GPUImageWeakPixelInclusionFilter.h"
|
||||
#import "GPUImageColorConversion.h"
|
||||
#import "GPUImageColourFASTFeatureDetector.h"
|
||||
#import "GPUImageColourFASTSamplingOperation.h"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#import "GPUImage3x3TextureSamplingFilter.h"
|
||||
|
||||
/** Runs a 3x3 convolution kernel against the image
|
||||
*/
|
||||
@interface GPUImage3x3ConvolutionFilter : GPUImage3x3TextureSamplingFilter
|
||||
{
|
||||
GLint convolutionMatrixUniform;
|
||||
}
|
||||
|
||||
/** Convolution kernel to run against the image
|
||||
|
||||
The convolution kernel is a 3x3 matrix of values to apply to the pixel and its 8 surrounding pixels.
|
||||
The matrix is specified in row-major order, with the top left pixel being one.one and the bottom right three.three
|
||||
If the values in the matrix don't add up to 1.0, the image could be brightened or darkened.
|
||||
*/
|
||||
@property(readwrite, nonatomic) GPUMatrix3x3 convolutionKernel;
|
||||
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
extern NSString *const kGPUImageNearbyTexelSamplingVertexShaderString;
|
||||
|
||||
@interface GPUImage3x3TextureSamplingFilter : GPUImageFilter
|
||||
{
|
||||
GLint texelWidthUniform, texelHeightUniform;
|
||||
|
||||
CGFloat texelWidth, texelHeight;
|
||||
BOOL hasOverriddenImageSizeFactor;
|
||||
}
|
||||
|
||||
// The texel width and height determines how far out to sample from this texel. By default, this is the normalized width of a pixel, but this can be overridden for different effects.
|
||||
@property(readwrite, nonatomic) CGFloat texelWidth;
|
||||
@property(readwrite, nonatomic) CGFloat texelHeight;
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,9 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@interface GPUImageAdaptiveThresholdFilter : GPUImageFilterGroup
|
||||
|
||||
/** A multiplier for the background averaging blur radius in pixels, with a default of 4
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat blurRadiusInPixels;
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageAddBlendFilter : GPUImageTwoInputFilter
|
||||
|
||||
@end
|
||||
@@ -1,11 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageAlphaBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
GLint mixUniform;
|
||||
}
|
||||
|
||||
// Mix ranges from 0.0 (only image 1) to 1.0 (only image 2), with 1.0 as the normal level
|
||||
@property(readwrite, nonatomic) CGFloat mix;
|
||||
|
||||
@end
|
||||
@@ -1,17 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@class GPUImagePicture;
|
||||
|
||||
/** A photo filter based on Photoshop action by Amatorka
|
||||
http://amatorka.deviantart.com/art/Amatorka-Action-2-121069631
|
||||
*/
|
||||
|
||||
// Note: If you want to use this effect you have to add lookup_amatorka.png
|
||||
// from Resources folder to your application bundle.
|
||||
|
||||
@interface GPUImageAmatorkaFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImagePicture *lookupImageSource;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,20 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
extern NSString *const kGPUImageColorAveragingVertexShaderString;
|
||||
|
||||
@interface GPUImageAverageColor : GPUImageFilter
|
||||
{
|
||||
GLint texelWidthUniform, texelHeightUniform;
|
||||
|
||||
NSUInteger numberOfStages;
|
||||
|
||||
GLubyte *rawImagePixels;
|
||||
CGSize finalStageSize;
|
||||
}
|
||||
|
||||
// This block is called on the completion of color averaging for a frame
|
||||
@property(nonatomic, copy) void(^colorAverageProcessingFinishedBlock)(CGFloat redComponent, CGFloat greenComponent, CGFloat blueComponent, CGFloat alphaComponent, CMTime frameTime);
|
||||
|
||||
- (void)extractAverageColorAtFrameTime:(CMTime)frameTime;
|
||||
|
||||
@end
|
||||
@@ -1,8 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@interface GPUImageAverageLuminanceThresholdFilter : GPUImageFilterGroup
|
||||
|
||||
// This is multiplied by the continually calculated average image luminosity to arrive at the final threshold. Default is 1.0.
|
||||
@property(readwrite, nonatomic) CGFloat thresholdMultiplier;
|
||||
|
||||
@end
|
||||
@@ -1,10 +0,0 @@
|
||||
#import "GPUImageGaussianBlurFilter.h"
|
||||
|
||||
@interface GPUImageBilateralFilter : GPUImageGaussianBlurFilter
|
||||
{
|
||||
CGFloat firstDistanceNormalizationFactorUniform;
|
||||
CGFloat secondDistanceNormalizationFactorUniform;
|
||||
}
|
||||
// A normalization factor for the distance between central color and sample color.
|
||||
@property(nonatomic, readwrite) CGFloat distanceNormalizationFactor;
|
||||
@end
|
||||
@@ -1,7 +0,0 @@
|
||||
#import "GPUImageGaussianBlurFilter.h"
|
||||
|
||||
/** A hardware-accelerated box blur of an image
|
||||
*/
|
||||
@interface GPUImageBoxBlurFilter : GPUImageGaussianBlurFilter
|
||||
|
||||
@end
|
||||
@@ -1,11 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageBrightnessFilter : GPUImageFilter
|
||||
{
|
||||
GLint brightnessUniform;
|
||||
}
|
||||
|
||||
// Brightness ranges from -1.0 to 1.0, with 0.0 as the normal level
|
||||
@property(readwrite, nonatomic) CGFloat brightness;
|
||||
|
||||
@end
|
||||
@@ -1,10 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageBuffer : GPUImageFilter
|
||||
{
|
||||
NSMutableArray *bufferedFramebuffers;
|
||||
}
|
||||
|
||||
@property(readwrite, nonatomic) NSUInteger bufferSize;
|
||||
|
||||
@end
|
||||
@@ -1,16 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
/// Creates a bulge distortion on the image
|
||||
@interface GPUImageBulgeDistortionFilter : GPUImageFilter
|
||||
{
|
||||
GLint aspectRatioUniform, radiusUniform, centerUniform, scaleUniform;
|
||||
}
|
||||
|
||||
/// The center about which to apply the distortion, with a default of (0.5, 0.5)
|
||||
@property(readwrite, nonatomic) CGPoint center;
|
||||
/// The radius of the distortion, ranging from 0.0 to 1.0, with a default of 0.25
|
||||
@property(readwrite, nonatomic) CGFloat radius;
|
||||
/// The amount of distortion to apply, from -1.0 to 1.0, with a default of 0.5
|
||||
@property(readwrite, nonatomic) CGFloat scale;
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageCGAColorspaceFilter : GPUImageFilter
|
||||
|
||||
@end
|
||||
@@ -1,62 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@class GPUImageGrayscaleFilter;
|
||||
@class GPUImageSingleComponentGaussianBlurFilter;
|
||||
@class GPUImageDirectionalSobelEdgeDetectionFilter;
|
||||
@class GPUImageDirectionalNonMaximumSuppressionFilter;
|
||||
@class GPUImageWeakPixelInclusionFilter;
|
||||
|
||||
/** This applies the edge detection process described by John Canny in
|
||||
|
||||
Canny, J., A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8(6):679–698, 1986.
|
||||
|
||||
and implemented in OpenGL ES by
|
||||
|
||||
A. Ensor, S. Hall. GPU-based Image Analysis on Mobile Devices. Proceedings of Image and Vision Computing New Zealand 2011.
|
||||
|
||||
It starts with a conversion to luminance, followed by an accelerated 9-hit Gaussian blur. A Sobel operator is applied to obtain the overall
|
||||
gradient strength in the blurred image, as well as the direction (in texture sampling steps) of the gradient. A non-maximum suppression filter
|
||||
acts along the direction of the gradient, highlighting strong edges that pass the threshold and completely removing those that fail the lower
|
||||
threshold. Finally, pixels from in-between these thresholds are either included in edges or rejected based on neighboring pixels.
|
||||
*/
|
||||
@interface GPUImageCannyEdgeDetectionFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageGrayscaleFilter *luminanceFilter;
|
||||
GPUImageSingleComponentGaussianBlurFilter *blurFilter;
|
||||
GPUImageDirectionalSobelEdgeDetectionFilter *edgeDetectionFilter;
|
||||
GPUImageDirectionalNonMaximumSuppressionFilter *nonMaximumSuppressionFilter;
|
||||
GPUImageWeakPixelInclusionFilter *weakPixelInclusionFilter;
|
||||
}
|
||||
|
||||
/** The image width and height factors tweak the appearance of the edges.
|
||||
|
||||
These parameters affect the visibility of the detected edges
|
||||
|
||||
By default, they match the inverse of the filter size in pixels
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat texelWidth;
|
||||
/** The image width and height factors tweak the appearance of the edges.
|
||||
|
||||
These parameters affect the visibility of the detected edges
|
||||
|
||||
By default, they match the inverse of the filter size in pixels
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat texelHeight;
|
||||
|
||||
/** The underlying blur radius for the Gaussian blur. Default is 2.0.
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat blurRadiusInPixels;
|
||||
|
||||
/** The underlying blur texel spacing multiplier. Default is 1.0.
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat blurTexelSpacingMultiplier;
|
||||
|
||||
/** Any edge with a gradient magnitude above this threshold will pass and show up in the final result.
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat upperThreshold;
|
||||
|
||||
/** Any edge with a gradient magnitude below this threshold will fail and be removed from the final result.
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat lowerThreshold;
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
/** Selectively replaces a color in the first image with the second image
|
||||
*/
|
||||
@interface GPUImageChromaKeyBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
GLint colorToReplaceUniform, thresholdSensitivityUniform, smoothingUniform;
|
||||
}
|
||||
|
||||
/** The threshold sensitivity controls how similar pixels need to be colored to be replaced
|
||||
|
||||
The default value is 0.3
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat thresholdSensitivity;
|
||||
|
||||
/** The degree of smoothing controls how gradually similar colors are replaced in the image
|
||||
|
||||
The default value is 0.1
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat smoothing;
|
||||
|
||||
/** The color to be replaced is specified using individual red, green, and blue components (normalized to 1.0).
|
||||
|
||||
The default is green: (0.0, 1.0, 0.0).
|
||||
|
||||
@param redComponent Red component of color to be replaced
|
||||
@param greenComponent Green component of color to be replaced
|
||||
@param blueComponent Blue component of color to be replaced
|
||||
*/
|
||||
- (void)setColorToReplaceRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
|
||||
|
||||
@end
|
||||
@@ -1,30 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageChromaKeyFilter : GPUImageFilter
|
||||
{
|
||||
GLint colorToReplaceUniform, thresholdSensitivityUniform, smoothingUniform;
|
||||
}
|
||||
|
||||
/** The threshold sensitivity controls how similar pixels need to be colored to be replaced
|
||||
|
||||
The default value is 0.3
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat thresholdSensitivity;
|
||||
|
||||
/** The degree of smoothing controls how gradually similar colors are replaced in the image
|
||||
|
||||
The default value is 0.1
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat smoothing;
|
||||
|
||||
/** The color to be replaced is specified using individual red, green, and blue components (normalized to 1.0).
|
||||
|
||||
The default is green: (0.0, 1.0, 0.0).
|
||||
|
||||
@param redComponent Red component of color to be replaced
|
||||
@param greenComponent Green component of color to be replaced
|
||||
@param blueComponent Blue component of color to be replaced
|
||||
*/
|
||||
- (void)setColorToReplaceRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
|
||||
|
||||
@end
|
||||
@@ -1,19 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@class GPUImageErosionFilter;
|
||||
@class GPUImageDilationFilter;
|
||||
|
||||
// A filter that first performs a dilation on the red channel of an image, followed by an erosion of the same radius.
|
||||
// This helps to filter out smaller dark elements.
|
||||
|
||||
@interface GPUImageClosingFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageErosionFilter *erosionFilter;
|
||||
GPUImageDilationFilter *dilationFilter;
|
||||
}
|
||||
|
||||
@property(readwrite, nonatomic) CGFloat verticalTexelSpacing, horizontalTexelSpacing;
|
||||
|
||||
- (id)initWithRadius:(NSUInteger)radius;
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageColorBlendFilter : GPUImageTwoInputFilter
|
||||
|
||||
@end
|
||||
@@ -1,9 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
/** Applies a color burn blend of two images
|
||||
*/
|
||||
@interface GPUImageColorBurnBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef GPUImageColorConversion_h
|
||||
#define GPUImageColorConversion_h
|
||||
|
||||
extern GLfloat *kColorConversion601;
|
||||
extern GLfloat *kColorConversion601FullRange;
|
||||
extern GLfloat *kColorConversion709;
|
||||
extern NSString *const kGPUImageYUVVideoRangeConversionForRGFragmentShaderString;
|
||||
extern NSString *const kGPUImageYUVFullRangeConversionForLAFragmentShaderString;
|
||||
extern NSString *const kGPUImageYUVVideoRangeConversionForLAFragmentShaderString;
|
||||
|
||||
|
||||
#endif /* GPUImageColorConversion_h */
|
||||
@@ -1,9 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
/** Applies a color dodge blend of two images
|
||||
*/
|
||||
@interface GPUImageColorDodgeBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,7 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageColorInvertFilter : GPUImageFilter
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImage3x3TextureSamplingFilter.h"
|
||||
|
||||
@interface GPUImageColorLocalBinaryPatternFilter : GPUImage3x3TextureSamplingFilter
|
||||
|
||||
@end
|
||||
@@ -1,19 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
/** Transforms the colors of an image by applying a matrix to them
|
||||
*/
|
||||
@interface GPUImageColorMatrixFilter : GPUImageFilter
|
||||
{
|
||||
GLint colorMatrixUniform;
|
||||
GLint intensityUniform;
|
||||
}
|
||||
|
||||
/** A 4x4 matrix used to transform each color in an image
|
||||
*/
|
||||
@property(readwrite, nonatomic) GPUMatrix4x4 colorMatrix;
|
||||
|
||||
/** The degree to which the new transformed color replaces the original color for each pixel
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat intensity;
|
||||
|
||||
@end
|
||||
@@ -1,10 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageColorPackingFilter : GPUImageFilter
|
||||
{
|
||||
GLint texelWidthUniform, texelHeightUniform;
|
||||
|
||||
CGFloat texelWidth, texelHeight;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,21 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
// This generates image-wide feature descriptors using the ColourFAST process, as developed and described in
|
||||
//
|
||||
// A. Ensor and S. Hall. ColourFAST: GPU-based feature point detection and tracking on mobile devices. 28th International Conference of Image and Vision Computing, New Zealand, 2013, p. 124-129.
|
||||
//
|
||||
// Seth Hall, "GPU accelerated feature algorithms for mobile devices", PhD thesis, School of Computing and Mathematical Sciences, Auckland University of Technology 2014.
|
||||
// http://aut.researchgateway.ac.nz/handle/10292/7991
|
||||
|
||||
@class GPUImageColourFASTSamplingOperation;
|
||||
@class GPUImageBoxBlurFilter;
|
||||
|
||||
@interface GPUImageColourFASTFeatureDetector : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageBoxBlurFilter *blurFilter;
|
||||
GPUImageColourFASTSamplingOperation *colourFASTSamplingOperation;
|
||||
}
|
||||
// The blur radius of the underlying box blur. The default is 3.0.
|
||||
@property (readwrite, nonatomic) CGFloat blurRadiusInPixels;
|
||||
|
||||
@end
|
||||
@@ -1,22 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
// This is the feature extraction phase of the ColourFAST feature detector, as described in:
|
||||
//
|
||||
// A. Ensor and S. Hall. ColourFAST: GPU-based feature point detection and tracking on mobile devices. 28th International Conference of Image and Vision Computing, New Zealand, 2013, p. 124-129.
|
||||
//
|
||||
// Seth Hall, "GPU accelerated feature algorithms for mobile devices", PhD thesis, School of Computing and Mathematical Sciences, Auckland University of Technology 2014.
|
||||
// http://aut.researchgateway.ac.nz/handle/10292/7991
|
||||
|
||||
@interface GPUImageColourFASTSamplingOperation : GPUImageTwoInputFilter
|
||||
{
|
||||
GLint texelWidthUniform, texelHeightUniform;
|
||||
|
||||
CGFloat texelWidth, texelHeight;
|
||||
BOOL hasOverriddenImageSizeFactor;
|
||||
}
|
||||
|
||||
// The texel width and height determines how far out to sample from this texel. By default, this is the normalized width of a pixel, but this can be overridden for different effects.
|
||||
@property(readwrite, nonatomic) CGFloat texelWidth;
|
||||
@property(readwrite, nonatomic) CGFloat texelHeight;
|
||||
|
||||
@end
|
||||
@@ -1,64 +0,0 @@
|
||||
#import "GLProgram.h"
|
||||
#import "GPUImageFramebuffer.h"
|
||||
#import "GPUImageFramebufferCache.h"
|
||||
|
||||
#define GPUImageRotationSwapsWidthAndHeight(rotation) ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical || (rotation) == kGPUImageRotateRightFlipHorizontal)
|
||||
|
||||
typedef NS_ENUM(NSUInteger, GPUImageRotationMode) {
|
||||
kGPUImageNoRotation,
|
||||
kGPUImageRotateLeft,
|
||||
kGPUImageRotateRight,
|
||||
kGPUImageFlipVertical,
|
||||
kGPUImageFlipHorizonal,
|
||||
kGPUImageRotateRightFlipVertical,
|
||||
kGPUImageRotateRightFlipHorizontal,
|
||||
kGPUImageRotate180
|
||||
};
|
||||
|
||||
@interface GPUImageContext : NSObject
|
||||
|
||||
@property(readonly, nonatomic) dispatch_queue_t contextQueue;
|
||||
@property(readwrite, retain, nonatomic) GLProgram *currentShaderProgram;
|
||||
@property(readonly, retain, nonatomic) EAGLContext *context;
|
||||
@property(readonly) CVOpenGLESTextureCacheRef coreVideoTextureCache;
|
||||
@property(readonly) GPUImageFramebufferCache *framebufferCache;
|
||||
|
||||
+ (void *)contextKey;
|
||||
+ (GPUImageContext *)sharedImageProcessingContext;
|
||||
+ (dispatch_queue_t)sharedContextQueue;
|
||||
+ (GPUImageFramebufferCache *)sharedFramebufferCache;
|
||||
+ (void)useImageProcessingContext;
|
||||
- (void)useAsCurrentContext;
|
||||
+ (void)setActiveShaderProgram:(GLProgram *)shaderProgram;
|
||||
- (void)setContextShaderProgram:(GLProgram *)shaderProgram;
|
||||
+ (GLint)maximumTextureSizeForThisDevice;
|
||||
+ (GLint)maximumTextureUnitsForThisDevice;
|
||||
+ (GLint)maximumVaryingVectorsForThisDevice;
|
||||
+ (BOOL)deviceSupportsOpenGLESExtension:(NSString *)extension;
|
||||
+ (BOOL)deviceSupportsRedTextures;
|
||||
+ (BOOL)deviceSupportsFramebufferReads;
|
||||
+ (CGSize)sizeThatFitsWithinATextureForSize:(CGSize)inputSize;
|
||||
|
||||
- (void)presentBufferForDisplay;
|
||||
- (GLProgram *)programForVertexShaderString:(NSString *)vertexShaderString fragmentShaderString:(NSString *)fragmentShaderString;
|
||||
|
||||
- (void)useSharegroup:(EAGLSharegroup *)sharegroup;
|
||||
|
||||
// Manage fast texture upload
|
||||
+ (BOOL)supportsFastTextureUpload;
|
||||
|
||||
@end
|
||||
|
||||
@protocol GPUImageInput <NSObject>
|
||||
- (void)newFrameReadyAtTime:(CMTime)frameTime atIndex:(NSInteger)textureIndex;
|
||||
- (void)setInputFramebuffer:(GPUImageFramebuffer *)newInputFramebuffer atIndex:(NSInteger)textureIndex;
|
||||
- (NSInteger)nextAvailableTextureIndex;
|
||||
- (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex;
|
||||
- (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteger)textureIndex;
|
||||
- (CGSize)maximumOutputSize;
|
||||
- (void)endProcessing;
|
||||
- (BOOL)shouldIgnoreUpdatesToThisTarget;
|
||||
- (BOOL)enabled;
|
||||
- (BOOL)wantsMonochromeInput;
|
||||
- (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;
|
||||
@end
|
||||
@@ -1,14 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
/** Adjusts the contrast of the image
|
||||
*/
|
||||
@interface GPUImageContrastFilter : GPUImageFilter
|
||||
{
|
||||
GLint contrastUniform;
|
||||
}
|
||||
|
||||
/** Contrast ranges from 0.0 to 4.0 (max contrast), with 1.0 as the normal level
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat contrast;
|
||||
|
||||
@end
|
||||
@@ -1,14 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageCropFilter : GPUImageFilter
|
||||
{
|
||||
GLfloat cropTextureCoordinates[8];
|
||||
}
|
||||
|
||||
// The crop region is the rectangle within the image to crop. It is normalized to a coordinate space from 0.0 to 1.0, with 0.0, 0.0 being the upper left corner of the image
|
||||
@property(readwrite, nonatomic) CGRect cropRegion;
|
||||
|
||||
// Initialization and teardown
|
||||
- (id)initWithCropRegion:(CGRect)newCropRegion;
|
||||
|
||||
@end
|
||||
@@ -1,17 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageCrosshairGenerator : GPUImageFilter
|
||||
{
|
||||
GLint crosshairWidthUniform, crosshairColorUniform;
|
||||
}
|
||||
|
||||
// The width of the displayed crosshairs, in pixels. Currently this only works well for odd widths. The default is 5.
|
||||
@property(readwrite, nonatomic) CGFloat crosshairWidth;
|
||||
|
||||
// The color of the crosshairs is specified using individual red, green, and blue components (normalized to 1.0). The default is green: (0.0, 1.0, 0.0).
|
||||
- (void)setCrosshairColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
|
||||
|
||||
// Rendering
|
||||
- (void)renderCrosshairsFromArray:(GLfloat *)crosshairCoordinates count:(NSUInteger)numberOfCrosshairs frameTime:(CMTime)frameTime;
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageCrosshatchFilter : GPUImageFilter
|
||||
{
|
||||
GLint crossHatchSpacingUniform, lineWidthUniform;
|
||||
}
|
||||
// The fractional width of the image to use as the spacing for the crosshatch. The default is 0.03.
|
||||
@property(readwrite, nonatomic) CGFloat crossHatchSpacing;
|
||||
|
||||
// A relative width for the crosshatch lines. The default is 0.003.
|
||||
@property(readwrite, nonatomic) CGFloat lineWidth;
|
||||
|
||||
@end
|
||||
@@ -1,7 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageDarkenBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,7 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageDifferenceBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,16 +0,0 @@
|
||||
#import "GPUImageTwoPassTextureSamplingFilter.h"
|
||||
|
||||
// For each pixel, this sets it to the maximum value of the red channel in a rectangular neighborhood extending out dilationRadius pixels from the center.
|
||||
// This extends out bright features, and is most commonly used with black-and-white thresholded images.
|
||||
|
||||
extern NSString *const kGPUImageDilationRadiusOneVertexShaderString;
|
||||
extern NSString *const kGPUImageDilationRadiusTwoVertexShaderString;
|
||||
extern NSString *const kGPUImageDilationRadiusThreeVertexShaderString;
|
||||
extern NSString *const kGPUImageDilationRadiusFourVertexShaderString;
|
||||
|
||||
@interface GPUImageDilationFilter : GPUImageTwoPassTextureSamplingFilter
|
||||
|
||||
// Acceptable values for dilationRadius, which sets the distance in pixels to sample out from the center, are 1, 2, 3, and 4.
|
||||
- (id)initWithRadius:(NSUInteger)dilationRadius;
|
||||
|
||||
@end
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageDirectionalNonMaximumSuppressionFilter : GPUImageFilter
|
||||
{
|
||||
GLint texelWidthUniform, texelHeightUniform;
|
||||
GLint upperThresholdUniform, lowerThresholdUniform;
|
||||
|
||||
BOOL hasOverriddenImageSizeFactor;
|
||||
}
|
||||
|
||||
// The texel width and height determines how far out to sample from this texel. By default, this is the normalized width of a pixel, but this can be overridden for different effects.
|
||||
@property(readwrite, nonatomic) CGFloat texelWidth;
|
||||
@property(readwrite, nonatomic) CGFloat texelHeight;
|
||||
|
||||
// These thresholds set cutoffs for the intensities that definitely get registered (upper threshold) and those that definitely don't (lower threshold)
|
||||
@property(readwrite, nonatomic) CGFloat upperThreshold;
|
||||
@property(readwrite, nonatomic) CGFloat lowerThreshold;
|
||||
|
||||
@end
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
#import "GPUImage3x3TextureSamplingFilter.h"
|
||||
|
||||
@interface GPUImageDirectionalSobelEdgeDetectionFilter : GPUImage3x3TextureSamplingFilter
|
||||
|
||||
@end
|
||||
@@ -1,11 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageDissolveBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
GLint mixUniform;
|
||||
}
|
||||
|
||||
// Mix ranges from 0.0 (only image 1) to 1.0 (only image 2), with 0.5 (half of either) as the normal level
|
||||
@property(readwrite, nonatomic) CGFloat mix;
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageDivideBlendFilter : GPUImageTwoInputFilter
|
||||
|
||||
@end
|
||||
@@ -1,8 +0,0 @@
|
||||
#import "GPUImage3x3ConvolutionFilter.h"
|
||||
|
||||
@interface GPUImageEmbossFilter : GPUImage3x3ConvolutionFilter
|
||||
|
||||
// The strength of the embossing, from 0.0 to 4.0, with 1.0 as the normal level
|
||||
@property(readwrite, nonatomic) CGFloat intensity;
|
||||
|
||||
@end
|
||||
@@ -1,11 +0,0 @@
|
||||
#import "GPUImageTwoPassTextureSamplingFilter.h"
|
||||
|
||||
// For each pixel, this sets it to the minimum value of the red channel in a rectangular neighborhood extending out dilationRadius pixels from the center.
|
||||
// This extends out dark features, and is most commonly used with black-and-white thresholded images.
|
||||
|
||||
@interface GPUImageErosionFilter : GPUImageTwoPassTextureSamplingFilter
|
||||
|
||||
// Acceptable values for erosionRadius, which sets the distance in pixels to sample out from the center, are 1, 2, 3, and 4.
|
||||
- (id)initWithRadius:(NSUInteger)erosionRadius;
|
||||
|
||||
@end
|
||||
@@ -1,7 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageExclusionBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,11 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageExposureFilter : GPUImageFilter
|
||||
{
|
||||
GLint exposureUniform;
|
||||
}
|
||||
|
||||
// Exposure ranges from -10.0 to 10.0, with 0.0 as the normal level
|
||||
@property(readwrite, nonatomic) CGFloat exposure;
|
||||
|
||||
@end
|
||||
@@ -1,33 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@class GPUImageGrayscaleFilter;
|
||||
@class GPUImage3x3TextureSamplingFilter;
|
||||
@class GPUImageNonMaximumSuppressionFilter;
|
||||
|
||||
/*
|
||||
An implementation of the Features from Accelerated Segment Test (FAST) feature detector as described in the following publications:
|
||||
|
||||
E. Rosten and T. Drummond. Fusing points and lines for high performance tracking. IEEE International Conference on Computer Vision, 2005.
|
||||
E. Rosten and T. Drummond. Machine learning for high-speed corner detection. European Conference on Computer Vision, 2006.
|
||||
|
||||
For more about the FAST feature detector, see the resources here:
|
||||
http://www.edwardrosten.com/work/fast.html
|
||||
*/
|
||||
|
||||
typedef enum { kGPUImageFAST12Contiguous, kGPUImageFAST12ContiguousNonMaximumSuppressed} GPUImageFASTDetectorType;
|
||||
|
||||
@interface GPUImageFASTCornerDetectionFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageGrayscaleFilter *luminanceReductionFilter;
|
||||
GPUImage3x3TextureSamplingFilter *featureDetectionFilter;
|
||||
GPUImageNonMaximumSuppressionFilter *nonMaximumSuppressionFilter;
|
||||
// Generate a lookup texture based on the bit patterns
|
||||
|
||||
// Step 1: convert to monochrome if necessary
|
||||
// Step 2: do a lookup at each pixel based on the Bresenham circle, encode comparison in two color components
|
||||
// Step 3: do non-maximum suppression of close corner points
|
||||
}
|
||||
|
||||
- (id)initWithFASTDetectorVariant:(GPUImageFASTDetectorType)detectorType;
|
||||
|
||||
@end
|
||||
@@ -1,15 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageFalseColorFilter : GPUImageFilter
|
||||
{
|
||||
GLint firstColorUniform, secondColorUniform;
|
||||
}
|
||||
|
||||
// The first and second colors specify what colors replace the dark and light areas of the image, respectively. The defaults are (0.0, 0.0, 0.5) amd (1.0, 0.0, 0.0).
|
||||
@property(readwrite, nonatomic) GPUVector4 firstColor;
|
||||
@property(readwrite, nonatomic) GPUVector4 secondColor;
|
||||
|
||||
- (void)setFirstColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
|
||||
- (void)setSecondColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
|
||||
|
||||
@end
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
#import "GPUImageOutput.h"
|
||||
|
||||
#define STRINGIZE(x) #x
|
||||
#define STRINGIZE2(x) STRINGIZE(x)
|
||||
#define SHADER_STRING(text) @ STRINGIZE2(text)
|
||||
|
||||
#define GPUImageHashIdentifier #
|
||||
#define GPUImageWrappedLabel(x) x
|
||||
#define GPUImageEscapedHashIdentifier(a) GPUImageWrappedLabel(GPUImageHashIdentifier)a
|
||||
|
||||
extern NSString *const kGPUImageVertexShaderString;
|
||||
extern NSString *const kGPUImagePassthroughFragmentShaderString;
|
||||
|
||||
struct GPUVector4 {
|
||||
GLfloat one;
|
||||
GLfloat two;
|
||||
GLfloat three;
|
||||
GLfloat four;
|
||||
};
|
||||
typedef struct GPUVector4 GPUVector4;
|
||||
|
||||
struct GPUVector3 {
|
||||
GLfloat one;
|
||||
GLfloat two;
|
||||
GLfloat three;
|
||||
};
|
||||
typedef struct GPUVector3 GPUVector3;
|
||||
|
||||
struct GPUMatrix4x4 {
|
||||
GPUVector4 one;
|
||||
GPUVector4 two;
|
||||
GPUVector4 three;
|
||||
GPUVector4 four;
|
||||
};
|
||||
typedef struct GPUMatrix4x4 GPUMatrix4x4;
|
||||
|
||||
struct GPUMatrix3x3 {
|
||||
GPUVector3 one;
|
||||
GPUVector3 two;
|
||||
GPUVector3 three;
|
||||
};
|
||||
typedef struct GPUMatrix3x3 GPUMatrix3x3;
|
||||
|
||||
/** GPUImage's base filter class
|
||||
|
||||
Filters and other subsequent elements in the chain conform to the GPUImageInput protocol, which lets them take in the supplied or processed texture from the previous link in the chain and do something with it. Objects one step further down the chain are considered targets, and processing can be branched by adding multiple targets to a single output or filter.
|
||||
*/
|
||||
@interface GPUImageFilter : GPUImageOutput <GPUImageInput>
|
||||
{
|
||||
GPUImageFramebuffer *firstInputFramebuffer;
|
||||
|
||||
GLProgram *filterProgram;
|
||||
GLint filterPositionAttribute, filterTextureCoordinateAttribute;
|
||||
GLint filterInputTextureUniform;
|
||||
GLfloat backgroundColorRed, backgroundColorGreen, backgroundColorBlue, backgroundColorAlpha;
|
||||
|
||||
BOOL isEndProcessing;
|
||||
|
||||
CGSize currentFilterSize;
|
||||
GPUImageRotationMode inputRotation;
|
||||
|
||||
BOOL currentlyReceivingMonochromeInput;
|
||||
|
||||
NSMutableDictionary *uniformStateRestorationBlocks;
|
||||
dispatch_semaphore_t imageCaptureSemaphore;
|
||||
}
|
||||
|
||||
@property(readonly) CVPixelBufferRef renderTarget;
|
||||
@property(readwrite, nonatomic) BOOL preventRendering;
|
||||
@property(readwrite, nonatomic) BOOL currentlyReceivingMonochromeInput;
|
||||
|
||||
/// @name Initialization and teardown
|
||||
|
||||
/**
|
||||
Initialize with vertex and fragment shaders
|
||||
|
||||
You make take advantage of the SHADER_STRING macro to write your shaders in-line.
|
||||
@param vertexShaderString Source code of the vertex shader to use
|
||||
@param fragmentShaderString Source code of the fragment shader to use
|
||||
*/
|
||||
- (id)initWithVertexShaderFromString:(NSString *)vertexShaderString fragmentShaderFromString:(NSString *)fragmentShaderString;
|
||||
|
||||
/**
|
||||
Initialize with a fragment shader
|
||||
|
||||
You may take advantage of the SHADER_STRING macro to write your shader in-line.
|
||||
@param fragmentShaderString Source code of fragment shader to use
|
||||
*/
|
||||
- (id)initWithFragmentShaderFromString:(NSString *)fragmentShaderString;
|
||||
/**
|
||||
Initialize with a fragment shader
|
||||
@param fragmentShaderFilename Filename of fragment shader to load
|
||||
*/
|
||||
- (id)initWithFragmentShaderFromFile:(NSString *)fragmentShaderFilename;
|
||||
- (void)initializeAttributes;
|
||||
- (void)setupFilterForSize:(CGSize)filterFrameSize;
|
||||
- (CGSize)rotatedSize:(CGSize)sizeToRotate forIndex:(NSInteger)textureIndex;
|
||||
- (CGPoint)rotatedPoint:(CGPoint)pointToRotate forRotation:(GPUImageRotationMode)rotation;
|
||||
|
||||
/// @name Managing the display FBOs
|
||||
/** Size of the frame buffer object
|
||||
*/
|
||||
- (CGSize)sizeOfFBO;
|
||||
|
||||
/// @name Rendering
|
||||
+ (const GLfloat *)textureCoordinatesForRotation:(GPUImageRotationMode)rotationMode;
|
||||
- (void)renderToTextureWithVertices:(const GLfloat *)vertices textureCoordinates:(const GLfloat *)textureCoordinates;
|
||||
- (void)informTargetsAboutNewFrameAtTime:(CMTime)frameTime;
|
||||
- (CGSize)outputFrameSize;
|
||||
|
||||
/// @name Input parameters
|
||||
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;
|
||||
- (void)setInteger:(GLint)newInteger forUniformName:(NSString *)uniformName;
|
||||
- (void)setFloat:(GLfloat)newFloat forUniformName:(NSString *)uniformName;
|
||||
- (void)setSize:(CGSize)newSize forUniformName:(NSString *)uniformName;
|
||||
- (void)setPoint:(CGPoint)newPoint forUniformName:(NSString *)uniformName;
|
||||
- (void)setFloatVec3:(GPUVector3)newVec3 forUniformName:(NSString *)uniformName;
|
||||
- (void)setFloatVec4:(GPUVector4)newVec4 forUniform:(NSString *)uniformName;
|
||||
- (void)setFloatArray:(GLfloat *)array length:(GLsizei)count forUniform:(NSString*)uniformName;
|
||||
|
||||
- (void)setMatrix3f:(GPUMatrix3x3)matrix forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setMatrix4f:(GPUMatrix4x4)matrix forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setFloat:(GLfloat)floatValue forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setPoint:(CGPoint)pointValue forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setSize:(CGSize)sizeValue forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setVec3:(GPUVector3)vectorValue forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setVec4:(GPUVector4)vectorValue forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setFloatArray:(GLfloat *)arrayValue length:(GLsizei)arrayLength forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
- (void)setInteger:(GLint)intValue forUniform:(GLint)uniform program:(GLProgram *)shaderProgram;
|
||||
|
||||
- (void)setAndExecuteUniformStateCallbackAtIndex:(GLint)uniform forProgram:(GLProgram *)shaderProgram toBlock:(dispatch_block_t)uniformStateBlock;
|
||||
- (void)setUniformsForProgramAtIndex:(NSUInteger)programIndex;
|
||||
|
||||
@end
|
||||
@@ -1,19 +0,0 @@
|
||||
#import "GPUImageOutput.h"
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageFilterGroup : GPUImageOutput <GPUImageInput>
|
||||
{
|
||||
NSMutableArray *filters;
|
||||
BOOL isEndProcessing;
|
||||
}
|
||||
|
||||
@property(readwrite, nonatomic, strong) GPUImageOutput<GPUImageInput> *terminalFilter;
|
||||
@property(readwrite, nonatomic, strong) NSArray *initialFilters;
|
||||
@property(readwrite, nonatomic, strong) GPUImageOutput<GPUImageInput> *inputFilterToIgnoreForUpdates;
|
||||
|
||||
// Filter management
|
||||
- (void)addFilter:(GPUImageOutput<GPUImageInput> *)newFilter;
|
||||
- (GPUImageOutput<GPUImageInput> *)filterAtIndex:(NSUInteger)filterIndex;
|
||||
- (NSUInteger)filterCount;
|
||||
|
||||
@end
|
||||
@@ -1,30 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "GPUImageOutput.h"
|
||||
|
||||
@interface GPUImageFilterPipeline : NSObject
|
||||
{
|
||||
NSString *stringValue;
|
||||
}
|
||||
|
||||
@property (strong) NSMutableArray *filters;
|
||||
|
||||
@property (strong) GPUImageOutput *input;
|
||||
@property (strong) id <GPUImageInput> output;
|
||||
|
||||
- (id) initWithOrderedFilters:(NSArray*) filters input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
|
||||
- (id) initWithConfiguration:(NSDictionary*) configuration input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
|
||||
- (id) initWithConfigurationFile:(NSURL*) configuration input:(GPUImageOutput*)input output:(id <GPUImageInput>)output;
|
||||
|
||||
- (void) addFilter:(GPUImageOutput<GPUImageInput> *)filter;
|
||||
- (void) addFilter:(GPUImageOutput<GPUImageInput> *)filter atIndex:(NSUInteger)insertIndex;
|
||||
- (void) replaceFilterAtIndex:(NSUInteger)index withFilter:(GPUImageOutput<GPUImageInput> *)filter;
|
||||
- (void) replaceAllFilters:(NSArray *) newFilters;
|
||||
- (void) removeFilter:(GPUImageOutput<GPUImageInput> *)filter;
|
||||
- (void) removeFilterAtIndex:(NSUInteger)index;
|
||||
- (void) removeAllFilters;
|
||||
|
||||
- (UIImage *) currentFilteredFrame;
|
||||
- (UIImage *) currentFilteredFrameWithOrientation:(UIImageOrientation)imageOrientation;
|
||||
- (CGImageRef) newCGImageFromCurrentFilteredFrame;
|
||||
|
||||
@end
|
||||
@@ -1,21 +0,0 @@
|
||||
#import "GPUImageThreeInputFilter.h"
|
||||
|
||||
extern NSString *const kGPUImageFourInputTextureVertexShaderString;
|
||||
|
||||
@interface GPUImageFourInputFilter : GPUImageThreeInputFilter
|
||||
{
|
||||
GPUImageFramebuffer *fourthInputFramebuffer;
|
||||
|
||||
GLint filterFourthTextureCoordinateAttribute;
|
||||
GLint filterInputTextureUniform4;
|
||||
GPUImageRotationMode inputRotation4;
|
||||
GLuint filterSourceTexture4;
|
||||
CMTime fourthFrameTime;
|
||||
|
||||
BOOL hasSetThirdTexture, hasReceivedFourthFrame, fourthFrameWasVideo;
|
||||
BOOL fourthFrameCheckDisabled;
|
||||
}
|
||||
|
||||
- (void)disableFourthFrameCheck;
|
||||
|
||||
@end
|
||||
@@ -1,59 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
|
||||
#import <OpenGLES/EAGL.h>
|
||||
#import <OpenGLES/ES2/gl.h>
|
||||
#import <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#import <OpenGL/OpenGL.h>
|
||||
#import <OpenGL/gl.h>
|
||||
#endif
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <CoreMedia/CoreMedia.h>
|
||||
|
||||
|
||||
typedef struct GPUTextureOptions {
|
||||
GLenum minFilter;
|
||||
GLenum magFilter;
|
||||
GLenum wrapS;
|
||||
GLenum wrapT;
|
||||
GLenum internalFormat;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
} GPUTextureOptions;
|
||||
|
||||
@interface GPUImageFramebuffer : NSObject
|
||||
|
||||
@property(readonly) CGSize size;
|
||||
@property(readonly) GPUTextureOptions textureOptions;
|
||||
@property(readonly) GLuint texture;
|
||||
@property(readonly) BOOL missingFramebuffer;
|
||||
|
||||
// Initialization and teardown
|
||||
- (id)initWithSize:(CGSize)framebufferSize;
|
||||
- (id)initWithSize:(CGSize)framebufferSize textureOptions:(GPUTextureOptions)fboTextureOptions onlyTexture:(BOOL)onlyGenerateTexture;
|
||||
- (id)initWithSize:(CGSize)framebufferSize overriddenTexture:(GLuint)inputTexture;
|
||||
|
||||
// Usage
|
||||
- (void)activateFramebuffer;
|
||||
|
||||
// Reference counting
|
||||
- (void)lock;
|
||||
- (void)unlock;
|
||||
- (void)clearAllLocks;
|
||||
- (void)disableReferenceCounting;
|
||||
- (void)enableReferenceCounting;
|
||||
|
||||
// Image capture
|
||||
- (CGImageRef)newCGImageFromFramebufferContents;
|
||||
- (void)restoreRenderTarget;
|
||||
|
||||
// Raw data bytes
|
||||
- (void)lockForReading;
|
||||
- (void)unlockAfterReading;
|
||||
- (NSUInteger)bytesPerRow;
|
||||
- (GLubyte *)byteBuffer;
|
||||
- (CVPixelBufferRef)pixelBuffer;
|
||||
|
||||
@end
|
||||
@@ -1,15 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import "GPUImageFramebuffer.h"
|
||||
|
||||
@interface GPUImageFramebufferCache : NSObject
|
||||
|
||||
// Framebuffer management
|
||||
- (GPUImageFramebuffer *)fetchFramebufferForSize:(CGSize)framebufferSize textureOptions:(GPUTextureOptions)textureOptions onlyTexture:(BOOL)onlyTexture;
|
||||
- (GPUImageFramebuffer *)fetchFramebufferForSize:(CGSize)framebufferSize onlyTexture:(BOOL)onlyTexture;
|
||||
- (void)returnFramebufferToCache:(GPUImageFramebuffer *)framebuffer;
|
||||
- (void)purgeAllUnassignedFramebuffers;
|
||||
- (void)addFramebufferToActiveImageCaptureList:(GPUImageFramebuffer *)framebuffer;
|
||||
- (void)removeFramebufferFromActiveImageCaptureList:(GPUImageFramebuffer *)framebuffer;
|
||||
|
||||
@end
|
||||
@@ -1,177 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for GPUImageFramework.
|
||||
FOUNDATION_EXPORT double GPUImageFrameworkVersionNumber;
|
||||
|
||||
//! Project version string for GPUImageFramework.
|
||||
FOUNDATION_EXPORT const unsigned char GPUImageFrameworkVersionString[];
|
||||
|
||||
#import <GPUImage/GLProgram.h>
|
||||
|
||||
// Base classes
|
||||
#import <GPUImage/GPUImageContext.h>
|
||||
#import <GPUImage/GPUImageOutput.h>
|
||||
#import <GPUImage/GPUImageView.h>
|
||||
#import <GPUImage/GPUImageVideoCamera.h>
|
||||
#import <GPUImage/GPUImageStillCamera.h>
|
||||
#import <GPUImage/GPUImageMovie.h>
|
||||
#import <GPUImage/GPUImagePicture.h>
|
||||
#import <GPUImage/GPUImageRawDataInput.h>
|
||||
#import <GPUImage/GPUImageRawDataOutput.h>
|
||||
#import <GPUImage/GPUImageMovieWriter.h>
|
||||
#import <GPUImage/GPUImageFilterPipeline.h>
|
||||
#import <GPUImage/GPUImageTextureOutput.h>
|
||||
#import <GPUImage/GPUImageFilterGroup.h>
|
||||
#import <GPUImage/GPUImageTextureInput.h>
|
||||
#import <GPUImage/GPUImageUIElement.h>
|
||||
#import <GPUImage/GPUImageBuffer.h>
|
||||
#import <GPUImage/GPUImageFramebuffer.h>
|
||||
#import <GPUImage/GPUImageFramebufferCache.h>
|
||||
|
||||
// Filters
|
||||
#import <GPUImage/GPUImageFilter.h>
|
||||
#import <GPUImage/GPUImageTwoInputFilter.h>
|
||||
#import <GPUImage/GPUImagePixellateFilter.h>
|
||||
#import <GPUImage/GPUImagePixellatePositionFilter.h>
|
||||
#import <GPUImage/GPUImageSepiaFilter.h>
|
||||
#import <GPUImage/GPUImageColorInvertFilter.h>
|
||||
#import <GPUImage/GPUImageSaturationFilter.h>
|
||||
#import <GPUImage/GPUImageContrastFilter.h>
|
||||
#import <GPUImage/GPUImageExposureFilter.h>
|
||||
#import <GPUImage/GPUImageBrightnessFilter.h>
|
||||
#import <GPUImage/GPUImageLevelsFilter.h>
|
||||
#import <GPUImage/GPUImageSharpenFilter.h>
|
||||
#import <GPUImage/GPUImageGammaFilter.h>
|
||||
#import <GPUImage/GPUImageSobelEdgeDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageSketchFilter.h>
|
||||
#import <GPUImage/GPUImageToonFilter.h>
|
||||
#import <GPUImage/GPUImageSmoothToonFilter.h>
|
||||
#import <GPUImage/GPUImageMultiplyBlendFilter.h>
|
||||
#import <GPUImage/GPUImageDissolveBlendFilter.h>
|
||||
#import <GPUImage/GPUImageKuwaharaFilter.h>
|
||||
#import <GPUImage/GPUImageKuwaharaRadius3Filter.h>
|
||||
#import <GPUImage/GPUImageVignetteFilter.h>
|
||||
#import <GPUImage/GPUImageGaussianBlurFilter.h>
|
||||
#import <GPUImage/GPUImageGaussianBlurPositionFilter.h>
|
||||
#import <GPUImage/GPUImageGaussianSelectiveBlurFilter.h>
|
||||
#import <GPUImage/GPUImageOverlayBlendFilter.h>
|
||||
#import <GPUImage/GPUImageDarkenBlendFilter.h>
|
||||
#import <GPUImage/GPUImageLightenBlendFilter.h>
|
||||
#import <GPUImage/GPUImageSwirlFilter.h>
|
||||
#import <GPUImage/GPUImageSourceOverBlendFilter.h>
|
||||
#import <GPUImage/GPUImageColorBurnBlendFilter.h>
|
||||
#import <GPUImage/GPUImageColorDodgeBlendFilter.h>
|
||||
#import <GPUImage/GPUImageScreenBlendFilter.h>
|
||||
#import <GPUImage/GPUImageExclusionBlendFilter.h>
|
||||
#import <GPUImage/GPUImageDifferenceBlendFilter.h>
|
||||
#import <GPUImage/GPUImageSubtractBlendFilter.h>
|
||||
#import <GPUImage/GPUImageHardLightBlendFilter.h>
|
||||
#import <GPUImage/GPUImageSoftLightBlendFilter.h>
|
||||
#import <GPUImage/GPUImageColorBlendFilter.h>
|
||||
#import <GPUImage/GPUImageHueBlendFilter.h>
|
||||
#import <GPUImage/GPUImageSaturationBlendFilter.h>
|
||||
#import <GPUImage/GPUImageLuminosityBlendFilter.h>
|
||||
#import <GPUImage/GPUImageCropFilter.h>
|
||||
#import <GPUImage/GPUImageGrayscaleFilter.h>
|
||||
#import <GPUImage/GPUImageTransformFilter.h>
|
||||
#import <GPUImage/GPUImageChromaKeyBlendFilter.h>
|
||||
#import <GPUImage/GPUImageHazeFilter.h>
|
||||
#import <GPUImage/GPUImageLuminanceThresholdFilter.h>
|
||||
#import <GPUImage/GPUImagePosterizeFilter.h>
|
||||
#import <GPUImage/GPUImageBoxBlurFilter.h>
|
||||
#import <GPUImage/GPUImageAdaptiveThresholdFilter.h>
|
||||
#import <GPUImage/GPUImageUnsharpMaskFilter.h>
|
||||
#import <GPUImage/GPUImageBulgeDistortionFilter.h>
|
||||
#import <GPUImage/GPUImagePinchDistortionFilter.h>
|
||||
#import <GPUImage/GPUImageCrosshatchFilter.h>
|
||||
#import <GPUImage/GPUImageCGAColorspaceFilter.h>
|
||||
#import <GPUImage/GPUImagePolarPixellateFilter.h>
|
||||
#import <GPUImage/GPUImageStretchDistortionFilter.h>
|
||||
#import <GPUImage/GPUImagePerlinNoiseFilter.h>
|
||||
#import <GPUImage/GPUImageJFAVoronoiFilter.h>
|
||||
#import <GPUImage/GPUImageVoronoiConsumerFilter.h>
|
||||
#import <GPUImage/GPUImageMosaicFilter.h>
|
||||
#import <GPUImage/GPUImageTiltShiftFilter.h>
|
||||
#import <GPUImage/GPUImage3x3ConvolutionFilter.h>
|
||||
#import <GPUImage/GPUImageEmbossFilter.h>
|
||||
#import <GPUImage/GPUImageCannyEdgeDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageThresholdEdgeDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageMaskFilter.h>
|
||||
#import <GPUImage/GPUImageHistogramFilter.h>
|
||||
#import <GPUImage/GPUImageHistogramGenerator.h>
|
||||
#import <GPUImage/GPUImagePrewittEdgeDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageXYDerivativeFilter.h>
|
||||
#import <GPUImage/GPUImageHarrisCornerDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageAlphaBlendFilter.h>
|
||||
#import <GPUImage/GPUImageNormalBlendFilter.h>
|
||||
#import <GPUImage/GPUImageNonMaximumSuppressionFilter.h>
|
||||
#import <GPUImage/GPUImageRGBFilter.h>
|
||||
#import <GPUImage/GPUImageMedianFilter.h>
|
||||
#import <GPUImage/GPUImageBilateralFilter.h>
|
||||
#import <GPUImage/GPUImageCrosshairGenerator.h>
|
||||
#import <GPUImage/GPUImageToneCurveFilter.h>
|
||||
#import <GPUImage/GPUImageNobleCornerDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageShiTomasiFeatureDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageErosionFilter.h>
|
||||
#import <GPUImage/GPUImageRGBErosionFilter.h>
|
||||
#import <GPUImage/GPUImageDilationFilter.h>
|
||||
#import <GPUImage/GPUImageRGBDilationFilter.h>
|
||||
#import <GPUImage/GPUImageOpeningFilter.h>
|
||||
#import <GPUImage/GPUImageRGBOpeningFilter.h>
|
||||
#import <GPUImage/GPUImageClosingFilter.h>
|
||||
#import <GPUImage/GPUImageRGBClosingFilter.h>
|
||||
#import <GPUImage/GPUImageColorPackingFilter.h>
|
||||
#import <GPUImage/GPUImageSphereRefractionFilter.h>
|
||||
#import <GPUImage/GPUImageMonochromeFilter.h>
|
||||
#import <GPUImage/GPUImageOpacityFilter.h>
|
||||
#import <GPUImage/GPUImageHighlightShadowFilter.h>
|
||||
#import <GPUImage/GPUImageFalseColorFilter.h>
|
||||
#import <GPUImage/GPUImageHSBFilter.h>
|
||||
#import <GPUImage/GPUImageHueFilter.h>
|
||||
#import <GPUImage/GPUImageGlassSphereFilter.h>
|
||||
#import <GPUImage/GPUImageLookupFilter.h>
|
||||
#import <GPUImage/GPUImageAmatorkaFilter.h>
|
||||
#import <GPUImage/GPUImageMissEtikateFilter.h>
|
||||
#import <GPUImage/GPUImageSoftEleganceFilter.h>
|
||||
#import <GPUImage/GPUImageAddBlendFilter.h>
|
||||
#import <GPUImage/GPUImageDivideBlendFilter.h>
|
||||
#import <GPUImage/GPUImagePolkaDotFilter.h>
|
||||
#import <GPUImage/GPUImageLocalBinaryPatternFilter.h>
|
||||
#import <GPUImage/GPUImageColorLocalBinaryPatternFilter.h>
|
||||
#import <GPUImage/GPUImageLanczosResamplingFilter.h>
|
||||
#import <GPUImage/GPUImageAverageColor.h>
|
||||
#import <GPUImage/GPUImageSolidColorGenerator.h>
|
||||
#import <GPUImage/GPUImageLuminosity.h>
|
||||
#import <GPUImage/GPUImageAverageLuminanceThresholdFilter.h>
|
||||
#import <GPUImage/GPUImageWhiteBalanceFilter.h>
|
||||
#import <GPUImage/GPUImageChromaKeyFilter.h>
|
||||
#import <GPUImage/GPUImageLowPassFilter.h>
|
||||
#import <GPUImage/GPUImageHighPassFilter.h>
|
||||
#import <GPUImage/GPUImageMotionDetector.h>
|
||||
#import <GPUImage/GPUImageHalftoneFilter.h>
|
||||
#import <GPUImage/GPUImageThresholdedNonMaximumSuppressionFilter.h>
|
||||
#import <GPUImage/GPUImageHoughTransformLineDetector.h>
|
||||
#import <GPUImage/GPUImageParallelCoordinateLineTransformFilter.h>
|
||||
#import <GPUImage/GPUImageThresholdSketchFilter.h>
|
||||
#import <GPUImage/GPUImageLineGenerator.h>
|
||||
#import <GPUImage/GPUImageLinearBurnBlendFilter.h>
|
||||
#import <GPUImage/GPUImageGaussianBlurPositionFilter.h>
|
||||
#import <GPUImage/GPUImagePixellatePositionFilter.h>
|
||||
#import <GPUImage/GPUImageTwoInputCrossTextureSamplingFilter.h>
|
||||
#import <GPUImage/GPUImagePoissonBlendFilter.h>
|
||||
#import <GPUImage/GPUImageMotionBlurFilter.h>
|
||||
#import <GPUImage/GPUImageZoomBlurFilter.h>
|
||||
#import <GPUImage/GPUImageLaplacianFilter.h>
|
||||
#import <GPUImage/GPUImageiOSBlurFilter.h>
|
||||
#import <GPUImage/GPUImageLuminanceRangeFilter.h>
|
||||
#import <GPUImage/GPUImageDirectionalNonMaximumSuppressionFilter.h>
|
||||
#import <GPUImage/GPUImageDirectionalSobelEdgeDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageSingleComponentGaussianBlurFilter.h>
|
||||
#import <GPUImage/GPUImageThreeInputFilter.h>
|
||||
#import <GPUImage/GPUImageFourInputFilter.h>
|
||||
#import <GPUImage/GPUImageWeakPixelInclusionFilter.h>
|
||||
#import <GPUImage/GPUImageFASTCornerDetectionFilter.h>
|
||||
#import <GPUImage/GPUImageMovieComposition.h>
|
||||
#import <GPUImage/GPUImageColourFASTFeatureDetector.h>
|
||||
#import <GPUImage/GPUImageColourFASTSamplingOperation.h>
|
||||
#import <GPUImage/GPUImageSolarizeFilter.h>
|
||||
@@ -1,11 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageGammaFilter : GPUImageFilter
|
||||
{
|
||||
GLint gammaUniform;
|
||||
}
|
||||
|
||||
// Gamma ranges from 0.0 to 3.0, with 1.0 as the normal level
|
||||
@property(readwrite, nonatomic) CGFloat gamma;
|
||||
|
||||
@end
|
||||
@@ -1,36 +0,0 @@
|
||||
#import "GPUImageTwoPassTextureSamplingFilter.h"
|
||||
|
||||
/** A Gaussian blur filter
|
||||
Interpolated optimization based on Daniel Rákos' work at http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/
|
||||
*/
|
||||
|
||||
@interface GPUImageGaussianBlurFilter : GPUImageTwoPassTextureSamplingFilter
|
||||
{
|
||||
BOOL shouldResizeBlurRadiusWithImageSize;
|
||||
CGFloat _blurRadiusInPixels;
|
||||
}
|
||||
|
||||
/** A multiplier for the spacing between texels, ranging from 0.0 on up, with a default of 1.0. Adjusting this may slightly increase the blur strength, but will introduce artifacts in the result.
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat texelSpacingMultiplier;
|
||||
|
||||
/** A radius in pixels to use for the blur, with a default of 2.0. This adjusts the sigma variable in the Gaussian distribution function.
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat blurRadiusInPixels;
|
||||
|
||||
/** Setting these properties will allow the blur radius to scale with the size of the image. These properties are mutually exclusive; setting either will set the other to 0.
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat blurRadiusAsFractionOfImageWidth;
|
||||
@property (readwrite, nonatomic) CGFloat blurRadiusAsFractionOfImageHeight;
|
||||
|
||||
/// The number of times to sequentially blur the incoming image. The more passes, the slower the filter.
|
||||
@property(readwrite, nonatomic) NSUInteger blurPasses;
|
||||
|
||||
+ (NSString *)vertexShaderForStandardBlurOfRadius:(NSUInteger)blurRadius sigma:(CGFloat)sigma;
|
||||
+ (NSString *)fragmentShaderForStandardBlurOfRadius:(NSUInteger)blurRadius sigma:(CGFloat)sigma;
|
||||
+ (NSString *)vertexShaderForOptimizedBlurOfRadius:(NSUInteger)blurRadius sigma:(CGFloat)sigma;
|
||||
+ (NSString *)fragmentShaderForOptimizedBlurOfRadius:(NSUInteger)blurRadius sigma:(CGFloat)sigma;
|
||||
|
||||
- (void)switchToVertexShader:(NSString *)newVertexShader fragmentShader:(NSString *)newFragmentShader;
|
||||
|
||||
@end
|
||||
@@ -1,22 +0,0 @@
|
||||
#import "GPUImageTwoPassTextureSamplingFilter.h"
|
||||
|
||||
/** A more generalized 9x9 Gaussian blur filter
|
||||
*/
|
||||
@interface GPUImageGaussianBlurPositionFilter : GPUImageTwoPassTextureSamplingFilter
|
||||
{
|
||||
GLint blurCenterUniform, blurRadiusUniform, aspectRatioUniform;
|
||||
}
|
||||
|
||||
/** A multiplier for the blur size, ranging from 0.0 on up, with a default of 1.0
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat blurSize;
|
||||
|
||||
/** Center for the blur, defaults to 0.5, 0.5
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGPoint blurCenter;
|
||||
|
||||
/** Radius for the blur, defaults to 1.0
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat blurRadius;
|
||||
|
||||
@end
|
||||
@@ -1,30 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@class GPUImageGaussianBlurFilter;
|
||||
|
||||
/** A Gaussian blur that preserves focus within a circular region
|
||||
*/
|
||||
@interface GPUImageGaussianSelectiveBlurFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageGaussianBlurFilter *blurFilter;
|
||||
GPUImageFilter *selectiveFocusFilter;
|
||||
BOOL hasOverriddenAspectRatio;
|
||||
}
|
||||
|
||||
/** The radius of the circular area being excluded from the blur
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat excludeCircleRadius;
|
||||
/** The center of the circular area being excluded from the blur
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGPoint excludeCirclePoint;
|
||||
/** The size of the area between the blurred portion and the clear circle
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat excludeBlurSize;
|
||||
/** A radius in pixels to use for the blur, with a default of 5.0. This adjusts the sigma variable in the Gaussian distribution function.
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat blurRadiusInPixels;
|
||||
/** The aspect ratio of the image, used to adjust the circularity of the in-focus region. By default, this matches the image aspect ratio, but you can override this value.
|
||||
*/
|
||||
@property (readwrite, nonatomic) CGFloat aspectRatio;
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImageSphereRefractionFilter.h"
|
||||
|
||||
@interface GPUImageGlassSphereFilter : GPUImageSphereRefractionFilter
|
||||
|
||||
@end
|
||||
@@ -1,9 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
extern NSString *const kGPUImageLuminanceFragmentShaderString;
|
||||
|
||||
/** Converts an image to grayscale (a slightly faster implementation of the saturation filter, without the ability to vary the color contribution)
|
||||
*/
|
||||
@interface GPUImageGrayscaleFilter : GPUImageFilter
|
||||
|
||||
@end
|
||||
@@ -1,27 +0,0 @@
|
||||
#import "GPUImageColorMatrixFilter.h"
|
||||
|
||||
@interface GPUImageHSBFilter : GPUImageColorMatrixFilter
|
||||
|
||||
/** Reset the filter to have no transformations.
|
||||
*/
|
||||
- (void)reset;
|
||||
|
||||
/** Add a hue rotation to the filter.
|
||||
The hue rotation is in the range [-360, 360] with 0 being no-change.
|
||||
Note that this adjustment is additive, so use the reset method if you need to.
|
||||
*/
|
||||
- (void)rotateHue:(float)h;
|
||||
|
||||
/** Add a saturation adjustment to the filter.
|
||||
The saturation adjustment is in the range [0.0, 2.0] with 1.0 being no-change.
|
||||
Note that this adjustment is additive, so use the reset method if you need to.
|
||||
*/
|
||||
- (void)adjustSaturation:(float)s;
|
||||
|
||||
/** Add a brightness adjustment to the filter.
|
||||
The brightness adjustment is in the range [0.0, 2.0] with 1.0 being no-change.
|
||||
Note that this adjustment is additive, so use the reset method if you need to.
|
||||
*/
|
||||
- (void)adjustBrightness:(float)b;
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImagePixellateFilter.h"
|
||||
|
||||
@interface GPUImageHalftoneFilter : GPUImagePixellateFilter
|
||||
|
||||
@end
|
||||
@@ -1,7 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageHardLightBlendFilter : GPUImageTwoInputFilter
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,53 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
|
||||
@class GPUImageGaussianBlurFilter;
|
||||
@class GPUImageXYDerivativeFilter;
|
||||
@class GPUImageGrayscaleFilter;
|
||||
@class GPUImageGaussianBlurFilter;
|
||||
@class GPUImageThresholdedNonMaximumSuppressionFilter;
|
||||
@class GPUImageColorPackingFilter;
|
||||
|
||||
//#define DEBUGFEATUREDETECTION
|
||||
|
||||
/** Harris corner detector
|
||||
|
||||
First pass: reduce to luminance and take the derivative of the luminance texture (GPUImageXYDerivativeFilter)
|
||||
|
||||
Second pass: blur the derivative (GPUImageGaussianBlurFilter)
|
||||
|
||||
Third pass: apply the Harris corner detection calculation
|
||||
|
||||
This is the Harris corner detector, as described in
|
||||
C. Harris and M. Stephens. A Combined Corner and Edge Detector. Proc. Alvey Vision Conf., Univ. Manchester, pp. 147-151, 1988.
|
||||
*/
|
||||
@interface GPUImageHarrisCornerDetectionFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageXYDerivativeFilter *derivativeFilter;
|
||||
GPUImageGaussianBlurFilter *blurFilter;
|
||||
GPUImageFilter *harrisCornerDetectionFilter;
|
||||
GPUImageThresholdedNonMaximumSuppressionFilter *nonMaximumSuppressionFilter;
|
||||
GPUImageColorPackingFilter *colorPackingFilter;
|
||||
GLfloat *cornersArray;
|
||||
GLubyte *rawImagePixels;
|
||||
}
|
||||
|
||||
/** The radius of the underlying Gaussian blur. The default is 2.0.
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat blurRadiusInPixels;
|
||||
|
||||
// This changes the dynamic range of the Harris corner detector by amplifying small cornerness values. Default is 5.0.
|
||||
@property(readwrite, nonatomic) CGFloat sensitivity;
|
||||
|
||||
// A threshold value at which a point is recognized as being a corner after the non-maximum suppression. Default is 0.20.
|
||||
@property(readwrite, nonatomic) CGFloat threshold;
|
||||
|
||||
// This block is called on the detection of new corner points, usually on every processed frame. A C array containing normalized coordinates in X, Y pairs is passed in, along with a count of the number of corners detected and the current timestamp of the video frame
|
||||
@property(nonatomic, copy) void(^cornersDetectedBlock)(GLfloat* cornerArray, NSUInteger cornersDetected, CMTime frameTime);
|
||||
|
||||
// These images are only enabled when built with DEBUGFEATUREDETECTION defined, and are used to examine the intermediate states of the feature detector
|
||||
@property(nonatomic, readonly, strong) NSMutableArray *intermediateImages;
|
||||
|
||||
// Initialization and teardown
|
||||
- (id)initWithCornerDetectionFragmentShader:(NSString *)cornerDetectionFragmentShader;
|
||||
|
||||
@end
|
||||
@@ -1,29 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
/*
|
||||
* The haze filter can be used to add or remove haze (similar to a UV filter)
|
||||
*
|
||||
* @author Alaric Cole
|
||||
* @creationDate 03/10/12
|
||||
*
|
||||
*/
|
||||
|
||||
/** The haze filter can be used to add or remove haze
|
||||
|
||||
This is similar to a UV filter
|
||||
*/
|
||||
@interface GPUImageHazeFilter : GPUImageFilter
|
||||
{
|
||||
GLint distanceUniform;
|
||||
GLint slopeUniform;
|
||||
}
|
||||
|
||||
/** Strength of the color applied. Default 0. Values between -.3 and .3 are best
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat distance;
|
||||
|
||||
/** Amount of color change. Default 0. Values between -.3 and .3 are best
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat slope;
|
||||
|
||||
@end
|
||||
@@ -1,14 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
#import "GPUImageLowPassFilter.h"
|
||||
#import "GPUImageDifferenceBlendFilter.h"
|
||||
|
||||
@interface GPUImageHighPassFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageLowPassFilter *lowPassFilter;
|
||||
GPUImageDifferenceBlendFilter *differenceBlendFilter;
|
||||
}
|
||||
|
||||
// This controls the degree by which the previous accumulated frames are blended and then subtracted from the current one. This ranges from 0.0 to 1.0, with a default of 0.5.
|
||||
@property(readwrite, nonatomic) CGFloat filterStrength;
|
||||
|
||||
@end
|
||||
@@ -1,20 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageHighlightShadowFilter : GPUImageFilter
|
||||
{
|
||||
GLint shadowsUniform, highlightsUniform;
|
||||
}
|
||||
|
||||
/**
|
||||
* 0 - 1, increase to lighten shadows.
|
||||
* @default 0
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat shadows;
|
||||
|
||||
/**
|
||||
* 0 - 1, decrease to darken highlights.
|
||||
* @default 1
|
||||
*/
|
||||
@property(readwrite, nonatomic) CGFloat highlights;
|
||||
|
||||
@end
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// GPUImageHistogramEqualizationFilter.h
|
||||
// FilterShowcase
|
||||
//
|
||||
// Created by Adam Marcus on 19/08/2014.
|
||||
// Copyright (c) 2014 Sunset Lake Software LLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GPUImageFilterGroup.h"
|
||||
#import "GPUImageHistogramFilter.h"
|
||||
#import "GPUImageRawDataOutput.h"
|
||||
#import "GPUImageRawDataInput.h"
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageHistogramEqualizationFilter : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageHistogramFilter *histogramFilter;
|
||||
GPUImageRawDataOutput *rawDataOutputFilter;
|
||||
GPUImageRawDataInput *rawDataInputFilter;
|
||||
}
|
||||
|
||||
@property(readwrite, nonatomic) NSUInteger downsamplingFactor;
|
||||
|
||||
- (id)initWithHistogramType:(GPUImageHistogramType)newHistogramType;
|
||||
|
||||
@end
|
||||
@@ -1,22 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
typedef enum { kGPUImageHistogramRed, kGPUImageHistogramGreen, kGPUImageHistogramBlue, kGPUImageHistogramRGB, kGPUImageHistogramLuminance} GPUImageHistogramType;
|
||||
|
||||
@interface GPUImageHistogramFilter : GPUImageFilter
|
||||
{
|
||||
GPUImageHistogramType histogramType;
|
||||
|
||||
GLubyte *vertexSamplingCoordinates;
|
||||
|
||||
GLProgram *secondFilterProgram, *thirdFilterProgram;
|
||||
GLint secondFilterPositionAttribute, thirdFilterPositionAttribute;
|
||||
}
|
||||
|
||||
// Rather than sampling every pixel, this dictates what fraction of the image is sampled. By default, this is 16 with a minimum of 1.
|
||||
@property(readwrite, nonatomic) NSUInteger downsamplingFactor;
|
||||
|
||||
// Initialization and teardown
|
||||
- (id)initWithHistogramType:(GPUImageHistogramType)newHistogramType;
|
||||
- (void)initializeSecondaryAttributes;
|
||||
|
||||
@end
|
||||
@@ -1,8 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageHistogramGenerator : GPUImageFilter
|
||||
{
|
||||
GLint backgroundColorUniform;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,49 +0,0 @@
|
||||
#import "GPUImageFilterGroup.h"
|
||||
#import "GPUImageThresholdEdgeDetectionFilter.h"
|
||||
#import "GPUImageParallelCoordinateLineTransformFilter.h"
|
||||
#import "GPUImageThresholdedNonMaximumSuppressionFilter.h"
|
||||
#import "GPUImageCannyEdgeDetectionFilter.h"
|
||||
|
||||
// This applies a Hough transform to detect lines in a scene. It starts with a thresholded Sobel edge detection pass,
|
||||
// then takes those edge points in and applies a Hough transform to convert them to lines. The intersection of these lines
|
||||
// is then determined via blending and accumulation, and a non-maximum suppression filter is applied to find local maxima.
|
||||
// These local maxima are then converted back into lines in normal space and returned via a callback block.
|
||||
//
|
||||
// Rather than using one of the standard Hough transform types, this filter uses parallel coordinate space which is far more efficient
|
||||
// to rasterize on a GPU.
|
||||
//
|
||||
// This approach is based entirely on the PC lines process developed by the Graph@FIT research group at the Brno University of Technology
|
||||
// and described in their publications:
|
||||
//
|
||||
// M. Dubská, J. Havel, and A. Herout. Real-Time Detection of Lines using Parallel Coordinates and OpenGL. Proceedings of SCCG 2011, Bratislava, SK, p. 7.
|
||||
// http://medusa.fit.vutbr.cz/public/data/papers/2011-SCCG-Dubska-Real-Time-Line-Detection-Using-PC-and-OpenGL.pdf
|
||||
// M. Dubská, J. Havel, and A. Herout. PClines — Line detection using parallel coordinates. 2011 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), p. 1489- 1494.
|
||||
// http://medusa.fit.vutbr.cz/public/data/papers/2011-CVPR-Dubska-PClines.pdf
|
||||
|
||||
//#define DEBUGLINEDETECTION
|
||||
|
||||
@interface GPUImageHoughTransformLineDetector : GPUImageFilterGroup
|
||||
{
|
||||
GPUImageOutput<GPUImageInput> *thresholdEdgeDetectionFilter;
|
||||
|
||||
// GPUImageThresholdEdgeDetectionFilter *thresholdEdgeDetectionFilter;
|
||||
GPUImageParallelCoordinateLineTransformFilter *parallelCoordinateLineTransformFilter;
|
||||
GPUImageThresholdedNonMaximumSuppressionFilter *nonMaximumSuppressionFilter;
|
||||
|
||||
GLfloat *linesArray;
|
||||
GLubyte *rawImagePixels;
|
||||
}
|
||||
|
||||
// A threshold value for which a point is detected as belonging to an edge for determining lines. Default is 0.9.
|
||||
@property(readwrite, nonatomic) CGFloat edgeThreshold;
|
||||
|
||||
// A threshold value for which a local maximum is detected as belonging to a line in parallel coordinate space. Default is 0.20.
|
||||
@property(readwrite, nonatomic) CGFloat lineDetectionThreshold;
|
||||
|
||||
// This block is called on the detection of lines, usually on every processed frame. A C array containing normalized slopes and intercepts in m, b pairs (y=mx+b) is passed in, along with a count of the number of lines detected and the current timestamp of the video frame
|
||||
@property(nonatomic, copy) void(^linesDetectedBlock)(GLfloat* lineArray, NSUInteger linesDetected, CMTime frameTime);
|
||||
|
||||
// These images are only enabled when built with DEBUGLINEDETECTION defined, and are used to examine the intermediate states of the Hough transform
|
||||
@property(nonatomic, readonly, strong) NSMutableArray *intermediateImages;
|
||||
|
||||
@end
|
||||
@@ -1,5 +0,0 @@
|
||||
#import "GPUImageTwoInputFilter.h"
|
||||
|
||||
@interface GPUImageHueBlendFilter : GPUImageTwoInputFilter
|
||||
|
||||
@end
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageHueFilter : GPUImageFilter
|
||||
{
|
||||
GLint hueAdjustUniform;
|
||||
|
||||
}
|
||||
@property (nonatomic, readwrite) CGFloat hue;
|
||||
|
||||
@end
|
||||
@@ -1,17 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
@interface GPUImageJFAVoronoiFilter : GPUImageFilter
|
||||
{
|
||||
GLuint secondFilterOutputTexture;
|
||||
GLuint secondFilterFramebuffer;
|
||||
|
||||
|
||||
GLint sampleStepUniform;
|
||||
GLint sizeUniform;
|
||||
NSUInteger numPasses;
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, readwrite) CGSize sizeInPixels;
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
#import "GPUImageFilter.h"
|
||||
|
||||
/** Kuwahara image abstraction, drawn from the work of Kyprianidis, et. al. in their publication "Anisotropic Kuwahara Filtering on the GPU" within the GPU Pro collection. This produces an oil-painting-like image, but it is extremely computationally expensive, so it can take seconds to render a frame on an iPad 2. This might be best used for still images.
|
||||
*/
|
||||
@interface GPUImageKuwaharaFilter : GPUImageFilter
|
||||
{
|
||||
GLint radiusUniform;
|
||||
}
|
||||
|
||||
/// The radius to sample from when creating the brush-stroke effect, with a default of 3. The larger the radius, the slower the filter.
|
||||
@property(readwrite, nonatomic) NSUInteger radius;
|
||||
|
||||
@end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user