-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScreenCameraController.m
More file actions
71 lines (59 loc) · 1.43 KB
/
Copy pathScreenCameraController.m
File metadata and controls
71 lines (59 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// ScreenCameraController.m
// Gawker
//
// Created by phil piwonka on 3/7/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "ScreenCameraController.h"
@implementation ScreenCameraController
- (id)initWithDelegate:(id)newDelegate
{
if (self = [super initWithDelegate:newDelegate]) {
imageSource = [[ScreenImageSource alloc] init];
[self registerForNotifications];
}
return self;
}
- (void)captureFrameAtInterval:(double)interval
{
if (recordTimer) {
[recordTimer invalidate];
[recordTimer release];
recordTimer = nil;
}
recordTimer = [[NSTimer scheduledTimerWithTimeInterval:interval
target:self
selector:@selector(recordTimerFired:)
userInfo:nil
repeats:YES] retain];
}
- (NSDate *)nextFrameTime
{
NSDate *fireDate = nil;
if (isRecording) {
fireDate = [recordTimer fireDate];
}
return fireDate;
}
- (BOOL)stopRecording
{
if (isRecording) {
//
// Release and invalidate timer.
//
[recordTimer invalidate];
[recordTimer release];
recordTimer = nil;
}
return [super stopRecording];
}
- (void)recordTimerFired:(NSTimer *)timer
{
[self recordCurrentImage];
}
- (void)setScreenToGrab:(int)screen
{
[imageSource setScreenToGrab:screen];
}
@end