This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CVImageBufferRef)getImageBufferFromURL:(NSURL *)url { | |
AVAsset *asset = [AVAsset assetWithURL:url]; | |
AVAssetTrack *track = [[asset | |
tracksWithMediaType:AVMediaTypeVideo] | |
objectAtIndex:0]; | |
AVAssetReaderTrackOutput | |
*readerTrack = [AVAssetReaderTrackOutput | |
assetReaderTrackOutputWithTrack:track | |
outputSettings:nil]; | |
AVAssetReader *reader = [AVAssetReader assetReaderWithAsset:asset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)screenshotFromFileURL:(NSURL *)url { | |
AVPlayerItem *item = [AVPlayerItem playerItemWithURL:url]; | |
AVURLAsset *asset = (AVURLAsset *)item.asset; | |
AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] | |
initWithAsset:asset]; | |
CGImageRef thumb = [imageGenerator | |
copyCGImageAtTime:CMTimeMakeWithSeconds(10.0, 1.0) | |
actualTime:NULL | |
error:NULL]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setupCaptureSession | |
{ | |
NSError *error = nil; | |
AVCaptureSession *session = [[AVCaptureSession alloc] init]; | |
session.sessionPreset = AVCaptureSessionPresetMedium; | |
AVCaptureDevice *device = [AVCaptureDevice | |
defaultDeviceWithMediaType:AVMediaTypeVideo]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage*)snapshot:(UIView*)eaglview | |
{ | |
GLint backingWidth, backingHeight; | |
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _colorRenderbuffer); | |
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, | |
GL_RENDERBUFFER_WIDTH_OES, | |
&backingWidth); | |
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, | |
GL_RENDERBUFFER_HEIGHT_OES, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage*)screenshotFromView:(UIView *)view | |
{ | |
CGSize imageSize = [view bounds].size; | |
if (NULL != UIGraphicsBeginImageContextWithOptions) | |
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0); | |
else | |
UIGraphicsBeginImageContext(imageSize); | |
CGContextRef context = UIGraphicsGetCurrentContext(); |
NewerOlder