Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问如何添加水印 #39

Closed
XFoxer opened this issue Aug 3, 2016 · 14 comments
Closed

请问如何添加水印 #39

XFoxer opened this issue Aug 3, 2016 · 14 comments

Comments

@XFoxer
Copy link

XFoxer commented Aug 3, 2016

`- (void)setWaterMark
{
GPUImageAlphaBlendFilter *blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
blendFilter.mix = 1.0;
NSDate *startTime = [NSDate date];

UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 240.0f, 320.0f)];
timeLabel.font = [UIFont systemFontOfSize:17.0f];
timeLabel.text = @"Time: 0.0 s";
timeLabel.textAlignment = NSTextAlignmentCenter;
timeLabel.backgroundColor = [UIColor clearColor];
timeLabel.textColor = [UIColor whiteColor];

GPUImageUIElement *uiElementInput = [[GPUImageUIElement alloc] initWithView:timeLabel];

[_filter addTarget:blendFilter];
[uiElementInput addTarget:blendFilter];

[blendFilter addTarget:_gpuImageView];

__unsafe_unretained GPUImageUIElement *weakUIElementInput = uiElementInput;
__weak typeof(self) _self = self;
[_filter setFrameProcessingCompletionBlock:^(GPUImageOutput * filter, CMTime frameTime){
    timeLabel.text = [NSString stringWithFormat:@"Time: %f s", -[startTime timeIntervalSinceNow]];
    [weakUIElementInput update];
    [_self processVideo:filter];
}];
[_videoCamera addTarget:_gpuImageView];

}`
这是我添加水印的代码 可是在[weakUIElementInput update] 这里崩溃

@XFoxer
Copy link
Author

XFoxer commented Aug 3, 2016

后续会出添加水印的功能么

@chenliming777
Copy link

这个一定会添加的,目前还在优化,稍等吧

@chenliming777
Copy link

这个你可以先参考GPUImage源码下的demo

@XFoxer
Copy link
Author

XFoxer commented Aug 3, 2016

我现在这个添加方法就是按照GPUImage里面的demo添加的 setWaterMark 是在setBeautyFace后面执行的 不知道问题出在哪里

@chenliming777
Copy link

这个稍等一下吧 这两天会提交的

@chenliming777
Copy link

水印这个接口已经加了,在master分支下。

@XFoxer
Copy link
Author

XFoxer commented Aug 4, 2016

刚才试了下 添加水印崩溃 输出
'Tried to overrelease a framebuffer, did you forget to call -useNextFrameForImageCapture before using -imageFromCurrentFramebuffer?'

@XFoxer
Copy link
Author

XFoxer commented Aug 4, 2016

CRASH: Tried to overrelease a framebuffer, did you forget to call -useNextFrameForImageCapture before using -imageFromCurrentFramebuffer?
0 CoreFoundation 0x0000000185704f74 + 148
1 libobjc.A.dylib 0x000000019abf3f80 objc_exception_throw + 56
2 CoreFoundation 0x0000000185704e2c + 0
3 Foundation 0x00000001865f3f3c + 112
4 bililive 0x0000000100430424 -[GPUImageFramebuffer unlock] + 312
5 bililive 0x00000001004718c0 -[GPUImageTwoInputFilter renderToTextureWithVertices:textureCoordinates:] + 1220
6 bililive 0x00000001004288dc -[GPUImageFilter newFrameReadyAtTime:atIndex:] + 144
7 bililive 0x000000010047214c -[GPUImageTwoInputFilter newFrameReadyAtTime:atIndex:] + 1204
8 bililive 0x000000010042637c -[GPUImageFilter informTargetsAboutNewFrameAtTime:] + 1500
9 bililive 0x0000000100428924 -[GPUImageFilter newFrameReadyAtTime:atIndex:] + 216
10 bililive 0x000000010042637c -[GPUImageFilter informTargetsAboutNewFrameAtTime:] + 1500
11 bililive 0x0000000100421ab0 -[GPUImageCropFilter newFrameReadyAtTime:atIndex:] + 152
12 bililive 0x0000000100479550 -[GPUImageVideoCamera updateTargetsForVideoCameraUsingCacheTextureAtWidth:height:time:] + 1740
13 bililive 0x0000000100479eac -[GPUImageVideoCamera processVideoSampleBuffer:] + 2200
14 bililive 0x000000010047aa88 __74-[GPUImageVideoCamera captureOutput:didOutputSampleBuffer:fromConnection:]_block_invoke + 176
15 libdispatch.dylib 0x00000001010add70 _dispatch_call_block_and_release + 24
16 libdispatch.dylib 0x00000001010add30 _dispatch_client_callout + 16
17 libdispatch.dylib 0x00000001010ba7f0 _dispatch_queue_drain + 1036
18 libdispatch.dylib 0x00000001010b1a20 _dispatch_queue_invoke + 464
19 libdispatch.dylib 0x00000001010bc908 _dispatch_root_queue_drain + 760
20 libdispatch.dylib 0x00000001010bc600 _dispatch_worker_thread3 + 132
21 libsystem_pthread.dylib 0x000000019b5f5478 _pthread_wqthread + 1092
22 libsystem_pthread.dylib 0x000000019b5f5028 start_wqthread + 4

@chenliming777
Copy link

调用这个接口试试,可以自己看源码,Master分支今天提交的
ee7980f1-3709-451c-ab8f-e58ff42e6e69

@XFoxer
Copy link
Author

XFoxer commented Aug 4, 2016

我调用的就是这个接口

2016-08-04 6 34 38

@chenliming777
Copy link

你是自己实现的 不是用的我的源码是嘛,GPUImage里面有改动

@chenliming777
Copy link

我的demo是没有问题的,你测测看是不是你自己哪里出问题了,我这不好定位

@XFoxer
Copy link
Author

XFoxer commented Aug 5, 2016

好的 谢谢 我这边再看看

@chenliming777
Copy link

GPUImageUIElement这个里面update有改动,你可以看下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants