Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
SWF-16337: switch from filter offset to direct filter type
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Donnelly committed Jul 7, 2017
1 parent 126f10e commit 09ac8f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
6 changes: 1 addition & 5 deletions Source/PBJVision.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ static CGFloat const PBJVideoBitRate1280x750 = 5000000 * 8; // 40bmps

+ (PBJVision *)sharedInstance;

// Swipe offset so we can get the correct filter
@property CGFloat filterOffset;
- (void)setCurrentFilterType:(VideoFilterType)filterType;

@property (nonatomic, weak) id<PBJVisionDelegate> delegate;

Expand Down Expand Up @@ -223,9 +222,6 @@ static CGFloat const PBJVideoBitRate1280x750 = 5000000 * 8; // 40bmps
@property (nonatomic, getter=isAudioCaptureEnabled) BOOL audioCaptureEnabled;
@property (nonatomic) CGFloat screenScale;

// this determines whether or not we update the offset of our split filter
@property (nonatomic) BOOL isSwipeEnabled;

// this determines whether we display video with PBJ or GPUImage
@property (nonatomic) BOOL isFilterEnabled;

Expand Down
12 changes: 2 additions & 10 deletions Source/PBJVision.m
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ @interface PBJVision () <
@property (nonatomic, strong) GPUImageMovie *movieDataInput;
@property (nonatomic, strong) GPUImageFilterGroup *currentFilterGroup;
@property (nonatomic, strong) VideoFilterManager *filterManager;
@property (nonatomic, assign) VideoFilterType currentFilterType;


@property (nonatomic, retain) __attribute__((NSObject)) CMFormatDescriptionRef outputVideoFormatDescription;
Expand Down Expand Up @@ -2787,7 +2788,7 @@ - (void)_renderSampleBuffer:(CMSampleBufferRef)sampleBuffer
if(_isFilterEnabled)
{
// Get filter based on scrollview offset
GPUImageFilterGroup *newFilterGroup = [_filterManager splitFilterGroupAtIndex:self.filterOffset airbrushFilterType:self.airbrushFilterType];
GPUImageFilterGroup *newFilterGroup = [_filterManager splitFilterGroupForType:self.currentFilterType airbrushFilterType:self.airbrushFilterType];

// Check if the filter needs to be changed
if (![[_movieDataInput targets] containsObject:newFilterGroup])
Expand All @@ -2812,15 +2813,6 @@ - (void)_renderSampleBuffer:(CMSampleBufferRef)sampleBuffer
[filter setInputRotation:rotation atIndex:0];
}
}

if (_isSwipeEnabled)
{
// Tell spilt filter what percentage should be left and right filter
CGFloat filterPercent = ((self.filterOffset < 1) ? self.filterOffset :
self.filterOffset - (truncf(self.filterOffset)));
GPUImageSplitFilter *splitFilter = (GPUImageSplitFilter*)[_currentFilterGroup filterAtIndex:_currentFilterGroup.filterCount-1];
[splitFilter setOffset:filterPercent];
}
}
else
{
Expand Down

0 comments on commit 09ac8f4

Please sign in to comment.