diff --git a/webrtc/modules/video_capture/video_capture.gypi b/webrtc/modules/video_capture/video_capture.gypi index bca05be954..b7eefc5cd2 100644 --- a/webrtc/modules/video_capture/video_capture.gypi +++ b/webrtc/modules/video_capture/video_capture.gypi @@ -86,16 +86,19 @@ 'windows', ], 'sources': [ - 'windows/capture_delay_values_windows.h', - 'windows/device_info_windows.cc', - 'windows/device_info_windows.h', - 'windows/help_functions_windows.cc', - 'windows/help_functions_windows.h', - 'windows/sink_filter_windows.cc', - 'windows/sink_filter_windows.h', + 'windows/device_info_ds.cc', + 'windows/device_info_ds.h', + 'windows/device_info_mf.cc', + 'windows/device_info_mf.h', + 'windows/help_functions_ds.cc', + 'windows/help_functions_ds.h', + 'windows/sink_filter_ds.cc', + 'windows/sink_filter_ds.h', + 'windows/video_capture_ds.cc', + 'windows/video_capture_ds.h', 'windows/video_capture_factory_windows.cc', - 'windows/video_capture_windows.cc', - 'windows/video_capture_windows.h', + 'windows/video_capture_mf.cc', + 'windows/video_capture_mf.h', ], 'link_settings': { 'libraries': [ diff --git a/webrtc/modules/video_capture/windows/capture_delay_values_windows.h b/webrtc/modules/video_capture/windows/capture_delay_values_windows.h deleted file mode 100644 index a4d9da6459..0000000000 --- a/webrtc/modules/video_capture/windows/capture_delay_values_windows.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_CAPTURE_DELAY_VALUES_WINDOWS_H_ -#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_CAPTURE_DELAY_VALUES_WINDOWS_H_ - -#include "../video_capture_delay.h" - -namespace webrtc -{ -namespace videocapturemodule -{ -const WebRtc_Word32 NoWindowsCaptureDelays=1; -const DelayValues WindowsCaptureDelays[NoWindowsCaptureDelays]= -{ - "Microsoft LifeCam Cinema","usb#vid_045e&pid_075d",{{640,480,125},{640,360,117},{424,240,111},{352,288,111},{320,240,116},{176,144,101},{160,120,109},{1280,720,166},{960,544,126},{800,448,120},{800,600,127}}, -}; - -} // namespace videocapturemodule -} // namespace webrtc -#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_CAPTURE_DELAY_VALUES_WINDOWS_H_ diff --git a/webrtc/modules/video_capture/windows/device_info_windows.cc b/webrtc/modules/video_capture/windows/device_info_ds.cc similarity index 96% rename from webrtc/modules/video_capture/windows/device_info_windows.cc rename to webrtc/modules/video_capture/windows/device_info_ds.cc index a149a2e361..5acd58ecb1 100644 --- a/webrtc/modules/video_capture/windows/device_info_windows.cc +++ b/webrtc/modules/video_capture/windows/device_info_ds.cc @@ -8,11 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "device_info_windows.h" +#include "device_info_ds.h" #include "../video_capture_config.h" -#include "help_functions_windows.h" -#include "capture_delay_values_windows.h" +#include "../video_capture_delay.h" +#include "help_functions_ds.h" #include "ref_count.h" #include "trace.h" @@ -23,12 +23,29 @@ namespace webrtc { namespace videocapturemodule { -VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo( - const WebRtc_Word32 id) -{ - videocapturemodule::DeviceInfoWindows* dsInfo = - new videocapturemodule::DeviceInfoWindows(id); +const WebRtc_Word32 NoWindowsCaptureDelays = 1; +const DelayValues WindowsCaptureDelays[NoWindowsCaptureDelays] = { + "Microsoft LifeCam Cinema", + "usb#vid_045e&pid_075d", + { + {640,480,125}, + {640,360,117}, + {424,240,111}, + {352,288,111}, + {320,240,116}, + {176,144,101}, + {160,120,109}, + {1280,720,166}, + {960,544,126}, + {800,448,120}, + {800,600,127} + }, +}; +// static +DeviceInfoDS* DeviceInfoDS::Create(const WebRtc_Word32 id) +{ + DeviceInfoDS* dsInfo = new DeviceInfoDS(id); if (!dsInfo || dsInfo->Init() != 0) { delete dsInfo; @@ -37,7 +54,7 @@ VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo( return dsInfo; } -DeviceInfoWindows::DeviceInfoWindows(const WebRtc_Word32 id) +DeviceInfoDS::DeviceInfoDS(const WebRtc_Word32 id) : DeviceInfoImpl(id), _dsDevEnum(NULL), _dsMonikerDevEnum(NULL), _CoUninitializeIsRequired(true) { @@ -81,7 +98,7 @@ DeviceInfoWindows::DeviceInfoWindows(const WebRtc_Word32 id) } } -DeviceInfoWindows::~DeviceInfoWindows() +DeviceInfoDS::~DeviceInfoDS() { RELEASE_AND_CLEAR(_dsMonikerDevEnum); RELEASE_AND_CLEAR(_dsDevEnum); @@ -91,7 +108,7 @@ DeviceInfoWindows::~DeviceInfoWindows() } } -WebRtc_Word32 DeviceInfoWindows::Init() +WebRtc_Word32 DeviceInfoDS::Init() { HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, IID_ICreateDevEnum, (void **) &_dsDevEnum); @@ -103,13 +120,13 @@ WebRtc_Word32 DeviceInfoWindows::Init() } return 0; } -WebRtc_UWord32 DeviceInfoWindows::NumberOfDevices() +WebRtc_UWord32 DeviceInfoDS::NumberOfDevices() { ReadLockScoped cs(_apiLock); return GetDeviceInfo(0, 0, 0, 0, 0, 0, 0); - } -WebRtc_Word32 DeviceInfoWindows::GetDeviceName( + +WebRtc_Word32 DeviceInfoDS::GetDeviceName( WebRtc_UWord32 deviceNumber, char* deviceNameUTF8, WebRtc_UWord32 deviceNameLength, @@ -128,7 +145,7 @@ WebRtc_Word32 DeviceInfoWindows::GetDeviceName( return result > (WebRtc_Word32) deviceNumber ? 0 : -1; } -WebRtc_Word32 DeviceInfoWindows::GetDeviceInfo( +WebRtc_Word32 DeviceInfoDS::GetDeviceInfo( WebRtc_UWord32 deviceNumber, char* deviceNameUTF8, WebRtc_UWord32 deviceNameLength, @@ -255,7 +272,7 @@ WebRtc_Word32 DeviceInfoWindows::GetDeviceInfo( return index; } -IBaseFilter * DeviceInfoWindows::GetDeviceFilter( +IBaseFilter * DeviceInfoDS::GetDeviceFilter( const char* deviceUniqueIdUTF8, char* productUniqueIdUTF8, WebRtc_UWord32 productUniqueIdUTF8Length) @@ -349,7 +366,7 @@ IBaseFilter * DeviceInfoWindows::GetDeviceFilter( return captureFilter; } -WebRtc_Word32 DeviceInfoWindows::GetWindowsCapability( +WebRtc_Word32 DeviceInfoDS::GetWindowsCapability( const WebRtc_Word32 capabilityIndex, VideoCaptureCapabilityWindows& windowsCapability) @@ -369,7 +386,7 @@ WebRtc_Word32 DeviceInfoWindows::GetWindowsCapability( return 0; } -WebRtc_Word32 DeviceInfoWindows::CreateCapabilityMap( +WebRtc_Word32 DeviceInfoDS::CreateCapabilityMap( const char* deviceUniqueIdUTF8) { @@ -396,13 +413,13 @@ WebRtc_Word32 DeviceInfoWindows::CreateCapabilityMap( char productId[kVideoCaptureProductIdLength]; - IBaseFilter* captureDevice = DeviceInfoWindows::GetDeviceFilter( + IBaseFilter* captureDevice = DeviceInfoDS::GetDeviceFilter( deviceUniqueIdUTF8, productId, kVideoCaptureProductIdLength); if (!captureDevice) return -1; - IPin* outputCapturePin = GetOutputPin(captureDevice); + IPin* outputCapturePin = GetOutputPin(captureDevice, GUID_NULL); if (!outputCapturePin) { WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, @@ -689,7 +706,7 @@ WebRtc_Word32 DeviceInfoWindows::CreateCapabilityMap( "\\?\usb#vid_0408&pid_2010&mi_00#7&258e7aaf&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" "\\?\avc#sony&dv-vcr&camcorder&dv#65b2d50301460008#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" */ -void DeviceInfoWindows::GetProductId(const char* devicePath, +void DeviceInfoDS::GetProductId(const char* devicePath, char* productUniqueIdUTF8, WebRtc_UWord32 productUniqueIdUTF8Length) { @@ -729,7 +746,7 @@ void DeviceInfoWindows::GetProductId(const char* devicePath, } } -WebRtc_Word32 DeviceInfoWindows::DisplayCaptureSettingsDialogBox( +WebRtc_Word32 DeviceInfoDS::DisplayCaptureSettingsDialogBox( const char* deviceUniqueIdUTF8, const char* dialogTitleUTF8, void* parentWindow, diff --git a/webrtc/modules/video_capture/windows/device_info_windows.h b/webrtc/modules/video_capture/windows/device_info_ds.h similarity index 93% rename from webrtc/modules/video_capture/windows/device_info_windows.h rename to webrtc/modules/video_capture/windows/device_info_ds.h index 2bae6b30a4..33ccdf5e5f 100644 --- a/webrtc/modules/video_capture/windows/device_info_windows.h +++ b/webrtc/modules/video_capture/windows/device_info_ds.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_WINDOWS_H_ -#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_WINDOWS_H_ +#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_ +#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_ #include "../video_capture_impl.h" #include "../device_info_impl.h" @@ -33,11 +33,14 @@ struct VideoCaptureCapabilityWindows: public VideoCaptureCapability } }; -class DeviceInfoWindows: public DeviceInfoImpl +class DeviceInfoDS: public DeviceInfoImpl { public: - DeviceInfoWindows(const WebRtc_Word32 id); - virtual ~DeviceInfoWindows(); + // Factory function. + static DeviceInfoDS* Create(const WebRtc_Word32 id); + + DeviceInfoDS(const WebRtc_Word32 id); + virtual ~DeviceInfoDS(); WebRtc_Word32 Init(); virtual WebRtc_UWord32 NumberOfDevices(); @@ -81,8 +84,8 @@ public: static void GetProductId(const char* devicePath, char* productUniqueIdUTF8, WebRtc_UWord32 productUniqueIdUTF8Length); -protected: +protected: WebRtc_Word32 GetDeviceInfo(WebRtc_UWord32 deviceNumber, char* deviceNameUTF8, WebRtc_UWord32 deviceNameLength, @@ -102,4 +105,4 @@ private: }; } // namespace videocapturemodule } // namespace webrtc -#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_WINDOWS_H_ +#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_ diff --git a/webrtc/modules/video_capture/windows/device_info_mf.cc b/webrtc/modules/video_capture/windows/device_info_mf.cc new file mode 100644 index 0000000000..61f4f46ecb --- /dev/null +++ b/webrtc/modules/video_capture/windows/device_info_mf.cc @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "modules/video_capture/windows/device_info_mf.h" + +namespace webrtc { +namespace videocapturemodule { + +DeviceInfoMF::DeviceInfoMF(const WebRtc_Word32 id) : DeviceInfoImpl(id) { +} + +DeviceInfoMF::~DeviceInfoMF() { +} + +WebRtc_Word32 DeviceInfoMF::Init() { + return -1; +} + +WebRtc_UWord32 DeviceInfoMF::NumberOfDevices() { + return 0; +} + +WebRtc_Word32 DeviceInfoMF::GetDeviceName( + WebRtc_UWord32 deviceNumber, + char* deviceNameUTF8, + WebRtc_UWord32 deviceNameLength, + char* deviceUniqueIdUTF8, + WebRtc_UWord32 deviceUniqueIdUTF8Length, + char* productUniqueIdUTF8, + WebRtc_UWord32 productUniqueIdUTF8Length) { + return -1; +} + +WebRtc_Word32 DeviceInfoMF::DisplayCaptureSettingsDialogBox( + const char* deviceUniqueIdUTF8, + const char* dialogTitleUTF8, + void* parentWindow, + WebRtc_UWord32 positionX, + WebRtc_UWord32 positionY) { + return -1; +} + +} // namespace videocapturemodule +} // namespace webrtc diff --git a/webrtc/modules/video_capture/windows/device_info_mf.h b/webrtc/modules/video_capture/windows/device_info_mf.h new file mode 100644 index 0000000000..cf1297f6d5 --- /dev/null +++ b/webrtc/modules/video_capture/windows/device_info_mf.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_DEVICE_INFO_MF_H_ +#define WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_DEVICE_INFO_MF_H_ + +#include "modules/video_capture/device_info_impl.h" + +namespace webrtc { +namespace videocapturemodule { + +// Provides video capture device information using the Media Foundation API. +class DeviceInfoMF : public DeviceInfoImpl { + public: + explicit DeviceInfoMF(const WebRtc_Word32 id); + virtual ~DeviceInfoMF(); + + WebRtc_Word32 Init(); + virtual WebRtc_UWord32 NumberOfDevices(); + + virtual WebRtc_Word32 GetDeviceName(WebRtc_UWord32 deviceNumber, + char* deviceNameUTF8, WebRtc_UWord32 deviceNameLength, + char* deviceUniqueIdUTF8, WebRtc_UWord32 deviceUniqueIdUTF8Length, + char* productUniqueIdUTF8, WebRtc_UWord32 productUniqueIdUTF8Length); + + virtual WebRtc_Word32 DisplayCaptureSettingsDialogBox( + const char* deviceUniqueIdUTF8, const char* dialogTitleUTF8, + void* parentWindow, WebRtc_UWord32 positionX, WebRtc_UWord32 positionY); +}; + +} // namespace videocapturemodule +} // namespace webrtc + +#endif // WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_DEVICE_INFO_MF_H_ diff --git a/webrtc/modules/video_capture/windows/help_functions_windows.cc b/webrtc/modules/video_capture/windows/help_functions_ds.cc similarity index 92% rename from webrtc/modules/video_capture/windows/help_functions_windows.cc rename to webrtc/modules/video_capture/windows/help_functions_ds.cc index 405a53d802..5c78e6b8ad 100644 --- a/webrtc/modules/video_capture/windows/help_functions_windows.cc +++ b/webrtc/modules/video_capture/windows/help_functions_ds.cc @@ -8,7 +8,13 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "help_functions_windows.h" +#include // Must come before the help_functions_ds.h include so + // that DEFINE_GUID() entries will be defined in this + // object file. + +#include "help_functions_ds.h" + +#include namespace webrtc { diff --git a/webrtc/modules/video_capture/windows/help_functions_windows.h b/webrtc/modules/video_capture/windows/help_functions_ds.h similarity index 81% rename from webrtc/modules/video_capture/windows/help_functions_windows.h rename to webrtc/modules/video_capture/windows/help_functions_ds.h index 002087789f..9765796c98 100644 --- a/webrtc/modules/video_capture/windows/help_functions_windows.h +++ b/webrtc/modules/video_capture/windows/help_functions_ds.h @@ -8,16 +8,13 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_HELP_FUNCTIONS_WINDOWS_H_ -#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_HELP_FUNCTIONS_WINDOWS_H_ +#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_HELP_FUNCTIONS_DS_H_ +#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_HELP_FUNCTIONS_DS_H_ #include -#include DEFINE_GUID(MEDIASUBTYPE_I420, 0x30323449, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -DEFINE_GUID(MEDIASUBTYPE_V210, 0x30313276, 0x0000, 0x0010, 0x80, 0x00, 0x00, - 0xAA, 0x00, 0x38, 0x9B, 0x71); DEFINE_GUID(MEDIASUBTYPE_HDYC, 0x43594448, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); @@ -30,9 +27,9 @@ namespace videocapturemodule LONGLONG GetMaxOfFrameArray(LONGLONG *maxFps, long size); IPin* GetInputPin(IBaseFilter* filter); -IPin* GetOutputPin(IBaseFilter* filter, REFGUID Category = GUID_NULL); +IPin* GetOutputPin(IBaseFilter* filter, REFGUID Category); BOOL PinMatchesCategory(IPin *pPin, REFGUID Category); } // namespace videocapturemodule } // namespace webrtc -#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_HELP_FUNCTIONS_WINDOWS_H_ +#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_HELP_FUNCTIONS_DS_H_ diff --git a/webrtc/modules/video_capture/windows/sink_filter_windows.cc b/webrtc/modules/video_capture/windows/sink_filter_ds.cc similarity index 99% rename from webrtc/modules/video_capture/windows/sink_filter_windows.cc rename to webrtc/modules/video_capture/windows/sink_filter_ds.cc index ec9d2bf1c4..db57eb263b 100644 --- a/webrtc/modules/video_capture/windows/sink_filter_windows.cc +++ b/webrtc/modules/video_capture/windows/sink_filter_ds.cc @@ -8,16 +8,19 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sink_filter_windows.h" +#include "sink_filter_ds.h" #include "trace.h" -#include "help_functions_windows.h" +#include "help_functions_ds.h" #include // VIDEOINFOHEADER2 #include #define DELETE_RESET(p) { delete (p) ; (p) = NULL ;} +DEFINE_GUID(CLSID_SINKFILTER, 0x88cdbbdc, 0xa73b, 0x4afa, 0xac, 0xbf, 0x15, 0xd5, + 0xe2, 0xce, 0x12, 0xc3); + namespace webrtc { namespace videocapturemodule @@ -31,9 +34,6 @@ typedef struct tagTHREADNAME_INFO DWORD dwFlags; // reserved for future use, must be zero } THREADNAME_INFO; -DEFINE_GUID(CLSID_SINKFILTER, 0x88cdbbdc, 0xa73b, 0x4afa, 0xac, 0xbf, 0x15, 0xd5, - 0xe2, 0xce, 0x12, 0xc3); - CaptureInputPin::CaptureInputPin (WebRtc_Word32 moduleId, IN TCHAR * szName, IN CaptureSinkFilter* pFilter, diff --git a/webrtc/modules/video_capture/windows/sink_filter_windows.h b/webrtc/modules/video_capture/windows/sink_filter_ds.h similarity index 98% rename from webrtc/modules/video_capture/windows/sink_filter_windows.h rename to webrtc/modules/video_capture/windows/sink_filter_ds.h index efeb9c77cb..78e34e3b26 100644 --- a/webrtc/modules/video_capture/windows/sink_filter_windows.h +++ b/webrtc/modules/video_capture/windows/sink_filter_ds.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_SINK_FILTER_WINDOWS_H_ -#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_SINK_FILTER_WINDOWS_H_ +#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_SINK_FILTER_DS_H_ +#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_SINK_FILTER_DS_H_ #include // Include base DS filter header files @@ -97,4 +97,4 @@ private: }; } // namespace videocapturemodule } // namespace webrtc -#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_SINK_FILTER_WINDOWS_H_ +#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_SINK_FILTER_DS_H_ diff --git a/webrtc/modules/video_capture/windows/video_capture_windows.cc b/webrtc/modules/video_capture/windows/video_capture_ds.cc similarity index 98% rename from webrtc/modules/video_capture/windows/video_capture_windows.cc rename to webrtc/modules/video_capture/windows/video_capture_ds.cc index 4c2d52419e..275d987a75 100644 --- a/webrtc/modules/video_capture/windows/video_capture_windows.cc +++ b/webrtc/modules/video_capture/windows/video_capture_ds.cc @@ -8,12 +8,12 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "video_capture_windows.h" +#include "video_capture_ds.h" #include "../video_capture_config.h" #include "critical_section_wrapper.h" -#include "help_functions_windows.h" -#include "sink_filter_windows.h" +#include "help_functions_ds.h" +#include "sink_filter_ds.h" #include "trace.h" #include // VIDEOINFOHEADER2 @@ -375,7 +375,7 @@ HRESULT VideoCaptureDS::ConnectDVCamera() "Failed to get input pin from DV decoder"); return -1; } - _outputDvPin = GetOutputPin(_dvFilter); + _outputDvPin = GetOutputPin(_dvFilter, GUID_NULL); if (_outputDvPin == NULL) { WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, diff --git a/webrtc/modules/video_capture/windows/video_capture_windows.h b/webrtc/modules/video_capture/windows/video_capture_ds.h similarity index 95% rename from webrtc/modules/video_capture/windows/video_capture_windows.h rename to webrtc/modules/video_capture/windows/video_capture_ds.h index 6b83505303..48c49909f9 100644 --- a/webrtc/modules/video_capture/windows/video_capture_windows.h +++ b/webrtc/modules/video_capture/windows/video_capture_ds.h @@ -8,13 +8,13 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_VIDEO_CAPTURE_WINDOWS_H_ -#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_VIDEO_CAPTURE_WINDOWS_H_ +#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_VIDEO_CAPTURE_DS_H_ +#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_VIDEO_CAPTURE_DS_H_ #include "../video_capture_impl.h" #include -#include "device_info_windows.h" +#include "device_info_ds.h" #define CAPTURE_FILTER_NAME L"VideoCaptureFilter" #define SINK_FILTER_NAME L"SinkFilter" @@ -62,7 +62,7 @@ protected: WebRtc_Word32 DisconnectGraph(); HRESULT VideoCaptureDS::ConnectDVCamera(); - DeviceInfoWindows _dsInfo; + DeviceInfoDS _dsInfo; IBaseFilter* _captureFilter; IGraphBuilder* _graphBuilder; @@ -79,4 +79,4 @@ protected: }; } // namespace videocapturemodule } //namespace webrtc -#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_VIDEO_CAPTURE_WINDOWS_H_ +#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_VIDEO_CAPTURE_DS_H_ diff --git a/webrtc/modules/video_capture/windows/video_capture_factory_windows.cc b/webrtc/modules/video_capture/windows/video_capture_factory_windows.cc index 41805c262e..815ff0251d 100644 --- a/webrtc/modules/video_capture/windows/video_capture_factory_windows.cc +++ b/webrtc/modules/video_capture/windows/video_capture_factory_windows.cc @@ -9,28 +9,33 @@ */ #include "ref_count.h" -#include "video_capture_windows.h" +#include "video_capture_ds.h" +#include "video_capture_mf.h" -namespace webrtc -{ -namespace videocapturemodule -{ -VideoCaptureModule* VideoCaptureImpl::Create( - const WebRtc_Word32 id, - const char* deviceUniqueIdUTF8) -{ - if (deviceUniqueIdUTF8 == NULL) - return NULL; +namespace webrtc { +namespace videocapturemodule { - RefCountImpl* newCaptureModule = - new RefCountImpl(id); - - if (newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0) - { - delete newCaptureModule; - newCaptureModule = NULL; - } - return newCaptureModule; +// static +VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo( + const WebRtc_Word32 id) { + // TODO(tommi): Use the Media Foundation version on Vista and up. + return DeviceInfoDS::Create(id); } -} //namespace videocapturemodule -} //namespace webrtc + +VideoCaptureModule* VideoCaptureImpl::Create(const WebRtc_Word32 id, + const char* device_id) { + if (device_id == NULL) + return NULL; + + // TODO(tommi): Use Media Foundation implementation for Vista and up. + RefCountImpl* capture = new RefCountImpl(id); + if (capture->Init(id, device_id) != 0) { + delete capture; + capture = NULL; + } + + return capture; +} + +} // namespace videocapturemodule +} // namespace webrtc diff --git a/webrtc/modules/video_capture/windows/video_capture_mf.cc b/webrtc/modules/video_capture/windows/video_capture_mf.cc new file mode 100644 index 0000000000..873165d9e5 --- /dev/null +++ b/webrtc/modules/video_capture/windows/video_capture_mf.cc @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "modules/video_capture/windows/video_capture_mf.h" + +namespace webrtc { +namespace videocapturemodule { + +VideoCaptureMF::VideoCaptureMF(const WebRtc_Word32 id) : VideoCaptureImpl(id) {} +VideoCaptureMF::~VideoCaptureMF() {} + +WebRtc_Word32 VideoCaptureMF::Init(const WebRtc_Word32 id, + const char* device_id) { + return 0; +} + +WebRtc_Word32 VideoCaptureMF::StartCapture( + const VideoCaptureCapability& capability) { + return -1; +} + +WebRtc_Word32 VideoCaptureMF::StopCapture() { + return -1; +} + +bool VideoCaptureMF::CaptureStarted() { + return false; +} + +WebRtc_Word32 VideoCaptureMF::CaptureSettings( + VideoCaptureCapability& settings) { + return -1; +} + +} // namespace videocapturemodule +} // namespace webrtc diff --git a/webrtc/modules/video_capture/windows/video_capture_mf.h b/webrtc/modules/video_capture/windows/video_capture_mf.h new file mode 100644 index 0000000000..5271eeb3db --- /dev/null +++ b/webrtc/modules/video_capture/windows/video_capture_mf.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_VIDEO_CAPTURE_MF_H_ +#define WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_VIDEO_CAPTURE_MF_H_ + +#include "modules/video_capture/video_capture_impl.h" + +namespace webrtc { +namespace videocapturemodule { + +// VideoCapture implementation that uses the Media Foundation API on Windows. +// This will replace the DirectShow based implementation on Vista and higher. +// TODO(tommi): Finish implementing and switch out the DS in the factory method +// for supported platforms. +class VideoCaptureMF : public VideoCaptureImpl { + public: + explicit VideoCaptureMF(const WebRtc_Word32 id); + + WebRtc_Word32 Init(const WebRtc_Word32 id, const char* device_id); + + // Overrides from VideoCaptureImpl. + virtual WebRtc_Word32 StartCapture(const VideoCaptureCapability& capability); + virtual WebRtc_Word32 StopCapture(); + virtual bool CaptureStarted(); + virtual WebRtc_Word32 CaptureSettings( + VideoCaptureCapability& settings); // NOLINT + + protected: + virtual ~VideoCaptureMF(); +}; + +} // namespace videocapturemodule +} // namespace webrtc + +#endif // WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_VIDEO_CAPTURE_MF_H_