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..5ab9faaca0599014938d466020d239eae89f138e 100644 |
--- a/media/video/capture/win/video_capture_device_win.h |
+++ b/media/video/capture/win/video_capture_device_win.h |
@@ -33,10 +33,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 base::win::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 +73,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. |