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 |
11 #include <dshow.h> | 11 #include <dshow.h> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 const REFERENCE_TIME kSecondsToReferenceTime = 10000000; | 17 const REFERENCE_TIME kSecondsToReferenceTime = 10000000; |
18 | 18 |
19 | 19 |
20 static DWORD GetArea(const BITMAPINFOHEADER& info_header) { | 20 static DWORD GetArea(const BITMAPINFOHEADER& info_header) { |
21 return info_header.biWidth * info_header.biHeight; | 21 return info_header.biWidth * info_header.biHeight; |
22 } | 22 } |
23 | 23 |
24 SinkInputPin::SinkInputPin(IBaseFilter* filter, | 24 SinkInputPin::SinkInputPin(IBaseFilter* filter, SinkFilterObserver* observer) |
25 SinkFilterObserver* observer) | 25 : PinBase(filter), requested_frame_rate_(0), observer_(observer) { |
26 : requested_frame_rate_(0), | |
27 observer_(observer), | |
28 PinBase(filter) { | |
29 } | 26 } |
30 | 27 |
31 void SinkInputPin::SetRequestedMediaFormat( | 28 void SinkInputPin::SetRequestedMediaFormat( |
32 VideoPixelFormat pixel_format, | 29 VideoPixelFormat pixel_format, |
33 float frame_rate, | 30 float frame_rate, |
34 const BITMAPINFOHEADER& info_header) { | 31 const BITMAPINFOHEADER& info_header) { |
35 requested_pixel_format_ = pixel_format; | 32 requested_pixel_format_ = pixel_format; |
36 requested_frame_rate_ = frame_rate; | 33 requested_frame_rate_ = frame_rate; |
37 requested_info_header_ = info_header; | 34 requested_info_header_ = info_header; |
38 resulting_format_.frame_size.SetSize(0, 0); | 35 resulting_format_.frame_size.SetSize(0, 0); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 if (FAILED(sample->GetPointer(&buffer))) | 184 if (FAILED(sample->GetPointer(&buffer))) |
188 return S_FALSE; | 185 return S_FALSE; |
189 | 186 |
190 observer_->FrameReceived(buffer, length); | 187 observer_->FrameReceived(buffer, length); |
191 return S_OK; | 188 return S_OK; |
192 } | 189 } |
193 | 190 |
194 SinkInputPin::~SinkInputPin() {} | 191 SinkInputPin::~SinkInputPin() {} |
195 | 192 |
196 } // namespace media | 193 } // namespace media |
OLD | NEW |