Skip to content

Instantly share code, notes, and snippets.

View b9AobJ's full-sized avatar
🙊
crazy on the writting bugs

a'lin b9AobJ

🙊
crazy on the writting bugs
View GitHub Profile
@stuffmc
stuffmc / composition.m
Created January 6, 2012 21:59
AVComposition & AVVideoComposition
// For whatever reason (I guess because my code is wrong) the "composition" returns twice the same asset (one transformed, one not),
// although it should display 2 different videos... If anybody has a clue :(
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], AVURLAssetPreferPreciseDurationAndTimingKey, nil];
AVMutableComposition *composition = [AVMutableComposition composition];
CMTimeRange timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(4, 1));
AVMutableVideoComposition *videoComposition = [AVMutableVideoComposition videoComposition];
// Track B
@yamaya
yamaya / xcode-clang-vers
Last active November 10, 2024 04:44
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@tkemp
tkemp / PrintASBD.m
Created December 6, 2012 17:08
Print an AudioStreamBasicDescription for a given AUGraph node
-(void) printASBDforNode:(AUNode) node scope:(int) scope bus:(int) bus {
AudioStreamBasicDescription testASBD;
UInt32 asbdSize = sizeof (AudioStreamBasicDescription);
AudioUnit nodeUnit;
AUGraphNodeInfo(_graph, node, NULL, &nodeUnit);
AudioUnitGetProperty(nodeUnit,
kAudioUnitProperty_StreamFormat,
scope,
bus, // bus
@tkemp
tkemp / AvailableASBDs.c
Created December 9, 2012 18:12
Get details on available AudioStreamBasicDescriptions for various file formats
void AUM_printAvailableStreamFormatsForId(AudioFileTypeID fileTypeID, UInt32 mFormatID)
{
AudioFileTypeAndFormatID fileTypeAndFormat;
fileTypeAndFormat.mFileType = fileTypeID;
fileTypeAndFormat.mFormatID = mFormatID;
UInt32 fileTypeIDChar = CFSwapInt32HostToBig(fileTypeID);
UInt32 mFormatChar = CFSwapInt32HostToBig(mFormatID);
OSStatus audioErr = noErr;
UInt32 infoSize = 0;
@tkemp
tkemp / SetStreamFormat.c
Created December 11, 2012 20:51
Set AudioFilePlayer AU stream format
// Get the ASBD from the player unit
UInt32 playerASBDsz;
checkError(AudioUnitGetProperty(_playerUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
BUS_PLAYER_OUTPUT,
&_playerASBD,
&playerASBDsz),
"AudioUnitSetProperty failed: getting stream format from the player unit", false);
@tkemp
tkemp / iOSASBD.c
Created December 11, 2012 20:53
ASBD for iOS native/canonical
AudioStreamBasicDescription _outputASBD;
memset(&_outputASBD, 0, sizeof(_outputASBD));
_outputASBD.mSampleRate = 44100.0;
_outputASBD.mFormatID = kAudioFormatLinearPCM;
_outputASBD.mFormatFlags = kAudioFormatFlagsCanonical; // Equivalent to kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked
_outputASBD.mBytesPerPacket = 2 * 2;
_outputASBD.mBytesPerFrame = 2 * 2;
_outputASBD.mFramesPerPacket = 1;
_outputASBD.mChannelsPerFrame = 2;
_outputASBD.mBitsPerChannel = 16;
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@heroicyang
heroicyang / ios_resources.json
Created October 9, 2013 02:33
GitHub 上的 iOS 开源项目
var githubList = [
{
name:'系统基础库',
list: [
{name:'Category/Util',
list: [
{name:'sstoolkit', owner:'soffes', desc:'一套Category类型的库,附带很多自定义控件 功能不错~'},
{name:'BlocksKit', owner:'pandamonia', desc:'将Block风格带入UIKit和Founcation'},
{name:'cocoa-helpers', owner:'enormego', desc:'一些Cocoa的扩展 2年前的工程'},
@dulacp
dulacp / libpng.sh
Last active December 7, 2019 07:54
Download & Compile Libpng for iOS (all architectures)
# Builds a Libpng framework for the iPhone and the iPhone Simulator.
# Creates a set of universal libraries that can be used on an iPhone and in the
# iPhone simulator. Then creates a pseudo-framework to make using libpng in Xcode
# less painful.
#
# To configure the script, define:
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1)
#
# Then go get the source tar.bz of the libpng you want to build, shove it in the
# same directory as this script, and run "./libpng.sh". Grab a cuppa. And voila.
@ka010
ka010 / gist:235253db3fccfac53910
Last active March 5, 2020 04:39
Convert an AVFrame to CVPixelbuffer
-(void)getPixelBuffer:(CVPixelBufferRef *)pbuf {
@synchronized (self) {
if(!_pFrame || !_pFrame->data[0])
return;
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
// [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
// [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
@(_pFrame->linesize[0]), kCVPixelBufferBytesPerRowAlignmentKey,