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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm

Issue 2890733003: Reland of Split iOS sdk in to separate targets (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import "RTCVideoFrame+Private.h"
12
13 #include "webrtc/sdk/objc/Framework/Classes/corevideo_frame_buffer.h"
14
15 @implementation RTCVideoFrame {
16 rtc::scoped_refptr<webrtc::VideoFrameBuffer> _videoBuffer;
17 RTCVideoRotation _rotation;
18 int64_t _timeStampNs;
19 }
20
21 - (int)width {
22 return _videoBuffer->width();
23 }
24
25 - (int)height {
26 return _videoBuffer->height();
27 }
28
29 - (RTCVideoRotation)rotation {
30 return _rotation;
31 }
32
33 - (const uint8_t *)dataY {
34 return _videoBuffer->DataY();
35 }
36
37 - (const uint8_t *)dataU {
38 return _videoBuffer->DataU();
39 }
40
41 - (const uint8_t *)dataV {
42 return _videoBuffer->DataV();
43 }
44
45 - (int)strideY {
46 return _videoBuffer->StrideY();
47 }
48
49 - (int)strideU {
50 return _videoBuffer->StrideU();
51 }
52
53 - (int)strideV {
54 return _videoBuffer->StrideV();
55 }
56
57 - (int64_t)timeStampNs {
58 return _timeStampNs;
59 }
60
61 - (CVPixelBufferRef)nativeHandle {
62 return static_cast<CVPixelBufferRef>(_videoBuffer->native_handle());
63 }
64
65 - (RTCVideoFrame *)newI420VideoFrame {
66 return [[RTCVideoFrame alloc]
67 initWithVideoBuffer:_videoBuffer->NativeToI420Buffer()
68 rotation:_rotation
69 timeStampNs:_timeStampNs];
70 }
71
72 - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
73 rotation:(RTCVideoRotation)rotation
74 timeStampNs:(int64_t)timeStampNs {
75 rtc::scoped_refptr<webrtc::VideoFrameBuffer> videoBuffer(
76 new rtc::RefCountedObject<webrtc::CoreVideoFrameBuffer>(pixelBuffer));
77 return [self initWithVideoBuffer:videoBuffer
78 rotation:rotation
79 timeStampNs:timeStampNs];
80 }
81
82 - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
83 scaledWidth:(int)scaledWidth
84 scaledHeight:(int)scaledHeight
85 cropWidth:(int)cropWidth
86 cropHeight:(int)cropHeight
87 cropX:(int)cropX
88 cropY:(int)cropY
89 rotation:(RTCVideoRotation)rotation
90 timeStampNs:(int64_t)timeStampNs {
91 rtc::scoped_refptr<webrtc::VideoFrameBuffer> videoBuffer(
92 new rtc::RefCountedObject<webrtc::CoreVideoFrameBuffer>(
93 pixelBuffer,
94 scaledWidth, scaledHeight,
95 cropWidth, cropHeight,
96 cropX, cropY));
97 return [self initWithVideoBuffer:videoBuffer
98 rotation:rotation
99 timeStampNs:timeStampNs];
100 }
101
102 #pragma mark - Private
103
104 - (instancetype)initWithVideoBuffer:
105 (rtc::scoped_refptr<webrtc::VideoFrameBuffer>)videoBuffer
106 rotation:(RTCVideoRotation)rotation
107 timeStampNs:(int64_t)timeStampNs {
108 if (self = [super init]) {
109 _videoBuffer = videoBuffer;
110 _rotation = rotation;
111 _timeStampNs = timeStampNs;
112 }
113 return self;
114 }
115
116 - (rtc::scoped_refptr<webrtc::VideoFrameBuffer>)videoBuffer {
117 return _videoBuffer;
118 }
119
120 @end
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCVideoCapturer.m ('k') | webrtc/sdk/objc/Framework/Classes/RTCVideoFrame+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698