RTCMTLRenderer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #import <Foundation/Foundation.h>
  11. #if TARGET_OS_IPHONE
  12. #import <UIKit/UIKit.h>
  13. #else
  14. #import <AppKit/AppKit.h>
  15. #endif
  16. #import "base/RTCVideoFrame.h"
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * Protocol defining ability to render RTCVideoFrame in Metal enabled views.
  20. */
  21. @protocol RTCMTLRenderer <NSObject>
  22. /**
  23. * Method to be implemented to perform actual rendering of the provided frame.
  24. *
  25. * @param frame The frame to be rendered.
  26. */
  27. - (void)drawFrame:(RTC_OBJC_TYPE(RTCVideoFrame) *)frame;
  28. /**
  29. * Sets the provided view as rendering destination if possible.
  30. *
  31. * If not possible method returns NO and callers of the method are responisble for performing
  32. * cleanups.
  33. */
  34. #if TARGET_OS_IOS
  35. - (BOOL)addRenderingDestination:(__kindof UIView *)view;
  36. #else
  37. - (BOOL)addRenderingDestination:(__kindof NSView *)view;
  38. #endif
  39. @end
  40. /**
  41. * Implementation of RTCMTLRenderer protocol.
  42. */
  43. NS_AVAILABLE(10_11, 9_0)
  44. @interface RTCMTLRenderer : NSObject <RTCMTLRenderer>
  45. /** @abstract A wrapped RTCVideoRotation, or nil.
  46. @discussion When not nil, the rotation of the actual frame is ignored when rendering.
  47. */
  48. @property(atomic, nullable) NSValue *rotationOverride;
  49. @end
  50. NS_ASSUME_NONNULL_END