RTCMTLVideoView.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_OSX
  12. #import <AppKit/AppKit.h>
  13. #endif
  14. #import <WebRTC/RTCMacros.h>
  15. #import <WebRTC/RTCVideoFrame.h>
  16. #import <WebRTC/RTCVideoRenderer.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * RTCMTLVideoView is thin wrapper around MTKView.
  20. *
  21. * It has id<RTCVideoRenderer> property that renders video frames in the view's
  22. * bounds using Metal.
  23. */
  24. #if TARGET_OS_IPHONE
  25. NS_CLASS_AVAILABLE_IOS(9)
  26. #elif TARGET_OS_OSX
  27. NS_AVAILABLE_MAC(10.11)
  28. #endif
  29. RTC_OBJC_EXPORT
  30. @interface RTC_OBJC_TYPE (RTCMTLVideoView) :
  31. #if TARGET_OS_IPHONE
  32. UIView<RTC_OBJC_TYPE(RTCVideoRenderer)>
  33. #elif TARGET_OS_OSX
  34. NSView<RTC_OBJC_TYPE(RTCVideoRenderer)>
  35. #endif
  36. @property(nonatomic, weak) id<RTC_OBJC_TYPE(RTCVideoViewDelegate)> delegate;
  37. #if TARGET_OS_IPHONE
  38. @property(nonatomic) UIViewContentMode videoContentMode;
  39. #endif
  40. /** @abstract Enables/disables rendering.
  41. */
  42. @property(nonatomic, getter=isEnabled) BOOL enabled;
  43. /** @abstract Wrapped RTCVideoRotation, or nil.
  44. */
  45. @property(nonatomic, nullable) NSValue* rotationOverride;
  46. + (BOOL)isMetalAvailable;
  47. @end
  48. NS_ASSUME_NONNULL_END