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

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

Issue 1325303004: Win Video Capture: add UYVY pixel format to Cr sink filter pin capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: emircan@ nit Created 5 years, 3 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/capture/video/win/sink_input_pin_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9c515a3422e722790a7cfc051d8ff9150e91bdaf..cbfaa8238c35d1c385d1ebd6b87eb9fdfd6e4d6d 100644
--- a/media/capture/video/win/sink_input_pin_win.cc
+++ b/media/capture/video/win/sink_input_pin_win.cc
@@ -36,21 +36,17 @@ void SinkInputPin::SetRequestedMediaFormat(
resulting_format_.pixel_format = PIXEL_FORMAT_UNKNOWN;
}
-const VideoCaptureFormat& SinkInputPin::ResultingFormat() {
- return resulting_format_;
-}
-
bool SinkInputPin::IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) {
- GUID type = media_type->majortype;
+ const GUID type = media_type->majortype;
if (type != MEDIATYPE_Video)
return false;
- GUID format_type = media_type->formattype;
+ const GUID format_type = media_type->formattype;
if (format_type != FORMAT_VideoInfo)
return false;
// Check for the sub types we support.
- GUID sub_type = media_type->subtype;
+ const GUID sub_type = media_type->subtype;
VIDEOINFOHEADER* pvi =
reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat);
if (pvi == NULL)
@@ -75,6 +71,12 @@ bool SinkInputPin::IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) {
resulting_format_.pixel_format = PIXEL_FORMAT_YUY2;
return true;
}
+ // This format is added after http:/crbug.com/508413.
+ if (sub_type == MEDIASUBTYPE_UYVY &&
+ pvi->bmiHeader.biCompression == MAKEFOURCC('U', 'Y', 'V', 'Y')) {
+ resulting_format_.pixel_format = PIXEL_FORMAT_UYVY;
+ return true;
+ }
if (sub_type == MEDIASUBTYPE_MJPG &&
pvi->bmiHeader.biCompression == MAKEFOURCC('M', 'J', 'P', 'G')) {
resulting_format_.pixel_format = PIXEL_FORMAT_MJPEG;
@@ -90,6 +92,12 @@ bool SinkInputPin::IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) {
resulting_format_.pixel_format = PIXEL_FORMAT_RGB32;
return true;
}
+
+#ifndef NDEBUG
+ WCHAR guid_str[128];
+ StringFromGUID2(sub_type, guid_str, arraysize(guid_str));
+ DVLOG(2) << __FUNCTION__ << " unsupported media type: " << guid_str;
+#endif
return false;
}
@@ -97,7 +105,7 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
if (media_type->cbFormat < sizeof(VIDEOINFOHEADER))
return false;
- VIDEOINFOHEADER* pvi =
+ VIDEOINFOHEADER* const pvi =
reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat);
ZeroMemory(pvi, sizeof(VIDEOINFOHEADER));
@@ -105,9 +113,8 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
pvi->bmiHeader.biPlanes = 1;
pvi->bmiHeader.biClrImportant = 0;
pvi->bmiHeader.biClrUsed = 0;
- if (requested_frame_rate_ > 0) {
+ if (requested_frame_rate_ > 0)
pvi->AvgTimePerFrame = kSecondsToReferenceTime / requested_frame_rate_;
- }
media_type->majortype = MEDIATYPE_Video;
media_type->formattype = FORMAT_VideoInfo;
@@ -144,6 +151,15 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
break;
}
case 2: {
+ pvi->bmiHeader.biCompression = MAKEFOURCC('U', 'Y', 'V', 'Y');
+ pvi->bmiHeader.biBitCount = 16;
+ pvi->bmiHeader.biWidth = requested_info_header_.biWidth;
+ pvi->bmiHeader.biHeight = requested_info_header_.biHeight;
+ pvi->bmiHeader.biSizeImage = GetArea(requested_info_header_) * 2;
+ media_type->subtype = MEDIASUBTYPE_UYVY;
+ break;
+ }
+ case 3: {
pvi->bmiHeader.biCompression = BI_RGB;
pvi->bmiHeader.biBitCount = 24;
pvi->bmiHeader.biWidth = requested_info_header_.biWidth;
@@ -152,7 +168,7 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
media_type->subtype = MEDIASUBTYPE_RGB24;
break;
}
- case 3: {
+ case 4: {
pvi->bmiHeader.biCompression = BI_RGB;
pvi->bmiHeader.biBitCount = 32;
pvi->bmiHeader.biWidth = requested_info_header_.biWidth;
« no previous file with comments | « media/capture/video/win/sink_input_pin_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698