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

Side by Side Diff: media/capture/video/win/video_capture_device_win.h

Issue 2169013002: Change class VideoCaptureDevice::Name to struct VideoCaptureDeviceDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build errors Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 // Windows specific implementation of VideoCaptureDevice. DirectShow is used for 5 // Windows specific implementation of VideoCaptureDevice. DirectShow is used for
6 // capturing. DirectShow provide its own threads for capturing. 6 // capturing. DirectShow provide its own threads for capturing.
7 7
8 #ifndef MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ 8 #ifndef MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_
9 #define MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ 9 #define MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 static HRESULT GetDeviceFilter(const std::string& device_id, 58 static HRESULT GetDeviceFilter(const std::string& device_id,
59 IBaseFilter** filter); 59 IBaseFilter** filter);
60 static base::win::ScopedComPtr<IPin> GetPin(IBaseFilter* filter, 60 static base::win::ScopedComPtr<IPin> GetPin(IBaseFilter* filter,
61 PIN_DIRECTION pin_dir, 61 PIN_DIRECTION pin_dir,
62 REFGUID category, 62 REFGUID category,
63 REFGUID major_type); 63 REFGUID major_type);
64 static VideoPixelFormat TranslateMediaSubtypeToPixelFormat( 64 static VideoPixelFormat TranslateMediaSubtypeToPixelFormat(
65 const GUID& sub_type); 65 const GUID& sub_type);
66 66
67 explicit VideoCaptureDeviceWin(const Name& device_name); 67 explicit VideoCaptureDeviceWin(
68 const VideoCaptureDeviceDescriptor& device_descriptor);
68 ~VideoCaptureDeviceWin() override; 69 ~VideoCaptureDeviceWin() override;
69 // Opens the device driver for this device. 70 // Opens the device driver for this device.
70 bool Init(); 71 bool Init();
71 72
72 // VideoCaptureDevice implementation. 73 // VideoCaptureDevice implementation.
73 void AllocateAndStart( 74 void AllocateAndStart(
74 const VideoCaptureParams& params, 75 const VideoCaptureParams& params,
75 std::unique_ptr<VideoCaptureDevice::Client> client) override; 76 std::unique_ptr<VideoCaptureDevice::Client> client) override;
76 void StopAndDeAllocate() override; 77 void StopAndDeAllocate() override;
77 78
78 private: 79 private:
79 enum InternalState { 80 enum InternalState {
80 kIdle, // The device driver is opened but camera is not in use. 81 kIdle, // The device driver is opened but camera is not in use.
81 kCapturing, // Video is being captured. 82 kCapturing, // Video is being captured.
82 kError // Error accessing HW functions. 83 kError // Error accessing HW functions.
83 // User needs to recover by destroying the object. 84 // User needs to recover by destroying the object.
84 }; 85 };
85 86
86 // Implements SinkFilterObserver. 87 // Implements SinkFilterObserver.
87 void FrameReceived(const uint8_t* buffer, 88 void FrameReceived(const uint8_t* buffer,
88 int length, 89 int length,
89 base::TimeDelta timestamp) override; 90 base::TimeDelta timestamp) override;
90 91
91 bool CreateCapabilityMap(); 92 bool CreateCapabilityMap();
92 void SetAntiFlickerInCaptureFilter(const VideoCaptureParams& params); 93 void SetAntiFlickerInCaptureFilter(const VideoCaptureParams& params);
93 void SetErrorState(const tracked_objects::Location& from_here, 94 void SetErrorState(const tracked_objects::Location& from_here,
94 const std::string& reason); 95 const std::string& reason);
95 96
96 const Name device_name_; 97 const VideoCaptureDeviceDescriptor device_descriptor_;
97 InternalState state_; 98 InternalState state_;
98 std::unique_ptr<VideoCaptureDevice::Client> client_; 99 std::unique_ptr<VideoCaptureDevice::Client> client_;
99 100
100 base::win::ScopedComPtr<IBaseFilter> capture_filter_; 101 base::win::ScopedComPtr<IBaseFilter> capture_filter_;
101 102
102 base::win::ScopedComPtr<IGraphBuilder> graph_builder_; 103 base::win::ScopedComPtr<IGraphBuilder> graph_builder_;
103 base::win::ScopedComPtr<ICaptureGraphBuilder2> capture_graph_builder_; 104 base::win::ScopedComPtr<ICaptureGraphBuilder2> capture_graph_builder_;
104 105
105 base::win::ScopedComPtr<IMediaControl> media_control_; 106 base::win::ScopedComPtr<IMediaControl> media_control_;
106 base::win::ScopedComPtr<IPin> input_sink_pin_; 107 base::win::ScopedComPtr<IPin> input_sink_pin_;
107 base::win::ScopedComPtr<IPin> output_capture_pin_; 108 base::win::ScopedComPtr<IPin> output_capture_pin_;
108 109
109 scoped_refptr<SinkFilter> sink_filter_; 110 scoped_refptr<SinkFilter> sink_filter_;
110 111
111 // Map of all capabilities this device support. 112 // Map of all capabilities this device support.
112 CapabilityList capabilities_; 113 CapabilityList capabilities_;
113 VideoCaptureFormat capture_format_; 114 VideoCaptureFormat capture_format_;
114 115
115 base::TimeTicks first_ref_time_; 116 base::TimeTicks first_ref_time_;
116 117
117 base::ThreadChecker thread_checker_; 118 base::ThreadChecker thread_checker_;
118 119
119 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin); 120 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin);
120 }; 121 };
121 122
122 } // namespace media 123 } // namespace media
123 124
124 #endif // MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ 125 #endif // MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_
OLDNEW
« no previous file with comments | « media/capture/video/win/video_capture_device_mf_win.cc ('k') | media/capture/video/win/video_capture_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698