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

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

Issue 558503003: Windows video capture: Remove duplicated code from GetDeviceSupportedFormats* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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. 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 IBaseFilter** filter); 57 IBaseFilter** filter);
58 static bool PinMatchesCategory(IPin* pin, REFGUID category); 58 static bool PinMatchesCategory(IPin* pin, REFGUID category);
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 static VideoPixelFormat TranslateMediaSubtypeToPixelFormat( 62 static VideoPixelFormat TranslateMediaSubtypeToPixelFormat(
63 const GUID& sub_type); 63 const GUID& sub_type);
64 64
65 static bool VideoCaptureDeviceWin::GetDeviceSupportedFormats(
66 const Name& device,
67 base::win::ScopedComPtr<IBaseFilter>* capture_filter,
tommi (sloooow) - chröme 2014/10/22 16:23:13 this is a bit strange for COM code. If this is me
68 base::win::ScopedComPtr<IPin>* output_capture_pin,
69 CapabilityList* capabilities);
70
65 explicit VideoCaptureDeviceWin(const Name& device_name); 71 explicit VideoCaptureDeviceWin(const Name& device_name);
66 virtual ~VideoCaptureDeviceWin(); 72 virtual ~VideoCaptureDeviceWin();
67 // Opens the device driver for this device. 73 // Opens the device driver for this device.
68 bool Init(); 74 bool Init();
69 75
70 // VideoCaptureDevice implementation. 76 // VideoCaptureDevice implementation.
71 virtual void AllocateAndStart( 77 virtual void AllocateAndStart(
72 const VideoCaptureParams& params, 78 const VideoCaptureParams& params,
73 scoped_ptr<VideoCaptureDevice::Client> client) OVERRIDE; 79 scoped_ptr<VideoCaptureDevice::Client> client) OVERRIDE;
74 virtual void StopAndDeAllocate() OVERRIDE; 80 virtual void StopAndDeAllocate() OVERRIDE;
75 81
76 private: 82 private:
77 enum InternalState { 83 enum InternalState {
78 kIdle, // The device driver is opened but camera is not in use. 84 kIdle, // The device driver is opened but camera is not in use.
79 kCapturing, // Video is being captured. 85 kCapturing, // Video is being captured.
80 kError // Error accessing HW functions. 86 kError // Error accessing HW functions.
81 // User needs to recover by destroying the object. 87 // User needs to recover by destroying the object.
82 }; 88 };
83 89
84 // Implements SinkFilterObserver. 90 // Implements SinkFilterObserver.
85 virtual void FrameReceived(const uint8* buffer, int length); 91 virtual void FrameReceived(const uint8* buffer, int length);
86 92
87 bool CreateCapabilityMap();
88 void SetAntiFlickerInCaptureFilter(); 93 void SetAntiFlickerInCaptureFilter();
89 void SetErrorState(const std::string& reason); 94 void SetErrorState(const std::string& reason);
90 95
91 Name device_name_; 96 Name device_name_;
92 InternalState state_; 97 InternalState state_;
93 scoped_ptr<VideoCaptureDevice::Client> client_; 98 scoped_ptr<VideoCaptureDevice::Client> client_;
94 99
95 base::win::ScopedComPtr<IBaseFilter> capture_filter_; 100 base::win::ScopedComPtr<IBaseFilter> capture_filter_;
96 base::win::ScopedComPtr<IGraphBuilder> graph_builder_; 101 base::win::ScopedComPtr<IGraphBuilder> graph_builder_;
97 base::win::ScopedComPtr<IMediaControl> media_control_; 102 base::win::ScopedComPtr<IMediaControl> media_control_;
98 base::win::ScopedComPtr<IPin> input_sink_pin_; 103 base::win::ScopedComPtr<IPin> input_sink_pin_;
99 base::win::ScopedComPtr<IPin> output_capture_pin_; 104 base::win::ScopedComPtr<IPin> output_capture_pin_;
100 // Used when using a MJPEG decoder. 105 // Used when using a MJPEG decoder.
101 base::win::ScopedComPtr<IBaseFilter> mjpg_filter_; 106 base::win::ScopedComPtr<IBaseFilter> mjpg_filter_;
102 base::win::ScopedComPtr<IPin> input_mjpg_pin_; 107 base::win::ScopedComPtr<IPin> input_mjpg_pin_;
103 base::win::ScopedComPtr<IPin> output_mjpg_pin_; 108 base::win::ScopedComPtr<IPin> output_mjpg_pin_;
104 109
105 scoped_refptr<SinkFilter> sink_filter_; 110 scoped_refptr<SinkFilter> sink_filter_;
106 111
107 // Map of all capabilities this device support. 112 // Map of all capabilities this device support.
108 CapabilityList capabilities_; 113 CapabilityList capabilities_;
109 VideoCaptureFormat capture_format_; 114 VideoCaptureFormat capture_format_;
110 115
111 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin); 116 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin);
112 }; 117 };
113 118
114 } // namespace media 119 } // namespace media
115 120
116 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ 121 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698