2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-02-16 18:18:21 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-10-30 21:58:00 +00:00
|
|
|
#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_INCLUDE_VIDEO_CAPTURE_H_
|
|
|
|
|
#define WEBRTC_MODULES_VIDEO_CAPTURE_INCLUDE_VIDEO_CAPTURE_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-10-30 21:58:00 +00:00
|
|
|
#include "webrtc/modules/interface/module.h"
|
|
|
|
|
#include "webrtc/modules/video_capture/include/video_capture_defines.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2012-07-13 22:00:43 +00:00
|
|
|
#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
|
|
|
|
WebRtc_Word32 SetCaptureAndroidVM(void* javaVM, void* javaContext);
|
|
|
|
|
#endif
|
|
|
|
|
|
2011-09-12 08:53:36 +00:00
|
|
|
class VideoCaptureModule: public RefCountedModule {
|
|
|
|
|
public:
|
|
|
|
|
// Interface for receiving information about available camera devices.
|
|
|
|
|
class DeviceInfo {
|
|
|
|
|
public:
|
|
|
|
|
virtual WebRtc_UWord32 NumberOfDevices() = 0;
|
|
|
|
|
|
|
|
|
|
// Returns the available capture devices.
|
|
|
|
|
// deviceNumber - 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,
|
2012-03-01 16:30:40 +00:00
|
|
|
char* deviceNameUTF8,
|
2011-09-12 08:53:36 +00:00
|
|
|
WebRtc_UWord32 deviceNameLength,
|
2012-03-01 16:30:40 +00:00
|
|
|
char* deviceUniqueIdUTF8,
|
2011-09-12 08:53:36 +00:00
|
|
|
WebRtc_UWord32 deviceUniqueIdUTF8Length,
|
2012-03-01 16:30:40 +00:00
|
|
|
char* productUniqueIdUTF8 = 0,
|
2011-09-12 08:53:36 +00:00
|
|
|
WebRtc_UWord32 productUniqueIdUTF8Length = 0) = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Returns the number of capabilities this device.
|
|
|
|
|
virtual WebRtc_Word32 NumberOfCapabilities(
|
2012-03-01 16:30:40 +00:00
|
|
|
const char* deviceUniqueIdUTF8) = 0;
|
2011-09-12 08:53:36 +00:00
|
|
|
|
|
|
|
|
// Gets the capabilities of the named device.
|
|
|
|
|
virtual WebRtc_Word32 GetCapability(
|
2012-03-01 16:30:40 +00:00
|
|
|
const char* deviceUniqueIdUTF8,
|
2011-09-12 08:53:36 +00:00
|
|
|
const WebRtc_UWord32 deviceCapabilityNumber,
|
|
|
|
|
VideoCaptureCapability& capability) = 0;
|
|
|
|
|
|
|
|
|
|
// Gets clockwise angle the captured frames should be rotated in order
|
|
|
|
|
// to be displayed correctly on a normally rotated display.
|
|
|
|
|
virtual WebRtc_Word32 GetOrientation(
|
2012-03-01 16:30:40 +00:00
|
|
|
const char* deviceUniqueIdUTF8,
|
2011-09-12 08:53:36 +00:00
|
|
|
VideoCaptureRotation& orientation) = 0;
|
|
|
|
|
|
|
|
|
|
// Gets the capability that best matches the requested width, height and
|
|
|
|
|
// frame rate.
|
|
|
|
|
// Returns the deviceCapabilityNumber on success.
|
|
|
|
|
virtual WebRtc_Word32 GetBestMatchedCapability(
|
2012-03-01 16:30:40 +00:00
|
|
|
const char* deviceUniqueIdUTF8,
|
2012-02-16 18:18:21 +00:00
|
|
|
const VideoCaptureCapability& requested,
|
2011-09-12 08:53:36 +00:00
|
|
|
VideoCaptureCapability& resulting) = 0;
|
|
|
|
|
|
|
|
|
|
// Display OS /capture device specific settings dialog
|
|
|
|
|
virtual WebRtc_Word32 DisplayCaptureSettingsDialogBox(
|
2012-03-01 16:30:40 +00:00
|
|
|
const char* deviceUniqueIdUTF8,
|
|
|
|
|
const char* dialogTitleUTF8,
|
2011-09-12 08:53:36 +00:00
|
|
|
void* parentWindow,
|
|
|
|
|
WebRtc_UWord32 positionX,
|
|
|
|
|
WebRtc_UWord32 positionY) = 0;
|
|
|
|
|
|
|
|
|
|
virtual ~DeviceInfo() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class VideoCaptureEncodeInterface {
|
|
|
|
|
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;
|
2011-12-02 08:34:05 +00:00
|
|
|
// Inform the encoder about the packet loss and the round-trip time.
|
2011-09-12 08:53:36 +00:00
|
|
|
// - packetLoss : Fraction lost
|
|
|
|
|
// (loss rate in percent = 100 * packetLoss / 255).
|
2011-12-02 08:34:05 +00:00
|
|
|
// - rtt : Round-trip time in milliseconds.
|
|
|
|
|
virtual WebRtc_Word32 SetChannelParameters(WebRtc_UWord32 packetLoss,
|
|
|
|
|
int rtt) = 0;
|
2011-09-12 08:53:36 +00:00
|
|
|
|
|
|
|
|
// Encode the next frame as key frame.
|
|
|
|
|
virtual WebRtc_Word32 EncodeFrameType(const FrameType type) = 0;
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~VideoCaptureEncodeInterface() {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Register capture data callback
|
|
|
|
|
virtual WebRtc_Word32 RegisterCaptureDataCallback(
|
|
|
|
|
VideoCaptureDataCallback& dataCallback) = 0;
|
|
|
|
|
|
|
|
|
|
// Remove capture data callback
|
|
|
|
|
virtual WebRtc_Word32 DeRegisterCaptureDataCallback() = 0;
|
|
|
|
|
|
|
|
|
|
// Register capture callback.
|
|
|
|
|
virtual WebRtc_Word32 RegisterCaptureCallback(
|
|
|
|
|
VideoCaptureFeedBack& callBack) = 0;
|
|
|
|
|
|
|
|
|
|
// Remove capture callback.
|
|
|
|
|
virtual WebRtc_Word32 DeRegisterCaptureCallback() = 0;
|
|
|
|
|
|
|
|
|
|
// Start capture device
|
|
|
|
|
virtual WebRtc_Word32 StartCapture(
|
|
|
|
|
const VideoCaptureCapability& capability) = 0;
|
|
|
|
|
|
|
|
|
|
virtual WebRtc_Word32 StopCapture() = 0;
|
|
|
|
|
|
|
|
|
|
// Returns the name of the device used by this module.
|
2012-03-01 16:30:40 +00:00
|
|
|
virtual const char* CurrentDeviceName() const = 0;
|
2011-09-12 08:53:36 +00:00
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
|
virtual WebRtc_Word32 EnableFrameRateCallback(const bool enable) = 0;
|
|
|
|
|
virtual WebRtc_Word32 EnableNoPictureAlarm(const bool enable) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~VideoCaptureModule() {};
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
2011-09-12 08:53:36 +00:00
|
|
|
|
|
|
|
|
} // namespace webrtc
|
2012-10-30 21:58:00 +00:00
|
|
|
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_INCLUDE_VIDEO_CAPTURE_H_
|