OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include "testAPI.h" | |
12 | |
13 #include <iostream> | |
14 | |
15 #import <Foundation/Foundation.h> | |
16 #import <Cocoa/Cocoa.h> | |
17 #import <AppKit/AppKit.h> | |
18 #import <QTKit/QTKit.h> | |
19 #include <sys/time.h> | |
20 | |
21 #import "webrtc/modules/video_render/mac/cocoa_render_view.h" | |
22 #include "webrtc/common_types.h" | |
23 #include "webrtc/modules/include/module_common_types.h" | |
24 #include "webrtc/modules/utility/include/process_thread.h" | |
25 #include "webrtc/modules/video_render/video_render.h" | |
26 #include "webrtc/modules/video_render/video_render_defines.h" | |
27 #include "webrtc/system_wrappers/include/tick_util.h" | |
28 #include "webrtc/system_wrappers/include/trace.h" | |
29 | |
30 using namespace webrtc; | |
31 | |
32 int WebRtcCreateWindow(CocoaRenderView*& cocoaRenderer, int winNum, int width, i
nt height) | |
33 { | |
34 // In Cocoa, rendering is not done directly to a window like in Windows and
Linux. | |
35 // It is rendererd to a Subclass of NSOpenGLView | |
36 | |
37 // create cocoa container window | |
38 NSRect outWindowFrame = NSMakeRect(200, 800, width + 20, height + 20); | |
39 NSWindow* outWindow = [[NSWindow alloc] initWithContentRect:outWindowFrame | |
40 styleMask:NSTitledWindowMa
sk | |
41 backing:NSBackingStoreBu
ffered | |
42 defer:NO]; | |
43 [outWindow orderOut:nil]; | |
44 [outWindow setTitle:@"Cocoa Renderer"]; | |
45 [outWindow setBackgroundColor:[NSColor blueColor]]; | |
46 | |
47 // create renderer and attach to window | |
48 NSRect cocoaRendererFrame = NSMakeRect(10, 10, width, height); | |
49 cocoaRenderer = [[CocoaRenderView alloc] initWithFrame:cocoaRendererFrame]; | |
50 [[outWindow contentView] addSubview:(NSView*)cocoaRenderer]; | |
51 | |
52 [outWindow makeKeyAndOrderFront:NSApp]; | |
53 | |
54 return 0; | |
55 } | |
56 | |
57 int main (int argc, const char * argv[]) { | |
58 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
59 [NSApplication sharedApplication]; | |
60 | |
61 CocoaRenderView* testWindow; | |
62 WebRtcCreateWindow(testWindow, 0, 352, 288); | |
63 VideoRenderType windowType = kRenderCocoa; | |
64 void* window = (void*)testWindow; | |
65 | |
66 RunVideoRenderTests(window, windowType); | |
67 | |
68 [pool release]; | |
69 } | |
OLD | NEW |