有没有办法检测GPUImageMovie何时完成处理?在那一刻我不希望电影保存,因此没有完成块的GPUImageMovieWriter。
self.movieFile = [[GPUImageMovie alloc] initWithURL:assetURL];
if([filterType isEqualToString:@"BigApple 1"]){
self.lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"BigApple1.png"]];
[self.lookupImageSource processImage];
[self.lookupImageSource useNextFrameForImageCapture];
filter = [[GPUImageLookupFilter alloc] init];
[lookupImageSource addTarget:filter atTextureLocation:1];
}
[movieFile addTarget:filter];
[filter addTarget:videoWindow];
[self.imageThumbnail removeFromSuperview];
[movieFile startProcessing];
答案 0 :(得分:2)
使用计时器解决问题,然后检查GPUImageMovie上的进度值。
self.sampleTimer = [NSTimer scheduledTimerWithTimeInterval:0.1f
target:self
selector:@selector(retrievingSampleProgress)
userInfo:nil
repeats:YES];
- (void)retrievingSampleProgress {
NSLog(@"Sample Complete:%f",self.movieFile.progress);
if(self.movieFile.progress == 1){
[self.sampleTimer invalidate];
self.viewingSample = 0;
}else {
self.viewingSample = 1;
}
}