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 "base/RTCVideoFrame.h" 19 20 NS_ASSUME_NONNULL_BEGIN 21 /** 22 * Protocol defining ability to render RTCVideoFrame in Metal enabled views. 23 */ 24 @protocol RTCMTLRenderer <NSObject> 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:(RTC_OBJC_TYPE(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 /** 49 * Implementation of RTCMTLRenderer protocol. 50 */ 51 NS_AVAILABLE(10_11, 9_0) 52 @interface RTCMTLRenderer : NSObject <RTCMTLRenderer> 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 59 @end 60 61 NS_ASSUME_NONNULL_END 62