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

Unified Diff: media/video/capture/win/video_capture_device_win.h

Issue 276383002: VideoCaptureDeviceWin: Extract class-static method into a Factory (both MF/DS) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased factory win. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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.
« 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