You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright 2015 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 "RTCVideoFrame.h"
  11. #import "RTCI420Buffer.h"
  12. #import "RTCVideoFrameBuffer.h"
  13. @implementation RTCVideoFrame {
  14. RTCVideoRotation _rotation;
  15. int64_t _timeStampNs;
  16. }
  17. @synthesize buffer = _buffer;
  18. @synthesize timeStamp;
  19. - (int)width {
  20. return _buffer.width;
  21. }
  22. - (int)height {
  23. return _buffer.height;
  24. }
  25. - (RTCVideoRotation)rotation {
  26. return _rotation;
  27. }
  28. - (int64_t)timeStampNs {
  29. return _timeStampNs;
  30. }
  31. - (RTCVideoFrame *)newI420VideoFrame {
  32. return [[RTCVideoFrame alloc] initWithBuffer:[_buffer toI420]
  33. rotation:_rotation
  34. timeStampNs:_timeStampNs];
  35. }
  36. - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
  37. rotation:(RTCVideoRotation)rotation
  38. timeStampNs:(int64_t)timeStampNs {
  39. // Deprecated.
  40. return nil;
  41. }
  42. - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
  43. scaledWidth:(int)scaledWidth
  44. scaledHeight:(int)scaledHeight
  45. cropWidth:(int)cropWidth
  46. cropHeight:(int)cropHeight
  47. cropX:(int)cropX
  48. cropY:(int)cropY
  49. rotation:(RTCVideoRotation)rotation
  50. timeStampNs:(int64_t)timeStampNs {
  51. // Deprecated.
  52. return nil;
  53. }
  54. - (instancetype)initWithBuffer:(id<RTCVideoFrameBuffer>)buffer
  55. rotation:(RTCVideoRotation)rotation
  56. timeStampNs:(int64_t)timeStampNs {
  57. if (self = [super init]) {
  58. _buffer = buffer;
  59. _rotation = rotation;
  60. _timeStampNs = timeStampNs;
  61. }
  62. return self;
  63. }
  64. @end