Index: webrtc/api/objc/RTCI420Frame.mm |
diff --git a/webrtc/api/objc/RTCI420Frame.mm b/webrtc/api/objc/RTCI420Frame.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..55295906a6fe26f5910ff6747056d5bd4ed0dde4 |
--- /dev/null |
+++ b/webrtc/api/objc/RTCI420Frame.mm |
@@ -0,0 +1,83 @@ |
+/* |
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#import "RTCI420Frame.h" |
+ |
+#include "webrtc/base/scoped_ptr.h" |
+ |
+#import "webrtc/api/objc/RTCI420Frame+Private.h" |
+ |
+@implementation RTCI420Frame { |
+ rtc::scoped_ptr<cricket::VideoFrame> _videoFrame; |
+} |
+ |
+- (NSUInteger)width { |
+ return _videoFrame->GetWidth(); |
+} |
+ |
+- (NSUInteger)height { |
+ return _videoFrame->GetHeight(); |
+} |
+ |
+- (NSUInteger)chromaWidth { |
+ return _videoFrame->GetChromaWidth(); |
+} |
+ |
+- (NSUInteger)chromaHeight { |
+ return _videoFrame->GetChromaHeight(); |
+} |
+ |
+- (NSUInteger)chromaSize { |
+ return _videoFrame->GetChromaSize(); |
+} |
+ |
+- (const uint8_t *)yPlane { |
+ const cricket::VideoFrame *const_frame = _videoFrame.get(); |
+ return const_frame->GetYPlane(); |
+} |
+ |
+- (const uint8_t *)uPlane { |
+ const cricket::VideoFrame *const_frame = _videoFrame.get(); |
+ return const_frame->GetUPlane(); |
+} |
+ |
+- (const uint8_t *)vPlane { |
+ const cricket::VideoFrame *const_frame = _videoFrame.get(); |
+ return const_frame->GetVPlane(); |
+} |
+ |
+- (NSInteger)yPitch { |
+ return _videoFrame->GetYPitch(); |
+} |
+ |
+- (NSInteger)uPitch { |
+ return _videoFrame->GetUPitch(); |
+} |
+ |
+- (NSInteger)vPitch { |
+ return _videoFrame->GetVPitch(); |
+} |
+ |
+- (BOOL)makeExclusive { |
+ return _videoFrame->MakeExclusive(); |
+} |
+ |
+#pragma mark - Private |
+ |
+- (instancetype)initWithVideoFrame:(const cricket::VideoFrame *)videoFrame { |
tkchin_webrtc
2016/01/05 17:09:28
to keep in line with the new stuff: initWIthNative
hjon
2016/01/05 23:55:35
Done.
|
+ if (self = [super init]) { |
+ // Keep a shallow copy of the video frame. The underlying frame buffer is |
+ // not copied. |
+ _videoFrame.reset(videoFrame->Copy()); |
+ } |
+ return self; |
+} |
+ |
+@end |