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

Unified Diff: media/base/video_frame.cc

Issue 1561703002: media/vpx: Add support for VP9 alpha channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 4a9636ffcf3bdd2c4edbc92415bb3b0416d3dddd..88e11609b5f86db2cd496abb9fdc2d264cc79979 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -375,6 +375,48 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvGpuMemoryBuffers(
return frame;
}
+// static
+scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvaData(
+ VideoPixelFormat format,
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect,
+ const gfx::Size& natural_size,
+ int32_t y_stride,
+ int32_t u_stride,
+ int32_t v_stride,
+ int32_t a_stride,
+ uint8_t* y_data,
+ uint8_t* u_data,
+ uint8_t* v_data,
+ uint8_t* a_data,
+ base::TimeDelta timestamp) {
+ const StorageType storage = STORAGE_UNOWNED_MEMORY;
+ if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
+ DLOG(ERROR) << __FUNCTION__ << " Invalid config."
DaleCurtis 2016/01/15 18:31:09 I believe there's another CL which changed these m
vignesh 2016/01/15 19:05:14 Done.
+ << ConfigToString(format, storage, coded_size, visible_rect,
+ natural_size);
+ return nullptr;
+ }
+
+ if (NumPlanes(format) != 4) {
+ DLOG(ERROR) << "Expecting Y, U, V and A planes to be present for the video"
+ << " format.";
+ return nullptr;
+ }
+
+ scoped_refptr<VideoFrame> frame(new VideoFrame(
+ format, storage, coded_size, visible_rect, natural_size, timestamp));
+ frame->strides_[kYPlane] = y_stride;
+ frame->strides_[kUPlane] = u_stride;
+ frame->strides_[kVPlane] = v_stride;
+ frame->strides_[kAPlane] = a_stride;
+ frame->data_[kYPlane] = y_data;
+ frame->data_[kUPlane] = u_data;
+ frame->data_[kVPlane] = v_data;
+ frame->data_[kAPlane] = a_data;
+ return frame;
+}
+
#if defined(OS_LINUX)
// static
scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(

Powered by Google App Engine
This is Rietveld 408576698