Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: talk/app/webrtc/objc/RTCI420Frame.mm

Issue 2296613002: Delete talk directory, and references from build_ios_libs.sh. (Closed)
Patch Set: Update filenames for c -> c++ conversion. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/objc/RTCEnumConverter.mm ('k') | talk/app/webrtc/objc/RTCI420Frame+Internal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * libjingle
3 * Copyright 2013 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #import "RTCI420Frame.h"
29
30 #include <memory>
31
32 #include "webrtc/media/engine/webrtcvideoframe.h"
33
34 @implementation RTCI420Frame {
35 std::unique_ptr<cricket::VideoFrame> _videoFrame;
36 }
37
38 - (NSUInteger)width {
39 return _videoFrame->width();
40 }
41
42 - (NSUInteger)height {
43 return _videoFrame->height();
44 }
45
46 // TODO(nisse): chromaWidth and chromaHeight are used only in
47 // RTCOpenGLVideoRenderer.mm. Update, and then delete these
48 // properties.
49 - (NSUInteger)chromaWidth {
50 return (self.width + 1) / 2;
51 }
52
53 - (NSUInteger)chromaHeight {
54 return (self.height + 1) / 2;
55 }
56
57 - (const uint8_t*)yPlane {
58 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer =
59 _videoFrame->video_frame_buffer();
60 return buffer ? buffer->DataY() : nullptr;
61 }
62
63 - (const uint8_t*)uPlane {
64 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer =
65 _videoFrame->video_frame_buffer();
66 return buffer ? buffer->DataU() : nullptr;
67 }
68
69 - (const uint8_t*)vPlane {
70 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer =
71 _videoFrame->video_frame_buffer();
72 return buffer ? buffer->DataV() : nullptr;
73 }
74
75 - (NSInteger)yPitch {
76 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer =
77 _videoFrame->video_frame_buffer();
78 return buffer ? buffer->StrideY() : 0;
79 }
80
81 - (NSInteger)uPitch {
82 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer =
83 _videoFrame->video_frame_buffer();
84 return buffer ? buffer->StrideU() : 0;
85 }
86
87 - (NSInteger)vPitch {
88 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer =
89 _videoFrame->video_frame_buffer();
90 return buffer ? buffer->StrideV() : 0;
91 }
92
93 @end
94
95 @implementation RTCI420Frame (Internal)
96
97 - (instancetype)initWithVideoFrame:(cricket::VideoFrame*)videoFrame {
98 if (self = [super init]) {
99 // Keep a shallow copy of the video frame. The underlying frame buffer is
100 // not copied.
101 _videoFrame.reset(new cricket::WebRtcVideoFrame(
102 videoFrame->video_frame_buffer(),
103 videoFrame->rotation(),
104 videoFrame->timestamp_us()));
105 }
106 return self;
107 }
108
109 @end
OLDNEW
« no previous file with comments | « talk/app/webrtc/objc/RTCEnumConverter.mm ('k') | talk/app/webrtc/objc/RTCI420Frame+Internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698