RTCVideoEncoder.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #import "RTCCodecSpecificInfo.h"
  12. #import "RTCEncodedImage.h"
  13. #import "RTCMacros.h"
  14. #import "RTCRtpFragmentationHeader.h"
  15. #import "RTCVideoEncoderQpThresholds.h"
  16. #import "RTCVideoEncoderSettings.h"
  17. #import "RTCVideoFrame.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. /** Callback block for encoder. */
  20. typedef BOOL (^RTCVideoEncoderCallback)(RTC_OBJC_TYPE(RTCEncodedImage) * frame,
  21. id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)> info,
  22. RTC_OBJC_TYPE(RTCRtpFragmentationHeader) * header);
  23. /** Protocol for encoder implementations. */
  24. RTC_OBJC_EXPORT
  25. @protocol RTC_OBJC_TYPE
  26. (RTCVideoEncoder)<NSObject>
  27. - (void)setCallback : (RTCVideoEncoderCallback)callback;
  28. - (NSInteger)startEncodeWithSettings:(RTC_OBJC_TYPE(RTCVideoEncoderSettings) *)settings
  29. numberOfCores:(int)numberOfCores;
  30. - (NSInteger)releaseEncoder;
  31. - (NSInteger)encode:(RTC_OBJC_TYPE(RTCVideoFrame) *)frame
  32. codecSpecificInfo:(nullable id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)>)info
  33. frameTypes:(NSArray<NSNumber *> *)frameTypes;
  34. - (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate;
  35. - (NSString *)implementationName;
  36. /** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to
  37. * keep the QP from the encoded images within the given range. Returning nil from this function
  38. * disables quality scaling. */
  39. - (nullable RTC_OBJC_TYPE(RTCVideoEncoderQpThresholds) *)scalingSettings;
  40. @end
  41. NS_ASSUME_NONNULL_END