blob: 4cf09c0bf63b7e5d242621e3349fecac72e01b18 [file] [log] [blame]
denicija070d5e32017-02-26 11:44:13 -08001/*
2 * Copyright 2017 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
Peter Hanspersfc4a9c92018-05-23 16:30:00 +020013#import "WebRTC/RTCVideoFrame.h"
denicija070d5e32017-02-26 11:44:13 -080014#import "WebRTC/RTCVideoRenderer.h"
15
kthelgasona2fb30c2017-03-09 03:34:27 -080016// Check if metal is supported in WebRTC.
17// NOTE: Currently arm64 == Metal.
18#if defined(__aarch64__)
19#define RTC_SUPPORTS_METAL
20#endif
21
denicija070d5e32017-02-26 11:44:13 -080022NS_ASSUME_NONNULL_BEGIN
denicija070d5e32017-02-26 11:44:13 -080023
24/**
25 * RTCMTLVideoView is thin wrapper around MTKView.
26 *
27 * It has id<RTCVideoRenderer> property that renders video frames in the view's
28 * bounds using Metal.
denicijad2088152017-04-28 02:14:54 -070029 * NOTE: always check if metal is available on the running device via
30 * RTC_SUPPORTS_METAL macro before initializing this class.
denicija070d5e32017-02-26 11:44:13 -080031 */
32NS_CLASS_AVAILABLE_IOS(9)
kthelgasona2fb30c2017-03-09 03:34:27 -080033
34RTC_EXPORT
denicija070d5e32017-02-26 11:44:13 -080035@interface RTCMTLVideoView : UIView <RTCVideoRenderer>
Kári Tristan Helgason4049a252018-04-20 17:33:32 +020036
Kári Tristan Helgason06d094f2018-04-19 17:38:05 +020037@property(nonatomic, weak) id<RTCVideoViewDelegate> delegate;
Kári Tristan Helgason4049a252018-04-20 17:33:32 +020038
Peter Hanspersfc4a9c92018-05-23 16:30:00 +020039@property(nonatomic) UIViewContentMode videoContentMode;
40
41/** @abstract Enables/disables rendering.
42 */
43@property(nonatomic, getter=isEnabled) BOOL enabled;
44
45/** @abstract If YES, the backing MTKView will use a display link to issue
46 draw calls.
47 @discussion Default is YES.
48 */
49@property(nonatomic) BOOL useDisplayLink;
50
51/** @abstract Wrapped RTCVideoRotation, or nil.
52 */
53@property(nullable) NSValue* rotationOverride;
Kári Tristan Helgason4049a252018-04-20 17:33:32 +020054
denicija070d5e32017-02-26 11:44:13 -080055@end
Kári Tristan Helgason06d094f2018-04-19 17:38:05 +020056
denicija070d5e32017-02-26 11:44:13 -080057NS_ASSUME_NONNULL_END