| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #import <AVFoundation/AVFoundation.h> | 11 #import <AVFoundation/AVFoundation.h> |
| 12 #import <Foundation/Foundation.h> | 12 #import <Foundation/Foundation.h> |
| 13 | 13 |
| 14 #import <WebRTC/RTCMacros.h> | 14 #import <WebRTC/RTCMacros.h> |
| 15 | 15 |
| 16 NS_ASSUME_NONNULL_BEGIN | 16 NS_ASSUME_NONNULL_BEGIN |
| 17 | 17 |
| 18 typedef NS_ENUM(NSInteger, RTCVideoRotation) { |
| 19 RTCVideoRotation_0 = 0, |
| 20 RTCVideoRotation_90 = 90, |
| 21 RTCVideoRotation_180 = 180, |
| 22 RTCVideoRotation_270 = 270, |
| 23 }; |
| 24 |
| 18 // RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame. | 25 // RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame. |
| 19 RTC_EXPORT | 26 RTC_EXPORT |
| 20 @interface RTCVideoFrame : NSObject | 27 @interface RTCVideoFrame : NSObject |
| 21 | 28 |
| 22 /** Width without rotation applied. */ | 29 /** Width without rotation applied. */ |
| 23 @property(nonatomic, readonly) size_t width; | 30 @property(nonatomic, readonly) int width; |
| 24 | 31 |
| 25 /** Height without rotation applied. */ | 32 /** Height without rotation applied. */ |
| 26 @property(nonatomic, readonly) size_t height; | 33 @property(nonatomic, readonly) int height; |
| 27 @property(nonatomic, readonly) int rotation; | 34 @property(nonatomic, readonly) RTCVideoRotation rotation; |
| 28 @property(nonatomic, readonly) size_t chromaWidth; | 35 /** Accessing YUV data should only be done for I420 frames, i.e. if nativeHandle |
| 29 @property(nonatomic, readonly) size_t chromaHeight; | 36 * is null. It is always possible to get such a frame by calling |
| 30 // These can return NULL if the object is not backed by a buffer. | 37 * newI420VideoFrame. |
| 31 @property(nonatomic, readonly, nullable) const uint8_t *yPlane; | 38 */ |
| 32 @property(nonatomic, readonly, nullable) const uint8_t *uPlane; | 39 @property(nonatomic, readonly, nullable) const uint8_t *dataY; |
| 33 @property(nonatomic, readonly, nullable) const uint8_t *vPlane; | 40 @property(nonatomic, readonly, nullable) const uint8_t *dataU; |
| 34 @property(nonatomic, readonly) int32_t yPitch; | 41 @property(nonatomic, readonly, nullable) const uint8_t *dataV; |
| 35 @property(nonatomic, readonly) int32_t uPitch; | 42 @property(nonatomic, readonly) int strideY; |
| 36 @property(nonatomic, readonly) int32_t vPitch; | 43 @property(nonatomic, readonly) int strideU; |
| 44 @property(nonatomic, readonly) int strideV; |
| 37 | 45 |
| 38 /** Timestamp in nanoseconds. */ | 46 /** Timestamp in nanoseconds. */ |
| 39 @property(nonatomic, readonly) int64_t timeStampNs; | 47 @property(nonatomic, readonly) int64_t timeStampNs; |
| 40 | 48 |
| 41 /** The native handle should be a pixel buffer on iOS. */ | 49 /** The native handle should be a pixel buffer on iOS. */ |
| 42 @property(nonatomic, readonly) CVPixelBufferRef nativeHandle; | 50 @property(nonatomic, readonly) CVPixelBufferRef nativeHandle; |
| 43 | 51 |
| 44 - (instancetype)init NS_UNAVAILABLE; | 52 - (instancetype)init NS_UNAVAILABLE; |
| 45 | 53 |
| 46 /** If the frame is backed by a CVPixelBuffer, creates a backing i420 frame. | 54 /** Return a frame that is guaranteed to be I420, i.e. it is possible to access |
| 47 * Calling the yuv plane properties will call this method if needed. | 55 * the YUV data on it. |
| 48 */ | 56 */ |
| 49 - (void)convertBufferIfNeeded; | 57 - (RTCVideoFrame *)newI420VideoFrame; |
| 50 | 58 |
| 51 @end | 59 @end |
| 52 | 60 |
| 53 NS_ASSUME_NONNULL_END | 61 NS_ASSUME_NONNULL_END |
| OLD | NEW |