Jon Hjelle | 7823495 | 2016-01-11 09:47:07 -0800 | [diff] [blame] | 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 | |
tkchin | 7d06a8c | 2016-04-04 14:10:43 -0700 | [diff] [blame^] | 11 | #import <AVFoundation/AVFoundation.h> |
Jon Hjelle | 7823495 | 2016-01-11 09:47:07 -0800 | [diff] [blame] | 12 | #import <Foundation/Foundation.h> |
| 13 | |
| 14 | NS_ASSUME_NONNULL_BEGIN |
| 15 | |
tkchin | 8b9ca95 | 2016-03-31 12:08:03 -0700 | [diff] [blame] | 16 | // RTCVideoFrame is an ObjectiveC version of cricket::VideoFrame. |
Jon Hjelle | 7823495 | 2016-01-11 09:47:07 -0800 | [diff] [blame] | 17 | @interface RTCVideoFrame : NSObject |
| 18 | |
| 19 | /** Width without rotation applied. */ |
| 20 | @property(nonatomic, readonly) size_t width; |
| 21 | |
| 22 | /** Height without rotation applied. */ |
| 23 | @property(nonatomic, readonly) size_t height; |
| 24 | @property(nonatomic, readonly) size_t chromaWidth; |
| 25 | @property(nonatomic, readonly) size_t chromaHeight; |
Jon Hjelle | 7823495 | 2016-01-11 09:47:07 -0800 | [diff] [blame] | 26 | // These can return NULL if the object is not backed by a buffer. |
| 27 | @property(nonatomic, readonly, nullable) const uint8_t *yPlane; |
| 28 | @property(nonatomic, readonly, nullable) const uint8_t *uPlane; |
| 29 | @property(nonatomic, readonly, nullable) const uint8_t *vPlane; |
| 30 | @property(nonatomic, readonly) int32_t yPitch; |
| 31 | @property(nonatomic, readonly) int32_t uPitch; |
| 32 | @property(nonatomic, readonly) int32_t vPitch; |
| 33 | |
tkchin | 7d06a8c | 2016-04-04 14:10:43 -0700 | [diff] [blame^] | 34 | /** Timestamp in nanoseconds. */ |
| 35 | @property(nonatomic, readonly) int64_t timeStamp; |
| 36 | |
| 37 | /** The native handle should be a pixel buffer on iOS. */ |
| 38 | @property(nonatomic, readonly) CVPixelBufferRef nativeHandle; |
| 39 | |
Jon Hjelle | 32e0c01 | 2016-03-08 16:04:46 -0800 | [diff] [blame] | 40 | - (instancetype)init NS_UNAVAILABLE; |
Jon Hjelle | 7823495 | 2016-01-11 09:47:07 -0800 | [diff] [blame] | 41 | |
tkchin | 7d06a8c | 2016-04-04 14:10:43 -0700 | [diff] [blame^] | 42 | /** If the frame is backed by a CVPixelBuffer, creates a backing i420 frame. |
| 43 | * Calling the yuv plane properties will call this method if needed. |
| 44 | */ |
| 45 | - (void)convertBufferIfNeeded; |
| 46 | |
Jon Hjelle | 7823495 | 2016-01-11 09:47:07 -0800 | [diff] [blame] | 47 | @end |
| 48 | |
| 49 | NS_ASSUME_NONNULL_END |