OGeek|极客世界-中国程序员成长平台

标题: ios - 如何检测 GPUImageMovie 何时完成处理 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:39
标题: ios - 如何检测 GPUImageMovie 何时完成处理

有没有办法检测 GPUImageMovie 何时完成处理?目前我不想保存电影,所以没有带有完成 block 的 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];



Best Answer-推荐答案


通过使用计时器然后检查 GPUImageMovie 上的进度值解决了该问题。

self.sampleTimer = [NSTimer scheduledTimerWithTimeInterval:0.1f
                                                  target:self
                                                selectorselector(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;
}

}

关于ios - 如何检测 GPUImageMovie 何时完成处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24573287/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4