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