Skip to content

Commit

Permalink
QuartzCore work
Browse files Browse the repository at this point in the history
  • Loading branch information
cjwl committed Oct 22, 2010
1 parent 1ef168d commit bab2e55
Show file tree
Hide file tree
Showing 33 changed files with 1,052 additions and 14 deletions.
32 changes: 32 additions & 0 deletions CoreVideo/CVBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#import <CoreFoundation/CoreFoundation.h>

#define COREVIDEO_EXPORT extern

typedef uint64_t CVOptionFlags;

struct CVSMPTETime {
SInt16 subframes;
SInt16 subframeDivisor;
UInt32 counter;
UInt32 type;
UInt32 flags;
SInt16 hours;
SInt16 minutes;
SInt16 seconds;
SInt16 frames;
};

typedef struct CVSMPTETime CVSMPTETime;

typedef struct {
uint32_t version;
int32_t videoTimeScale;
int64_t videoTime;
uint64_t hostTime;
double rateScalar;
int64_t videoRefreshPeriod;
CVSMPTETime smpteTime;
uint64_t flags;
uint64_t reserved;
} CVTimeStamp;

16 changes: 16 additions & 0 deletions CoreVideo/CVDisplayLink.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#import <Foundation/Foundation.h>
#import <CoreVideo/CVBase.h>
#import <CoreVideo/CVReturn.h>
#import <OpenGL/OpenGL.h>

@class CVDisplayLink;

typedef CVDisplayLink *CVDisplayLinkRef;

typedef CVReturn (*CVDisplayLinkOutputCallback)(CVDisplayLinkRef,const CVTimeStamp *,const CVTimeStamp *,CVOptionFlags,CVOptionFlags *,void *);

COREVIDEO_EXPORT CVReturn CVDisplayLinkCreateWithActiveCGDisplays(CVDisplayLinkRef *result);
COREVIDEO_EXPORT CVReturn CVDisplayLinkSetOutputCallback(CVDisplayLinkRef self,CVDisplayLinkOutputCallback callback,void *userInfo);
COREVIDEO_EXPORT CVReturn CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(CVDisplayLinkRef self,CGLContextObj cglContext,CGLPixelFormatObj cglPixelFormat);
COREVIDEO_EXPORT CVReturn CVDisplayLinkStart(CVDisplayLinkRef self);
COREVIDEO_EXPORT void CVDisplayLinkRelease(CVDisplayLinkRef self);
57 changes: 57 additions & 0 deletions CoreVideo/CVDisplayLink.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#import <CoreVideo/CVDisplayLink.h>
#import <Foundation/NSRaise.h>

@interface CVDisplayLink : NSObject {
NSTimer *_timer;
CVDisplayLinkOutputCallback _callback;
void *_userInfo;
}

@end

@implementation CVDisplayLink

-init {
return self;
}

-(void)dealloc {
[_timer invalidate];
[_timer release];
[super dealloc];
}

-(void)timer:(NSTimer *)timer {
if(_callback!=NULL)
_callback(self,NULL,NULL,0,NULL,_userInfo);
}

-(void)start {
_timer=[[NSTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self selector:@selector(timer:) userInfo:nil repeats:YES] retain];
}

CVReturn CVDisplayLinkCreateWithActiveCGDisplays(CVDisplayLinkRef *result) {
*result=[[CVDisplayLink alloc] init];
return 0;
}

CVReturn CVDisplayLinkSetOutputCallback(CVDisplayLinkRef self,CVDisplayLinkOutputCallback callback,void *userInfo) {
self->_callback=callback;
self->_userInfo=userInfo;
return 0;
}

CVReturn CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(CVDisplayLinkRef self,CGLContextObj cglContext,CGLPixelFormatObj cglPixelFormat) {
return 0;
}

CVReturn CVDisplayLinkStart(CVDisplayLinkRef self) {
[self start];
return 0;
}

void CVDisplayLinkRelease(CVDisplayLinkRef self) {
[self release];
}

@end
7 changes: 7 additions & 0 deletions CoreVideo/CVReturn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#import <CoreVideo/CVBase.h>

enum {
kCVReturnSuccess = 0,
};

typedef int32_t CVReturn;
1 change: 1 addition & 0 deletions CoreVideo/CoreVideo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import <CoreVideo/CVDisplayLink.h>
263 changes: 263 additions & 0 deletions CoreVideo/CoreVideo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {

/* Begin PBXBuildFile section */
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
FE43015C11E2531F00EBDD56 /* CVDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = FE43015A11E2531F00EBDD56 /* CVDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE43015D11E2531F00EBDD56 /* CVDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = FE43015B11E2531F00EBDD56 /* CVDisplayLink.m */; };
FE43016711E2534D00EBDD56 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; };
FE43017C11E253E900EBDD56 /* CoreVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FE43017B11E253E900EBDD56 /* CoreVideo.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE43045911E2769E00EBDD56 /* CVBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FE43045811E2769E00EBDD56 /* CVBase.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE43045B11E2779700EBDD56 /* CVReturn.h in Headers */ = {isa = PBXBuildFile; fileRef = FE43045A11E2779700EBDD56 /* CVReturn.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

/* Begin PBXBuildRule section */
FE43016A11E2536B00EBDD56 /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = org.cocotron.1.0.windows.i386.gcc.default;
fileType = sourcecode.c;
isEditable = 1;
outputFiles = (
);
};
/* End PBXBuildRule section */

