Allow creation of 420 Buffer using YUV data.

There currently are no Objective-C API's to create a buffer with that data.
This change allows us to create a buffer with yuv data.

Bug: webrtc:9167
Change-Id: I00f1b91b04bbaa013a88137d0f54bef44287c5aa
Reviewed-on: https://webrtc-review.googlesource.com/70563
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Zeke Chin <tkchin@webrtc.org>
Commit-Queue: Peter Slatala <psla@google.com>
Cr-Commit-Position: refs/heads/master@{#22945}
This commit is contained in:
Piotr (Peter) Slatala
2018-04-18 12:42:30 -07:00
committed by Commit Bot
parent 06d094f3e6
commit 0b71c2973f
2 changed files with 17 additions and 0 deletions

View File

@ -30,6 +30,18 @@
return self;
}
- (instancetype)initWithWidth:(int)width
height:(int)height
dataY:(const uint8_t *)dataY
dataU:(const uint8_t *)dataU
dataV:(const uint8_t *)dataV {
if (self = [super init]) {
_i420Buffer = webrtc::I420Buffer::Copy(
width, height, dataY, width, dataU, (width + 1) / 2, dataV, (width + 1) / 2);
}
return self;
}
- (instancetype)initWithWidth:(int)width
height:(int)height
strideY:(int)strideY

View File

@ -38,6 +38,11 @@ RTC_EXPORT
@property(nonatomic, readonly) int strideU;
@property(nonatomic, readonly) int strideV;
- (instancetype)initWithWidth:(int)width
height:(int)height
dataY:(const uint8_t *)dataY
dataU:(const uint8_t *)dataU
dataV:(const uint8_t *)dataV;
- (instancetype)initWithWidth:(int)width height:(int)height;
- (instancetype)initWithWidth:(int)width
height:(int)height