git-svn-id: http://webrtc.googlecode.com/svn/trunk@9 4adac7df-926f-26a2-2b94-8c16560cd09d

This commit is contained in:
niklase@google.com
2011-05-30 11:43:19 +00:00
parent 47bdc463db
commit bb8a15d8b5
177 changed files with 45468 additions and 0 deletions

View File

@@ -0,0 +1,153 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
//
// - Creating and deleting VideoEngine instances.
// - Creating and deleting channels.
// - Connect a video channel with a corresponding voice channel for audio/video synchronization.
// - Start and stop sending and receiving.
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_BASE_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_BASE_H_
#include "common_types.h"
// Forward declarations
namespace webrtc
{
class VoiceEngine;
// ----------------------------------------------------------------------------
// VideoEngine Callbacks
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViEBaseObserver
{
public:
// This method will be called periodically if the average system CPU usage
// exceeds 75%.
virtual void PerformanceAlarm(const unsigned int cpuLoad) = 0;
protected:
virtual ~ViEBaseObserver() {};
};
// ----------------------------------------------------------------------------
// VideoEngine
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT VideoEngine
{
public:
// Creates a VideoEngine object, which can then be used to acquire subAPIs.
static VideoEngine* Create();
// Deletes a VideoEngine instance.
static bool Delete(VideoEngine*& videoEngine);
// Specifies the amount and type of trace information, which will be created
// by the VideoEngine.
static int SetTraceFilter(const unsigned int filter);
// Sets the name of the trace file and enables nonencrypted trace messages.
static int SetTraceFile(const char* fileNameUTF8,
const bool addFileCounter = false);
// Installs the TraceCallback implementation to ensure that the VideoEngine
// user receives callbacks for generated trace messages.
static int SetTraceCallback(TraceCallback* callback);
// Android specific
// Provides VideoEngine with pointers to objects supplied by the Java
// applications JNI interface.
static int SetAndroidObjects(void* javaVM, void* javaContext);
protected:
VideoEngine() {};
virtual ~VideoEngine() {};
};
// ----------------------------------------------------------------------------
// VideoBase
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViEBase
{
public:
// Factory for the ViEBase subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViEBase* GetInterface(VideoEngine* videoEngine);
// Releases the ViEBase sub-API and decreases an internal reference counter.
// Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// Initiates all common parts of the VideoEngine.
virtual int Init() = 0;
// Connects a VideoEngine instance to a VoiceEngine instance for audio video
// synchronization.
virtual int SetVoiceEngine(VoiceEngine* ptrVoiceEngine) = 0;
// Creates a new channel, either with a new encoder instance or by sharing
// encoder instance with an already created channel.
virtual int CreateChannel(int& videoChannel) = 0;
virtual int CreateChannel(int& videoChannel, int originalChannel) = 0;
// Deletes an existing channel and releases the utilized resources.
virtual int DeleteChannel(const int videoChannel) = 0;
// Specifies the VoiceEngine and VideoEngine channel pair to use for
// audio/video synchronization.
virtual int ConnectAudioChannel(const int videoChannel,
const int audioChannel) = 0;
// Disconnects a previously paired VideoEngine and VoiceEngine channel pair.
virtual int DisconnectAudioChannel(const int videoChannel) = 0;
// Starts sending packets to an already specified IP address and port number
// for a specified channel.
virtual int StartSend(const int videoChannel) = 0;
// Stops packets from being sent for a specified channel.
virtual int StopSend(const int videoChannel) = 0;
// Prepares VideoEngine for receiving packets on the specified channel.
virtual int StartReceive(const int videoChannel) = 0;
// Stops receiving incoming RTP and RTCP packets on the specified channel.
virtual int StopReceive(const int videoChannel) = 0;
// Registers an instance of a user implementation of the ViEBase
// observer.
virtual int RegisterObserver(ViEBaseObserver& observer) = 0;
// Removes an already registered instance of ViEBaseObserver.
virtual int DeregisterObserver() = 0;
// Retrieves the version information for VideoEngine and its components.
virtual int GetVersion(char version[1024]) = 0;
// Returns the last VideoEngine error code.
virtual int LastError() = 0;
protected:
ViEBase() {};
virtual ~ViEBase(){};
};
} // namespace webrtc
#endif // #define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_BASE_H_

View File

