| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/video/capture/win/sink_input_pin_win.h" | 5 #include "media/video/capture/win/sink_input_pin_win.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 // Avoid including strsafe.h via dshow as it will cause build warnings. | 9 // Avoid including strsafe.h via dshow as it will cause build warnings. |
| 10 #define NO_DSHOW_STRSAFE | 10 #define NO_DSHOW_STRSAFE |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 media_type->lSampleSize = pvi->bmiHeader.biSizeImage; | 62 media_type->lSampleSize = pvi->bmiHeader.biSizeImage; |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 switch (index) { | 66 switch (index) { |
| 67 case 0: { | 67 case 0: { |
| 68 pvi->bmiHeader.biCompression = MAKEFOURCC('I', '4', '2', '0'); | 68 pvi->bmiHeader.biCompression = MAKEFOURCC('I', '4', '2', '0'); |
| 69 pvi->bmiHeader.biBitCount = 12; // bit per pixel | 69 pvi->bmiHeader.biBitCount = 12; // bit per pixel |
| 70 pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); | 70 pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); |
| 71 pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); | 71 pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); |
| 72 pvi->bmiHeader.biSizeImage = requested_format_.ImageAllocationSize(); | 72 pvi->bmiHeader.biSizeImage = |
| 73 requested_format_.frame_size.GetArea() * 3 / 2; |
| 73 media_type->subtype = kMediaSubTypeI420; | 74 media_type->subtype = kMediaSubTypeI420; |
| 74 break; | 75 break; |
| 75 } | 76 } |
| 76 case 1: { | 77 case 1: { |
| 77 pvi->bmiHeader.biCompression = MAKEFOURCC('Y', 'U', 'Y', '2'); | 78 pvi->bmiHeader.biCompression = MAKEFOURCC('Y', 'U', 'Y', '2'); |
| 78 pvi->bmiHeader.biBitCount = 16; | 79 pvi->bmiHeader.biBitCount = 16; |
| 79 pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); | 80 pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); |
| 80 pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); | 81 pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); |
| 81 pvi->bmiHeader.biSizeImage = requested_format_.ImageAllocationSize(); | 82 pvi->bmiHeader.biSizeImage = requested_format_.frame_size.GetArea() * 2; |
| 82 media_type->subtype = MEDIASUBTYPE_YUY2; | 83 media_type->subtype = MEDIASUBTYPE_YUY2; |
| 83 break; | 84 break; |
| 84 } | 85 } |
| 85 case 2: { | 86 case 2: { |
| 86 pvi->bmiHeader.biCompression = BI_RGB; | 87 pvi->bmiHeader.biCompression = BI_RGB; |
| 87 pvi->bmiHeader.biBitCount = 24; | 88 pvi->bmiHeader.biBitCount = 24; |
| 88 pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); | 89 pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); |
| 89 pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); | 90 pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); |
| 90 pvi->bmiHeader.biSizeImage = requested_format_.ImageAllocationSize(); | 91 pvi->bmiHeader.biSizeImage = requested_format_.frame_size.GetArea() * 3; |
| 91 media_type->subtype = MEDIASUBTYPE_RGB24; | 92 media_type->subtype = MEDIASUBTYPE_RGB24; |
| 92 break; | 93 break; |
| 93 } | 94 } |
| 94 default: | 95 default: |
| 95 return false; | 96 return false; |
| 96 } | 97 } |
| 97 | 98 |
| 98 media_type->bFixedSizeSamples = TRUE; | 99 media_type->bFixedSizeSamples = TRUE; |
| 99 media_type->lSampleSize = pvi->bmiHeader.biSizeImage; | 100 media_type->lSampleSize = pvi->bmiHeader.biSizeImage; |
| 100 return true; | 101 return true; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 resulting_format_.frame_size.SetSize(0, 0); | 164 resulting_format_.frame_size.SetSize(0, 0); |
| 164 resulting_format_.frame_rate = 0; | 165 resulting_format_.frame_rate = 0; |
| 165 resulting_format_.pixel_format = PIXEL_FORMAT_UNKNOWN; | 166 resulting_format_.pixel_format = PIXEL_FORMAT_UNKNOWN; |
| 166 } | 167 } |
| 167 | 168 |
| 168 const VideoCaptureFormat& SinkInputPin::ResultingFormat() { | 169 const VideoCaptureFormat& SinkInputPin::ResultingFormat() { |
| 169 return resulting_format_; | 170 return resulting_format_; |
| 170 } | 171 } |
| 171 | 172 |
| 172 } // namespace media | 173 } // namespace media |
| OLD | NEW |