blob: f4a293b5c0c32a71a010519d729308c87cb81fb6 [file] [log] [blame]
denicijad2088152017-04-28 02:14:54 -07001/*
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#if TARGET_OS_IPHONE
13#import <UIKit/UIKit.h>
14#else
15#import <AppKit/AppKit.h>
16#endif
17
18#import "WebRTC/RTCVideoFrame.h"
19
20NS_ASSUME_NONNULL_BEGIN
21/**
22 * Protocol defining ability to render RTCVideoFrame in Metal enabled views.
23 */
Yves Gerey665174f2018-06-19 15:03:05 +020024@protocol RTCMTLRenderer <NSObject>
denicijad2088152017-04-28 02:14:54 -070025
26/**
27 * Method to be implemented to perform actual rendering of the provided frame.
28 *
29 * @param frame The frame to be rendered.
30 */
31- (void)drawFrame:(RTCVideoFrame *)frame;
32
33/**
34 * Sets the provided view as rendering destination if possible.
35 *
36 * If not possible method returns NO and callers of the method are responisble for performing
37 * cleanups.
38 */
39
40#if TARGET_OS_IOS
41- (BOOL)addRenderingDestination:(__kindof UIView *)view;
42#else
43- (BOOL)addRenderingDestination:(__kindof NSView *)view;
44#endif
45
46@end
47
48/**
Peter Hanspers5daaf7d2018-06-01 10:34:37 +020049 * Implementation of RTCMTLRenderer protocol.
denicijad2088152017-04-28 02:14:54 -070050 */
51NS_AVAILABLE(10_11, 9_0)
Yves Gerey665174f2018-06-19 15:03:05 +020052@interface RTCMTLRenderer : NSObject <RTCMTLRenderer>
Peter Hanspers5daaf7d2018-06-01 10:34:37 +020053
54/** @abstract A wrapped RTCVideoRotation, or nil.
55 @discussion When not nil, the rotation of the actual frame is ignored when rendering.
56 */
57@property(atomic, nullable) NSValue *rotationOverride;
58
denicijad2088152017-04-28 02:14:54 -070059@end
60
61NS_ASSUME_NONNULL_END