/* Begin PBXFileReference section */
0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* CoreVideo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreVideo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FE43015A11E2531F00EBDD56 /* CVDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVDisplayLink.h; sourceTree = "<group>"; };
FE43015B11E2531F00EBDD56 /* CVDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CVDisplayLink.m; sourceTree = "<group>"; };
FE43017B11E253E900EBDD56 /* CoreVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreVideo.h; sourceTree = "<group>"; };
FE43045811E2769E00EBDD56 /* CVBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVBase.h; sourceTree = "<group>"; };
FE43045A11E2779700EBDD56 /* CVReturn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVReturn.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
8DC2EF560486A6940098B216 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FE43016711E2534D00EBDD56 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
034768DFFF38A50411DB9C8B /* Products */ = {
isa = PBXGroup;
children = (
8DC2EF5B0486A6940098B216 /* CoreVideo.framework */,
);
name = Products;
sourceTree = "<group>";
};
0867D691FE84028FC02AAC07 /* CoreVideo */ = {
isa = PBXGroup;
children = (
FE43045A11E2779700EBDD56 /* CVReturn.h */,
FE43045811E2769E00EBDD56 /* CVBase.h */,
FE43017B11E253E900EBDD56 /* CoreVideo.h */,
32C88DFF0371C24200C91783 /* Other Sources */,
089C1665FE841158C02AAC07 /* Resources */,
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
034768DFFF38A50411DB9C8B /* Products */,
FE43015A11E2531F00EBDD56 /* CVDisplayLink.h */,
FE43015B11E2531F00EBDD56 /* CVDisplayLink.m */,
);
name = CoreVideo;
sourceTree = "<group>";
};
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */,
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8DC2EF5A0486A6940098B216 /* Info.plist */,
089C1666FE841158C02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
0867D69BFE84028FC02AAC07 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
32C88DFF0371C24200C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
);
name = "Other Sources";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
8DC2EF500486A6940098B216 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
FE43015C11E2531F00EBDD56 /* CVDisplayLink.h in Headers */,
FE43017C11E253E900EBDD56 /* CoreVideo.h in Headers */,
FE43045911E2769E00EBDD56 /* CVBase.h in Headers */,
FE43045B11E2779700EBDD56 /* CVReturn.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
8DC2EF4F0486A6940098B216 /* CoreVideo-Windows-i386 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "CoreVideo-Windows-i386" */;
buildPhases = (
8DC2EF500486A6940098B216 /* Headers */,
8DC2EF520486A6940098B216 /* Resources */,
8DC2EF540486A6940098B216 /* Sources */,
8DC2EF560486A6940098B216 /* Frameworks */,
);
buildRules = (
FE43016A11E2536B00EBDD56 /* PBXBuildRule */,
);
dependencies = (
);
name = "CoreVideo-Windows-i386";
productInstallPath = "$(HOME)/Library/Frameworks";
productName = CoreVideo;
productReference = 8DC2EF5B0486A6940098B216 /* CoreVideo.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CoreVideo" */;
compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* CoreVideo */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
8DC2EF4F0486A6940098B216 /* CoreVideo-Windows-i386 */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
8DC2EF520486A6940098B216 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
8DC2EF540486A6940098B216 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FE43015D11E2531F00EBDD56 /* CVDisplayLink.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
089C1666FE841158C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C1667FE841158C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
1DEB91AF08733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = i386;
DEPLOYMENT_LOCATION = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DSTROOT = /;
EXECUTABLE_SUFFIX = .1.0.dll;
FRAMEWORK_SEARCH_PATHS = /Developer/Cocotron/1.0/Windows/i386/Frameworks;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist;
INSTALL_MODE_FLAG = "og-w,a+rX";
INSTALL_PATH = /Developer/Cocotron/1.0/Windows/i386/Frameworks;
OTHER_LDFLAGS = (
"-shared",
"-Wl,--enable-auto-import",
"-Wl,--export-all-symbols",
"-Wl,--out-implib,$TARGET_BUILD_DIR/$(PRODUCT_NAME).framework/lib$(PRODUCT_NAME).a",
);
PREBINDING = NO;
PRODUCT_NAME = CoreVideo;
STRIP_INSTALLED_PRODUCT = YES;
SYMROOT = build/Windows/i386;
};
name = Release;
};
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "CoreVideo-Windows-i386" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91AF08733DA50010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CoreVideo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91B308733DA50010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
}
2 changes: 2 additions & 0 deletions CoreVideo/English.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

Loading

0 comments on commit bab2e55

Please sign in to comment.