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

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

Issue 900233002: Enumerate MJPEG as the prefered format if set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit. Created 5 years, 10 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 | « no previous file | media/video/capture/win/video_capture_device_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/win/sink_input_pin_win.cc
diff --git a/media/video/capture/win/sink_input_pin_win.cc b/media/video/capture/win/sink_input_pin_win.cc
index bf2a247a8381150a7117e03986277261f5773c32..8212e15fe9f04b1c4d681edd3c8f8fa0f534ccfe 100644
--- a/media/video/capture/win/sink_input_pin_win.cc
+++ b/media/video/capture/win/sink_input_pin_win.cc
@@ -45,6 +45,24 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
media_type->formattype = FORMAT_VideoInfo;
media_type->bTemporalCompression = FALSE;
+ if (requested_format_.pixel_format == PIXEL_FORMAT_MJPEG) {
+ // If the requested pixel format is MJPEG, accept only MJPEG.
+ // This is ok since the capabilities of the capturer have been
+ // enumerated and we know that it is supported.
+ if (index != 0)
+ return false;
+
+ pvi->bmiHeader.biCompression = MAKEFOURCC('M', 'J', 'P', 'G');
+ pvi->bmiHeader.biBitCount = 0;
+ pvi->bmiHeader.biWidth = requested_format_.frame_size.width();
+ pvi->bmiHeader.biHeight = requested_format_.frame_size.height();
+ pvi->bmiHeader.biSizeImage = 0;
+ media_type->subtype = MEDIASUBTYPE_MJPG;
+ media_type->bFixedSizeSamples = FALSE;
+ media_type->lSampleSize = pvi->bmiHeader.biSizeImage;
+ return true;
+ }
+
switch (index) {
case 0: {
pvi->bmiHeader.biCompression = MAKEFOURCC('I', '4', '2', '0');
@@ -66,15 +84,6 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
break;
}
case 2: {
- pvi->bmiHeader.biCompression = MAKEFOURCC('M', 'J', 'P', 'G');
- pvi->bmiHeader.biBitCount = 0;
- pvi->bmiHeader.biWidth = requested_format_.frame_size.width();
- pvi->bmiHeader.biHeight = requested_format_.frame_size.height();
- pvi->bmiHeader.biSizeImage = 0;
- media_type->subtype = MEDIASUBTYPE_MJPG;
- break;
- }
- case 3: {
pvi->bmiHeader.biCompression = BI_RGB;
pvi->bmiHeader.biBitCount = 24;
pvi->bmiHeader.biWidth = requested_format_.frame_size.width();
« no previous file with comments | « no previous file | media/video/capture/win/video_capture_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698