if(mediaType ==kCMMediaType_Video)
{
UIImage*overlayImage = [UIImageimageNamed:@"video_watermark"];
CGColorSpaceRefcSpace =CGColorSpaceCreateDeviceRGB();
CVPixelBufferLockBaseAddress( pixelBuffer,0);
CGContextRefcontext =CGBitmapContextCreate(CVPixelBufferGetBaseAddress(pixelBuffer),
CVPixelBufferGetWidth(pixelBuffer),
CVPixelBufferGetHeight(pixelBuffer),
8,
CVPixelBufferGetBytesPerRow(pixelBuffer),
CGColorSpaceCreateDeviceRGB(),
(CGBitmapInfo)
kCGBitmapByteOrder32Little|
kCGImageAlphaPremultipliedFirst);
//设置水印的位置
//CGFloat width = CVPixelBufferGetWidth(pixelBuffer);
//CGFloat height = CVPixelBufferGetHeight(pixelBuffer);
//
//CGRect renderBounds = CGRectMake(width - 306/kVisualFactor,40/kVisualFactor , 266/kVisualFactor , 66/kVisualFactor );
//CGContextDrawImage(context, renderBounds, [overlayImage CGImage]);
CVPixelBufferUnlockBaseAddress(pixelBuffer,0);
CGColorSpaceRelease(cSpace);
}