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

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: rebase 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
« no previous file with comments | « media/base/video_frame.h ('k') | media/filters/vpx_video_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index aad4969e61541effbf31541a825dad83ba59e32b..e0f8ba82007af76e34012633837c4ee70dc54943 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)) {
+ LOG(DFATAL) << __FUNCTION__ << " Invalid config."
+ << ConfigToString(format, storage, coded_size, visible_rect,
+ natural_size);
+ return nullptr;
+ }
+
+ if (NumPlanes(format) != 4) {
+ LOG(DFATAL) << "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(
« no previous file with comments | « media/base/video_frame.h ('k') | media/filters/vpx_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698