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
// | |
// HKLCGImageUtils.swift | |
// | |
// Created by Hirohito Kato on 2014/12/26. | |
// | |
// @see https://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/ImageIOGuide/imageio_source/ikpg_source.html#//apple_ref/doc/uid/TP40005462-CH218-DontLinkElementID_6 | |
import Foundation | |
import ImageIO |
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
// | |
// HKLCMTimeUtils.swift | |
// | |
// Created by Hirohito Kato on 2015/01/07. | |
// Copyright © 2020 Kato Hirohito. Licensed under Unlicense(https://unlicense.org). Feel free to use it! | |
import CoreMedia | |
// MARK: Initialization | |
public extension CMTime { |
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
@interface TestView : UIView | |
- (void)startPreviewing; | |
- (void)stopPreviewing; | |
@property (nonatomic,assign)CMSampleBufferRef sampleBuffer; | |
@end | |
//////////////////////////////////////////// | |
#import <AVFoundation/AVFoundation.h> | |
#import <CoreMedia/CoreMedia.h> |
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
/* | |
Mute a shutter sound. | |
In detail, see http://stackoverflow.com/questions/4401232/avfoundation-how-to-turn-off-the-shutter-sound-when-capturestillimageasynchrono | |
*/ | |
- (void)becomeSilentModeForCaptureOutput:(AVCaptureStillImageOutput *)imageOutput | |
{ | |
if (!self.invertedSound) { | |
NSString *path = [[NSBundle mainBundle] pathForResource:@"photoShutter_inverted" | |
ofType:@"wav"]; |
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
@import AVFoundation; | |
#import "ViewController.h" | |
@interface ViewController () | |
@property (nonatomic)AVCaptureSession *session; | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad |
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 DumpCVPixelBufferInfo(CVPixelBufferRef buff) { | |
CVPixelBufferRetain(buff); | |
CVPixelBufferLockBaseAddress(buff, 0); | |
union typeUnion { | |
char c[sizeof(FourCharCode)]; | |
FourCharCode fc; | |
} type; | |
type.fc = CVPixelBufferGetPixelFormatType(buff); | |
size_t w, h, bpr, size; |
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
// ref: http://okwave.jp/qa/q3884248.html | |
#include <iostream> | |
#include <stdio.h> | |
#include <functional> | |
class SuperClass { | |
public: | |
virtual ~SuperClass() {} |
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
@property (nonatomic,strong)AVCaptureSession *captureSession; | |
@property (nonatomic,strong)AVCaptureDevice *device; | |
@property (weak, nonatomic) IBOutlet UISlider *torchLevelSlider; | |
- (void)setupTorch | |
{ | |
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; | |
for (AVCaptureDevice *d in devices) | |
if (d.hasTorch && [d isTorchModeSupported:AVCaptureTorchModeOn]) { | |
self.device = d; |
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
#define N(x) _Generic((x), \ | |
int: [NSNumber numberWithInt: x], \ | |
float: [NSNumber numberWithFloat: x], \ | |
double: [NSNumber numberWithDouble: x]) |
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
require 'coreaudio' | |
dev = CoreAudio.default_output_device | |
buf = dev.output_loop(44000) | |
line = ARGV[0] | |
puts line | |
44000.times do |t| | |
# buf[i] = 0x3FFF * rand() |