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 rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = | 58 const cricket::VideoFrame* const_frame = _videoFrame.get(); |
59 _videoFrame->video_frame_buffer(); | 59 return const_frame->GetYPlane(); |
60 return buffer ? buffer->DataY() : nullptr; | |
61 } | 60 } |
62 | 61 |
63 - (const uint8_t*)uPlane { | 62 - (const uint8_t*)uPlane { |
64 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = | 63 const cricket::VideoFrame* const_frame = _videoFrame.get(); |
65 _videoFrame->video_frame_buffer(); | 64 return const_frame->GetUPlane(); |
66 return buffer ? buffer->DataU() : nullptr; | |
67 } | 65 } |
68 | 66 |
69 - (const uint8_t*)vPlane { | 67 - (const uint8_t*)vPlane { |
70 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = | 68 const cricket::VideoFrame* const_frame = _videoFrame.get(); |
71 _videoFrame->video_frame_buffer(); | 69 return const_frame->GetVPlane(); |
72 return buffer ? buffer->DataV() : nullptr; | |
73 } | 70 } |
74 | 71 |
75 - (NSInteger)yPitch { | 72 - (NSInteger)yPitch { |
76 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = | 73 return _videoFrame->GetYPitch(); |
77 _videoFrame->video_frame_buffer(); | |
78 return buffer ? buffer->StrideY() : 0; | |
79 } | 74 } |
80 | 75 |
81 - (NSInteger)uPitch { | 76 - (NSInteger)uPitch { |
82 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = | 77 return _videoFrame->GetUPitch(); |
83 _videoFrame->video_frame_buffer(); | |
84 return buffer ? buffer->StrideU() : 0; | |
85 } | 78 } |
86 | 79 |
87 - (NSInteger)vPitch { | 80 - (NSInteger)vPitch { |
88 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer = | 81 return _videoFrame->GetVPitch(); |
89 _videoFrame->video_frame_buffer(); | |
90 return buffer ? buffer->StrideV() : 0; | |
91 } | 82 } |
92 | 83 |
93 @end | 84 @end |
94 | 85 |
95 @implementation RTCI420Frame (Internal) | 86 @implementation RTCI420Frame (Internal) |
96 | 87 |
97 - (instancetype)initWithVideoFrame:(cricket::VideoFrame*)videoFrame { | 88 - (instancetype)initWithVideoFrame:(cricket::VideoFrame*)videoFrame { |
98 if (self = [super init]) { | 89 if (self = [super init]) { |
99 // Keep a shallow copy of the video frame. The underlying frame buffer is | 90 // Keep a shallow copy of the video frame. The underlying frame buffer is |
100 // not copied. | 91 // not copied. |
101 _videoFrame.reset(videoFrame->Copy()); | 92 _videoFrame.reset(videoFrame->Copy()); |
102 } | 93 } |
103 return self; | 94 return self; |
104 } | 95 } |
105 | 96 |
106 @end | 97 @end |
OLD | NEW |