Restructure the video_capture code a bit to make room for a Media Foundation class implementation.

This change includes the following:

* Skeleton classes for a couple of base MediaFoundation classes (no code yet).  See *_mf.*.
* Renaming the DirectShow based implementation from "_windows" to "_ds".
* Move the VideoCaptureImpl::CreateDeviceInfo() method into video_capture_factory_windows.cc
  The reason for this is that that's where the other VideoCaptureImpl factory function is
  and the factory function won't be implementation specific.
* Removed use of <initguid.h> from a header file to avoid defining the same guids in multiple object files.
  (more info here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375463(v=vs.85).aspx)
* Moved a couple of global variables from the capture_delay_values_windows.h header and into
  device_info_ds.cc since that's the only file that uses those variables.
* Delete capture_delay_values_windows.h.
* Added a factory function: DeviceInfoDS::Create() that'll create the DirectShow specific implementation.

TEST=This is mostly moving code around.  The code that is added, is currently "dead". No manual testing needed.
BUG=chromium:140545
Review URL: https://webrtc-codereview.appspot.com/967008

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3135 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tommi@webrtc.org 2012-11-20 11:27:25 +00:00
parent 655d8f56f6
commit 704eb8fa15
15 changed files with 294 additions and 113 deletions

View File

@ -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': [

View File

@ -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_

View File

@ -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,

View File

@ -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_

View File

@ -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

View File

@ -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_

View File

@ -8,7 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "help_functions_windows.h"
#include <initguid.h> // 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 <cguid.h>
namespace webrtc
{

View File

@ -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 <dshow.h>
#include <initguid.h>
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_

View File

@ -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 <Dvdmedia.h> // VIDEOINFOHEADER2
#include <initguid.h>
#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,

View File

@ -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 <Streams.h> // 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_

View File

@ -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 <Dvdmedia.h> // 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,

View File

@ -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 <tchar.h>
#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_

View File

@ -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<videocapturemodule::VideoCaptureDS>* newCaptureModule =
new RefCountImpl<videocapturemodule::VideoCaptureDS>(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<VideoCaptureDS>* capture = new RefCountImpl<VideoCaptureDS>(id);
if (capture->Init(id, device_id) != 0) {
delete capture;
capture = NULL;
}
return capture;
}
} // namespace videocapturemodule
} // namespace webrtc

View File

@ -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

View File

@ -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_