RTCVideoEncoder.h 1.8 KB

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