GPUImage视频滤镜设置亮度不起作用

时间:2016-03-03 10:21:37

标签: ios objective-c gpuimage

//整个代码看起来很好,但是movieWriter - setCompletionBlock行没有被编译。我不知道它的问题是什么。

自从过去3天以来我试图解决,但我没有成功地工作。

-(IBAction)setBrightness:(id)sender
{    
    sleep(1);

    NSURL *sampleURL = [NSURL URLWithString:_videoURLPath];
    movieFile = [[GPUImageMovie alloc] initWithURL:sampleURL];
    movieFile.runBenchmark = YES;
    movieFile.playAtActualSpeed = NO;

    filterView = (GPUImageView *)gpuView;
    filter=[[GPUImageBrightnessFilter alloc]init];
    [movieFile addTarget:filter];
    [filter addTarget:filterView];

    [(GPUImageBrightnessFilter *)filter setBrightness:brightValue];

    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];enter code here

    movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(320.0, 320.0)];
    [filter addTarget:movieWriter];

    movieWriter.shouldPassthroughAudio = NO;
    movieFile.audioEncodingTarget = movieWriter;
    [movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];

    [movieWriter startRecording];
    [movieFile startProcessing];

    [movieWriter setCompletionBlock:^{

        [filter removeTarget:movieWriter];
        [movieWriter finishRecording];

        dispatch_async(dispatch_get_main_queue(), ^{

            [_toolDelegate stringPathOfFilteredVideoFromTool:pathToMovie];
            [self.navigationController popViewControllerAnimated:YES];

        });
    }];
}

1 个答案:

答案 0 :(得分:0)

这对我有用。

  $(document).ready(function(){
 $('.dropdown-menu input').click(function (e) {
     e.stopPropagation();
 });

    $('.dropdown a').click(function(){
      $('.dropdown').addClass("open");
    });
$('.dropdown-menu li').click(function(){

$('.dropdown-toggle b').remove().appendTo($('.dropdown-toggle').text($(this).text()));
});
});

只需将以上内容替换为以下内容。

[movieWriter setCompletionBlock:^{

    [filter removeTarget:movieWriter];
    [movieWriter finishRecording];
}];