OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // properties. | 48 // properties. |
49 - (NSUInteger)chromaWidth { | 49 - (NSUInteger)chromaWidth { |
50 return (self.width + 1) / 2; | 50 return (self.width + 1) / 2; |
51 } | 51 } |
52 | 52 |
53 - (NSUInteger)chromaHeight { | 53 - (NSUInteger)chromaHeight { |
54 return (self.height + 1) / 2; | 54 return (self.height + 1) / 2; |
55 } | 55 } |
56 | 56 |
57 - (const uint8_t*)yPlane { | 57 - (const uint8_t*)yPlane { |
58 const cricket::VideoFrame* const_frame = _videoFrame.get(); | 58 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = |
59 return const_frame->GetYPlane(); | 59 _videoFrame->video_frame_buffer(); |
| 60 return buffer ? buffer->DataY() : nullptr; |
60 } | 61 } |
61 | 62 |
62 - (const uint8_t*)uPlane { | 63 - (const uint8_t*)uPlane { |
63 const cricket::VideoFrame* const_frame = _videoFrame.get(); | 64 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = |
64 return const_frame->GetUPlane(); | 65 _videoFrame->video_frame_buffer(); |
| 66 return buffer ? buffer->DataU() : nullptr; |
65 } | 67 } |
66 | 68 |
67 - (const uint8_t*)vPlane { | 69 - (const uint8_t*)vPlane { |
68 const cricket::VideoFrame* const_frame = _videoFrame.get(); | 70 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = |
69 return const_frame->GetVPlane(); | 71 _videoFrame->video_frame_buffer(); |
| 72 return buffer ? buffer->DataV() : nullptr; |
70 } | 73 } |
71 | 74 |
72 - (NSInteger)yPitch { | 75 - (NSInteger)yPitch { |
73 return _videoFrame->GetYPitch(); | 76 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = |
| 77 _videoFrame->video_frame_buffer(); |
| 78 return buffer ? buffer->StrideY() : 0; |
74 } | 79 } |
75 | 80 |
76 - (NSInteger)uPitch { | 81 - (NSInteger)uPitch { |
77 return _videoFrame->GetUPitch(); | 82 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = |
| 83 _videoFrame->video_frame_buffer(); |
| 84 return buffer ? buffer->StrideU() : 0; |
78 } | 85 } |
79 | 86 |
80 - (NSInteger)vPitch { | 87 - (NSInteger)vPitch { |
81 return _videoFrame->GetVPitch(); | 88 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = |
| 89 _videoFrame->video_frame_buffer(); |
| 90 return buffer ? buffer->StrideV() : 0; |
82 } | 91 } |
83 | 92 |
84 @end | 93 @end |
85 | 94 |
86 @implementation RTCI420Frame (Internal) | 95 @implementation RTCI420Frame (Internal) |
87 | 96 |
88 - (instancetype)initWithVideoFrame:(cricket::VideoFrame*)videoFrame { | 97 - (instancetype)initWithVideoFrame:(cricket::VideoFrame*)videoFrame { |
89 if (self = [super init]) { | 98 if (self = [super init]) { |
90 // Keep a shallow copy of the video frame. The underlying frame buffer is | 99 // Keep a shallow copy of the video frame. The underlying frame buffer is |
91 // not copied. | 100 // not copied. |
92 _videoFrame.reset(videoFrame->Copy()); | 101 _videoFrame.reset(videoFrame->Copy()); |
93 } | 102 } |
94 return self; | 103 return self; |
95 } | 104 } |
96 | 105 |
97 @end | 106 @end |
OLD | NEW |