Chromium Code Reviews| Index: media/video/capture/win/video_capture_device_win.h |
| diff --git a/media/video/capture/win/video_capture_device_win.h b/media/video/capture/win/video_capture_device_win.h |
| index ac4b704f4e6d7d076169a5d4a1ad762a7102e831..a0d7c55c36134afdbc4c59294d41ef097e0b75ba 100644 |
| --- a/media/video/capture/win/video_capture_device_win.h |
| +++ b/media/video/capture/win/video_capture_device_win.h |
| @@ -25,6 +25,8 @@ |
| #include "media/video/capture/win/sink_filter_win.h" |
| #include "media/video/capture/win/sink_input_pin_win.h" |
| +using base::win::ScopedComPtr; |
|
tommi (sloooow) - chröme
2014/05/15 15:18:33
if you remove the other one, then please this one
mcasas
2014/05/15 16:03:23
Done.
|
| + |
| namespace media { |
| // All the methods in the class can only be run on a COM initialized thread. |
| @@ -33,10 +35,38 @@ class VideoCaptureDeviceWin |
| public VideoCaptureDevice, |
| public SinkFilterObserver { |
| public: |
| + // A utility class that wraps the AM_MEDIA_TYPE type and guarantees that |
| + // we free the structure when exiting the scope. DCHECKing is also done to |
| + // avoid memory leaks. |
| + class ScopedMediaType { |
| + public: |
| + ScopedMediaType() : media_type_(NULL) {} |
| + ~ScopedMediaType() { Free(); } |
| + |
| + AM_MEDIA_TYPE* operator->() { return media_type_; } |
| + AM_MEDIA_TYPE* get() { return media_type_; } |
| + void Free(); |
| + AM_MEDIA_TYPE** Receive(); |
| + |
| + private: |
| + void FreeMediaType(AM_MEDIA_TYPE* mt); |
| + void DeleteMediaType(AM_MEDIA_TYPE* mt); |
| + |
| + AM_MEDIA_TYPE* media_type_; |
| + }; |
| + |
| + static HRESULT GetDeviceFilter(const Name& device_name, |
| + IBaseFilter** filter); |
| + static bool PinMatchesCategory(IPin* pin, REFGUID category); |
| + static ScopedComPtr<IPin> GetPin(IBaseFilter* filter, |
| + PIN_DIRECTION pin_dir, |
| + REFGUID category); |
| + static VideoPixelFormat TranslateMediaSubtypeToPixelFormat( |
| + const GUID& sub_type); |
| + |
| explicit VideoCaptureDeviceWin(const Name& device_name); |
| virtual ~VideoCaptureDeviceWin(); |
| // Opens the device driver for this device. |
| - // This function is used by the static VideoCaptureDevice::Create function. |
| bool Init(); |
| // VideoCaptureDevice implementation. |
| @@ -45,10 +75,6 @@ class VideoCaptureDeviceWin |
| scoped_ptr<VideoCaptureDevice::Client> client) OVERRIDE; |
| virtual void StopAndDeAllocate() OVERRIDE; |
| - static void GetDeviceNames(Names* device_names); |
| - static void GetDeviceSupportedFormats(const Name& device, |
| - VideoCaptureFormats* formats); |
| - |
| private: |
| enum InternalState { |
| kIdle, // The device driver is opened but camera is not in use. |