diff --git a/CocoaSplit.xcodeproj/project.pbxproj b/CocoaSplit.xcodeproj/project.pbxproj index 19f25db8..25b80edd 100644 --- a/CocoaSplit.xcodeproj/project.pbxproj +++ b/CocoaSplit.xcodeproj/project.pbxproj @@ -99,6 +99,7 @@ 3451A1E81712C7D000DF6A8B /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 347B7FC516907A1700B5F4B3 /* libbz2.dylib */; }; 3451A1E91712C7DE00DF6A8B /* VideoDecodeAcceleration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 347B7FC716907AE700B5F4B3 /* VideoDecodeAcceleration.framework */; }; 3451A1EA1712C80400DF6A8B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 340FE4A115F3417E00E4CE4E /* Cocoa.framework */; }; + 34559A281E12D4400085883C /* CSCaptureBase+InputFrameTick.m in Sources */ = {isa = PBXBuildFile; fileRef = 34559A271E12D4400085883C /* CSCaptureBase+InputFrameTick.m */; }; 34576C7819AFCA1B007BAD90 /* CSPluginLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 34576C7719AFCA1B007BAD90 /* CSPluginLoader.m */; }; 34576C7919AFCA1B007BAD90 /* CSPluginLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 34576C7719AFCA1B007BAD90 /* CSPluginLoader.m */; }; 345F89861976113C00BD4062 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34A64A36165F208800A68428 /* QuartzCore.framework */; }; @@ -717,6 +718,8 @@ 3451A1CA17111BD900DF6A8B /* CocoaSplitCmd.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = CocoaSplitCmd.1; sourceTree = ""; }; 3451A1D2171187D400DF6A8B /* ControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControllerProtocol.h; sourceTree = ""; }; 3451A1E11712C5F700DF6A8B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 34559A261E12D4400085883C /* CSCaptureBase+InputFrameTick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CSCaptureBase+InputFrameTick.h"; sourceTree = ""; }; + 34559A271E12D4400085883C /* CSCaptureBase+InputFrameTick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CSCaptureBase+InputFrameTick.m"; sourceTree = ""; }; 34576C7619AFCA1B007BAD90 /* CSPluginLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSPluginLoader.h; sourceTree = ""; }; 34576C7719AFCA1B007BAD90 /* CSPluginLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSPluginLoader.m; sourceTree = ""; }; 34576C9819AFE6F7007BAD90 /* CSWindowCapturePlugin.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CSWindowCapturePlugin.xcodeproj; path = CapturePlugins/CSWindowCapturePlugin/CSWindowCapturePlugin.xcodeproj; sourceTree = ""; }; @@ -1221,6 +1224,8 @@ 349461581AB420E600F28883 /* CSAnimationRunner */, 349461571AB41DA000F28883 /* CSAnimationRunnerObj.h */, 340DC733197CF6E9003A0BB3 /* CSCaptureBase.m */, + 34559A261E12D4400085883C /* CSCaptureBase+InputFrameTick.h */, + 34559A271E12D4400085883C /* CSCaptureBase+InputFrameTick.m */, 34938EE61AE4A7E500F3B1CF /* CSCIFilterConfigProxy.h */, 34938EE71AE4A7E500F3B1CF /* CSCIFilterConfigProxy.m */, 346CF44A1A5C10C2008E5BFF /* CSInputLayer.h */, @@ -2456,6 +2461,7 @@ 3400A0791BD4533A003E1828 /* CSInputLibraryWindowController.m in Sources */, 345F8B691A16C348009A81E3 /* CAMultiAudioGraph.m in Sources */, 3431FFE119786502000965FE /* InputSource.m in Sources */, + 34559A281E12D4400085883C /* CSCaptureBase+InputFrameTick.m in Sources */, 3414C6AE1CBB9EBF00107C69 /* CSIRCompressor.m in Sources */, 34ED8C911B07371C002C0674 /* MIKMIDINoteOnCommand.m in Sources */, 346865471CC353E2002BAB86 /* CSInstantRecorderCompressorViewController.m in Sources */, diff --git a/CocoaSplit.xcodeproj/project.xcworkspace/xcuserdata/zakk.xcuserdatad/UserInterfaceState.xcuserstate b/CocoaSplit.xcodeproj/project.xcworkspace/xcuserdata/zakk.xcuserdatad/UserInterfaceState.xcuserstate index 67f69b09..7d3da78a 100644 Binary files a/CocoaSplit.xcodeproj/project.xcworkspace/xcuserdata/zakk.xcuserdatad/UserInterfaceState.xcuserstate and b/CocoaSplit.xcodeproj/project.xcworkspace/xcuserdata/zakk.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/CocoaSplit/.DS_Store b/CocoaSplit/.DS_Store index 254532ad..c12160e2 100644 Binary files a/CocoaSplit/.DS_Store and b/CocoaSplit/.DS_Store differ diff --git a/CocoaSplit/CSCaptureBase+InputFrameTick.h b/CocoaSplit/CSCaptureBase+InputFrameTick.h new file mode 100644 index 00000000..d0244de5 --- /dev/null +++ b/CocoaSplit/CSCaptureBase+InputFrameTick.h @@ -0,0 +1,21 @@ +// +// CSCaptureBase+InputFrameTick.h +// CocoaSplit +// +// Created by Zakk on 12/27/16. +// Copyright © 2016 Zakk. All rights reserved. +// + +#import "CSCaptureBase.h" + +@class InputSource; + +@interface CSCaptureBase (InputFrameTick) +-(void)frameTickFromInput:(InputSource *)input; +@property (weak) InputSource *tickInput; + +@end + +@protocol CSCaptureBaseInputFrameTickProtocol +-(void)frameTickFromInput:(InputSource *)input; +@end diff --git a/CocoaSplit/CSCaptureBase+InputFrameTick.m b/CocoaSplit/CSCaptureBase+InputFrameTick.m new file mode 100644 index 00000000..be20910f --- /dev/null +++ b/CocoaSplit/CSCaptureBase+InputFrameTick.m @@ -0,0 +1,25 @@ +// +// CSCaptureBase+InputFrameTick.m +// CocoaSplit +// +// Created by Zakk on 12/27/16. +// Copyright © 2016 Zakk. All rights reserved. +// + +#import "CSCaptureBase+InputFrameTick.h" + +@implementation CSCaptureBase (InputFrameTick) +@dynamic tickInput; + + + +-(void)frameTickFromInput:(InputSource *)input +{ + + if (self.tickInput && (input == self.tickInput)) + { + + [self frameTick]; + } +} +@end diff --git a/CocoaSplit/CSCaptureBase.m b/CocoaSplit/CSCaptureBase.m index b14b9725..d0a90abf 100644 --- a/CocoaSplit/CSCaptureBase.m +++ b/CocoaSplit/CSCaptureBase.m @@ -21,6 +21,7 @@ frame_render_behavior _saved_render_behavior; CFAbsoluteTime _fps_start_time; int _fps_frame_cnt; + } @@ -30,7 +31,7 @@ @property (assign) CGFloat detectedInputWidth; @property (assign) CGFloat detectedInputHeight; @property (assign) double layerUpdateFPS; - +@property (weak) InputSource *tickInput; @end @@ -181,6 +182,12 @@ } } +-(void)frameTickFromInput:(InputSource *)input +{ + [self frameTick]; +} + + -(void)frameTick { return; @@ -276,6 +283,10 @@ CALayer *newLayer = [self createNewLayer]; @synchronized(self) { + if (!self.tickInput) + { + self.tickInput = inputsrc; + } [_allLayers setObject:newLayer forKey:inputsrc]; } [CATransaction commit]; @@ -287,7 +298,22 @@ { @synchronized(self) { + if (self.tickInput == inputsrc) + { + self.tickInput = nil; + + } [_allLayers removeObjectForKey:inputsrc]; + if (!self.tickInput) + { + for (id key in _allLayers) + { + if (key) + { + self.tickInput = key; + } + } + } if (_allLayers.count == 0) { [self willDelete]; @@ -295,6 +321,7 @@ } } + -(void)updateLayersWithFramedataBlock:(void(^)(CALayer *))updateBlock { @@ -315,6 +342,10 @@ layersCopy = _allLayers.copy; } [CATransaction begin]; + if (frameData) + { + _fps_frame_cnt++; + } for (id key in layersCopy) { InputSource *layerSrc = (InputSource *)key; @@ -329,7 +360,6 @@ updateBlock(clayer); if (frameData) { - _fps_frame_cnt++; [layerSrc layerUpdated]; } } diff --git a/CocoaSplit/InputSource.h b/CocoaSplit/InputSource.h index 6cab95c5..d8bf1c48 100644 --- a/CocoaSplit/InputSource.h +++ b/CocoaSplit/InputSource.h @@ -10,6 +10,7 @@ #import #import "Capture.h" #import "CSCaptureSourceProtocol.h" +#import "CSCaptureBase+InputFrameTick.h" #import "CSPluginLoader.h" #import "SourceCache.h" #import "InputPopupControllerViewController.h" @@ -97,7 +98,7 @@ typedef enum resize_style_t { @property (assign) float scrollXSpeed; @property (assign) float scrollYSpeed; -@property (strong) NSObject *videoInput; +@property (strong) NSObject *videoInput; @property (assign) float rotationAngle; @property (assign) float rotationAngleY; @property (assign) float rotationAngleX; diff --git a/CocoaSplit/InputSource.m b/CocoaSplit/InputSource.m index ff033766..1f221510 100644 --- a/CocoaSplit/InputSource.m +++ b/CocoaSplit/InputSource.m @@ -1794,7 +1794,9 @@ static NSArray *_sourceTypes = nil; self.layer.sourceLayer = _currentLayer; } - [self.videoInput frameTick]; + + [self.videoInput frameTickFromInput:self]; + [self.layer frameTick]; if (self.needsAdjustment) {