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
func configureSlomoCaptureFormats(formats: [AVCaptureDeviceFormat]) { | |
var bestFormat: AVCaptureDeviceFormat? | |
var bestFrameRateRange: AVFrameRateRange? | |
for format in device.formats as! [AVCaptureDeviceFormat] { | |
// We only want to use 420f media sub types to get the best dynamic range. | |
let mediaSubtype = CMFormatDescriptionGetMediaSubType(format.formatDescription) | |
if mediaSubtype == k420f { | |
// let dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription) |
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
// this ALMOST crops a CMSampleBufferRef. | |
// | |
// SampleBufferHelper.m | |
// sampleBufferBS | |
// | |
// Created by Ivan Lesko on 2/25/16. | |
// Copyright © 2016 Ivan Lesko. All rights reserved. | |
// |
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
// From: http://stackoverflow.com/a/30724543/2526115 | |
// Adds the ability to remove a certain object based on value from an array | |
extension RangeReplaceableCollectionType where Generator.Element : Equatable { | |
// Remove first collection element that is equal to the given `object`: | |
mutating func removeObject(object : Generator.Element) { | |
if let index = self.indexOf(object) { | |
self.removeAtIndex(index) | |
} |
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
PHPhotoLibrary.sharedPhotoLibrary().performChanges({ () -> Void in | |
_ = PHAssetChangeRequest.creationRequestForAssetFromVideoAtFileURL(outputFileURL) | |
}, completionHandler: { (success: Bool, error: NSError?) -> Void in | |
if success { | |
print("successfully saved video to camera roll") | |
do { | |
let _ = try NSFileManager().removeItemAtPath(outputFileURL.path!) | |
print("Successfully removed saved video file from local directory") | |
} catch let error as NSError { |
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
// Gotta have 'em... | |
[ | |
{ "keys": ["shift+enter"], "command": "move_to", "args": {"to": "eol", "extend": false} }, | |
// Toggle auto-save | |
{ "keys": ["ctrl+shift+s"], "command": "auto_save" }, | |
// Auto indent | |
{ "keys": ["ctrl+i"], "command": "reindent"} |
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
export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH | |
export EDITOR='subl -w' | |
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"' | |
export PS1='⚡ ' |
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
/* | |
File: MYAudioTapProcessor.h | |
Abstract: Audio tap processor using MTAudioProcessingTap for audio visualization and processing. | |
Version: 1.0.1 | |
*/ | |
#import <Foundation/Foundation.h> | |
@class AVAudioMix; | |
@class AVAssetTrack; |
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
// | |
// Debugging.h | |
// | |
// Created by Ivan Lesko on 6/24/14. | |
// Copyright (c) 2014 Ivan Lesko. All rights reserved. | |
// | |
/** | |
* Debugging.h is a nice macro that defines a better NSLog. | |
* Instead of showing the Project name and timestamp, it shows the Class, method, and line number the NSLog is called. |