OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2015 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 #import <Foundation/Foundation.h> | |
12 #if TARGET_OS_IPHONE | |
13 #import <GLKit/GLKit.h> | |
14 #else | |
15 #import <AppKit/NSOpenGL.h> | |
16 #endif | |
17 | |
18 #import "webrtc/base/objc/RTCMacros.h" | |
19 | |
20 NS_ASSUME_NONNULL_BEGIN | |
21 | |
22 @class RTCVideoFrame; | |
23 | |
24 // RTCOpenGLVideoRenderer issues appropriate OpenGL commands to draw a frame to | |
25 // the currently bound framebuffer. Supports OpenGL 3.2 and OpenGLES 2.0. OpenGL | |
26 // framebuffer creation and management should be handled elsewhere using the | |
27 // same context used to initialize this class. | |
28 RTC_EXPORT | |
29 @interface RTCOpenGLVideoRenderer : NSObject | |
30 | |
31 // The last successfully drawn frame. Used to avoid drawing frames unnecessarily | |
32 // hence saving battery life by reducing load. | |
33 @property(nonatomic, readonly) RTCVideoFrame *lastDrawnFrame; | |
34 | |
35 #if TARGET_OS_IPHONE | |
36 - (instancetype)initWithContext:(EAGLContext *)context | |
37 NS_DESIGNATED_INITIALIZER; | |
38 #else | |
39 - (instancetype)initWithContext:(NSOpenGLContext *)context | |
40 NS_DESIGNATED_INITIALIZER; | |
41 #endif | |
42 | |
43 // Draws |frame| onto the currently bound OpenGL framebuffer. |setupGL| must be | |
44 // called before this function will succeed. | |
45 - (BOOL)drawFrame:(RTCVideoFrame *)frame; | |
46 | |
47 // The following methods are used to manage OpenGL resources. On iOS | |
48 // applications should release resources when placed in background for use in | |
49 // the foreground application. In fact, attempting to call OpenGLES commands | |
50 // while in background will result in application termination. | |
51 | |
52 // Sets up the OpenGL state needed for rendering. | |
53 - (void)setupGL; | |
54 // Tears down the OpenGL state created by |setupGL|. | |
55 - (void)teardownGL; | |
56 | |
57 - (instancetype)init NS_UNAVAILABLE; | |
58 | |
59 @end | |
60 | |
61 NS_ASSUME_NONNULL_END | |
OLD | NEW |