Skip to content

Instantly share code, notes, and snippets.

View SheffieldKevin's full-sized avatar

Kevin Meaney SheffieldKevin

View GitHub Profile
@SheffieldKevin
SheffieldKevin / MICMSampleBuffer.h
Last active January 18, 2024 10:14
Video Sample buffer accessor/iterator using AVFoundation
// MICMSampleBuffer.h
// MovieMaker
//
// Created by Kevin Meaney on 02/01/2015.
// Copyright (c) 2015 MIT License. All rights reserved.
@import Foundation;
@import AVFoundation;
@interface MICMSampleBuffer : NSObject <NSCopying>
@SheffieldKevin
SheffieldKevin / compareimages.swift
Last active February 26, 2023 18:33
A couple of swift functions for comparing two CGImage using CIImage in OS X
/**
@brief Returns true if images have same meta. Width, Height, bit depth.
@discussion Assumes images are non null.
*/
func doImagesHaveSameMeta(#image1:CGImage, #image2:CGImage) -> Bool {
if CGImageGetWidth(image1) != CGImageGetWidth(image2) {
return false
}
if CGImageGetHeight(image1) != CGImageGetHeight(image2) {
@SheffieldKevin
SheffieldKevin / main.m
Last active July 1, 2022 06:43
Code to demonstrate that the backside image option for the CIPageCurlTransition filter doesn't work.
// main.m
// pagecurlbacksidetest
//
// Created by Kevin Meaney on 30/03/2014.
@import Foundation;
@import QuartzCore;
size_t const kWidth = 600;
size_t const kHeight = 400;
@SheffieldKevin
SheffieldKevin / movietransitions.swift
Last active June 25, 2021 16:58
Make a movie with transitions with AVFoundation and swift
//
// main.swift
// mutablecomposition
//
// Created by Kevin Meaney on 24/08/2015.
// Copyright (c) 2015 Kevin Meaney. All rights reserved.
//
import Foundation
@SheffieldKevin
SheffieldKevin / movietracks.swift
Last active November 7, 2020 14:47
Playing with movie tracks using AVFoundation in Swift (command line version)
#!/usr/bin/env swift
import Foundation
import AVFoundation
if Process.arguments.count != 2 {
println("The first and only argument should be a full path to a movie or music file.")
exit(1)
}
@SheffieldKevin
SheffieldKevin / main.m
Last active November 26, 2018 18:22
I had far more difficulty getting the generation of gif animations working correctly using ImageIO and Core-Graphics aka Quartz on MacOS/iOS than should have reasonably been expected.
// main.m
// creategif
//
// Created by Kevin Meaney on 21/10/2013.
// I've briefly blogged about it here:
// http://blog.yvs.eu.com/2013/10/creating-gif-animations-using-coreimagequartz
// The following code is all that is all the code needed for a creating a command line tool to generate
// a gif animation from image files.
// The main limitation with this code is that apart from the frame delay time of 0.1 second, every

Keybase proof

I hereby claim:

  • I am SheffieldKevin on github.
  • I am ktam (https://keybase.io/ktam) on keybase.
  • I have a public key whose fingerprint is D09A 1368 02CD 66C0 454C 42A8 595C 9934 19FB CBF9

To claim this, I am signing this object:

@SheffieldKevin
SheffieldKevin / MIAVCreateImageOfCompositionMap.m
Created March 8, 2015 19:22
This is a hack grab of code from Apple's AV Composition Debug Viewer application to generate a CGImage. Works on OS X and iOS. Doesn't draw text.
//
// MIAVCreateImageOfCompositionMap.m
// MovingImagesFramework
//
// Created by Kevin Meaney on 08/03/2015.
//
// Lifted from Apple's Composition Debug Viewer application.
@import Foundation;
@import AVFoundation;
@SheffieldKevin
SheffieldKevin / main.m
Created February 20, 2015 11:20
bigears. Drawing rotated and positioned text within a path using CoreText (OS X command line, intended to be bug report for apple but highlighted a bug of mine)
//
// main.m
// bigears
//
// Created by Kevin Meaney on 18/02/2015.
// Copyright (c) 2015 Kevin Meaney. All rights reserved.
//
#import <Foundation/Foundation.h>
@SheffieldKevin
SheffieldKevin / CreateImageProtocol.h
Created October 17, 2014 16:38
Objective-C properties of protocols that take blocks/closures and accessing them in Swift
//
// CreateImageProtocol.h
// test
//
// Created by Kevin Meaney on 17/10/2014.
// Copyright (c) 2014 Kevin Meaney. All rights reserved.
//
#import <Foundation/Foundation.h>