Change Video capture module to be reference counting. Also prevent the module from beeing deleted using the interface.
Furthermore remove all static module creation and deletion functions. Review URL: http://webrtc-codereview.appspot.com/133012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@580 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
31c6b60456
commit
0cc68dc38a
@ -11,257 +11,149 @@
|
|||||||
#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_INTERFACE_VIDEO_CAPTURE_H_
|
#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_INTERFACE_VIDEO_CAPTURE_H_
|
||||||
#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_INTERFACE_VIDEO_CAPTURE_H_
|
#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_INTERFACE_VIDEO_CAPTURE_H_
|
||||||
|
|
||||||
/*
|
|
||||||
* video_capture.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "video_capture_defines.h"
|
#include "video_capture_defines.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
// Class definitions
|
|
||||||
class VideoCaptureModule: public Module
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/*
|
|
||||||
* Create a video capture module object
|
|
||||||
*
|
|
||||||
* id - unique identifier of this video capture module object
|
|
||||||
* deviceUniqueIdUTF8 - name of the device. Available names can be found by using GetDeviceName
|
|
||||||
*/
|
|
||||||
static VideoCaptureModule* Create(const WebRtc_Word32 id,
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8);
|
|
||||||
|
|
||||||
/*
|
class VideoCaptureModule: public RefCountedModule {
|
||||||
* Create a video capture module object used for external capture.
|
public:
|
||||||
*
|
// Interface for receiving information about available camera devices.
|
||||||
* id - unique identifier of this video capture module object
|
class DeviceInfo {
|
||||||
* externalCapture - [out] interface to call when a new frame is captured.
|
public:
|
||||||
*/
|
virtual WebRtc_UWord32 NumberOfDevices() = 0;
|
||||||
static VideoCaptureModule* Create(const WebRtc_Word32 id,
|
|
||||||
VideoCaptureExternal*& externalCapture);
|
|
||||||
|
|
||||||
/*
|
// Returns the available capture devices.
|
||||||
* destroy a video capture module object
|
// deviceNumber - Index of capture device.
|
||||||
*
|
// deviceNameUTF8 - Friendly name of the capture device.
|
||||||
* module - object to destroy
|
// deviceUniqueIdUTF8 - Unique name of the capture device if it exist.
|
||||||
*/
|
// Otherwise same as deviceNameUTF8.
|
||||||
static void Destroy(VideoCaptureModule* module);
|
// productUniqueIdUTF8 - Unique product id if it exist.
|
||||||
|
// Null terminated otherwise.
|
||||||
|
virtual WebRtc_Word32 GetDeviceName(
|
||||||
|
WebRtc_UWord32 deviceNumber,
|
||||||
|
WebRtc_UWord8* deviceNameUTF8,
|
||||||
|
WebRtc_UWord32 deviceNameLength,
|
||||||
|
WebRtc_UWord8* deviceUniqueIdUTF8,
|
||||||
|
WebRtc_UWord32 deviceUniqueIdUTF8Length,
|
||||||
|
WebRtc_UWord8* productUniqueIdUTF8 = 0,
|
||||||
|
WebRtc_UWord32 productUniqueIdUTF8Length = 0) = 0;
|
||||||
|
|
||||||
/* Android specific function
|
|
||||||
* Set global Android VM*/
|
|
||||||
static WebRtc_Word32 SetAndroidObjects(void* javaVM, void* javaContext);
|
|
||||||
|
|
||||||
/*
|
// Returns the number of capabilities this device.
|
||||||
* Returns version of the module and its components
|
virtual WebRtc_Word32 NumberOfCapabilities(
|
||||||
*
|
const WebRtc_UWord8* deviceUniqueIdUTF8) = 0;
|
||||||
* version - buffer to which the version will be written
|
|
||||||
* remainingBufferInBytes - remaining number of WebRtc_Word8 in the version buffer
|
|
||||||
* position - position of the next empty WebRtc_Word8 in the version buffer
|
|
||||||
*/
|
|
||||||
static WebRtc_Word32 GetVersion(WebRtc_Word8* version,
|
|
||||||
WebRtc_UWord32& remainingBufferInBytes,
|
|
||||||
WebRtc_UWord32& position);
|
|
||||||
|
|
||||||
/*
|
// Gets the capabilities of the named device.
|
||||||
* Change the unique identifier of this object
|
virtual WebRtc_Word32 GetCapability(
|
||||||
*
|
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
||||||
* id - new unique identifier of this video capture module object
|
const WebRtc_UWord32 deviceCapabilityNumber,
|
||||||
*/
|
VideoCaptureCapability& capability) = 0;
|
||||||
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0;
|
|
||||||
|
|
||||||
/**************************************************************************
|
// Gets clockwise angle the captured frames should be rotated in order
|
||||||
*
|
// to be displayed correctly on a normally rotated display.
|
||||||
* Device Information
|
virtual WebRtc_Word32 GetOrientation(
|
||||||
*
|
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
||||||
**************************************************************************/
|
VideoCaptureRotation& orientation) = 0;
|
||||||
|
|
||||||
class DeviceInfo
|
// Gets the capability that best matches the requested width, height and
|
||||||
{
|
// frame rate.
|
||||||
public:
|
// Returns the deviceCapabilityNumber on success.
|
||||||
|
virtual WebRtc_Word32 GetBestMatchedCapability(
|
||||||
|
const WebRtc_UWord8*deviceUniqueIdUTF8,
|
||||||
|
const VideoCaptureCapability requested,
|
||||||
|
VideoCaptureCapability& resulting) = 0;
|
||||||
|
|
||||||
virtual WebRtc_UWord32 NumberOfDevices()=0;
|
// Display OS /capture device specific settings dialog
|
||||||
|
virtual WebRtc_Word32 DisplayCaptureSettingsDialogBox(
|
||||||
|
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
||||||
|
const WebRtc_UWord8* dialogTitleUTF8,
|
||||||
|
void* parentWindow,
|
||||||
|
WebRtc_UWord32 positionX,
|
||||||
|
WebRtc_UWord32 positionY) = 0;
|
||||||
|
|
||||||
/*
|
protected:
|
||||||
* Returns the available capture devices.
|
virtual ~DeviceInfo() {}
|
||||||
* deviceNumber -[in] index of capture device
|
};
|
||||||
* deviceNameUTF8 - friendly name of the capture device
|
|
||||||
* deviceUniqueIdUTF8 - unique name of the capture device if it exist. Otherwise same as deviceNameUTF8
|
|
||||||
* productUniqueIdUTF8 - unique product id if it exist. Null terminated otherwise.
|
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 GetDeviceName(WebRtc_UWord32 deviceNumber,
|
|
||||||
WebRtc_UWord8* deviceNameUTF8,
|
|
||||||
WebRtc_UWord32 deviceNameLength,
|
|
||||||
WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
WebRtc_UWord32 deviceUniqueIdUTF8Length,
|
|
||||||
WebRtc_UWord8* productUniqueIdUTF8 = 0,
|
|
||||||
WebRtc_UWord32 productUniqueIdUTF8Length = 0) = 0;
|
|
||||||
|
|
||||||
/*
|
class VideoCaptureEncodeInterface {
|
||||||
* Returns the number of capabilities for this device
|
public:
|
||||||
*/
|
virtual WebRtc_Word32 ConfigureEncoder(const VideoCodec& codec,
|
||||||
virtual WebRtc_Word32 NumberOfCapabilities(const WebRtc_UWord8* deviceUniqueIdUTF8)=0;
|
WebRtc_UWord32 maxPayloadSize) = 0;
|
||||||
|
// Inform the encoder about the new target bit rate.
|
||||||
|
// - newBitRate : New target bit rate in Kbit/s.
|
||||||
|
// - frameRate : The target frame rate.
|
||||||
|
virtual WebRtc_Word32 SetRates(WebRtc_Word32 newBitRate,
|
||||||
|
WebRtc_Word32 frameRate) = 0;
|
||||||
|
// Inform the encoder about the packet loss.
|
||||||
|
// - packetLoss : Fraction lost
|
||||||
|
// (loss rate in percent = 100 * packetLoss / 255).
|
||||||
|
virtual WebRtc_Word32 SetPacketLoss(WebRtc_UWord32 packetLoss) = 0;
|
||||||
|
|
||||||
/*
|
// Encode the next frame as key frame.
|
||||||
* Gets the capabilities of the named device
|
virtual WebRtc_Word32 EncodeFrameType(const FrameType type) = 0;
|
||||||
*/
|
protected:
|
||||||
virtual WebRtc_Word32 GetCapability(const WebRtc_UWord8* deviceUniqueIdUTF8,
|
virtual ~VideoCaptureEncodeInterface() {
|
||||||
const WebRtc_UWord32 deviceCapabilityNumber,
|
}
|
||||||
VideoCaptureCapability& capability) = 0;
|
};
|
||||||
|
|
||||||
/*
|
// Register capture data callback
|
||||||
* Gets clockwise angle the captured frames should be rotated in order to be displayed
|
virtual WebRtc_Word32 RegisterCaptureDataCallback(
|
||||||
* correctly on a normally rotated display.
|
VideoCaptureDataCallback& dataCallback) = 0;
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 GetOrientation(const WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
VideoCaptureRotation& orientation)=0;
|
|
||||||
|
|
||||||
/*
|
// Remove capture data callback
|
||||||
* Gets the capability that best matches the requested width, height and frame rate.
|
virtual WebRtc_Word32 DeRegisterCaptureDataCallback() = 0;
|
||||||
* Returns the deviceCapabilityNumber on success.
|
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 GetBestMatchedCapability(
|
|
||||||
const WebRtc_UWord8*deviceUniqueIdUTF8,
|
|
||||||
const VideoCaptureCapability requested,
|
|
||||||
VideoCaptureCapability& resulting) = 0;
|
|
||||||
|
|
||||||
/*
|
// Register capture callback.
|
||||||
* Display OS /capture device specific settings dialog
|
virtual WebRtc_Word32 RegisterCaptureCallback(
|
||||||
*/
|
VideoCaptureFeedBack& callBack) = 0;
|
||||||
virtual WebRtc_Word32 DisplayCaptureSettingsDialogBox(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
const WebRtc_UWord8* dialogTitleUTF8,
|
|
||||||
void* parentWindow, WebRtc_UWord32 positionX,
|
|
||||||
WebRtc_UWord32 positionY) = 0;
|
|
||||||
|
|
||||||
protected:
|
// Remove capture callback.
|
||||||
virtual ~DeviceInfo(){}
|
virtual WebRtc_Word32 DeRegisterCaptureCallback() = 0;
|
||||||
};
|
|
||||||
|
|
||||||
static DeviceInfo* CreateDeviceInfo(const WebRtc_Word32 id);
|
// Start capture device
|
||||||
static void DestroyDeviceInfo(DeviceInfo* deviceInfo);
|
virtual WebRtc_Word32 StartCapture(
|
||||||
|
const VideoCaptureCapability& capability) = 0;
|
||||||
|
|
||||||
class VideoCaptureEncodeInterface
|
virtual WebRtc_Word32 StopCapture() = 0;
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual WebRtc_Word32 ConfigureEncoder(const VideoCodec& codec,
|
|
||||||
WebRtc_UWord32 maxPayloadSize)=0;
|
|
||||||
// Inform the encoder about the new target bit rate.
|
|
||||||
//
|
|
||||||
// - newBitRate : New target bit rate in Kbit/s
|
|
||||||
// - frameRate : The target frame rate
|
|
||||||
//
|
|
||||||
virtual WebRtc_Word32 SetRates(WebRtc_Word32 newBitRate, WebRtc_Word32 frameRate) = 0;
|
|
||||||
// Inform the encoder about the packet loss
|
|
||||||
//
|
|
||||||
// - packetLoss : Fraction lost
|
|
||||||
// (loss rate in percent = 100 * packetLoss / 255)
|
|
||||||
//
|
|
||||||
virtual WebRtc_Word32 SetPacketLoss(WebRtc_UWord32 packetLoss) = 0;
|
|
||||||
// Encode the next frame as key frame.
|
|
||||||
//
|
|
||||||
virtual WebRtc_Word32 EncodeFrameType(const FrameType type) =0;
|
|
||||||
protected:
|
|
||||||
virtual ~VideoCaptureEncodeInterface(){}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**************************************************************************
|
// Send an image when the capture device is not running.
|
||||||
*
|
virtual WebRtc_Word32 StartSendImage(const VideoFrame& videoFrame,
|
||||||
* Observers
|
WebRtc_Word32 frameRate = 1) = 0;
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*
|
virtual WebRtc_Word32 StopSendImage() = 0;
|
||||||
* Register capture data callback
|
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 RegisterCaptureDataCallback(
|
|
||||||
VideoCaptureDataCallback& dataCallback) = 0;
|
|
||||||
|
|
||||||
/*
|
// Returns the name of the device used by this module.
|
||||||
* Remove capture data callback
|
virtual const WebRtc_UWord8* CurrentDeviceName() const = 0;
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 DeRegisterCaptureDataCallback() = 0;
|
|
||||||
|
|
||||||
/*
|
// Returns true if the capture device is running
|
||||||
* Register capture callback
|
virtual bool CaptureStarted() = 0;
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 RegisterCaptureCallback(VideoCaptureFeedBack& callBack) = 0;
|
|
||||||
|
|
||||||
/*
|
// Gets the current configuration.
|
||||||
* Remove capture callback
|
virtual WebRtc_Word32 CaptureSettings(VideoCaptureCapability& settings) = 0;
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 DeRegisterCaptureCallback() = 0;
|
|
||||||
|
|
||||||
/**************************************************************************
|
virtual WebRtc_Word32 SetCaptureDelay(WebRtc_Word32 delayMS) = 0;
|
||||||
*
|
|
||||||
* Start/Stop
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*
|
// Returns the current CaptureDelay. Only valid when the camera is running.
|
||||||
* Start capture device
|
virtual WebRtc_Word32 CaptureDelay() = 0;
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 StartCapture(const VideoCaptureCapability& capability) = 0;
|
|
||||||
|
|
||||||
/*
|
// Set the rotation of the captured frames.
|
||||||
* Stop capture device
|
// If the rotation is set to the same as returned by
|
||||||
*/
|
// DeviceInfo::GetOrientation the captured frames are
|
||||||
virtual WebRtc_Word32 StopCapture() = 0;
|
// displayed correctly if rendered.
|
||||||
|
virtual WebRtc_Word32 SetCaptureRotation(VideoCaptureRotation rotation) = 0;
|
||||||
|
|
||||||
/*
|
// Gets a pointer to an encode interface if the capture device supports the
|
||||||
* Send an image when the capture device is not running.
|
// requested type and size. NULL otherwise.
|
||||||
*/
|
virtual VideoCaptureEncodeInterface* GetEncodeInterface(
|
||||||
virtual WebRtc_Word32 StartSendImage(const VideoFrame& videoFrame,
|
const VideoCodec& codec) = 0;
|
||||||
WebRtc_Word32 frameRate = 1)=0;
|
|
||||||
|
|
||||||
/*
|
virtual WebRtc_Word32 EnableFrameRateCallback(const bool enable) = 0;
|
||||||
* Stop send image.
|
virtual WebRtc_Word32 EnableNoPictureAlarm(const bool enable) = 0;
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 StopSendImage()=0;
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* Properties of the set device
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
/*
|
|
||||||
* Returns the name of the device used by this module.
|
|
||||||
*/
|
|
||||||
virtual const WebRtc_UWord8* CurrentDeviceName() const =0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns true if the capture device is running
|
|
||||||
*/
|
|
||||||
virtual bool CaptureStarted() = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Gets the current configuration.
|
|
||||||
*/
|
|
||||||
virtual WebRtc_Word32 CaptureSettings(VideoCaptureCapability& settings) = 0;
|
|
||||||
|
|
||||||
virtual WebRtc_Word32 SetCaptureDelay(WebRtc_Word32 delayMS)=0;
|
|
||||||
|
|
||||||
/* Returns the current CaptureDelay.
|
|
||||||
Only valid when the camera is running*/
|
|
||||||
virtual WebRtc_Word32 CaptureDelay()=0;
|
|
||||||
|
|
||||||
/* Set the rotation of the captured frames.
|
|
||||||
If the rotation is set to the same as returned by
|
|
||||||
DeviceInfo::GetOrientation the captured frames are displayed correctly if rendered.*/
|
|
||||||
virtual WebRtc_Word32 SetCaptureRotation(VideoCaptureRotation rotation)=0;
|
|
||||||
|
|
||||||
/* Gets a pointer to an encode interface if the capture device supports the requested type and size.
|
|
||||||
NULL otherwise.
|
|
||||||
*/
|
|
||||||
virtual VideoCaptureEncodeInterface* GetEncodeInterface(const VideoCodec& codec)= 0;
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Information Callbacks
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
virtual WebRtc_Word32 EnableFrameRateCallback(const bool enable) = 0;
|
|
||||||
virtual WebRtc_Word32 EnableNoPictureAlarm(const bool enable) = 0;
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~VideoCaptureModule() {};
|
||||||
};
|
};
|
||||||
} //namespace webrtc
|
|
||||||
|
} // namespace webrtc
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_INTERFACE_VIDEO_CAPTURE_H_
|
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_INTERFACE_VIDEO_CAPTURE_H_
|
||||||
|
@ -8,14 +8,19 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "device_info_android.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "ref_count.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "video_capture_android.h"
|
#include "video_capture_android.h"
|
||||||
#include "device_info_android.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
VideoCaptureModule::DeviceInfo* VideoCaptureModule::CreateDeviceInfo (
|
namespace videocapturemodule
|
||||||
|
{
|
||||||
|
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo (
|
||||||
const WebRtc_Word32 id)
|
const WebRtc_Word32 id)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id,
|
||||||
@ -30,7 +35,7 @@ VideoCaptureModule::DeviceInfo* VideoCaptureModule::CreateDeviceInfo (
|
|||||||
return deviceInfo;
|
return deviceInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoCaptureModule::DestroyDeviceInfo(
|
void VideoCaptureImpl::DestroyDeviceInfo(
|
||||||
VideoCaptureModule::DeviceInfo* deviceInfo)
|
VideoCaptureModule::DeviceInfo* deviceInfo)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, -1,
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, -1,
|
||||||
@ -41,8 +46,6 @@ void VideoCaptureModule::DestroyDeviceInfo(
|
|||||||
delete devInfo;
|
delete devInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace videocapturemodule
|
|
||||||
{
|
|
||||||
DeviceInfoAndroid::DeviceInfoAndroid(const WebRtc_Word32 id) :
|
DeviceInfoAndroid::DeviceInfoAndroid(const WebRtc_Word32 id) :
|
||||||
DeviceInfoImpl(id)
|
DeviceInfoImpl(id)
|
||||||
{
|
{
|
||||||
|
@ -9,32 +9,33 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "video_capture_android.h"
|
#include "video_capture_android.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include "critical_section_wrapper.h"
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "critical_section_wrapper.h"
|
||||||
|
#include "ref_count.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
namespace videocapturemodule
|
||||||
VideoCaptureModule* VideoCaptureModule::Create(const WebRtc_Word32 id,
|
{
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8)
|
VideoCaptureModule* VideoCaptureImpl::Create(
|
||||||
|
const WebRtc_Word32 id,
|
||||||
|
const WebRtc_UWord8* deviceUniqueIdUTF8)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, -1,
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, -1,
|
||||||
"%s:", __FUNCTION__);
|
"%s:", __FUNCTION__);
|
||||||
|
|
||||||
videocapturemodule::VideoCaptureAndroid* newCaptureModule =
|
RefCountImpl<videocapturemodule::VideoCaptureAndroid>* implementation =
|
||||||
new videocapturemodule::VideoCaptureAndroid(id);
|
new RefCountImpl<videocapturemodule::VideoCaptureAndroid>(id);
|
||||||
if (!newCaptureModule || newCaptureModule->Init(id, deviceUniqueIdUTF8)
|
|
||||||
!= 0)
|
|
||||||
{
|
|
||||||
Destroy(newCaptureModule);
|
|
||||||
newCaptureModule = NULL;
|
|
||||||
}
|
|
||||||
return newCaptureModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace videocapturemodule
|
if (!implementation || implementation->Init(id, deviceUniqueId) != 0)
|
||||||
{
|
{
|
||||||
|
delete implementation;
|
||||||
|
implementation = NULL;
|
||||||
|
}
|
||||||
|
return implementation;
|
||||||
|
}
|
||||||
|
|
||||||
// Android logging, uncomment to print trace to logcat instead of trace file/callback
|
// Android logging, uncomment to print trace to logcat instead of trace file/callback
|
||||||
//#include <android/log.h>
|
//#include <android/log.h>
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "trace.h"
|
|
||||||
#include "device_info_linux.h"
|
#include "device_info_linux.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -22,10 +21,17 @@
|
|||||||
|
|
||||||
//v4l includes
|
//v4l includes
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
|
|
||||||
|
#include "ref_count.h"
|
||||||
|
#include "trace.h"
|
||||||
|
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
namespace videocapturemodule
|
||||||
|
{
|
||||||
VideoCaptureModule::DeviceInfo*
|
VideoCaptureModule::DeviceInfo*
|
||||||
VideoCaptureModule::CreateDeviceInfo(const WebRtc_Word32 id)
|
VideoCaptureImpl::CreateDeviceInfo(const WebRtc_Word32 id)
|
||||||
{
|
{
|
||||||
videocapturemodule::DeviceInfoLinux *deviceInfo =
|
videocapturemodule::DeviceInfoLinux *deviceInfo =
|
||||||
new videocapturemodule::DeviceInfoLinux(id);
|
new videocapturemodule::DeviceInfoLinux(id);
|
||||||
@ -37,15 +43,13 @@ VideoCaptureModule::CreateDeviceInfo(const WebRtc_Word32 id)
|
|||||||
return deviceInfo;
|
return deviceInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoCaptureModule::DestroyDeviceInfo(DeviceInfo* deviceInfo)
|
void VideoCaptureImpl::DestroyDeviceInfo(DeviceInfo* deviceInfo)
|
||||||
{
|
{
|
||||||
videocapturemodule::DeviceInfoLinux* devInfo =
|
videocapturemodule::DeviceInfoLinux* devInfo =
|
||||||
static_cast<videocapturemodule::DeviceInfoLinux*> (deviceInfo);
|
static_cast<videocapturemodule::DeviceInfoLinux*> (deviceInfo);
|
||||||
delete devInfo;
|
delete devInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace videocapturemodule
|
|
||||||
{
|
|
||||||
|
|
||||||
DeviceInfoLinux::DeviceInfoLinux(const WebRtc_Word32 id)
|
DeviceInfoLinux::DeviceInfoLinux(const WebRtc_Word32 id)
|
||||||
: DeviceInfoImpl(id)
|
: DeviceInfoImpl(id)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
|
#include "ref_count.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "thread_wrapper.h"
|
#include "thread_wrapper.h"
|
||||||
#include "critical_section_wrapper.h"
|
#include "critical_section_wrapper.h"
|
||||||
@ -28,23 +29,23 @@
|
|||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
VideoCaptureModule* VideoCaptureModule::Create(const WebRtc_Word32 id,
|
|
||||||
const WebRtc_UWord8* deviceUniqueId)
|
|
||||||
{
|
|
||||||
|
|
||||||
videocapturemodule::VideoCaptureModuleV4L2* interface =
|
|
||||||
new videocapturemodule::VideoCaptureModuleV4L2(id);
|
|
||||||
if (!interface || interface->Init(deviceUniqueId) != 0)
|
|
||||||
{
|
|
||||||
Destroy(interface);
|
|
||||||
interface = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return interface;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace videocapturemodule
|
namespace videocapturemodule
|
||||||
{
|
{
|
||||||
|
VideoCaptureModule* VideoCaptureImpl::Create(const WebRtc_Word32 id,
|
||||||
|
const WebRtc_UWord8* deviceUniqueId)
|
||||||
|
{
|
||||||
|
RefCountImpl<videocapturemodule::VideoCaptureModuleV4L2>* implementation =
|
||||||
|
new RefCountImpl<videocapturemodule::VideoCaptureModuleV4L2>(id);
|
||||||
|
|
||||||
|
if (!implementation || implementation->Init(deviceUniqueId) != 0)
|
||||||
|
{
|
||||||
|
delete implementation;
|
||||||
|
implementation = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return implementation;
|
||||||
|
}
|
||||||
|
|
||||||
VideoCaptureModuleV4L2::VideoCaptureModuleV4L2(const WebRtc_Word32 id)
|
VideoCaptureModuleV4L2::VideoCaptureModuleV4L2(const WebRtc_Word32 id)
|
||||||
: VideoCaptureImpl(id), _captureThread(NULL),
|
: VideoCaptureImpl(id), _captureThread(NULL),
|
||||||
_captureCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
_captureCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
|
@ -18,24 +18,6 @@
|
|||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns version of the module and its components
|
|
||||||
*
|
|
||||||
* version - buffer to which the version will be written
|
|
||||||
* remainingBufferInBytes - remaining number of WebRtc_Word8 in the version
|
|
||||||
* buffer
|
|
||||||
* position - position of the next empty WebRtc_Word8 in the
|
|
||||||
* version buffer
|
|
||||||
*/
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureModule::GetVersion(
|
|
||||||
WebRtc_Word8* version, WebRtc_UWord32& remainingBufferInBytes,
|
|
||||||
WebRtc_UWord32& position)
|
|
||||||
{
|
|
||||||
return webrtc::videocapturemodule::VideoCaptureMacQTKit::GetVersion(
|
|
||||||
version, remainingBufferInBytes, position);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace videocapturemodule
|
namespace videocapturemodule
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -13,13 +13,12 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// self header
|
|
||||||
#include "video_capture_mac.h"
|
|
||||||
|
|
||||||
// super class stuff
|
// super class stuff
|
||||||
#include "../video_capture_impl.h"
|
#include "../video_capture_impl.h"
|
||||||
#include "../device_info_impl.h"
|
#include "../device_info_impl.h"
|
||||||
#include "../video_capture_config.h"
|
#include "../video_capture_config.h"
|
||||||
|
#include "ref_count.h"
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ namespace videocapturemodule
|
|||||||
{
|
{
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool VideoCaptureMac::CheckOSVersion()
|
bool CheckOSVersion()
|
||||||
{
|
{
|
||||||
// Check OSX version
|
// Check OSX version
|
||||||
OSErr err = noErr;
|
OSErr err = noErr;
|
||||||
@ -70,7 +69,7 @@ bool VideoCaptureMac::CheckOSVersion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool VideoCaptureMac::CheckQTVersion()
|
bool CheckQTVersion()
|
||||||
{
|
{
|
||||||
// Check OSX version
|
// Check OSX version
|
||||||
OSErr err = noErr;
|
OSErr err = noErr;
|
||||||
@ -96,7 +95,6 @@ bool VideoCaptureMac::CheckQTVersion()
|
|||||||
"QuickTime version compatible: 0x%x", version);
|
"QuickTime version compatible: 0x%x", version);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // videocapturemodule
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
@ -114,13 +112,13 @@ bool VideoCaptureMac::CheckQTVersion()
|
|||||||
* version buffer
|
* version buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VideoCaptureModule* VideoCaptureModule::Create(
|
VideoCaptureModule* VideoCaptureImpl::Create(
|
||||||
const WebRtc_Word32 id, const WebRtc_UWord8* deviceUniqueIdUTF8)
|
const WebRtc_Word32 id, const WebRtc_UWord8* deviceUniqueIdUTF8)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id,
|
||||||
"Create %s", deviceUniqueIdUTF8);
|
"Create %s", deviceUniqueIdUTF8);
|
||||||
|
|
||||||
if (webrtc::videocapturemodule::VideoCaptureMac::CheckOSVersion == false)
|
if (webrtc::videocapturemodule::CheckOSVersion() == false)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
||||||
"OS version is too old. Could not create video capture "
|
"OS version is too old. Could not create video capture "
|
||||||
@ -129,7 +127,7 @@ VideoCaptureModule* VideoCaptureModule::Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
||||||
if (webrtc::videocapturemodule::VideoCaptureMac::CheckQTVersion == false)
|
if (webrtc::videocapturemodule::CheckQTVersion() == false)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
||||||
"QuickTime version is too old. Could not create video "
|
"QuickTime version is too old. Could not create video "
|
||||||
@ -142,15 +140,16 @@ VideoCaptureModule* VideoCaptureModule::Create(
|
|||||||
"QuickTime framework to capture video",
|
"QuickTime framework to capture video",
|
||||||
__FILE__, __LINE__);
|
__FILE__, __LINE__);
|
||||||
|
|
||||||
webrtc::videocapturemodule::VideoCaptureMacQuickTime* newCaptureModule =
|
RefCountImpl<videocapturemodule::VideoCaptureMacQuickTime>*
|
||||||
new webrtc::videocapturemodule::VideoCaptureMacQuickTime(id);
|
newCaptureModule =
|
||||||
|
new RefCountImpl<videocapturemodule::VideoCaptureMacQuickTime>(id);
|
||||||
|
|
||||||
if (!newCaptureModule)
|
if (!newCaptureModule)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
|
||||||
"could not Create for unique device %s, !newCaptureModule",
|
"could not Create for unique device %s, !newCaptureModule",
|
||||||
deviceUniqueIdUTF8);
|
deviceUniqueIdUTF8);
|
||||||
Destroy(newCaptureModule);
|
return NULL;
|
||||||
newCaptureModule = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
|
if (newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
|
||||||
@ -159,8 +158,8 @@ VideoCaptureModule* VideoCaptureModule::Create(
|
|||||||
"could not Create for unique device %s, "
|
"could not Create for unique device %s, "
|
||||||
"newCaptureModule->Init()!=0",
|
"newCaptureModule->Init()!=0",
|
||||||
deviceUniqueIdUTF8);
|
deviceUniqueIdUTF8);
|
||||||
Destroy(newCaptureModule);
|
delete newCaptureModule;
|
||||||
newCaptureModule = NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Successfully created VideoCaptureMacQuicktime. Return it
|
// Successfully created VideoCaptureMacQuicktime. Return it
|
||||||
@ -175,23 +174,23 @@ VideoCaptureModule* VideoCaptureModule::Create(
|
|||||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, id,
|
||||||
"Using QTKit framework to capture video", id);
|
"Using QTKit framework to capture video", id);
|
||||||
|
|
||||||
webrtc::videocapturemodule::VideoCaptureMacQTKit* newCaptureModule =
|
RefCountImpl<videocapturemodule::VideoCaptureMacQTKit>* newCaptureModule =
|
||||||
new webrtc::videocapturemodule::VideoCaptureMacQTKit(id);
|
new RefCountImpl<videocapturemodule::VideoCaptureMacQTKit>(id);
|
||||||
|
|
||||||
if(!newCaptureModule)
|
if(!newCaptureModule)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
|
||||||
"could not Create for unique device %s, !newCaptureModule",
|
"could not Create for unique device %s, !newCaptureModule",
|
||||||
deviceUniqueIdUTF8);
|
deviceUniqueIdUTF8);
|
||||||
Destroy(newCaptureModule);
|
return NULL;
|
||||||
newCaptureModule = NULL;
|
|
||||||
}
|
}
|
||||||
if(newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
|
if(newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, id,
|
||||||
"could not Create for unique device %s, "
|
"could not Create for unique device %s, "
|
||||||
"newCaptureModule->Init()!=0", deviceUniqueIdUTF8);
|
"newCaptureModule->Init()!=0", deviceUniqueIdUTF8);
|
||||||
Destroy(newCaptureModule);
|
delete newCaptureModule;
|
||||||
newCaptureModule = NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Successfully created VideoCaptureMacQuicktime. Return it
|
// Successfully created VideoCaptureMacQuicktime. Return it
|
||||||
@ -202,121 +201,6 @@ VideoCaptureModule* VideoCaptureModule::Create(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Destroy(VideoCaptureModule* module)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
|
||||||
"%s:%d Destroying GISPModuleVideoCapture", __FUNCTION__,
|
|
||||||
__LINE__);
|
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
webrtc::videocapturemodule::VideoCaptureMacQuickTime* captureDevice =
|
|
||||||
static_cast<VideoCaptureMacQuickTime*> (module);
|
|
||||||
delete captureDevice;
|
|
||||||
captureDevice = NULL;
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
webrtc::videocapturemodule::VideoCaptureMacQTKit* captureDevice =
|
|
||||||
static_cast<webrtc::videocapturemodule::VideoCaptureMacQTKit*> (module);
|
|
||||||
delete captureDevice;
|
|
||||||
captureDevice = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* End Create/Destroy VideoCaptureModule
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
// VideoCaptureMac class
|
|
||||||
namespace videocapturemodule
|
|
||||||
{
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* These will just delegate to the appropriate class
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
VideoCaptureMac::VideoCaptureMac(const WebRtc_Word32 id) :
|
|
||||||
VideoCaptureImpl(id), // super class constructor
|
|
||||||
_isFrameworkSupported(false), _captureClass(NULL)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
_isFrameworkSupported = false;
|
|
||||||
_captureClass = new VideoCaptureMacQuickTime(_id);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
_isFrameworkSupported = true;
|
|
||||||
_captureClass = new VideoCaptureMacQTKit(_id);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoCaptureMac::~VideoCaptureMac()
|
|
||||||
{
|
|
||||||
delete _captureClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMac::Init(const WebRtc_Word32 id,
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTime*> (_captureClass)->Init(
|
|
||||||
id, deviceUniqueIdUTF8);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKit*>(_captureClass)->Init(id, deviceUniqueIdUTF8);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMac::StartCapture(
|
|
||||||
const VideoCaptureCapability& capability)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTime*> (_captureClass)->StartCapture(
|
|
||||||
capability);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKit*>
|
|
||||||
(_captureClass)->StartCapture(capability);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMac::StopCapture()
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTime*>
|
|
||||||
(_captureClass)->StopCapture();
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKit*>(_captureClass)->StopCapture();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VideoCaptureMac::CaptureStarted()
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTime*>
|
|
||||||
(_captureClass)->CaptureStarted();
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKit*>(_captureClass)->CaptureStarted();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMac::CaptureSettings(VideoCaptureCapability& settings)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTime*>
|
|
||||||
(_captureClass)->CaptureSettings(settings);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKit*>
|
|
||||||
(_captureClass)->CaptureSettings(settings);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} // namespace videocapturemodule
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Create/Destroy a DeviceInfo
|
* Create/Destroy a DeviceInfo
|
||||||
@ -324,13 +208,13 @@ WebRtc_Word32 VideoCaptureMac::CaptureSettings(VideoCaptureCapability& settings)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
VideoCaptureModule::DeviceInfo*
|
VideoCaptureModule::DeviceInfo*
|
||||||
VideoCaptureModule::CreateDeviceInfo(const WebRtc_Word32 id)
|
VideoCaptureImpl::CreateDeviceInfo(const WebRtc_Word32 id)
|
||||||
{
|
{
|
||||||
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id,
|
||||||
"Create %d", id);
|
"Create %d", id);
|
||||||
|
|
||||||
if (webrtc::videocapturemodule::VideoCaptureMac::CheckOSVersion == false)
|
if (webrtc::videocapturemodule::CheckOSVersion() == false)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
||||||
"OS version is too old. Could not create video capture "
|
"OS version is too old. Could not create video capture "
|
||||||
@ -339,7 +223,7 @@ VideoCaptureModule::CreateDeviceInfo(const WebRtc_Word32 id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
||||||
if (webrtc::videocapturemodule::VideoCaptureMac::CheckQTVersion == false)
|
if (webrtc::videocapturemodule::CheckQTVersion() == false)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, id,
|
||||||
"QuickTime version is too old. Could not create video "
|
"QuickTime version is too old. Could not create video "
|
||||||
@ -385,7 +269,7 @@ VideoCaptureModule::CreateDeviceInfo(const WebRtc_Word32 id)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoCaptureModule::DestroyDeviceInfo(DeviceInfo* deviceInfo)
|
void VideoCaptureImpl::DestroyDeviceInfo(DeviceInfo* deviceInfo)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, 0,
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, 0,
|
||||||
"%s:%d", __FUNCTION__, __LINE__);
|
"%s:%d", __FUNCTION__, __LINE__);
|
||||||
@ -410,165 +294,6 @@ void VideoCaptureModule::DestroyDeviceInfo(DeviceInfo* deviceInfo)
|
|||||||
* End Create/Destroy VideoCaptureModule
|
* End Create/Destroy VideoCaptureModule
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
// VideoCaptureMacInfo class
|
|
||||||
|
|
||||||
namespace videocapturemodule {
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* These will just delegate to the appropriate class
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
VideoCaptureMacInfo::VideoCaptureMacInfo(const WebRtc_Word32 id) :
|
|
||||||
DeviceInfoImpl(id), _isFrameworkSupported(false)//,
|
|
||||||
//_captureInfoClass( NULL) // special init below
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
_isFrameworkSupported = false;
|
|
||||||
_captureInfoClass = new VideoCaptureMacQuickTimeInfo(_id);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
_isFrameworkSupported = true;
|
|
||||||
_captureInfoClass = new VideoCaptureMacQTKitInfo(_id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoCaptureMacInfo::~VideoCaptureMacInfo()
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
delete _captureInfoClass;
|
|
||||||
#else // QTKit version
|
|
||||||
delete _captureInfoClass;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMacInfo::Init()
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTimeInfo*>
|
|
||||||
(_captureInfoClass)->Init();
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKitInfo*>(_captureInfoClass)->Init();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_UWord32 VideoCaptureMacInfo::NumberOfDevices()
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTimeInfo*>
|
|
||||||
(_captureInfoClass)->NumberOfDevices();
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKitInfo*>
|
|
||||||
(_captureInfoClass)->NumberOfDevices();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMacInfo::GetDeviceName(
|
|
||||||
WebRtc_UWord32 deviceNumber, WebRtc_UWord8* deviceNameUTF8,
|
|
||||||
WebRtc_UWord32 deviceNameLength, WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
WebRtc_UWord32 deviceUniqueIdUTF8Length, WebRtc_UWord8* productUniqueIdUTF8,
|
|
||||||
WebRtc_UWord32 productUniqueIdUTF8Length)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTimeInfo*>
|
|
||||||
(_captureInfoClass)->GetDeviceName(deviceNumber, deviceNameUTF8,
|
|
||||||
deviceNameLength, deviceUniqueIdUTF8,
|
|
||||||
deviceUniqueIdUTF8Length,
|
|
||||||
productUniqueIdUTF8,
|
|
||||||
productUniqueIdUTF8Length);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKitInfo*>
|
|
||||||
(_captureInfoClass)->GetDeviceName(deviceNumber, deviceNameUTF8,
|
|
||||||
deviceNameLength, deviceUniqueIdUTF8,
|
|
||||||
deviceUniqueIdUTF8Length,
|
|
||||||
productUniqueIdUTF8,
|
|
||||||
productUniqueIdUTF8Length);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMacInfo::NumberOfCapabilities(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTimeInfo*>
|
|
||||||
(_captureInfoClass)->NumberOfCapabilities(deviceUniqueIdUTF8);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKitInfo*>
|
|
||||||
(_captureInfoClass)->NumberOfCapabilities(deviceUniqueIdUTF8);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMacInfo::GetCapability(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
const WebRtc_UWord32 deviceCapabilityNumber,
|
|
||||||
VideoCaptureCapability& capability)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTimeInfo*>
|
|
||||||
(_captureInfoClass)->GetCapability(deviceUniqueIdUTF8,
|
|
||||||
deviceCapabilityNumber, capability);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKitInfo*>
|
|
||||||
(_captureInfoClass)->GetCapability(deviceUniqueIdUTF8,
|
|
||||||
deviceCapabilityNumber, capability);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMacInfo::GetBestMatchedCapability(
|
|
||||||
const WebRtc_UWord8*deviceUniqueIdUTF8,
|
|
||||||
const VideoCaptureCapability requested, VideoCaptureCapability& resulting)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTimeInfo*>
|
|
||||||
(_captureInfoClass)->GetBestMatchedCapability(deviceUniqueIdUTF8,
|
|
||||||
requested, resulting);
|
|
||||||
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKitInfo*>
|
|
||||||
(_captureInfoClass)->GetBestMatchedCapability(deviceUniqueIdUTF8,
|
|
||||||
requested, resulting);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMacInfo::DisplayCaptureSettingsDialogBox(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
const WebRtc_UWord8* dialogTitleUTF8, void* parentWindow,
|
|
||||||
WebRtc_UWord32 positionX, WebRtc_UWord32 positionY)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
return static_cast<VideoCaptureMacQuickTimeInfo*>
|
|
||||||
(_captureInfoClass)->DisplayCaptureSettingsDialogBox(deviceUniqueIdUTF8,
|
|
||||||
dialogTitleUTF8,
|
|
||||||
parentWindow,
|
|
||||||
positionX,
|
|
||||||
positionY);
|
|
||||||
#else // QTKit version
|
|
||||||
return static_cast<VideoCaptureMacQTKitInfo*>
|
|
||||||
(_captureInfoClass)->DisplayCaptureSettingsDialogBox(deviceUniqueIdUTF8,
|
|
||||||
dialogTitleUTF8,
|
|
||||||
parentWindow,
|
|
||||||
positionX,
|
|
||||||
positionY);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureMacInfo::CreateCapabilityMap(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8)
|
|
||||||
{
|
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED == __MAC_10_4 // QuickTime version
|
|
||||||
#else // QTKit version
|
|
||||||
#endif
|
|
||||||
// not supported. The call stack should never make it this deep.
|
|
||||||
// This call should be returned higher in the order
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
}
|
|
||||||
} // namespace webrtc
|
|
||||||
} // namespace videocapturemodule
|
} // namespace videocapturemodule
|
||||||
|
} // namespace webrtc
|
||||||
|
|
||||||
|
@ -1,121 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* video_capture_mac.h
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* This class exists so that the correct capturing framework can be called
|
|
||||||
* at runtime for compatiblity reasons.
|
|
||||||
*
|
|
||||||
* * QTKit is the modern objective-c interface. Our capturing code was
|
|
||||||
* rewritten to use QTKit because QuickTime does not support 64-bit.
|
|
||||||
* Although QTKit exists in 10.4, it does not support all of the
|
|
||||||
* capture APIs needed
|
|
||||||
* * QuickTime is the older C++ interface. It supports
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_VIDEO_CAPTURE_MAC_H_
|
|
||||||
#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_VIDEO_CAPTURE_MAC_H_
|
|
||||||
|
|
||||||
#include "../video_capture_impl.h"
|
|
||||||
#include "../device_info_impl.h"
|
|
||||||
#include "../video_capture_config.h"
|
|
||||||
|
|
||||||
namespace webrtc
|
|
||||||
{
|
|
||||||
namespace videocapturemodule
|
|
||||||
{
|
|
||||||
|
|
||||||
class VideoCaptureMac: public VideoCaptureImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VideoCaptureMac(const WebRtc_Word32 id);
|
|
||||||
virtual ~VideoCaptureMac();
|
|
||||||
|
|
||||||
static VideoCaptureModule* Create(const WebRtc_Word32 id,
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8);
|
|
||||||
static void Destroy(VideoCaptureModule* module);
|
|
||||||
|
|
||||||
WebRtc_Word32 Init(const WebRtc_Word32 id,
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8);
|
|
||||||
virtual WebRtc_Word32 StartCapture(
|
|
||||||
const VideoCaptureCapability& capability);
|
|
||||||
virtual WebRtc_Word32 StopCapture();
|
|
||||||
virtual bool CaptureStarted();
|
|
||||||
virtual WebRtc_Word32 CaptureSettings(VideoCaptureCapability& settings);
|
|
||||||
static bool CheckQTVersion();
|
|
||||||
static bool CheckOSVersion();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
bool _isFrameworkSupported;
|
|
||||||
VideoCaptureImpl* _captureClass;
|
|
||||||
WebRtc_Word32 _id;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VideoCaptureMacInfo: public DeviceInfoImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// public methods
|
|
||||||
|
|
||||||
static DeviceInfo* Create(const WebRtc_Word32 id);
|
|
||||||
static void Destroy(DeviceInfo* deviceInfo);
|
|
||||||
|
|
||||||
VideoCaptureMacInfo(const WebRtc_Word32 id);
|
|
||||||
virtual ~VideoCaptureMacInfo();
|
|
||||||
|
|
||||||
WebRtc_Word32 Init();
|
|
||||||
|
|
||||||
virtual WebRtc_UWord32 NumberOfDevices();
|
|
||||||
virtual WebRtc_Word32 GetDeviceName(
|
|
||||||
WebRtc_UWord32 deviceNumber,
|
|
||||||
WebRtc_UWord8* deviceNameUTF8,
|
|
||||||
WebRtc_UWord32 deviceNameLength,
|
|
||||||
WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
WebRtc_UWord32 deviceUniqueIdUTF8Length,
|
|
||||||
WebRtc_UWord8* productUniqueIdUTF8 = 0,
|
|
||||||
WebRtc_UWord32 productUniqueIdUTF8Length = 0);
|
|
||||||
|
|
||||||
virtual WebRtc_Word32 NumberOfCapabilities(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8);
|
|
||||||
|
|
||||||
virtual WebRtc_Word32 GetCapability(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
const WebRtc_UWord32 deviceCapabilityNumber,
|
|
||||||
VideoCaptureCapability& capability);
|
|
||||||
|
|
||||||
virtual WebRtc_Word32 GetBestMatchedCapability(
|
|
||||||
const WebRtc_UWord8*deviceUniqueIdUTF8,
|
|
||||||
const VideoCaptureCapability requested,
|
|
||||||
VideoCaptureCapability& resulting);
|
|
||||||
|
|
||||||
virtual WebRtc_Word32 DisplayCaptureSettingsDialogBox(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8,
|
|
||||||
const WebRtc_UWord8* dialogTitleUTF8,
|
|
||||||
void* parentWindow, WebRtc_UWord32 positionX,
|
|
||||||
WebRtc_UWord32 positionY);
|
|
||||||
|
|
||||||
virtual WebRtc_Word32 CreateCapabilityMap(
|
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool _isFrameworkSupported;
|
|
||||||
DeviceInfoImpl* _captureInfoClass;
|
|
||||||
WebRtc_Word32 _id;
|
|
||||||
};
|
|
||||||
} // namespace videocapturemodule
|
|
||||||
} // namespace webrtc
|
|
||||||
|
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_MAC_VIDEO_CAPTURE_MAC_H_
|
|
@ -10,17 +10,20 @@
|
|||||||
|
|
||||||
#include "device_info_windows.h"
|
#include "device_info_windows.h"
|
||||||
|
|
||||||
#include "trace.h"
|
|
||||||
#include "help_functions_windows.h"
|
|
||||||
#include "../video_capture_config.h"
|
#include "../video_capture_config.h"
|
||||||
|
#include "help_functions_windows.h"
|
||||||
#include "capture_delay_values_windows.h"
|
#include "capture_delay_values_windows.h"
|
||||||
|
#include "ref_count.h"
|
||||||
|
#include "trace.h"
|
||||||
|
|
||||||
#include <Streams.h>
|
#include <Streams.h>
|
||||||
#include <Dvdmedia.h>
|
#include <Dvdmedia.h>
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
VideoCaptureModule::DeviceInfo* VideoCaptureModule::CreateDeviceInfo(
|
namespace videocapturemodule
|
||||||
|
{
|
||||||
|
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
|
||||||
const WebRtc_Word32 id)
|
const WebRtc_Word32 id)
|
||||||
{
|
{
|
||||||
videocapturemodule::DeviceInfoWindows* dsInfo =
|
videocapturemodule::DeviceInfoWindows* dsInfo =
|
||||||
@ -34,16 +37,13 @@ VideoCaptureModule::DeviceInfo* VideoCaptureModule::CreateDeviceInfo(
|
|||||||
return dsInfo;
|
return dsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoCaptureModule::DestroyDeviceInfo(DeviceInfo* deviceInfo)
|
void VideoCaptureImpl::DestroyDeviceInfo(DeviceInfo* deviceInfo)
|
||||||
{
|
{
|
||||||
videocapturemodule::DeviceInfoWindows* impl =
|
videocapturemodule::DeviceInfoWindows* impl =
|
||||||
static_cast<videocapturemodule::DeviceInfoWindows*> (deviceInfo);
|
static_cast<videocapturemodule::DeviceInfoWindows*> (deviceInfo);
|
||||||
delete impl;
|
delete impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace videocapturemodule
|
|
||||||
{
|
|
||||||
|
|
||||||
DeviceInfoWindows::DeviceInfoWindows(const WebRtc_Word32 id)
|
DeviceInfoWindows::DeviceInfoWindows(const WebRtc_Word32 id)
|
||||||
: DeviceInfoImpl(id), _dsDevEnum(NULL), _dsMonikerDevEnum(NULL),
|
: DeviceInfoImpl(id), _dsDevEnum(NULL), _dsMonikerDevEnum(NULL),
|
||||||
_CoUninitializeIsRequired(true)
|
_CoUninitializeIsRequired(true)
|
||||||
|
@ -8,14 +8,17 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "ref_count.h"
|
||||||
#include "video_capture_windows.h"
|
#include "video_capture_windows.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
VideoCaptureModule* VideoCaptureModule::Create(
|
namespace videocapturemodule
|
||||||
const WebRtc_Word32 id,
|
{
|
||||||
const WebRtc_UWord8* deviceUniqueIdUTF8)
|
VideoCaptureModule* VideoCaptureImpl::Create(
|
||||||
|
const WebRtc_Word32 id,
|
||||||
|
const WebRtc_UWord8* deviceUniqueIdUTF8)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id, "Create %s",
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, id, "Create %s",
|
||||||
deviceUniqueIdUTF8);
|
deviceUniqueIdUTF8);
|
||||||
@ -31,16 +34,16 @@ VideoCaptureModule* VideoCaptureModule::Create(
|
|||||||
videocapturemodule::DeviceInfoWindows::GetProductId(deviceUniqueIdUTF8,
|
videocapturemodule::DeviceInfoWindows::GetProductId(deviceUniqueIdUTF8,
|
||||||
productId,
|
productId,
|
||||||
sizeof(productId));
|
sizeof(productId));
|
||||||
|
|
||||||
|
RefCountImpl<videocapturemodule::VideoCaptureDS>* newCaptureModule =
|
||||||
|
new RefCountImpl<videocapturemodule::VideoCaptureDS>(id);
|
||||||
|
|
||||||
videocapturemodule::VideoCaptureDS* newCaptureModule = NULL;
|
if (newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
|
||||||
newCaptureModule = new videocapturemodule::VideoCaptureDS(id);
|
|
||||||
|
|
||||||
if (!newCaptureModule
|
|
||||||
|| newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0)
|
|
||||||
{
|
{
|
||||||
Destroy(newCaptureModule);
|
delete newCaptureModule;
|
||||||
newCaptureModule = NULL;
|
newCaptureModule = NULL;
|
||||||
}
|
}
|
||||||
return newCaptureModule;
|
return newCaptureModule;
|
||||||
}
|
}
|
||||||
|
} //namespace videocapturemodule
|
||||||
} //namespace webrtc
|
} //namespace webrtc
|
||||||
|
@ -9,11 +9,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "video_capture_windows.h"
|
#include "video_capture_windows.h"
|
||||||
#include "trace.h"
|
|
||||||
#include "sink_filter_windows.h"
|
|
||||||
#include "help_functions_windows.h"
|
|
||||||
#include "../video_capture_config.h"
|
#include "../video_capture_config.h"
|
||||||
#include "critical_section_wrapper.h"
|
#include "critical_section_wrapper.h"
|
||||||
|
#include "help_functions_windows.h"
|
||||||
|
#include "sink_filter_windows.h"
|
||||||
|
#include "trace.h"
|
||||||
|
|
||||||
#include <Dvdmedia.h> // VIDEOINFOHEADER2
|
#include <Dvdmedia.h> // VIDEOINFOHEADER2
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
|
@ -57,8 +57,7 @@
|
|||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
['OS=="mac" and build_with_chromium==0', {
|
['OS=="mac" and build_with_chromium==0', {
|
||||||
'sources': [
|
'sources': [
|
||||||
'Mac/video_capture_mac.h',
|
|
||||||
'Mac/QTKit/video_capture_recursive_lock.h',
|
'Mac/QTKit/video_capture_recursive_lock.h',
|
||||||
'Mac/QTKit/video_capture_qtkit.h',
|
'Mac/QTKit/video_capture_qtkit.h',
|
||||||
'Mac/QTKit/video_capture_qtkit_info.h',
|
'Mac/QTKit/video_capture_qtkit_info.h',
|
||||||
|
@ -28,7 +28,7 @@ enum {kProcessInterval = 300};
|
|||||||
enum {kFrameRateCallbackInterval = 1000};
|
enum {kFrameRateCallbackInterval = 1000};
|
||||||
enum {kFrameRateCountHistorySize = 90};
|
enum {kFrameRateCountHistorySize = 90};
|
||||||
enum {kFrameRateHistoryWindowMs = 2000};
|
enum {kFrameRateHistoryWindowMs = 2000};
|
||||||
} //namespace videocapturemodule
|
} // namespace videocapturemodule
|
||||||
} //namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_CONFIG_H_
|
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_CONFIG_H_
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "vplib_conversions.h"
|
#include "vplib_conversions.h"
|
||||||
#include "video_capture_config.h"
|
#include "video_capture_config.h"
|
||||||
#include "module_common_types.h"
|
#include "module_common_types.h"
|
||||||
|
#include "ref_count.h"
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
#ifdef WEBRTC_ANDROID
|
||||||
#include "video_capture_android.h" // Need inclusion here to set Java environment.
|
#include "video_capture_android.h" // Need inclusion here to set Java environment.
|
||||||
@ -22,33 +23,26 @@
|
|||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
namespace videocapturemodule
|
||||||
VideoCaptureModule* VideoCaptureModule::Create(const WebRtc_Word32 id,
|
|
||||||
VideoCaptureExternal*& externalCapture)
|
|
||||||
{
|
{
|
||||||
videocapturemodule::VideoCaptureImpl* implementation =
|
VideoCaptureModule* VideoCaptureImpl::Create(
|
||||||
new videocapturemodule::VideoCaptureImpl(id);
|
const WebRtc_Word32 id,
|
||||||
|
VideoCaptureExternal*& externalCapture)
|
||||||
|
{
|
||||||
|
RefCountImpl<VideoCaptureImpl>* implementation =
|
||||||
|
new RefCountImpl<VideoCaptureImpl>(id);
|
||||||
externalCapture = implementation;
|
externalCapture = implementation;
|
||||||
return implementation;
|
return implementation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void VideoCaptureModule::Destroy(VideoCaptureModule* module)
|
|
||||||
{
|
|
||||||
delete module;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
#ifdef WEBRTC_ANDROID
|
||||||
WebRtc_Word32 VideoCaptureModule::SetAndroidObjects(void* javaVM,void* javaContext)
|
WebRtc_Word32 VideoCaptureImpl::SetAndroidObjects(void* javaVM,void* javaContext)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, 0, "SetAndroidObjects");
|
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, 0, "SetAndroidObjects");
|
||||||
return videocapturemodule::VideoCaptureAndroid::SetAndroidObjects(javaVM,javaContext);
|
return videocapturemodule::VideoCaptureAndroid::SetAndroidObjects(javaVM,javaContext);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace videocapturemodule
|
|
||||||
{
|
|
||||||
|
|
||||||
WebRtc_Word32 VideoCaptureImpl::Version(WebRtc_Word8* version,
|
WebRtc_Word32 VideoCaptureImpl::Version(WebRtc_Word8* version,
|
||||||
WebRtc_UWord32& remainingBufferInBytes,
|
WebRtc_UWord32& remainingBufferInBytes,
|
||||||
WebRtc_UWord32& position) const
|
WebRtc_UWord32& position) const
|
||||||
@ -281,7 +275,8 @@ WebRtc_Word32 VideoCaptureImpl::IncomingFrame(WebRtc_UWord8* videoFrame,
|
|||||||
|
|
||||||
if (frameInfo.codecType == kVideoCodecUnknown) // None encoded. Convert to I420.
|
if (frameInfo.codecType == kVideoCodecUnknown) // None encoded. Convert to I420.
|
||||||
{
|
{
|
||||||
const VideoType vpLibType =RawVideoTypeToVplibVideoType(frameInfo.rawType);
|
const VideoType vpLibType = videocapturemodule::
|
||||||
|
RawVideoTypeToVplibVideoType(frameInfo.rawType);
|
||||||
int size = CalcBufferSize(vpLibType, width, height);
|
int size = CalcBufferSize(vpLibType, width, height);
|
||||||
if (size != videoFrameLength)
|
if (size != videoFrameLength)
|
||||||
{
|
{
|
||||||
@ -477,5 +472,5 @@ WebRtc_UWord32 VideoCaptureImpl::CalculateFrameRate(const TickTime& now)
|
|||||||
|
|
||||||
return nrOfFrames;
|
return nrOfFrames;
|
||||||
}
|
}
|
||||||
} //namespace videocapturemodule
|
} // namespace videocapturemodule
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -24,24 +24,43 @@ namespace webrtc
|
|||||||
{
|
{
|
||||||
class CriticalSectionWrapper;
|
class CriticalSectionWrapper;
|
||||||
|
|
||||||
namespace videocapturemodule
|
namespace videocapturemodule {
|
||||||
{
|
|
||||||
// Class definitions
|
// Class definitions
|
||||||
class VideoCaptureImpl: public VideoCaptureModule, public VideoCaptureExternal
|
class VideoCaptureImpl: public VideoCaptureModule, public VideoCaptureExternal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VideoCaptureImpl(const WebRtc_Word32 id);
|
/*
|
||||||
virtual ~VideoCaptureImpl();
|
* Create a video capture module object
|
||||||
|
*
|
||||||
|
* id - unique identifier of this video capture module object
|
||||||
|
* deviceUniqueIdUTF8 - name of the device. Available names can be found by using GetDeviceName
|
||||||
|
*/
|
||||||
|
static VideoCaptureModule* Create(const WebRtc_Word32 id,
|
||||||
|
const WebRtc_UWord8* deviceUniqueIdUTF8);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a video capture module object used for external capture.
|
||||||
|
*
|
||||||
|
* id - unique identifier of this video capture module object
|
||||||
|
* externalCapture - [out] interface to call when a new frame is captured.
|
||||||
|
*/
|
||||||
static VideoCaptureModule* Create(const WebRtc_Word32 id,
|
static VideoCaptureModule* Create(const WebRtc_Word32 id,
|
||||||
VideoCaptureExternal*& externalCapture);
|
VideoCaptureExternal*& externalCapture);
|
||||||
|
|
||||||
static void Destroy(VideoCaptureModule* module);
|
static DeviceInfo* CreateDeviceInfo(const WebRtc_Word32 id);
|
||||||
|
static void DestroyDeviceInfo(DeviceInfo* deviceInfo);
|
||||||
|
|
||||||
|
#ifdef WEBRTC_ANDROID
|
||||||
|
static WebRtc_Word32 SetAndroidObjects(void* javaVM, void* javaContext);
|
||||||
|
#endif
|
||||||
|
|
||||||
static WebRtc_Word32 GetVersion(WebRtc_Word8* version,
|
static WebRtc_Word32 GetVersion(WebRtc_Word8* version,
|
||||||
WebRtc_UWord32& remainingBufferInBytes,
|
WebRtc_UWord32& remainingBufferInBytes,
|
||||||
WebRtc_UWord32& position);
|
WebRtc_UWord32& position);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Implements Module declared functions.
|
// Implements Module declared functions.
|
||||||
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
|
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
|
||||||
|
|
||||||
@ -91,6 +110,9 @@ public:
|
|||||||
{ return NULL; }
|
{ return NULL; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
VideoCaptureImpl(const WebRtc_Word32 id);
|
||||||
|
virtual ~VideoCaptureImpl();
|
||||||
|
|
||||||
WebRtc_Word32 _id; // Module ID
|
WebRtc_Word32 _id; // Module ID
|
||||||
WebRtc_UWord8* _deviceUniqueId; // current Device unique name;
|
WebRtc_UWord8* _deviceUniqueId; // current Device unique name;
|
||||||
CriticalSectionWrapper& _apiCs;
|
CriticalSectionWrapper& _apiCs;
|
||||||
@ -121,6 +143,6 @@ private:
|
|||||||
|
|
||||||
VideoFrame _captureFrame;
|
VideoFrame _captureFrame;
|
||||||
};
|
};
|
||||||
} //namespace videocapturemodule
|
} // namespace videocapturemodule
|
||||||
} //namespace webrtc
|
} //namespace webrtc
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_
|
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "org_webrtc_capturemoduleandroidtest_VideoCaptureModuleTest.h"
|
#include "org_webrtc_capturemoduleandroidtest_VideoCaptureModuleTest.h"
|
||||||
#include "../../../interface/video_capture.h"
|
#include "../../../interface/video_capture.h"
|
||||||
|
#include "../../../source/video_capture_impl.h"
|
||||||
#include "../../../../../video_render/main/interface/video_render.h"
|
#include "../../../../../video_render/main/interface/video_render.h"
|
||||||
#include "../../testAPI/testPlatformDependent.h"
|
#include "../../testAPI/testPlatformDependent.h"
|
||||||
#include "../../testAPI/testPlatformDependent.h"
|
#include "../../testAPI/testPlatformDependent.h"
|
||||||
@ -116,11 +117,11 @@ Java_org_webrtc_capturemoduleandroidtest_VideoCaptureModuleTest_StartCapture(
|
|||||||
{
|
{
|
||||||
if (!jniData._captureInfo) {
|
if (!jniData._captureInfo) {
|
||||||
VideoCaptureModule::SetAndroidObjects(jniData.jvm, context);
|
VideoCaptureModule::SetAndroidObjects(jniData.jvm, context);
|
||||||
jniData._captureInfo = VideoCaptureModule::CreateDeviceInfo(5);
|
jniData._captureInfo = VideoCaptureImpl::CreateDeviceInfo(5);
|
||||||
WebRtc_UWord8 id[256];
|
WebRtc_UWord8 id[256];
|
||||||
WebRtc_UWord8 name[256];
|
WebRtc_UWord8 name[256];
|
||||||
jniData._captureInfo->GetDeviceName(0, name, 256, id, 256);
|
jniData._captureInfo->GetDeviceName(0, name, 256, id, 256);
|
||||||
jniData._videoCapture = VideoCaptureModule::Create(0, id);
|
jniData._videoCapture = VideoCaptureImpl::Create(0, id);
|
||||||
VideoCaptureCapability capability;
|
VideoCaptureCapability capability;
|
||||||
|
|
||||||
jniData._captureInfo->GetCapability(id, 0, capability);
|
jniData._captureInfo->GetCapability(id, 0, capability);
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'../interface',
|
'../interface',
|
||||||
'../../../modules/video_capture/main/interface',
|
'../../../modules/video_capture/main/interface',
|
||||||
|
'../../../modules/video_capture/main/source',
|
||||||
'../../../modules/video_render/main/interface',
|
'../../../modules/video_render/main/interface',
|
||||||
],
|
],
|
||||||
'direct_dependent_settings': {
|
'direct_dependent_settings': {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "event_wrapper.h"
|
#include "event_wrapper.h"
|
||||||
#include "module_common_types.h"
|
#include "module_common_types.h"
|
||||||
#include "video_capture.h"
|
#include "video_capture.h"
|
||||||
#include "video_capture.h"
|
#include "video_capture_impl.h"
|
||||||
#include "video_processing.h"
|
#include "video_processing.h"
|
||||||
#include "video_render_defines.h"
|
#include "video_render_defines.h"
|
||||||
#include "thread_wrapper.h"
|
#include "thread_wrapper.h"
|
||||||
@ -41,7 +41,6 @@ ViECapturer::ViECapturer(int captureId,
|
|||||||
_captureCritsect(*CriticalSectionWrapper::CreateCriticalSection()),
|
_captureCritsect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_deliverCritsect(*CriticalSectionWrapper::CreateCriticalSection()),
|
_deliverCritsect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_captureModule(NULL),
|
_captureModule(NULL),
|
||||||
_useExternalModule(false),
|
|
||||||
_externalCaptureModule(NULL),
|
_externalCaptureModule(NULL),
|
||||||
_moduleProcessThread(moduleProcessThread),
|
_moduleProcessThread(moduleProcessThread),
|
||||||
_captureId(captureId),
|
_captureId(captureId),
|
||||||
@ -118,6 +117,8 @@ ViECapturer::~ViECapturer()
|
|||||||
{
|
{
|
||||||
_moduleProcessThread.DeRegisterModule(_captureModule);
|
_moduleProcessThread.DeRegisterModule(_captureModule);
|
||||||
_captureModule->DeRegisterCaptureDataCallback();
|
_captureModule->DeRegisterCaptureDataCallback();
|
||||||
|
_captureModule->Release();
|
||||||
|
_captureModule = NULL;
|
||||||
}
|
}
|
||||||
if (_vieCaptureThread.Stop())
|
if (_vieCaptureThread.Stop())
|
||||||
{
|
{
|
||||||
@ -134,11 +135,6 @@ ViECapturer::~ViECapturer()
|
|||||||
// Not possible to stop the thread, leak it...
|
// Not possible to stop the thread, leak it...
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_useExternalModule)
|
|
||||||
{
|
|
||||||
VideoCaptureModule::Destroy(_captureModule);
|
|
||||||
}
|
|
||||||
_captureModule = NULL;
|
|
||||||
if (_imageProcModule)
|
if (_imageProcModule)
|
||||||
{
|
{
|
||||||
VideoProcessingModule::Destroy(_imageProcModule);
|
VideoProcessingModule::Destroy(_imageProcModule);
|
||||||
@ -179,9 +175,10 @@ ViECapturer* ViECapturer::CreateViECapture(int captureId,
|
|||||||
|
|
||||||
WebRtc_Word32 ViECapturer::Init(VideoCaptureModule& captureModule)
|
WebRtc_Word32 ViECapturer::Init(VideoCaptureModule& captureModule)
|
||||||
{
|
{
|
||||||
|
assert(_captureModule == NULL);
|
||||||
_captureModule = &captureModule;
|
_captureModule = &captureModule;
|
||||||
_useExternalModule = true;
|
|
||||||
_captureModule->RegisterCaptureDataCallback(*this);
|
_captureModule->RegisterCaptureDataCallback(*this);
|
||||||
|
_captureModule->AddRef();
|
||||||
if (_moduleProcessThread.RegisterModule(_captureModule) != 0)
|
if (_moduleProcessThread.RegisterModule(_captureModule) != 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -205,23 +202,23 @@ ViECapturer* ViECapturer::CreateViECapture(int captureId,
|
|||||||
return capture;
|
return capture;
|
||||||
}
|
}
|
||||||
WebRtc_Word32 ViECapturer::Init(const WebRtc_UWord8* deviceUniqueIdUTF8,
|
WebRtc_Word32 ViECapturer::Init(const WebRtc_UWord8* deviceUniqueIdUTF8,
|
||||||
const WebRtc_UWord32 deviceUniqueIdUTF8Length)
|
const WebRtc_UWord32 deviceUniqueIdUTF8Length)
|
||||||
{
|
{
|
||||||
|
assert(_captureModule == NULL);
|
||||||
#ifndef WEBRTC_VIDEO_EXTERNAL_CAPTURE_AND_RENDER
|
#ifndef WEBRTC_VIDEO_EXTERNAL_CAPTURE_AND_RENDER
|
||||||
if (deviceUniqueIdUTF8 == NULL)
|
if (deviceUniqueIdUTF8 == NULL)
|
||||||
{
|
{
|
||||||
_captureModule = VideoCaptureModule::Create(
|
_captureModule = videocapturemodule::VideoCaptureImpl::Create(
|
||||||
ViEModuleId(_engineId, _captureId),
|
ViEModuleId(_engineId, _captureId), _externalCaptureModule);
|
||||||
_externalCaptureModule);
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
_captureModule = VideoCaptureModule::Create(
|
_captureModule = videocapturemodule::VideoCaptureImpl::Create(
|
||||||
ViEModuleId(_engineId, _captureId),
|
ViEModuleId(_engineId, _captureId), deviceUniqueIdUTF8);
|
||||||
deviceUniqueIdUTF8);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!_captureModule)
|
if (!_captureModule)
|
||||||
return -1;
|
return -1;
|
||||||
|
_captureModule->AddRef();
|
||||||
_captureModule->RegisterCaptureDataCallback(*this);
|
_captureModule->RegisterCaptureDataCallback(*this);
|
||||||
if (_moduleProcessThread.RegisterModule(_captureModule) != 0)
|
if (_moduleProcessThread.RegisterModule(_captureModule) != 0)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,6 @@ private:
|
|||||||
CriticalSectionWrapper& _captureCritsect; // Never take this one before deliverCritsect!
|
CriticalSectionWrapper& _captureCritsect; // Never take this one before deliverCritsect!
|
||||||
CriticalSectionWrapper& _deliverCritsect;
|
CriticalSectionWrapper& _deliverCritsect;
|
||||||
VideoCaptureModule* _captureModule;
|
VideoCaptureModule* _captureModule;
|
||||||
bool _useExternalModule;
|
|
||||||
VideoCaptureExternal* _externalCaptureModule;
|
VideoCaptureExternal* _externalCaptureModule;
|
||||||
ProcessThread& _moduleProcessThread;
|
ProcessThread& _moduleProcessThread;
|
||||||
const int _captureId;
|
const int _captureId;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
#ifdef WEBRTC_ANDROID
|
||||||
#include "video_capture.h"
|
#include "video_capture.h"
|
||||||
|
#include "video_capture_impl.h"
|
||||||
#include "video_render.h"
|
#include "video_render.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -281,7 +282,7 @@ int VideoEngine::SetAndroidObjects(void* javaVM, void* javaContext)
|
|||||||
"SetAndroidObjects()");
|
"SetAndroidObjects()");
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
#ifdef WEBRTC_ANDROID
|
||||||
if (VideoCaptureModule::SetAndroidObjects(javaVM,javaContext) != 0)
|
if (VideoCaptureImpl::SetAndroidObjects(javaVM,javaContext) != 0)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter,
|
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter,
|
||||||
"Could not set capture module Android objects");
|
"Could not set capture module Android objects");
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "common_types.h"
|
#include "common_types.h"
|
||||||
#include "critical_section_wrapper.h"
|
#include "critical_section_wrapper.h"
|
||||||
#include "video_capture.h"
|
#include "video_capture.h"
|
||||||
#include "video_capture.h"
|
#include "video_capture_impl.h"
|
||||||
#include "video_coding.h"
|
#include "video_coding.h"
|
||||||
#include "video_coding_defines.h"
|
#include "video_coding_defines.h"
|
||||||
#include "rw_lock_wrapper.h"
|
#include "rw_lock_wrapper.h"
|
||||||
@ -58,8 +58,9 @@ ViEInputManager::ViEInputManager(const int engineId)
|
|||||||
#ifdef WEBRTC_VIDEO_EXTERNAL_CAPTURE_AND_RENDER
|
#ifdef WEBRTC_VIDEO_EXTERNAL_CAPTURE_AND_RENDER
|
||||||
_ptrCaptureDeviceInfo=NULL;
|
_ptrCaptureDeviceInfo=NULL;
|
||||||
#else
|
#else
|
||||||
_ptrCaptureDeviceInfo = VideoCaptureModule::CreateDeviceInfo(
|
_ptrCaptureDeviceInfo =
|
||||||
ViEModuleId(_engineId));
|
videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(
|
||||||
|
ViEModuleId(_engineId));
|
||||||
#endif
|
#endif
|
||||||
for (int idx = 0; idx < kViEMaxFilePlayers; idx++)
|
for (int idx = 0; idx < kViEMaxFilePlayers; idx++)
|
||||||
{
|
{
|
||||||
@ -87,11 +88,14 @@ ViEInputManager::~ViEInputManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete &_mapCritsect;
|
delete &_mapCritsect;
|
||||||
|
#ifndef WEBRTC_VIDEO_EXTERNAL_CAPTURE_AND_RENDER
|
||||||
if (_ptrCaptureDeviceInfo)
|
if (_ptrCaptureDeviceInfo)
|
||||||
{
|
{
|
||||||
VideoCaptureModule::DestroyDeviceInfo( _ptrCaptureDeviceInfo);
|
videocapturemodule::VideoCaptureImpl::DestroyDeviceInfo(
|
||||||
|
_ptrCaptureDeviceInfo);
|
||||||
_ptrCaptureDeviceInfo = NULL;
|
_ptrCaptureDeviceInfo = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tb_capture_device.h"
|
#include "tb_capture_device.h"
|
||||||
|
#include "video_capture_impl.h"
|
||||||
|
|
||||||
tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
|
tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
|
||||||
captureId(-1),
|
captureId(-1),
|
||||||
@ -27,7 +28,7 @@ tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
|
|||||||
bool captureDeviceSet = false;
|
bool captureDeviceSet = false;
|
||||||
|
|
||||||
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
||||||
webrtc::VideoCaptureModule::CreateDeviceInfo(0);
|
webrtc::videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(0);
|
||||||
for (size_t captureIdx = 0;
|
for (size_t captureIdx = 0;
|
||||||
captureIdx < devInfo->NumberOfDevices();
|
captureIdx < devInfo->NumberOfDevices();
|
||||||
captureIdx++)
|
captureIdx++)
|
||||||
@ -39,11 +40,13 @@ tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
|
|||||||
"ERROR: %s at line %d",
|
"ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
vcpm_ = webrtc::VideoCaptureModule::Create(captureIdx, uniqueId);
|
vcpm_ = webrtc::videocapturemodule::VideoCaptureImpl::Create(
|
||||||
|
captureIdx, uniqueId);
|
||||||
if (vcpm_ == NULL) // Failed to open this device. Try next.
|
if (vcpm_ == NULL) // Failed to open this device. Try next.
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
vcpm_->AddRef();
|
||||||
|
|
||||||
error = ViE.ptrViECapture->AllocateCaptureDevice(*vcpm_, captureId);
|
error = ViE.ptrViECapture->AllocateCaptureDevice(*vcpm_, captureId);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
@ -54,7 +57,7 @@ tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webrtc::VideoCaptureModule::DestroyDeviceInfo(devInfo);
|
webrtc::videocapturemodule::VideoCaptureImpl::DestroyDeviceInfo(devInfo);
|
||||||
numberOfErrors += ViETest::TestError(
|
numberOfErrors += ViETest::TestError(
|
||||||
captureDeviceSet, "ERROR: %s at line %d - Could not set capture device",
|
captureDeviceSet, "ERROR: %s at line %d - Could not set capture device",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
@ -78,9 +81,7 @@ tbCaptureDevice::~tbCaptureDevice(void)
|
|||||||
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
|
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
|
||||||
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
vcpm_->Release();
|
||||||
webrtc::VideoCaptureModule::Destroy(vcpm_);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tbCaptureDevice::ConnectTo(int videoChannel)
|
void tbCaptureDevice::ConnectTo(int videoChannel)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "vie_autotest_defines.h"
|
#include "vie_autotest_defines.h"
|
||||||
#include "vie_autotest.h"
|
#include "vie_autotest.h"
|
||||||
#include "engine_configurations.h"
|
#include "engine_configurations.h"
|
||||||
#include "video_capture.h"
|
#include "video_capture_impl.h"
|
||||||
|
|
||||||
int ViEAutoTest::ViEBaseStandardTest()
|
int ViEAutoTest::ViEBaseStandardTest()
|
||||||
{
|
{
|
||||||
@ -82,7 +82,7 @@ int ViEAutoTest::ViEBaseStandardTest()
|
|||||||
bool captureDeviceSet = false;
|
bool captureDeviceSet = false;
|
||||||
int captureId = 0;
|
int captureId = 0;
|
||||||
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
||||||
webrtc::VideoCaptureModule::CreateDeviceInfo(0);
|
webrtc::videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(0);
|
||||||
|
|
||||||
for (unsigned int captureIdx = 0;
|
for (unsigned int captureIdx = 0;
|
||||||
captureIdx < devInfo->NumberOfDevices();
|
captureIdx < devInfo->NumberOfDevices();
|
||||||
@ -95,7 +95,9 @@ int ViEAutoTest::ViEBaseStandardTest()
|
|||||||
"ERROR: %s at line %d",
|
"ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
vcpm = webrtc::VideoCaptureModule::Create(4571, uniqueId);
|
vcpm = webrtc::videocapturemodule::VideoCaptureImpl::Create(
|
||||||
|
4571, uniqueId);
|
||||||
|
vcpm->AddRef();
|
||||||
numberOfErrors += ViETest::TestError(vcpm != NULL,
|
numberOfErrors += ViETest::TestError(vcpm != NULL,
|
||||||
"ERROR: %s at line %d",
|
"ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
@ -110,11 +112,11 @@ int ViEAutoTest::ViEBaseStandardTest()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
webrtc::VideoCaptureModule::Destroy(vcpm);
|
vcpm->Release();
|
||||||
vcpm = NULL;
|
vcpm = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webrtc::VideoCaptureModule::DestroyDeviceInfo(devInfo);
|
webrtc::videocapturemodule::VideoCaptureImpl::DestroyDeviceInfo(devInfo);
|
||||||
|
|
||||||
numberOfErrors+= ViETest::TestError(
|
numberOfErrors+= ViETest::TestError(
|
||||||
captureDeviceSet,
|
captureDeviceSet,
|
||||||
@ -314,7 +316,7 @@ int ViEAutoTest::ViEBaseStandardTest()
|
|||||||
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
webrtc::VideoCaptureModule::Destroy(vcpm);
|
vcpm->Release();
|
||||||
vcpm = NULL;
|
vcpm = NULL;
|
||||||
|
|
||||||
remainingInterfaces = ptrViECapture->Release();
|
remainingInterfaces = ptrViECapture->Release();
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "tb_interfaces.h"
|
#include "tb_interfaces.h"
|
||||||
#include "tb_video_channel.h"
|
#include "tb_video_channel.h"
|
||||||
#include "video_capture.h"
|
#include "video_capture_impl.h"
|
||||||
|
|
||||||
class CaptureObserver: public webrtc::ViECaptureObserver
|
class CaptureObserver: public webrtc::ViECaptureObserver
|
||||||
{
|
{
|
||||||
@ -138,7 +138,7 @@ int ViEAutoTest::ViECaptureStandardTest()
|
|||||||
tbInterfaces ViE("WebRTCViECapture_Standard", numberOfErrors);
|
tbInterfaces ViE("WebRTCViECapture_Standard", numberOfErrors);
|
||||||
|
|
||||||
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
||||||
webrtc::VideoCaptureModule::CreateDeviceInfo(0);
|
webrtc::videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(0);
|
||||||
|
|
||||||
int numberOfCaptureDevices = devInfo->NumberOfDevices();
|
int numberOfCaptureDevices = devInfo->NumberOfDevices();
|
||||||
ViETest::Log("Number of capture devices %d", numberOfCaptureDevices);
|
ViETest::Log("Number of capture devices %d", numberOfCaptureDevices);
|
||||||
@ -229,7 +229,9 @@ int ViEAutoTest::ViECaptureStandardTest()
|
|||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
webrtc::VideoCaptureModule* vcpm =
|
webrtc::VideoCaptureModule* vcpm =
|
||||||
webrtc::VideoCaptureModule::Create(deviceIndex, deviceUniqueName);
|
webrtc::videocapturemodule::VideoCaptureImpl::Create(
|
||||||
|
deviceIndex, deviceUniqueName);
|
||||||
|
vcpm->AddRef();
|
||||||
numberOfErrors += ViETest::TestError(vcpm != NULL,
|
numberOfErrors += ViETest::TestError(vcpm != NULL,
|
||||||
"ERROR: %s at line %d",
|
"ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
@ -323,7 +325,7 @@ int ViEAutoTest::ViECaptureStandardTest()
|
|||||||
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
webrtc::VideoCaptureModule::Destroy(vcpms[deviceIndex]);
|
vcpms[deviceIndex]->Release();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (numberOfErrors > 0)
|
if (numberOfErrors > 0)
|
||||||
@ -336,7 +338,7 @@ int ViEAutoTest::ViECaptureStandardTest()
|
|||||||
ViETest::Log(" ");
|
ViETest::Log(" ");
|
||||||
return numberOfErrors;
|
return numberOfErrors;
|
||||||
}
|
}
|
||||||
webrtc::VideoCaptureModule::DestroyDeviceInfo(devInfo);
|
webrtc::videocapturemodule::VideoCaptureImpl::DestroyDeviceInfo(devInfo);
|
||||||
|
|
||||||
ViETest::Log(" ");
|
ViETest::Log(" ");
|
||||||
ViETest::Log(" ViECapture Standard Test PASSED!");
|
ViETest::Log(" ViECapture Standard Test PASSED!");
|
||||||
@ -384,7 +386,7 @@ int ViEAutoTest::ViECaptureAPITest()
|
|||||||
int captureId = 0;
|
int captureId = 0;
|
||||||
|
|
||||||
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
||||||
webrtc::VideoCaptureModule::CreateDeviceInfo(0);
|
webrtc::videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(0);
|
||||||
numberOfErrors += ViETest::TestError(devInfo != NULL,
|
numberOfErrors += ViETest::TestError(devInfo != NULL,
|
||||||
"ERROR: %s at line %d", __FUNCTION__,
|
"ERROR: %s at line %d", __FUNCTION__,
|
||||||
__LINE__);
|
__LINE__);
|
||||||
@ -396,7 +398,9 @@ int ViEAutoTest::ViECaptureAPITest()
|
|||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
webrtc::VideoCaptureModule* vcpm =
|
webrtc::VideoCaptureModule* vcpm =
|
||||||
webrtc::VideoCaptureModule::Create(0, deviceUniqueName);
|
webrtc::videocapturemodule::VideoCaptureImpl::Create(
|
||||||
|
0, deviceUniqueName);
|
||||||
|
vcpm->AddRef();
|
||||||
numberOfErrors += ViETest::TestError(vcpm != NULL, "ERROR: %s at line %d",
|
numberOfErrors += ViETest::TestError(vcpm != NULL, "ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
@ -554,8 +558,8 @@ int ViEAutoTest::ViECaptureAPITest()
|
|||||||
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
webrtc::VideoCaptureModule::DestroyDeviceInfo(devInfo);
|
webrtc::videocapturemodule::VideoCaptureImpl::DestroyDeviceInfo(devInfo);
|
||||||
webrtc::VideoCaptureModule::Destroy(vcpm);
|
vcpm->Release();
|
||||||
|
|
||||||
//***************************************************************
|
//***************************************************************
|
||||||
// Testing finished. Tear down Video Engine
|
// Testing finished. Tear down Video Engine
|
||||||
@ -604,7 +608,9 @@ int ViEAutoTest::ViECaptureExternalCaptureTest()
|
|||||||
|
|
||||||
// Allocate the external capture device
|
// Allocate the external capture device
|
||||||
webrtc::VideoCaptureModule* vcpm =
|
webrtc::VideoCaptureModule* vcpm =
|
||||||
webrtc::VideoCaptureModule::Create(0, externalCapture);
|
webrtc::videocapturemodule::VideoCaptureImpl::Create(
|
||||||
|
0, externalCapture);
|
||||||
|
vcpm->AddRef();
|
||||||
numberOfErrors += ViETest::TestError(vcpm != NULL, "ERROR: %s at line %d",
|
numberOfErrors += ViETest::TestError(vcpm != NULL, "ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
@ -787,6 +793,7 @@ int ViEAutoTest::ViECaptureExternalCaptureTest()
|
|||||||
numberOfErrors += ViETest::TestError(
|
numberOfErrors += ViETest::TestError(
|
||||||
ViE.LastError() == kViECaptureDeviceDoesnNotExist,
|
ViE.LastError() == kViECaptureDeviceDoesnNotExist,
|
||||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||||
|
vcpm->Release();
|
||||||
|
|
||||||
//***************************************************************
|
//***************************************************************
|
||||||
// Testing finished. Tear down Video Engine
|
// Testing finished. Tear down Video Engine
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
'interface/',
|
'interface/',
|
||||||
'../../interface',
|
'../../interface',
|
||||||
'../../source',
|
'../../source',
|
||||||
|
'../../../../modules/video_capture/main/source/',
|
||||||
'../../../../modules/video_coding/codecs/interface/',
|
'../../../../modules/video_coding/codecs/interface/',
|
||||||
'../../../../common_video/interface/',
|
'../../../../common_video/interface/',
|
||||||
],
|
],
|
||||||
|
@ -116,6 +116,8 @@ WebRtcVideoEngine::WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
|
|||||||
voice_engine_(voice_engine),
|
voice_engine_(voice_engine),
|
||||||
log_level_(kDefaultLogSeverity),
|
log_level_(kDefaultLogSeverity),
|
||||||
capture_started_(false) {
|
capture_started_(false) {
|
||||||
|
if(capture_)
|
||||||
|
capture_->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcVideoEngine::WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
|
WebRtcVideoEngine::WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
|
||||||
@ -137,7 +139,7 @@ WebRtcVideoEngine::~WebRtcVideoEngine() {
|
|||||||
Terminate();
|
Terminate();
|
||||||
vie_wrapper_.reset();
|
vie_wrapper_.reset();
|
||||||
if (capture_) {
|
if (capture_) {
|
||||||
webrtc::VideoCaptureModule::Destroy(capture_);
|
capture_->Release();
|
||||||
}
|
}
|
||||||
if (renderer_) {
|
if (renderer_) {
|
||||||
webrtc::VideoRender::DestroyVideoRender(renderer_);
|
webrtc::VideoRender::DestroyVideoRender(renderer_);
|
||||||
@ -382,9 +384,10 @@ bool WebRtcVideoEngine::SetCaptureDevice(const Device* cam) {
|
|||||||
bool WebRtcVideoEngine::SetCaptureModule(webrtc::VideoCaptureModule* vcm) {
|
bool WebRtcVideoEngine::SetCaptureModule(webrtc::VideoCaptureModule* vcm) {
|
||||||
ReleaseCaptureDevice();
|
ReleaseCaptureDevice();
|
||||||
if (capture_) {
|
if (capture_) {
|
||||||
webrtc::VideoCaptureModule::Destroy(capture_);
|
capture_->Release();
|
||||||
}
|
}
|
||||||
capture_ = vcm;
|
capture_ = vcm;
|
||||||
|
capture_->AddRef();
|
||||||
external_capture_ = true;
|
external_capture_ = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user