blob: b44bf7331d1f1b006927487579dfd8b1145eb122 [file] [log] [blame]
Jon Hjelle78234952016-01-11 09:47:07 -08001/*
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
tkchin7d06a8c2016-04-04 14:10:43 -070011#import <AVFoundation/AVFoundation.h>
Jon Hjelle78234952016-01-11 09:47:07 -080012#import <Foundation/Foundation.h>
13
14NS_ASSUME_NONNULL_BEGIN
15
tkchin8b9ca952016-03-31 12:08:03 -070016// RTCVideoFrame is an ObjectiveC version of cricket::VideoFrame.
Jon Hjelle78234952016-01-11 09:47:07 -080017@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 Hjelle78234952016-01-11 09:47:07 -080026// 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
tkchin7d06a8c2016-04-04 14:10:43 -070034/** 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 Hjelle32e0c012016-03-08 16:04:46 -080040- (instancetype)init NS_UNAVAILABLE;
Jon Hjelle78234952016-01-11 09:47:07 -080041
tkchin7d06a8c2016-04-04 14:10:43 -070042/** 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 Hjelle78234952016-01-11 09:47:07 -080047@end
48
49NS_ASSUME_NONNULL_END