denicija | d208815 | 2017-04-28 02:14:54 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | NS_ASSUME_NONNULL_BEGIN |
| 21 | /** |
| 22 | * Protocol defining ability to render RTCVideoFrame in Metal enabled views. |
| 23 | */ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame^] | 24 | @protocol RTCMTLRenderer <NSObject> |
denicija | d208815 | 2017-04-28 02:14:54 -0700 | [diff] [blame] | 25 | |
| 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 Hanspers | 5daaf7d | 2018-06-01 10:34:37 +0200 | [diff] [blame] | 49 | * Implementation of RTCMTLRenderer protocol. |
denicija | d208815 | 2017-04-28 02:14:54 -0700 | [diff] [blame] | 50 | */ |
| 51 | NS_AVAILABLE(10_11, 9_0) |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame^] | 52 | @interface RTCMTLRenderer : NSObject <RTCMTLRenderer> |
Peter Hanspers | 5daaf7d | 2018-06-01 10:34:37 +0200 | [diff] [blame] | 53 | |
| 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 | |
denicija | d208815 | 2017-04-28 02:14:54 -0700 | [diff] [blame] | 59 | @end |
| 60 | |
| 61 | NS_ASSUME_NONNULL_END |