|
@@ -103,7 +103,7 @@
|
|
if (_queue == NULL) {
|
|
if (_queue == NULL) {
|
|
// Allocate a one-second long queue, which we can use our FPS constant for.
|
|
// Allocate a one-second long queue, which we can use our FPS constant for.
|
|
OSStatus err = CMSimpleQueueCreate(kCFAllocatorDefault,
|
|
OSStatus err = CMSimpleQueueCreate(kCFAllocatorDefault,
|
|
- self.fps, &_queue);
|
|
|
|
|
|
+ (int32_t)self.fps, &_queue);
|
|
if (err != noErr) {
|
|
if (err != noErr) {
|
|
DLog(@"Err %d in CMSimpleQueueCreate", err);
|
|
DLog(@"Err %d in CMSimpleQueueCreate", err);
|
|
}
|
|
}
|
|
@@ -131,9 +131,9 @@
|
|
if (NSEqualSizes(_testCardSize, NSZeroSize)) {
|
|
if (NSEqualSizes(_testCardSize, NSZeroSize)) {
|
|
NSUserDefaults *defaults =
|
|
NSUserDefaults *defaults =
|
|
[NSUserDefaults standardUserDefaults];
|
|
[NSUserDefaults standardUserDefaults];
|
|
- int width = [[defaults objectForKey:kTestCardWidthKey]
|
|
|
|
|
|
+ NSInteger width = [[defaults objectForKey:kTestCardWidthKey]
|
|
integerValue];
|
|
integerValue];
|
|
- int height = [[defaults objectForKey:kTestCardHeightKey]
|
|
|
|
|
|
+ NSInteger height = [[defaults objectForKey:kTestCardHeightKey]
|
|
integerValue];
|
|
integerValue];
|
|
if (width == 0 || height == 0) {
|
|
if (width == 0 || height == 0) {
|
|
_testCardSize =
|
|
_testCardSize =
|
|
@@ -183,8 +183,10 @@
|
|
|
|
|
|
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
|
|
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
|
|
initWithBitmapDataPlanes:NULL
|
|
initWithBitmapDataPlanes:NULL
|
|
- pixelsWide:self.testCardSize.width
|
|
|
|
- pixelsHigh:self.testCardSize.height
|
|
|
|
|
|
+ pixelsWide:(NSInteger)
|
|
|
|
+ self.testCardSize.width
|
|
|
|
+ pixelsHigh:(NSInteger)self.testCardSize
|
|
|
|
+ .height
|
|
bitsPerSample:8
|
|
bitsPerSample:8
|
|
samplesPerPixel:4
|
|
samplesPerPixel:4
|
|
hasAlpha:YES
|
|
hasAlpha:YES
|
|
@@ -194,18 +196,18 @@
|
|
bitsPerPixel:0];
|
|
bitsPerPixel:0];
|
|
rep.size = self.testCardSize;
|
|
rep.size = self.testCardSize;
|
|
|
|
|
|
- float hScale =
|
|
|
|
|
|
+ double hScale =
|
|
placeholderImage.size.width / self.testCardSize.width;
|
|
placeholderImage.size.width / self.testCardSize.width;
|
|
- float vScale =
|
|
|
|
|
|
+ double vScale =
|
|
placeholderImage.size.height / self.testCardSize.height;
|
|
placeholderImage.size.height / self.testCardSize.height;
|
|
|
|
|
|
- float scaling = fmax(hScale, vScale);
|
|
|
|
|
|
+ double scaling = fmax(hScale, vScale);
|
|
|
|
|
|
- float newWidth = placeholderImage.size.width / scaling;
|
|
|
|
- float newHeight = placeholderImage.size.height / scaling;
|
|
|
|
|
|
+ double newWidth = placeholderImage.size.width / scaling;
|
|
|
|
+ double newHeight = placeholderImage.size.height / scaling;
|
|
|
|
|
|
- float leftOffset = (self.testCardSize.width - newWidth) / 2;
|
|
|
|
- float topOffset = (self.testCardSize.height - newHeight) / 2;
|
|
|
|
|
|
+ double leftOffset = (self.testCardSize.width - newWidth) / 2;
|
|
|
|
+ double topOffset = (self.testCardSize.height - newHeight) / 2;
|
|
|
|
|
|
[NSGraphicsContext saveGraphicsState];
|
|
[NSGraphicsContext saveGraphicsState];
|
|
[NSGraphicsContext
|
|
[NSGraphicsContext
|
|
@@ -249,8 +251,8 @@
|
|
|
|
|
|
- (CVPixelBufferRef)createPixelBufferWithTestAnimation
|
|
- (CVPixelBufferRef)createPixelBufferWithTestAnimation
|
|
{
|
|
{
|
|
- int width = self.testCardSize.width;
|
|
|
|
- int height = self.testCardSize.height;
|
|
|
|
|
|
+ int width = (int)self.testCardSize.width;
|
|
|
|
+ int height = (int)self.testCardSize.height;
|
|
|
|
|
|
NSDictionary *options = [NSDictionary
|
|
NSDictionary *options = [NSDictionary
|
|
dictionaryWithObjectsAndKeys:
|
|
dictionaryWithObjectsAndKeys:
|
|
@@ -316,7 +318,7 @@
|
|
|
|
|
|
uint64_t hostTime = mach_absolute_time();
|
|
uint64_t hostTime = mach_absolute_time();
|
|
CMSampleTimingInfo timingInfo =
|
|
CMSampleTimingInfo timingInfo =
|
|
- CMSampleTimingInfoForTimestamp(hostTime, self.fps, 1);
|
|
|
|
|
|
+ CMSampleTimingInfoForTimestamp(hostTime, (uint32_t)self.fps, 1);
|
|
|
|
|
|
OSStatus err = CMIOStreamClockPostTimingEvent(
|
|
OSStatus err = CMIOStreamClockPostTimingEvent(
|
|
timingInfo.presentationTimeStamp, hostTime, true, self.clock);
|
|
timingInfo.presentationTimeStamp, hostTime, true, self.clock);
|
|
@@ -418,8 +420,8 @@
|
|
OSStatus err = CMVideoFormatDescriptionCreate(
|
|
OSStatus err = CMVideoFormatDescriptionCreate(
|
|
kCFAllocatorDefault,
|
|
kCFAllocatorDefault,
|
|
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,
|
|
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,
|
|
- self.testCardSize.width, self.testCardSize.height, NULL,
|
|
|
|
- &formatDescription);
|
|
|
|
|
|
+ (int32_t)self.testCardSize.width,
|
|
|
|
+ (int32_t)self.testCardSize.height, NULL, &formatDescription);
|
|
if (err != noErr) {
|
|
if (err != noErr) {
|
|
DLog(@"Error %d from CMVideoFormatDescriptionCreate", err);
|
|
DLog(@"Error %d from CMVideoFormatDescriptionCreate", err);
|
|
}
|
|
}
|