OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Avoid including strsafe.h via dshow as it will cause build warnings. | 7 // Avoid including strsafe.h via dshow as it will cause build warnings. |
8 #define NO_DSHOW_STRSAFE | 8 #define NO_DSHOW_STRSAFE |
9 #include <dshow.h> | 9 #include <dshow.h> |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 resulting_capability_.width = pvi->bmiHeader.biWidth; | 103 resulting_capability_.width = pvi->bmiHeader.biWidth; |
104 resulting_capability_.height = abs(pvi->bmiHeader.biHeight); | 104 resulting_capability_.height = abs(pvi->bmiHeader.biHeight); |
105 if (pvi->AvgTimePerFrame > 0) { | 105 if (pvi->AvgTimePerFrame > 0) { |
106 resulting_capability_.frame_rate = | 106 resulting_capability_.frame_rate = |
107 static_cast<int>(kSecondsToReferenceTime / pvi->AvgTimePerFrame); | 107 static_cast<int>(kSecondsToReferenceTime / pvi->AvgTimePerFrame); |
108 } else { | 108 } else { |
109 resulting_capability_.frame_rate = requested_capability_.frame_rate; | 109 resulting_capability_.frame_rate = requested_capability_.frame_rate; |
110 } | 110 } |
111 if (sub_type == kMediaSubTypeI420 && | 111 if (sub_type == kMediaSubTypeI420 && |
112 pvi->bmiHeader.biCompression == MAKEFOURCC('I', '4', '2', '0')) { | 112 pvi->bmiHeader.biCompression == MAKEFOURCC('I', '4', '2', '0')) { |
113 resulting_capability_.color = VideoCaptureDevice::kI420; | 113 resulting_capability_.color = VideoCaptureCapability::kI420; |
114 return true; // This format is acceptable. | 114 return true; // This format is acceptable. |
115 } | 115 } |
116 if (sub_type == MEDIASUBTYPE_YUY2 && | 116 if (sub_type == MEDIASUBTYPE_YUY2 && |
117 pvi->bmiHeader.biCompression == MAKEFOURCC('Y', 'U', 'Y', '2')) { | 117 pvi->bmiHeader.biCompression == MAKEFOURCC('Y', 'U', 'Y', '2')) { |
118 resulting_capability_.color = VideoCaptureDevice::kYUY2; | 118 resulting_capability_.color = VideoCaptureCapability::kYUY2; |
119 return true; // This format is acceptable. | 119 return true; // This format is acceptable. |
120 } | 120 } |
121 if (sub_type == MEDIASUBTYPE_RGB24 && | 121 if (sub_type == MEDIASUBTYPE_RGB24 && |
122 pvi->bmiHeader.biCompression == BI_RGB) { | 122 pvi->bmiHeader.biCompression == BI_RGB) { |
123 resulting_capability_.color = VideoCaptureDevice::kRGB24; | 123 resulting_capability_.color = VideoCaptureCapability::kRGB24; |
124 return true; // This format is acceptable. | 124 return true; // This format is acceptable. |
125 } | 125 } |
126 return false; | 126 return false; |
127 } | 127 } |
128 | 128 |
129 HRESULT SinkInputPin::Receive(IMediaSample* sample) { | 129 HRESULT SinkInputPin::Receive(IMediaSample* sample) { |
130 const int length = sample->GetActualDataLength(); | 130 const int length = sample->GetActualDataLength(); |
131 uint8* buffer = NULL; | 131 uint8* buffer = NULL; |
132 if (FAILED(sample->GetPointer(&buffer))) | 132 if (FAILED(sample->GetPointer(&buffer))) |
133 return S_FALSE; | 133 return S_FALSE; |
134 | 134 |
135 observer_->FrameReceived(buffer, length); | 135 observer_->FrameReceived(buffer, length); |
136 return S_OK; | 136 return S_OK; |
137 } | 137 } |
138 | 138 |
139 void SinkInputPin::SetRequestedMediaCapability( | 139 void SinkInputPin::SetRequestedMediaCapability( |
140 const VideoCaptureDevice::Capability& capability) { | 140 const VideoCaptureCapability& capability) { |
141 requested_capability_ = capability; | 141 requested_capability_ = capability; |
142 resulting_capability_ = VideoCaptureDevice::Capability(); | 142 resulting_capability_.width = 0; |
| 143 resulting_capability_.height = 0; |
| 144 resulting_capability_.frame_rate = 0; |
| 145 resulting_capability_.color = VideoCaptureCapability::kColorUnknown; |
| 146 resulting_capability_.expected_capture_delay = 0; |
| 147 resulting_capability_.interlaced = false; |
143 } | 148 } |
144 | 149 |
145 const VideoCaptureDevice::Capability& SinkInputPin::ResultingCapability() { | 150 const VideoCaptureCapability& SinkInputPin::ResultingCapability() { |
146 return resulting_capability_; | 151 return resulting_capability_; |
147 } | 152 } |
148 | 153 |
149 } // namespace media | 154 } // namespace media |
OLD | NEW |