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 // Implement a DirectShow input pin used for receiving captured frames from | 5 // Implement a DirectShow input pin used for receiving captured frames from |
6 // a DirectShow Capture filter. | 6 // a DirectShow Capture filter. |
7 | 7 |
8 #ifndef MEDIA_CAPTURE_VIDEO_WIN_SINK_INPUT_PIN_WIN_H_ | 8 #ifndef MEDIA_CAPTURE_VIDEO_WIN_SINK_INPUT_PIN_WIN_H_ |
9 #define MEDIA_CAPTURE_VIDEO_WIN_SINK_INPUT_PIN_WIN_H_ | 9 #define MEDIA_CAPTURE_VIDEO_WIN_SINK_INPUT_PIN_WIN_H_ |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "media/base/video_capture_types.h" | 12 #include "media/base/video_capture_types.h" |
13 #include "media/capture/video/video_capture_device.h" | 13 #include "media/capture/video/video_capture_device.h" |
14 #include "media/capture/video/win/pin_base_win.h" | 14 #include "media/capture/video/win/pin_base_win.h" |
15 #include "media/capture/video/win/sink_filter_win.h" | 15 #include "media/capture/video/win/sink_filter_win.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 // Const used for converting Seconds to REFERENCE_TIME. | 19 // Const used for converting Seconds to REFERENCE_TIME. |
20 extern const REFERENCE_TIME kSecondsToReferenceTime; | 20 extern const REFERENCE_TIME kSecondsToReferenceTime; |
21 | 21 |
22 // Input pin of the SinkFilter. | 22 // Input pin of the SinkFilter. |
23 class SinkInputPin : public PinBase { | 23 class SinkInputPin : public PinBase { |
24 public: | 24 public: |
25 SinkInputPin(IBaseFilter* filter, SinkFilterObserver* observer); | 25 SinkInputPin(IBaseFilter* filter, SinkFilterObserver* observer); |
26 | 26 |
27 void SetRequestedMediaFormat(VideoPixelFormat pixel_format, | 27 void SetRequestedMediaFormat(VideoPixelFormat pixel_format, |
28 float frame_rate, | 28 float frame_rate, |
29 const BITMAPINFOHEADER& info_header); | 29 const BITMAPINFOHEADER& info_header); |
30 // Returns the capability that is negotiated when this | |
31 // pin is connected to a media filter. | |
32 const VideoCaptureFormat& resulting_format() const { | |
33 return resulting_format_; | |
34 } | |
35 | 30 |
36 // Implement PinBase. | 31 // Implement PinBase. |
37 bool IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) override; | 32 bool IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) override; |
38 bool GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) override; | 33 bool GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) override; |
39 | 34 |
40 STDMETHOD(Receive)(IMediaSample* media_sample) override; | 35 STDMETHOD(Receive)(IMediaSample* media_sample) override; |
41 | 36 |
42 private: | 37 private: |
43 ~SinkInputPin() override; | 38 ~SinkInputPin() override; |
44 | 39 |
45 VideoPixelFormat requested_pixel_format_; | 40 VideoPixelFormat requested_pixel_format_; |
46 float requested_frame_rate_; | 41 float requested_frame_rate_; |
47 BITMAPINFOHEADER requested_info_header_; | 42 BITMAPINFOHEADER requested_info_header_; |
48 VideoCaptureFormat resulting_format_; | 43 VideoCaptureFormat resulting_format_; |
49 SinkFilterObserver* observer_; | 44 SinkFilterObserver* observer_; |
50 | 45 |
51 DISALLOW_IMPLICIT_CONSTRUCTORS(SinkInputPin); | 46 DISALLOW_IMPLICIT_CONSTRUCTORS(SinkInputPin); |
52 }; | 47 }; |
53 | 48 |
54 } // namespace media | 49 } // namespace media |
55 | 50 |
56 #endif // MEDIA_CAPTURE_VIDEO_WIN_SINK_INPUT_PIN_WIN_H_ | 51 #endif // MEDIA_CAPTURE_VIDEO_WIN_SINK_INPUT_PIN_WIN_H_ |
OLD | NEW |