| 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 "RTCVideoFrame.h" | 11 #import "RTCVideoFrame.h" |
| 12 | 12 |
| 13 #include "webrtc/base/scoped_ptr.h" | 13 #include "webrtc/base/scoped_ptr.h" |
| 14 | 14 |
| 15 #import "webrtc/api/objc/RTCVideoFrame+Private.h" | 15 #import "webrtc/api/objc/RTCVideoFrame+Private.h" |
| 16 | 16 |
| 17 @implementation RTCVideoFrame { | 17 @implementation RTCVideoFrame { |
| 18 rtc::scoped_ptr<cricket::VideoFrame> _videoFrame; | 18 rtc::scoped_ptr<cricket::VideoFrame> _videoFrame; |
| 19 } | 19 } |
| 20 | 20 |
| 21 - (size_t)width { | 21 - (size_t)width { |
| 22 return _videoFrame->GetWidth(); | 22 return _videoFrame->width(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 - (size_t)height { | 25 - (size_t)height { |
| 26 return _videoFrame->GetHeight(); | 26 return _videoFrame->height(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // TODO(nisse): chromaWidth and chromaHeight are used only in |
| 30 // RTCOpenGLVideoRenderer.mm. Update, and then delete these |
| 31 // properties. |
| 29 - (size_t)chromaWidth { | 32 - (size_t)chromaWidth { |
| 30 return _videoFrame->GetChromaWidth(); | 33 return (self.width + 1) / 2; |
| 31 } | 34 } |
| 32 | 35 |
| 33 - (size_t)chromaHeight { | 36 - (size_t)chromaHeight { |
| 34 return _videoFrame->GetChromaHeight(); | 37 return (self.height + 1) / 2; |
| 35 } | |
| 36 | |
| 37 - (size_t)chromaSize { | |
| 38 return _videoFrame->GetChromaSize(); | |
| 39 } | 38 } |
| 40 | 39 |
| 41 - (const uint8_t *)yPlane { | 40 - (const uint8_t *)yPlane { |
| 42 const cricket::VideoFrame *const_frame = _videoFrame.get(); | 41 const cricket::VideoFrame *const_frame = _videoFrame.get(); |
| 43 return const_frame->GetYPlane(); | 42 return const_frame->GetYPlane(); |
| 44 } | 43 } |
| 45 | 44 |
| 46 - (const uint8_t *)uPlane { | 45 - (const uint8_t *)uPlane { |
| 47 const cricket::VideoFrame *const_frame = _videoFrame.get(); | 46 const cricket::VideoFrame *const_frame = _videoFrame.get(); |
| 48 return const_frame->GetUPlane(); | 47 return const_frame->GetUPlane(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 - (instancetype)initWithNativeFrame:(const cricket::VideoFrame *)nativeFrame { | 69 - (instancetype)initWithNativeFrame:(const cricket::VideoFrame *)nativeFrame { |
| 71 if (self = [super init]) { | 70 if (self = [super init]) { |
| 72 // Keep a shallow copy of the video frame. The underlying frame buffer is | 71 // Keep a shallow copy of the video frame. The underlying frame buffer is |
| 73 // not copied. | 72 // not copied. |
| 74 _videoFrame.reset(nativeFrame->Copy()); | 73 _videoFrame.reset(nativeFrame->Copy()); |
| 75 } | 74 } |
| 76 return self; | 75 return self; |
| 77 } | 76 } |
| 78 | 77 |
| 79 @end | 78 @end |
| OLD | NEW |