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

Unified Diff: content/common/gpu/media/v4l2_video_device.cc

Issue 839523002: V4L2VDA: Generalize EGLImage import and query driver for output formats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: content/common/gpu/media/v4l2_video_device.cc
diff --git a/content/common/gpu/media/v4l2_video_device.cc b/content/common/gpu/media/v4l2_video_device.cc
index 771ea41bed934b353b7fa2626e9944a461abead7..5a05365af8a48d90d3da912a953cf3c70c6b1067 100644
--- a/content/common/gpu/media/v4l2_video_device.cc
+++ b/content/common/gpu/media/v4l2_video_device.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <libdrm/drm_fourcc.h>
#include <linux/videodev2.h>
#include "base/numerics/safe_conversions.h"
@@ -40,6 +41,9 @@ media::VideoFrame::Format V4L2Device::V4L2PixFmtToVideoFrameFormat(
case V4L2_PIX_FMT_YUV420M:
return media::VideoFrame::I420;
+ case V4L2_PIX_FMT_RGB32:
+ return media::VideoFrame::ARGB;
+
default:
LOG(FATAL) << "Add more cases as needed";
return media::VideoFrame::UNKNOWN;
@@ -78,6 +82,26 @@ uint32 V4L2Device::VideoCodecProfileToV4L2PixFmt(
}
// static
+uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) {
+ switch (format) {
+ case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV12M:
+ return DRM_FORMAT_NV12;
+
+ case V4L2_PIX_FMT_YUV420:
+ case V4L2_PIX_FMT_YUV420M:
+ return DRM_FORMAT_YUV420;
+
+ case V4L2_PIX_FMT_RGB32:
+ return DRM_FORMAT_ARGB8888;
+
+ default:
+ LOG(FATAL) << "Add more cases as needed";
+ return 0;
+ }
+}
+
+// static
gfx::Size V4L2Device::CodedSizeFromV4L2Format(struct v4l2_format format) {
gfx::Size coded_size;
gfx::Size visible_size;

Powered by Google App Engine
This is Rietveld 408576698