@@ -0,0 +1,234 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
//
// - Allocating capture devices.
// - Connect a capture device with one or more channels.
// - Start and stop capture devices.
// - Getting capture device capabilities.
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CAPTURE_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CAPTURE_H_
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
class VideoCaptureModule;
// This structure describes one set of the supported capabilities for a capture
// device.
struct CaptureCapability
{
unsigned int width;
unsigned int height;
unsigned int maxFPS;
RawVideoType rawType;
VideoCodecType codecType;
unsigned int expectedCaptureDelay;
bool interlaced;
CaptureCapability()
{
width = 0;
height = 0;
maxFPS = 0;
rawType = kVideoI420;
codecType = kVideoCodecUnknown;
expectedCaptureDelay = 0;
interlaced = false;
}
};
// This enumerator tells the current brightness alarm mode.
enum Brightness
{
Normal = 0,
Bright = 1,
Dark = 2
};
// This enumerator describes the capture alarm mode.
enum CaptureAlarm
{
AlarmRaised = 0,
AlarmCleared = 1
};
enum RotateCapturedFrame
{
RotateCapturedFrame_0 = 0,
RotateCapturedFrame_90 = 90,
RotateCapturedFrame_180 = 180,
RotateCapturedFrame_270 = 270
};
// This class declares an abstract interface to be used when using an external
// capture device. The user implemented derived class is registered using
// AllocateExternalCaptureDevice and is released using ReleaseCaptureDevice.
class WEBRTC_DLLEXPORT ViEExternalCapture
{
public:
ViEExternalCapture() {}
virtual ~ViEExternalCapture() {}
// This method is called by the user to deliver a new captured frame to
// VideoEngine.
virtual int IncomingFrame(unsigned char* videoFrame,
unsigned int videoFrameLength,
unsigned short width, unsigned short height,
RawVideoType videoType,
unsigned long long captureTime = 0) = 0;
};
// ----------------------------------------------------------------------------
// ViECaptureObserver
// ----------------------------------------------------------------------------
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterObserver() and
// deregistered using DeregisterObserver().
class WEBRTC_DLLEXPORT ViECaptureObserver
{
public:
// This method is called if a bright or dark captured image is detected.
virtual void BrightnessAlarm(const int captureId,
const Brightness brightness) = 0;
// This method is called periodically telling the capture device frame rate.
virtual void CapturedFrameRate(const int captureId,
const unsigned char frameRate) = 0;
// This method is called if the capture device stops delivering images to
// VideoEngine.
virtual void NoPictureAlarm(const int captureId,
const CaptureAlarm alarm) = 0;
protected:
virtual ~ViECaptureObserver()
{
}
};
// ----------------------------------------------------------------------------
// ViECapture
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViECapture
{
public:
// Factory for the ViECapture subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViECapture* GetInterface(VideoEngine* videoEngine);
// Releases the ViECapture sub-API and decreases an internal reference
// counter.
// Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// Gets the number of available capture devices.
virtual int NumberOfCaptureDevices() = 0;
// Gets the name and unique id of a capture device.
virtual int GetCaptureDevice(unsigned int listNumber, char* deviceNameUTF8,
const unsigned int deviceNameUTF8Length,
char* uniqueIdUTF8,
const unsigned int uniqueIdUTF8Length) = 0;
// Allocates a capture device to be used in VideoEngine.
virtual int AllocateCaptureDevice(const char* uniqueIdUTF8,
const unsigned int uniqueIdUTF8Length,
int& captureId) = 0;
// Registers an external capture device to be used in VideoEngine
virtual int AllocateExternalCaptureDevice(
int& captureId, ViEExternalCapture *&externalCapture) = 0;
// Use capture device using external capture module.
virtual int AllocateCaptureDevice(VideoCaptureModule& captureModule,
int& captureId) = 0;
// Releases a capture device and makes it available for other applications.
virtual int ReleaseCaptureDevice(const int captureId) = 0;
// This function connects a capture device with a channel. Multiple channels
// can be connected to the same capture device.
virtual int ConnectCaptureDevice(const int captureId,
const int videoChannel) = 0;
// Disconnects a capture device as input for a specified channel.
virtual int DisconnectCaptureDevice(const int videoChannel) = 0;
// Makes a capture device start capturing video frames.
virtual int StartCapture(const int captureId,
const CaptureCapability captureCapability =
CaptureCapability()) = 0;
// Stops a started capture device from capturing video frames.
virtual int StopCapture(const int captureId) = 0;
// Rotates captured frames before encoding and sending.
// Used on mobile devices with rotates cameras.
virtual int SetRotateCapturedFrames(const int captureId,
const RotateCapturedFrame rotation) = 0;
// This function sets the expected delay from when a video frame is captured
// to when that frame is delivered to VideoEngine.
virtual int SetCaptureDelay(const int captureId,
const unsigned int captureDelayMs) = 0;
// Returns the number of sets of capture capabilities the capture device
// supports.
virtual int NumberOfCapabilities(const char* uniqueIdUTF8,
const unsigned int uniqueIdUTF8Length) = 0;
// Gets a set of capture capabilities for a specified capture device.
virtual int GetCaptureCapability(const char* uniqueIdUTF8,
const unsigned int uniqueIdUTF8Length,
const unsigned int capabilityNumber,
CaptureCapability& capability) = 0;
// Displays the capture device property dialog box for the specified capture
// device. Windows only.
virtual int ShowCaptureSettingsDialogBox(
const char* uniqueIdUTF8, const unsigned int uniqueIdUTF8Length,
const char* dialogTitle, void* parentWindow = NULL,
const unsigned int x = 200, const unsigned int y = 200) = 0;
// Gets the clockwise angle the frames from the camera must be rotated in
// order to display the frames correctly if the display is rotated in its
// natural orientation.
virtual int GetOrientation(const char* uniqueIdUTF8,
RotateCapturedFrame &orientation) = 0;
// Enables brightness alarm detection and the brightness alarm callback.
virtual int EnableBrightnessAlarm(const int captureId,
const bool enable) = 0;
// Registers an instance of a user implementation of the ViECaptureObserver.
virtual int RegisterObserver(const int captureId,
ViECaptureObserver& observer) = 0;
// Removes an already registered instance of ViECaptureObserver.
virtual int DeregisterObserver(const int captureId) = 0;
protected:
ViECapture() {};
virtual ~ViECapture() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CAPTURE_H_

View File

@@ -0,0 +1,185 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
// - Setting send and receive codecs.
// - Codec specific settings.
// - Key frame signaling.
// - Stream management settings.
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CODEC_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CODEC_H_
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
struct VideoCodec;
// ----------------------------------------------------------------------------
// ViEEncoderObserver
// ----------------------------------------------------------------------------
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterEncoderObserver()
// and deregistered using DeregisterEncoderObserver().
class WEBRTC_DLLEXPORT ViEEncoderObserver
{
public:
// This method is called once per second with the current encoded frame rate
// and bit rate.
virtual void OutgoingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate) = 0;
protected:
virtual ~ViEEncoderObserver() {};
};
// ----------------------------------------------------------------------------
// ViEEncoderObserver
// ----------------------------------------------------------------------------
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterDecoderObserver()
// and deregistered using DeregisterDecoderObserver().
class WEBRTC_DLLEXPORT ViEDecoderObserver
{
public:
// This method is called when a new incoming stream is detected, normally
// triggered by a new incoming SSRC or payload type.
virtual void IncomingCodecChanged(const int videoChannel,
const VideoCodec& videoCodec) = 0;
// This method is called once per second containing the frame rate and bit
// rate for the incoming stream
virtual void IncomingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate) = 0;
// This method is called when the decoder needs a new key frame from encoder
// on the sender.
virtual void RequestNewKeyFrame(const int videoChannel) = 0;
protected:
virtual ~ViEDecoderObserver() {};
};
// ----------------------------------------------------------------------------
// ViECodec
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViECodec
{
public:
// Factory for the ViECodec subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViECodec* GetInterface(VideoEngine* videoEngine);
// Releases the ViECodec sub-API and decreases an internal reference
// counter.
// Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// Gets the number of available codecs for the VideoEngine build.
virtual int NumberOfCodecs() const = 0;
// Gets a VideoCodec struct for a codec containing the default configuration
// for that codec type.
virtual int GetCodec(const unsigned char listNumber,
VideoCodec& videoCodec) const = 0;
// Sets the send codec to use for a specified channel.
virtual int SetSendCodec(const int videoChannel,
const VideoCodec& videoCodec) = 0;
// Gets the current send codec settings.
virtual int GetSendCodec(const int videoChannel,
VideoCodec& videoCodec) const = 0;
// Prepares VideoEngine to receive a certain codec type and setting for a
// specified payload type.
virtual int SetReceiveCodec(const int videoChannel,
const VideoCodec& videoCodec) = 0;
// Gets the current receive codec.
virtual int GetReceiveCodec(const int videoChannel,
VideoCodec& videoCodec) const = 0;
// This function is used to get codec configuration parameters to be
// signaled from the encoder to the decoder in the call setup.
virtual int GetCodecConfigParameters(
const int videoChannel,
unsigned char configParameters[kConfigParameterSize],
unsigned char& configParametersSize) const = 0;
// Enables advanced scaling of the captured video stream if the stream
// differs from the send codec settings.
virtual int SetImageScaleStatus(const int videoChannel,
const bool enable) = 0;
// Gets the number of sent key frames and number of sent delta frames.
virtual int GetSendCodecStastistics(const int videoChannel,
unsigned int& keyFrames,
unsigned int& deltaFrames) const = 0;
// Gets the number of decoded key frames and number of decoded delta frames.
virtual int GetReceiveCodecStastistics(const int videoChannel,
unsigned int& keyFrames,
unsigned int& deltaFrames) const = 0;
// Enables key frame request callback in ViEDecoderObserver.
virtual int SetKeyFrameRequestCallbackStatus(const int videoChannel,
const bool enable) = 0;
// Enables key frame requests for detected lost packets.
virtual int SetSignalKeyPacketLossStatus(
const int videoChannel, const bool enable,
const bool onlyKeyFrames = false) = 0;
// Registers an instance of a user implementation of the ViEEncoderObserver.
virtual int RegisterEncoderObserver(const int videoChannel,
ViEEncoderObserver& observer) = 0;
// Removes an already registered instance of ViEEncoderObserver.
virtual int DeregisterEncoderObserver(const int videoChannel) = 0;
// Registers an instance of a user implementation of the ViEDecoderObserver.
virtual int RegisterDecoderObserver(const int videoChannel,
ViEDecoderObserver& observer) = 0;
// Removes an already registered instance of ViEDecoderObserver.
virtual int DeregisterDecoderObserver(const int videoChannel) = 0;
// This function forces the next encoded frame to be a key frame. This is
// normally used when the remote endpoint only supports outband key frame
// request.
virtual int SendKeyFrame(const int videoChannel) = 0;
// This function makes the decoder wait for a key frame before starting to
// decode the incoming video stream.
virtual int WaitForFirstKeyFrame(const int videoChannel,
const bool wait) = 0;
// This function makes VideoEngine decode all incoming H.263 key frames as
// delta frames and all incoming delta frames as key frames.
virtual int SetInverseH263Logic(int videoChannel, bool enable) = 0;
protected:
ViECodec() {};
virtual ~ViECodec() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CODEC_H_

View File

@@ -0,0 +1,91 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
// - Secure RTP (SRTP).
// - External encryption and decryption.
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ENCRYPTION_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ENCRYPTION_H_
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
// ----------------------------------------------------------------------------
// ViEEncryption
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViEEncryption
{
public:
enum
{
kMaxSrtpKeyLength = 30
};
// Factory for the ViEEncryption subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViEEncryption* GetInterface(VideoEngine* videoEngine);
// Releases the ViEEncryption sub-API and decreases an internal reference
// counter.
// Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// This function enables SRTP on send packets for a specific channel.
virtual int EnableSRTPSend(const int videoChannel,
const CipherTypes cipherType,
const unsigned int cipherKeyLength,
const AuthenticationTypes authType,
const unsigned int authKeyLength,
const unsigned int authTagLength,
const SecurityLevels level,
const unsigned char key[kMaxSrtpKeyLength],
const bool useForRTCP = false) = 0;
// This function disables SRTP for the specified channel.
virtual int DisableSRTPSend(const int videoChannel) = 0;
// This function enables SRTP on the received packets for a specific
// channel.
virtual int EnableSRTPReceive(const int videoChannel,
const CipherTypes cipherType,
const unsigned int cipherKeyLength,
const AuthenticationTypes authType,
const unsigned int authKeyLength,
const unsigned int authTagLength,
const SecurityLevels level,
const unsigned char key[kMaxSrtpKeyLength],
const bool useForRTCP = false) = 0;
// This function disables SRTP on received packets for a specific channel.
virtual int DisableSRTPReceive(const int videoChannel) = 0;
// This function registers a encryption derived instance and enables
// external encryption for the specified channel.
virtual int RegisterExternalEncryption(const int videoChannel,
Encryption& encryption) = 0;
// This function deregisters a registered encryption derived instance
// and disables external encryption.
virtual int DeregisterExternalEncryption(const int videoChannel) = 0;
protected:
ViEEncryption() {};
virtual ~ViEEncryption() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ENCRYPTION_H_

View File

@@ -0,0 +1,121 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ERRORS_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ERRORS_H_
enum ViEErrors {
//ViEBase
kViENotInitialized = 12000, // Init has not been called successfully.
kViEBaseVoEFailure, // SetVoiceEngine. ViE failed to use VE instance. Check VE instance pointer.ConnectAudioChannel failed to set voice channel. Have SetVoiceEngine been called? Is the voice channel correct.
kViEBaseChannelCreationFailed, // CreateChannel.
kViEBaseInvalidChannelId, // The channel does not exist.
kViEAPIDoesNotExist, // Release called on Interface that has not been created.
kViEBaseInvalidArgument,
kViEBaseAlreadySending, // StartSend called on channel that is already sending.
kViEBaseNotSending, // StopSend called on channel that is not sending.
kViEBaseAlreadyReceiving, // StartReceive called on channel that is already receiving.
kViEBaseObserverAlreadyRegistered, // RegisterObserver- an observer has already been set.
kViEBaseObserverNotRegistered, // DeregisterObserver - no observer has been registered.
kViEBaseUnknownError, // An unknown error has occurred. Check the log file.
//ViECodec
kViECodecInvalidArgument = 12100, // Wrong input parameter to function.
kViECodecObserverAlreadyRegistered, // RegisterEncoderObserver, RegisterDecoderObserver.
kViECodecObserverNotRegistered, // DeregisterEncoderObserver, DeregisterDecoderObserver.
kViECodecInvalidCodec, // SetSendCodec,SetReceiveCodec- The codec structure is invalid.
kViECodecInvalidChannelId, // The channel does not exist.
kViECodecInUse, // SetSendCodec- Can't change codec size or type when multiple channels use the same encoder.
kViECodecUnknownError, // An unknown error has occurred. Check the log file.
//ViERender
kViERenderInvalidRenderId = 12200, // No renderer with the ID exist. In AddRenderer - The render ID is invalid. No capture device, channel or file is allocated with that id.
kViERenderAlreadyExists, // AddRenderer: the renderer already exist.
kViERenderInvalidFrameFormat, // AddRender (external renderer). The user has requested a frame format that we don't support.
kViERenderUnknownError, // An unknown error has occurred. Check the log file.
//ViECapture
kViECaptureDeviceAlreadyConnected = 12300, // ConnectCaptureDevice - A capture device has already been connected to this video channel.
kViECaptureDeviceDoesnNotExist, // No capture device exist with the provided capture id or unique name.
kViECaptureDeviceInvalidChannelId, // ConnectCaptureDevice, DisconnectCaptureDevice- No Channel exist with the provided channel id.
kViECaptureDeviceNotConnected, // DisconnectCaptureDevice- No capture device is connected to the channel.
kViECaptureDeviceNotStarted, // Stop- The capture device is not started.
kViECaptureDeviceAlreadyStarted, // Start- The capture device is already started.
kViECaptureDeviceAlreadyAllocated, // AllocateCaptureDevice The device is already allocated.
kViECaptureDeviceMaxNoDevicesAllocated, // AllocateCaptureDevice Max number of devices already allocated.
kViECaptureObserverAlreadyRegistered, // RegisterObserver- An observer is already registered. Need to deregister first.
kViECaptureDeviceObserverNotRegistered, // DeregisterObserver- No observer is registered.
kViECaptureDeviceUnknownError, // An unknown error has occurred. Check the log file.
kViECaptureDeviceMacQtkitNotSupported, // QTKit handles the capture devices automatically. Thus querying capture capabilities is not supported.
//ViEFile
kViEFileInvalidChannelId = 12400, // No Channel exist with the provided channel id.
kViEFileInvalidArgument, // Incorrect input argument
kViEFileAlreadyRecording, // StartRecordOutgoingVideo - already recording channel
kViEFileVoENotSet, // StartRecordOutgoingVideo. Failed to access voice engine. Has SetVoiceEngine been called?
kViEFileNotRecording, // StopRecordOutgoingVideo
kViEFileMaxNoOfFilesOpened, // StartPlayFile
kViEFileNotPlaying, // StopPlayFile. The file with the provided id is not playing.
kViEFileObserverAlreadyRegistered, // RegisterObserver
kViEFileObserverNotRegistered, // DeregisterObserver
kViEFileInputAlreadyConnected, // SendFileOnChannel- the video channel already have a connected input.
kViEFileNotConnected, // StopSendFileOnChannel- No file is being sent on the channel.
kViEFileVoEFailure, // SendFileOnChannel,StartPlayAudioLocally - failed to play audio stream
kViEFileInvalidRenderId, // SetRenderTimeoutImage and SetRenderStartImage: Renderer with the provided render id does not exist.
kViEFileInvalidFile, // Can't open the file with provided filename. Is the path and file format correct?
kViEFileInvalidCapture, // Can't use ViEPicture. Is the object correct?
kViEFileSetRenderTimeoutError, // SetRenderTimeoutImage- Please see log file.
kViEFileInvalidCaptureId, // SetCaptureDeviceImage capture id does not exist.
kViEFileSetCaptureImageError, // SetCaptureDeviceImage error. Please see log file.
kViEFileSetStartImageError, // SetRenderStartImage error. Please see log file.
kViEFileUnknownError, // An unknown error has occurred. Check the log file.
//ViENetwork
kViENetworkInvalidChannelId = 12500, // No Channel exist with the provided channel id.
kViENetworkAlreadyReceiving, // SetLocalReceiver: Can not change ports while receiving.
kViENetworkLocalReceiverNotSet, // GetLocalReceiver: SetLocalReceiver not called.
kViENetworkAlreadySending, // SetSendDestination
kViENetworkDestinationNotSet, // GetSendDestination
kViENetworkInvalidArgument, // GetLocalIP- Check function arguments.
kViENetworkSendCodecNotSet, // SetSendGQoS- Need to set the send codec first.
kViENetworkServiceTypeNotSupported, // SetSendGQoS
kViENetworkNotSupported, // SetSendGQoS Not supported on this OS.
kViENetworkObserverAlreadyRegistered, // RegisterObserver
kViENetworkObserverNotRegistered, // SetPeriodicDeadOrAliveStatus - Need to call RegisterObserver first, DeregisterObserver if no observer is registered.
kViENetworkUnknownError, // An unknown error has occurred. Check the log file.
//ViERTP_RTCP
kViERtpRtcpInvalidChannelId = 12600, // No Channel exist with the provided channel id.
kViERtpRtcpAlreadySending, // The channel is already sending. Need to stop send before calling this API.
kViERtpRtcpNotSending, // The channel needs to be sending in order for this function to work.
kViERtpRtcpRtcpDisabled, // Functions failed because RTCP is disabled.
kViERtpRtcpObserverAlreadyRegistered, // An observer is already registered. Need to deregister the old first.
kViERtpRtcpObserverNotRegistered, // No observer registered.
kViERtpRtcpUnknownError, // An unknown error has occurred. Check the log file.
//ViEEncryption
kViEEncryptionInvalidChannelId = 12700, // Channel id does not exist.
kViEEncryptionInvalidSrtpParameter, // EnableSRTPSend, EnableSRTPReceive- Check the SRTP parameters.
kViEEncryptionSrtpNotSupported, // This build does not support SRTP.
kViEEncryptionUnknownError, // An unknown error has occurred. Check the log file.
//ViEImageProcess
kViEImageProcessInvalidChannelId = 12800, // No Channel exist with the provided channel id.
kViEImageProcessInvalidCaptureId, // No capture device exist with the provided capture id.
kViEImageProcessFilterExists, // RegisterCaptureEffectFilter,RegisterSendEffectFilter,RegisterRenderEffectFilter - Effect filter already registered.
kViEImageProcessFilterDoesNotExist, // DeRegisterCaptureEffectFilter,DeRegisterSendEffectFilter,DeRegisterRenderEffectFilter - Effect filter not registered.
kViEImageProcessAlreadyEnabled, // EnableDeflickering,EnableDenoising,EnableColorEnhancement- Function already enabled.
kViEImageProcessAlreadyDisabled, // EnableDeflickering,EnableDenoising,EnableColorEnhancement- Function already disabled.
kViEImageProcessUnknownError // An unknown error has occurred. Check the log file.
};
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ERRORS_H_

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_EXTERNAL_CODEC_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_EXTERNAL_CODEC_H_
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
class VideoEncoder;
class VideoDecoder;
// ----------------------------------------------------------------------------
// ViEExternalCodec
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViEExternalCodec
{
public:
static ViEExternalCodec* GetInterface(VideoEngine* videoEngine);
virtual int Release() = 0;
virtual int RegisterExternalSendCodec(const int videoChannel,
const unsigned char plType,
VideoEncoder* encoder) = 0;
virtual int DeRegisterExternalSendCodec(const int videoChannel,
const unsigned char plType) = 0;
virtual int RegisterExternalReceiveCodec(const int videoChannel,
const unsigned int plType,
VideoDecoder* decoder,
bool decoderRender = false,
int renderDelay = 0) = 0;
virtual int DeRegisterExternalReceiveCodec(const int videoChannel,
const unsigned char plType) = 0;
protected:
ViEExternalCodec() {};
virtual ~ViEExternalCodec() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_EXTERNAL_CODEC_H_

View File

@@ -0,0 +1,229 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
// - File recording and playing.
// - Snapshots.
// - Background images.
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_FILE_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_FILE_H_
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
struct VideoCodec;
// This structure contains picture data and describes the picture type.
struct ViEPicture
{
unsigned char* data;
unsigned int size;
unsigned int width;
unsigned int height;
RawVideoType type;
ViEPicture()
{
data = NULL;
size = 0;
width = 0;
height = 0;
type = kVideoI420;
}
//call FreePicture to free data
~ViEPicture()
{
data = NULL;
size = 0;
width = 0;
height = 0;
type = kVideoUnknown;
}
};
// This enumerator tells which audio source to use for media files.
enum AudioSource
{
NO_AUDIO,
MICROPHONE,
PLAYOUT,
VOICECALL
};
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterObserver() and
// deregistered using DeregisterObserver().
class WEBRTC_DLLEXPORT ViEFileObserver
{
public:
// This method is called when the end is reached of a played file.
virtual void PlayFileEnded(const WebRtc_Word32 fileId) = 0;
protected:
virtual ~ViEFileObserver() {};
};
// ----------------------------------------------------------------------------
// ViEFile
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViEFile
{
public:
// Factory for the ViEFile subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViEFile* GetInterface(VideoEngine* videoEngine);
// Releases the ViEFile sub-API and decreases an internal reference counter.
// Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// Starts playing a video file.
virtual int StartPlayFile(const char* fileNameUTF8, int& fileId,
const bool loop = false,
const FileFormats fileFormat =
kFileFormatAviFile) = 0;
// Stops a file from being played.
virtual int StopPlayFile(const int fileId) = 0;
// Registers an instance of a user implementation of the ViEFileObserver.
virtual int RegisterObserver(int fileId, ViEFileObserver& observer) = 0;
// Removes an already registered instance of ViEFileObserver.
virtual int DeregisterObserver(int fileId, ViEFileObserver& observer) = 0;
// This function tells which channel, if any, the file should be sent on.
virtual int SendFileOnChannel(const int fileId, const int videoChannel) = 0;
// Stops a file from being sent on a a channel.
virtual int StopSendFileOnChannel(const int videoChannel) = 0;
// Starts playing the file audio as microphone input for the specified voice
// channel.
virtual int StartPlayFileAsMicrophone(const int fileId,
const int audioChannel,
bool mixMicrophone = false,
float volumeScaling = 1) = 0;
// The function stop the audio from being played on a VoiceEngine channel.
virtual int StopPlayFileAsMicrophone(const int fileId,
const int audioChannel) = 0;
// The function plays and mixes the file audio with the local speaker signal
// for playout.
virtual int StartPlayAudioLocally(const int fileId, const int audioChannel,
float volumeScaling = 1) = 0;
// Stops the audio from a file from being played locally.
virtual int StopPlayAudioLocally(const int fileId,
const int audioChannel) = 0;
// This function starts recording the video transmitted to another endpoint.
virtual int StartRecordOutgoingVideo(const int videoChannel,
const char* fileNameUTF8,
AudioSource audioSource,
const CodecInst& audioCodec,
const VideoCodec& videoCodec,
const FileFormats fileFormat =
kFileFormatAviFile) =0;
// This function starts recording the incoming video stream on a channel.
virtual int StartRecordIncomingVideo(const int videoChannel,
const char* fileNameUTF8,
AudioSource audioSource,
const CodecInst& audioCodec,
const VideoCodec& videoCodec,
const FileFormats fileFormat =
kFileFormatAviFile) = 0;
// Stops the file recording of the outgoing stream.
virtual int StopRecordOutgoingVideo(const int videoChannel) = 0;
// Stops the file recording of the incoming stream.
virtual int StopRecordIncomingVideo(const int videoChannel) = 0;
// Gets the audio codec, video codec and file format of a recorded file.
virtual int GetFileInformation(const char* fileName,
VideoCodec& videoCodec,
CodecInst& audioCodec,
const FileFormats fileFormat =
kFileFormatAviFile) = 0;
// The function takes a snapshot of the last rendered image for a video
// channel.
virtual int GetRenderSnapshot(const int videoChannel,
const char* fileNameUTF8) = 0;
// The function takes a snapshot of the last rendered image for a video
// channel
virtual int GetRenderSnapshot(const int videoChannel,
ViEPicture& picture) = 0;
// The function takes a snapshot of the last captured image by a specified
// capture device.
virtual int GetCaptureDeviceSnapshot(const int captureId,
const char* fileNameUTF8) = 0;
// The function takes a snapshot of the last captured image by a specified
// capture device.
virtual int GetCaptureDeviceSnapshot(const int captureId,
ViEPicture& picture) = 0;
// This function sets a jpg image to show before the first frame is captured
// by the capture device. This frame will be encoded and transmitted to a
// possible receiver
virtual int SetCaptureDeviceImage(const int captureId,
const char* fileNameUTF8) = 0;
// This function sets an image to show before the first frame is captured by
// the capture device. This frame will be encoded and transmitted to a
// possible receiver
virtual int SetCaptureDeviceImage(const int captureId,
const ViEPicture& picture) = 0;
virtual int FreePicture(ViEPicture& picture) = 0;
// This function sets a jpg image to render before the first received video
// frame is decoded for a specified channel.
virtual int SetRenderStartImage(const int videoChannel,
const char* fileNameUTF8) = 0;
// This function sets an image to render before the first received video
// frame is decoded for a specified channel.
virtual int SetRenderStartImage(const int videoChannel,
const ViEPicture& picture) = 0;
// This function sets a jpg image to render if no frame is decoded for a
// specified time interval.
virtual int SetRenderTimeoutImage(const int videoChannel,
const char* fileNameUTF8,
const unsigned int timeoutMs = 1000) = 0;
// This function sets an image to render if no frame is decoded for a
// specified time interval.
virtual int SetRenderTimeoutImage(const int videoChannel,
const ViEPicture& picture,
const unsigned int timeoutMs) = 0;
protected:
ViEFile() {};
virtual ~ViEFile() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_FILE_H_

View File

@@ -0,0 +1,108 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
// - Effect filters
// - Deflickering
// - Denoising
// - Color enhancement
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_IMAGE_PROCESS_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_IMAGE_PROCESS_H_
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
// ----------------------------------------------------------------------------
// ViEEffectFilter
// ----------------------------------------------------------------------------
// This class declares an abstract interface for a user defined effect filter.
// The effect filter is registered using RegisterCaptureEffectFilter(),
// RegisterSendEffectFilter() or RegisterRenderEffectFilter() and deregistered
// with the corresponding deregister function.
class WEBRTC_DLLEXPORT ViEEffectFilter
{
public:
// This method is called with an I420 video frame allowing the user to
// modify the video frame.
virtual int Transform(int size, unsigned char* frameBuffer,
unsigned int timeStamp90KHz, unsigned int width,
unsigned int height) = 0;
protected:
ViEEffectFilter() {}
virtual ~ViEEffectFilter(){}
};
// ----------------------------------------------------------------------------
// ViEImageProcess
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViEImageProcess
{
public:
// Factory for the ViEImageProcess subAPI and increases an internal
// reference counter if successful. Returns NULL if the API is not supported
// or if construction fails.
static ViEImageProcess* GetInterface(VideoEngine* videoEngine);
// Releases the ViEImageProcess sub-API and decreases an internal reference
// counter. Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// This function registers a EffectFilter to use for a specified capture
// device.
virtual int RegisterCaptureEffectFilter(const int captureId,
ViEEffectFilter& captureFilter) = 0;
// This function deregisters a EffectFilter for a specified capture device.
virtual int DeregisterCaptureEffectFilter(const int captureId) = 0;
// This function registers an EffectFilter to use for a specified channel.
virtual int RegisterSendEffectFilter(const int videoChannel,
ViEEffectFilter& sendFilter) = 0;
// This function deregisters a send effect filter for a specified channel.
virtual int DeregisterSendEffectFilter(const int videoChannel) = 0;
// This function registers a EffectFilter to use for the rendered video
// stream on an incoming channel.
virtual int RegisterRenderEffectFilter(const int videoChannel,
ViEEffectFilter& renderFilter) = 0;
// This function deregisters a render effect filter for a specified channel.
virtual int DeregisterRenderEffectFilter(const int videoChannel) = 0;
// All cameras run the risk of getting in almost perfect sync with
// florescent lamps, which will result in a very annoying flickering of the
// image. Most cameras have some type of filter to protect against this but
// not all of them succeed. Enabling this function will remove the flicker.
virtual int EnableDeflickering(const int captureId, const bool enable) = 0;
// Some cameras produce very noisy captured images, especially in lowlight
// conditions. This functionality will reduce the camera noise.
virtual int EnableDenoising(const int captureId, const bool enable) = 0;
// This function enhances the colors on the decoded video stream, enabled by
// default.
virtual int EnableColorEnhancement(const int videoChannel,
const bool enable) = 0;
protected:
ViEImageProcess() {};
virtual ~ViEImageProcess() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_IMAGE_PROCESS_H_

View File

@@ -0,0 +1,214 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_NETWORK_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_NETWORK_H_
// This sub-API supports the following functionalities:
// - Configuring send and receive addresses.
// - External transport support.
// - Port and address filters.
// - Windows GQoS functions and ToS functions.
// - Packet timeout notification.
// - DeadorAlive connection observations.
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
class Transport;
// ----------------------------------------------------------------------------
// ViENetworkObserver
// ----------------------------------------------------------------------------
// This enumerator describes VideoEngine packet timeout states.
enum ViEPacketTimeout
{
NoPacket = 0,
PacketReceived = 1
};
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterObserver() and
// deregistered using DeregisterObserver().
class WEBRTC_DLLEXPORT ViENetworkObserver
{
public:
// This method will be called periodically delivering a deadoralive
// decision for a specified channel.
virtual void OnPeriodicDeadOrAlive(const int videoChannel,
const bool alive) = 0;
// This method is called once if a packet timeout occurred.
virtual void PacketTimeout(const int videoChannel,
const ViEPacketTimeout timeout) = 0;
protected:
virtual ~ViENetworkObserver() {};
};
// ----------------------------------------------------------------------------
// ViENetwork
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViENetwork
{
public:
// Default values
enum
{
KDefaultSampleTimeSeconds = 2
};
// Factory for the ViENetwork subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViENetwork* GetInterface(VideoEngine* videoEngine);
// Releases the ViENetwork sub-API and decreases an internal reference
// counter.Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// Specifies the ports to receive RTP packets on. It is also possible to set
// port for RTCP and local IP address.
virtual int SetLocalReceiver(const int videoChannel,
const unsigned short rtpPort,
const unsigned short rtcpPort = 0,
const char* ipAddress = NULL) = 0;
// Gets the local receiver ports and address for a specified channel.
virtual int GetLocalReceiver(const int videoChannel,
unsigned short& rtpPort,
unsigned short& rtcpPort, char* ipAddress) = 0;
// Specifies the destination port and IP address for a specified channel.
virtual int SetSendDestination(const int videoChannel,
const char* ipAddress,
const unsigned short rtpPort,
const unsigned short rtcpPort = 0,
const unsigned short sourceRtpPort = 0,
const unsigned short sourceRtcpPort = 0) = 0;
// Get the destination port and address for a specified channel.
virtual int GetSendDestination(const int videoChannel, char* ipAddress,
unsigned short& rtpPort,
unsigned short& rtcpPort,
unsigned short& sourceRtpPort,
unsigned short& sourceRtcpPort) = 0;
// This function registers a user implementation of Transport to use for
// sending RTP and RTCP packets on this channel.
virtual int RegisterSendTransport(const int videoChannel,
Transport& transport) = 0;
// This function deregisters a used Transport for a specified channel.
virtual int DeregisterSendTransport(const int videoChannel) = 0;
// When using external transport for a channel, received RTP packets should
// be passed to VideoEngine using this function. The input should contain
// the RTP header and payload.
virtual int ReceivedRTPPacket(const int videoChannel, const void* data,
const int length) = 0;
// When using external transport for a channel, received RTCP packets should
// be passed to VideoEngine using this function.
virtual int ReceivedRTCPPacket(const int videoChannel, const void* data,
const int length) = 0;
// Gets the source ports and IP address of the incoming stream for a
// specified channel.
virtual int GetSourceInfo(const int videoChannel, unsigned short& rtpPort,
unsigned short& rtcpPort, char* ipAddress,
unsigned int ipAddressLength) = 0;
// Gets the local IP address, in string format.
virtual int GetLocalIP(char ipAddress[64], bool ipv6 = false) = 0;
// Enables IPv6, instead of IPv4, for a specified channel.
virtual int EnableIPv6(int videoChannel) = 0;
// The function returns true if IPv6 is enabled, false otherwise.
virtual bool IsIPv6Enabled(int videoChannel) = 0;
// Enables a port and IP address filtering for incoming packets on a
// specific channel.
virtual int SetSourceFilter(const int videoChannel,
const unsigned short rtpPort,
const unsigned short rtcpPort = 0,
const char* ipAddress = NULL) = 0;
// Gets current port and IP address filter for a specified channel.
virtual int GetSourceFilter(const int videoChannel, unsigned short& rtpPort,
unsigned short& rtcpPort, char* ipAddress) = 0;
// This function sets the sixbit Differentiated Services Code Point (DSCP)
// in the IP header of the outgoing stream for a specific channel.
// Windows and Linux only.
virtual int SetSendToS(const int videoChannel, const int DSCP,
const bool useSetSockOpt = false) = 0;
// Retrieves the sixbit Differentiated Services Code Point (DSCP) in the IP
// header of the outgoing stream for a specific channel.
virtual int GetSendToS(const int videoChannel, int& DSCP,
bool& useSetSockOpt) = 0;
// This function sets the Generic Quality of Service (GQoS) service level.
// The Windows operating system then maps to a Differentiated Services Code
// Point (DSCP) and to an 802.1p setting. Windows only.
virtual int SetSendGQoS(const int videoChannel, const bool enable,
const int serviceType,
const int overrideDSCP = 0) = 0;
// This function retrieves the currently set GQoS service level for a
// specific channel.
virtual int GetSendGQoS(const int videoChannel, bool& enabled,
int& serviceType, int& overrideDSCP) = 0;
// This function sets the Maximum Transition Unit (MTU) for a channel. The
// RTP packet will be packetized based on this MTU to optimize performance
// over the network.
virtual int SetMTU(int videoChannel, unsigned int mtu) = 0;
// This function enables or disables warning reports if packets have not
// been received for a specified time interval.
virtual int SetPacketTimeoutNotification(const int videoChannel,
bool enable,
int timeoutSeconds) = 0;
// Registers an instance of a user implementation of the ViENetwork
// observer.
virtual int RegisterObserver(const int videoChannel,
ViENetworkObserver& observer) = 0;
// Removes a registered instance of ViENetworkObserver.
virtual int DeregisterObserver(const int videoChannel) = 0;
// This function enables or disables the periodic deadoralive callback
// functionality for a specified channel.
virtual int SetPeriodicDeadOrAliveStatus(
const int videoChannel, const bool enable,
const unsigned int sampleTimeSeconds = KDefaultSampleTimeSeconds) = 0;
// This function handles sending a raw UDP data packet over an existing RTP
// or RTCP socket.
virtual int SendUDPPacket(const int videoChannel, const void* data,
const unsigned int length, int& transmittedBytes,
bool useRtcpSocket = false) = 0;
protected:
ViENetwork() {};
virtual ~ViENetwork() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_NETWORK_H_

View File

@@ -0,0 +1,106 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
// - Specify render destinations for incoming video streams, capture devices
// and files.
// - Configuring render streams.
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RENDER_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RENDER_H_
#include "common_types.h"
namespace webrtc
{
class VideoRender;
class VideoEngine;
// ----------------------------------------------------------------------------
// ExternalRenderer
// ----------------------------------------------------------------------------
// This class declares an abstract interface to be used for external renderers.
// The user implemented derived class is registered using AddRenderer().
class WEBRTC_DLLEXPORT ExternalRenderer
{
public:
// This method will be called when the stream to be rendered changes in
// resolution or number of streams mixed in the image.
virtual int FrameSizeChange(unsigned int width, unsigned int height,
unsigned int numberOfStreams) = 0;
// This method is called when a new frame should be rendered.
virtual int DeliverFrame(unsigned char* buffer, int bufferSize) = 0;
protected:
virtual ~ExternalRenderer() {}
};
// ----------------------------------------------------------------------------
// ViERender
// ----------------------------------------------------------------------------
class WEBRTC_DLLEXPORT ViERender
{
public:
// Factory for the ViERender subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViERender* GetInterface(VideoEngine* videoEngine);
// Releases the ViERender sub-API and decreases an internal reference
// counter. Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// Registers render module
virtual int RegisterVideoRenderModule(VideoRender& renderModule) = 0;
// Deegisters render module
virtual int DeRegisterVideoRenderModule(VideoRender& renderModule) = 0;
// Sets the render destination for a given render ID.
virtual int AddRenderer(const int renderId, void* window,
const unsigned int zOrder, const float left,
const float top, const float right,
const float bottom) = 0;
// Removes the renderer for a stream
virtual int RemoveRenderer(const int renderId) = 0;
// Starts rendering a render stream.
virtual int StartRender(const int renderId) = 0;
// Stops rendering a render stream.
virtual int StopRender(const int renderId) = 0;
// Configures an already added render stream.
virtual int ConfigureRender(int renderId, const unsigned int zOrder,
const float left, const float top,
const float right, const float bottom) = 0;
// This function mirrors the rendered stream left and right or up and down.
virtual int MirrorRenderStream(const int renderId, const bool enable,
const bool mirrorXAxis,
const bool mirrorYAxis) = 0;
// External render
virtual int AddRenderer(const int renderId, RawVideoType videoInputFormat,
ExternalRenderer* renderer) = 0;
protected:
ViERender() {};
virtual ~ViERender() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RENDER_H_

View File

@@ -0,0 +1,262 @@
/*
* 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.
*/
// This sub-API supports the following functionalities:
// - Callbacks for RTP and RTCP events such as modified SSRC or CSRC.
// - SSRC handling.
// - Transmission of RTCP reports.
// - Obtaining RTCP data from incoming RTCP sender reports.
// - RTP and RTCP statistics (jitter, packet loss, RTT etc.).
// - Forward Error Correction (FEC).
// - RTP Keepalive for maintaining the NAT mappings associated to RTP flows.
// - Writing RTP and RTCP packets to binary files for offline analysis of the
// call quality.
// - Inserting extra RTP packets into active audio stream.
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RTP_RTCP_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RTP_RTCP_H_
#include "common_types.h"
namespace webrtc
{
class VideoEngine;
// This enumerator sets the RTCP mode.
enum ViERTCPMode
{
kRtcpNone = 0,
kRtcpCompound_RFC4585 = 1,
kRtcpNonCompound_RFC5506 = 2
};
// This enumerator describes the key frame request mode.
enum ViEKeyFrameRequestMethod
{
kViEKeyFrameRequestNone = 0,
kViEKeyFrameRequestPliRtcp = 1,
kViEKeyFrameRequestFirRtp = 2,
kViEKeyFrameRequestFirRtcp = 3
};
// ----------------------------------------------------------------------------
// ViERTPObserver
// ----------------------------------------------------------------------------
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterRTPObserver() and
// deregistered using DeregisterRTPObserver().
class WEBRTC_DLLEXPORT ViERTPObserver
{
public:
// This method is called if SSRC of the incoming stream is changed.
virtual void IncomingSSRCChanged(const int videoChannel,
const unsigned int SSRC) = 0;
// This method is called if a field in CSRC changes or if the number of
// CSRCs changes.
virtual void IncomingCSRCChanged(const int videoChannel,
const unsigned int CSRC,
const bool added) = 0;
protected:
virtual ~ViERTPObserver() {}
};
// ----------------------------------------------------------------------------
// ViERTCPObserver
// ----------------------------------------------------------------------------
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterRTCPObserver() and
// deregistered using DeregisterRTCPObserver().
class WEBRTC_DLLEXPORT ViERTCPObserver
{
public:
// This method is called if a application-defined RTCP packet has been
// received.
virtual void OnApplicationDataReceived(
const int videoChannel, const unsigned char subType,
const unsigned int name, const char* data,
const unsigned short dataLengthInBytes) = 0;
protected:
virtual ~ViERTCPObserver() {}
};
//
class WEBRTC_DLLEXPORT ViERTP_RTCP
{
public:
// Default values
enum
{
KDefaultDeltaTransmitTimeSeconds = 15
};
enum
{
KMaxRTCPCNameLength = 256
};
// Factory for the ViERTP_RTCP subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if
// construction fails.
static ViERTP_RTCP* GetInterface(VideoEngine* videoEngine);
// Releases the ViERTP_RTCP sub-API and decreases an internal reference
// counter. Returns the new reference count. This value should be zero
// for all sub-API:s before the VideoEngine object can be safely deleted.
virtual int Release() = 0;
// This function enables you to specify the RTP synchronization source
// identifier (SSRC) explicitly.
virtual int SetLocalSSRC(const int videoChannel,
const unsigned int SSRC) = 0;
// This function gets the SSRC for the outgoing RTP stream for the specified
// channel.
virtual int GetLocalSSRC(const int videoChannel,
unsigned int& SSRC) const = 0;
// This function gets the SSRC for the incoming RTP stream for the specified
// channel.
virtual int GetRemoteSSRC(const int videoChannel,
unsigned int& SSRC) const = 0;
// This function returns the CSRCs of the incoming RTP packets.
virtual int GetRemoteCSRCs(const int videoChannel,
unsigned int CSRCs[kRtpCsrcSize]) const = 0;
// This function enables manual initialization of the sequence number. The
// start sequence number is normally a random number.
virtual int SetStartSequenceNumber(const int videoChannel,
unsigned short sequenceNumber) = 0;
// This function sets the RTCP status for the specified channel.
// Default mode is kRtcpCompound_RFC4585.
virtual int SetRTCPStatus(const int videoChannel,
const ViERTCPMode rtcpMode) = 0;
// This function gets the RTCP status for the specified channel.
virtual int GetRTCPStatus(const int videoChannel,
ViERTCPMode& rtcpMode) = 0;
// This function sets the RTCP canonical name (CNAME) for the RTCP reports
// on a specific channel.
virtual int SetRTCPCName(const int videoChannel,
const char rtcpCName[KMaxRTCPCNameLength]) = 0;
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
// sent the specified channel.
virtual int GetRTCPCName(const int videoChannel,
char rtcpCName[KMaxRTCPCNameLength]) = 0;
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
// received on the specified channel.
virtual int GetRemoteRTCPCName(
const int videoChannel, char rtcpCName[KMaxRTCPCNameLength]) const = 0;
// This function sends an RTCP APP packet on a specific channel.
virtual int SendApplicationDefinedRTCPPacket(
const int videoChannel, const unsigned char subType,
unsigned int name, const char* data,
unsigned short dataLengthInBytes) = 0;
// This function enables Negative Acknowledgement (NACK) using RTCP,
// implemented based on RFC 4585. NACK retransmits RTP packets if lost on
// the network. This creates a lossless transport at the expense of delay.
// If using NACK, NACK should be enabled on both endpoints in a call.
virtual int SetNACKStatus(const int videoChannel, const bool enable) = 0;
// This function enables Forward Error Correction (FEC) using RTCP,
// implemented based on RFC 5109, to improve packet loss robustness. Extra
// FEC packets are sent together with the usual media packets, hence
// part of the bitrate will be used for FEC packets.
virtual int SetFECStatus(const int videoChannel, const bool enable,
const unsigned char payloadTypeRED,
const unsigned char payloadTypeFEC) = 0;
// This function enables RTCP key frame requests.
virtual int SetKeyFrameRequestMethod(
const int videoChannel, const ViEKeyFrameRequestMethod method) = 0;
// This function enables signaling of temporary bitrate constraints using
// RTCP, implemented based on RFC4585.
virtual int SetTMMBRStatus(const int videoChannel, const bool enable) = 0;
// The function gets statistics from the received RTCP report.
virtual int GetReceivedRTCPStatistics(
const int videoChannel, unsigned short& fractionLost,
unsigned int& cumulativeLost, unsigned int& extendedMax,
unsigned int& jitter, int& rttMs) const = 0;
// The function gets statistics from the RTCP report sent to the receiver.
virtual int GetSentRTCPStatistics(const int videoChannel,
unsigned short& fractionLost,
unsigned int& cumulativeLost,
unsigned int& extendedMax,
unsigned int& jitter,
int& rttMs) const = 0;
// The function gets statistics from the sent and received RTP streams.
virtual int GetRTPStatistics(const int videoChannel,
unsigned int& bytesSent,
unsigned int& packetsSent,
unsigned int& bytesReceived,
unsigned int& packetsReceived) const = 0;
// This function enables or disables an RTP keep-alive mechanism which can
// be used to maintain an existing Network Address Translator (NAT) mapping
// while regular RTP is no longer transmitted.
virtual int SetRTPKeepAliveStatus(
const int videoChannel, bool enable, const char unknownPayloadType,
const unsigned int deltaTransmitTimeSeconds =
KDefaultDeltaTransmitTimeSeconds) = 0;
// This function gets the RTP keep-alive status.
virtual int GetRTPKeepAliveStatus(
const int videoChannel, bool& enabled, char& unkownPayloadType,
unsigned int& deltaTransmitTimeSeconds) = 0;
// This function enables capturing of RTP packets to a binary file on a
// specific channel and for a given direction. The file can later be
// replayed using e.g. RTP Tools rtpplay since the binary file format is
// compatible with the rtpdump format.
virtual int StartRTPDump(const int videoChannel,
const char fileNameUTF8[1024],
RTPDirections direction) = 0;
// This function disables capturing of RTP packets to a binary file on a
// specific channel and for a given direction.
virtual int StopRTPDump(const int videoChannel,
RTPDirections direction) = 0;
// Registers an instance of a user implementation of the ViERTPObserver.
virtual int RegisterRTPObserver(const int videoChannel,
ViERTPObserver& observer) = 0;
// Removes a registered instance of ViERTPObserver.
virtual int DeregisterRTPObserver(const int videoChannel) = 0;
// Registers an instance of a user implementation of the ViERTCPObserver.
virtual int RegisterRTCPObserver(const int videoChannel,
ViERTCPObserver& observer) = 0;
// Removes a registered instance of ViERTCPObserver.
virtual int DeregisterRTCPObserver(const int videoChannel) = 0;
protected:
ViERTP_RTCP() {};
virtual ~ViERTP_RTCP() {};
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RTP_RTCP_H_