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

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

Issue 691143002: Revert of Windows video capture: Remove duplicated code from GetDeviceSupportedFormats* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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. 5 // Windows specific implementation of VideoCaptureDevice.
6 // DirectShow is used for capturing. DirectShow provide its own threads 6 // DirectShow is used for capturing. DirectShow provide its own threads
7 // for capturing. 7 // for capturing.
8 8
9 #ifndef MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ 9 #ifndef MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_
10 #define MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ 10 #define MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 static HRESULT GetDeviceFilter(const std::string& device_id, 56 static HRESULT GetDeviceFilter(const std::string& device_id,
57 const CLSID device_class_id, 57 const CLSID device_class_id,
58 IBaseFilter** filter); 58 IBaseFilter** filter);
59 static base::win::ScopedComPtr<IPin> GetPin(IBaseFilter* filter, 59 static base::win::ScopedComPtr<IPin> GetPin(IBaseFilter* filter,
60 PIN_DIRECTION pin_dir, 60 PIN_DIRECTION pin_dir,
61 REFGUID category, 61 REFGUID category,
62 REFGUID major_type); 62 REFGUID major_type);
63 static VideoPixelFormat TranslateMediaSubtypeToPixelFormat( 63 static VideoPixelFormat TranslateMediaSubtypeToPixelFormat(
64 const GUID& sub_type); 64 const GUID& sub_type);
65 static bool CreateCapabilityMap(IPin* output_capture_pin,
66 IBaseFilter* capture_filter,
67 CapabilityList* capabilities);
68 65
69 explicit VideoCaptureDeviceWin(const Name& device_name); 66 explicit VideoCaptureDeviceWin(const Name& device_name);
70 virtual ~VideoCaptureDeviceWin(); 67 virtual ~VideoCaptureDeviceWin();
71 // Opens the device driver for this device. 68 // Opens the device driver for this device.
72 bool Init(); 69 bool Init();
73 70
74 // VideoCaptureDevice implementation. 71 // VideoCaptureDevice implementation.
75 virtual void AllocateAndStart( 72 virtual void AllocateAndStart(
76 const VideoCaptureParams& params, 73 const VideoCaptureParams& params,
77 scoped_ptr<VideoCaptureDevice::Client> client) override; 74 scoped_ptr<VideoCaptureDevice::Client> client) override;
78 virtual void StopAndDeAllocate() override; 75 virtual void StopAndDeAllocate() override;
79 76
80 private: 77 private:
81 enum InternalState { 78 enum InternalState {
82 kIdle, // The device driver is opened but camera is not in use. 79 kIdle, // The device driver is opened but camera is not in use.
83 kCapturing, // Video is being captured. 80 kCapturing, // Video is being captured.
84 kError // Error accessing HW functions. 81 kError // Error accessing HW functions.
85 // User needs to recover by destroying the object. 82 // User needs to recover by destroying the object.
86 }; 83 };
87 84
88 // Implements SinkFilterObserver. 85 // Implements SinkFilterObserver.
89 virtual void FrameReceived(const uint8* buffer, int length); 86 virtual void FrameReceived(const uint8* buffer, int length);
90 87
88 bool CreateCapabilityMap();
91 void SetAntiFlickerInCaptureFilter(); 89 void SetAntiFlickerInCaptureFilter();
92 HRESULT InstantiateWDMFiltersAndPins(); 90 HRESULT InstantiateWDMFiltersAndPins();
93 HRESULT AddWDMCrossbarFilterToGraphAndConnect(); 91 HRESULT AddWDMCrossbarFilterToGraphAndConnect();
94 void SetErrorState(const std::string& reason); 92 void SetErrorState(const std::string& reason);
95 93
96 Name device_name_; 94 Name device_name_;
97 InternalState state_; 95 InternalState state_;
98 scoped_ptr<VideoCaptureDevice::Client> client_; 96 scoped_ptr<VideoCaptureDevice::Client> client_;
99 97
100 base::win::ScopedComPtr<IBaseFilter> capture_filter_; 98 base::win::ScopedComPtr<IBaseFilter> capture_filter_;
(...skipping 16 matching lines...) Expand all
117 // Map of all capabilities this device support. 115 // Map of all capabilities this device support.
118 CapabilityList capabilities_; 116 CapabilityList capabilities_;
119 VideoCaptureFormat capture_format_; 117 VideoCaptureFormat capture_format_;
120 118
121 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin); 119 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin);
122 }; 120 };
123 121
124 } // namespace media 122 } // namespace media
125 123
126 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ 124 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_
OLDNEW
« no previous file with comments | « media/video/capture/win/video_capture_device_mf_win.cc ('k') | media/video/capture/win/video_capture_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698