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

Unified Diff: media/capture/video/win/sink_input_pin_win.cc

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WebGL video to texture support and readPixels from R16UI for CPU access Created 4 years, 4 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/capture/video/win/sink_input_pin_win.cc
diff --git a/media/capture/video/win/sink_input_pin_win.cc b/media/capture/video/win/sink_input_pin_win.cc
index b29215829de817b3ecdd036c6e8faa072e7ff054..7478e7a837336748f7d5bcd865b74c323be26dcb 100644
--- a/media/capture/video/win/sink_input_pin_win.cc
+++ b/media/capture/video/win/sink_input_pin_win.cc
@@ -11,6 +11,7 @@
#include <dshow.h>
#include <stdint.h>
+#include "base/big_endian.h"
#include "base/logging.h"
#include "base/macros.h"
#include "media/base/timestamp_constants.h"
@@ -96,6 +97,21 @@ bool SinkInputPin::IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) {
return true;
}
+ if (sub_type.Data1 == pvi->bmiHeader.biCompression) {
+ // TODO(astojilj) Define GUIDs and move this to common place as the code is
+ // replicated around.
+ uint32_t fourcc;
+ base::ReadBigEndian(reinterpret_cast<const char*>(&sub_type.Data1),
+ &fourcc);
+ if (fourcc == 'Z16 ' || fourcc == 'INVZ') {
+ resulting_format_.pixel_format = PIXEL_FORMAT_Y16;
+ return true;
+ } else if (fourcc == 'Y8 ') {
+ resulting_format_.pixel_format = PIXEL_FORMAT_Y8;
+ return true;
+ }
+ }
+
#ifndef NDEBUG
WCHAR guid_str[128];
StringFromGUID2(sub_type, guid_str, arraysize(guid_str));
@@ -123,8 +139,11 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
media_type->formattype = FORMAT_VideoInfo;
media_type->bTemporalCompression = FALSE;
- if (requested_pixel_format_ == PIXEL_FORMAT_MJPEG) {
+ if (requested_pixel_format_ == PIXEL_FORMAT_MJPEG ||
+ requested_pixel_format_ == PIXEL_FORMAT_Y8 ||
+ requested_pixel_format_ == PIXEL_FORMAT_Y16) {
// If the requested pixel format is MJPEG, accept only MJPEG.
+ // If the requested pixel format is Y16 or Y8, accept only those.
// This is ok since the capabilities of the capturer have been
// enumerated and we know that it is supported.
if (index != 0)

Powered by Google App Engine
This is Rietveld 408576698