michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** @section vcm VCM APIs michael@0: * michael@0: * @section Introduction michael@0: * This module contains command APIs to the media layer michael@0: */ michael@0: michael@0: /** michael@0: * @file vcm.h michael@0: * @brief APIs to interface with the Media layer. michael@0: * michael@0: * This file contains API that interface to the media layer on the platform. michael@0: * The following APIs need to be implemented to have the sip stack interact michael@0: * and issue commands to the media layer. michael@0: */ michael@0: michael@0: #ifndef _VCM_H_ michael@0: #define _VCM_H_ michael@0: michael@0: #include "cpr_types.h" michael@0: #include "cc_constants.h" michael@0: #include "ccsdp.h" michael@0: michael@0: michael@0: /** Evaluates to TRUE for audio media streams where id is the mcap_id of the given stream */ michael@0: #define CC_IS_AUDIO(id) ((id == CC_AUDIO_1) ? TRUE:FALSE) michael@0: /** Evaluates to TRUE for video media streams where id is the mcap_id of the given stream */ michael@0: #define CC_IS_VIDEO(id) ((id == CC_VIDEO_1) ? TRUE:FALSE) michael@0: /** Evaluates to TRUE for datachannel streams where id is the mcap_id of the given stream */ michael@0: #define CC_IS_DATACHANNEL(id) ((id == CC_DATACHANNEL_1) ? TRUE:FALSE) michael@0: michael@0: michael@0: /** Definitions for direction requesting Play tone to user */ michael@0: #define VCM_PLAY_TONE_TO_EAR 1 michael@0: /** Definitions value for direction requesting Play tone to network stream or far end */ michael@0: #define VCM_PLAY_TONE_TO_NET 2 michael@0: /** Definitions value for direction requesting Play tone to both user and network */ michael@0: #define VCM_PLAY_TONE_TO_ALL 3 michael@0: michael@0: /** Definitions for alert_info in vcmToneStartWithSpeakerAsBackup API */ michael@0: #define VCM_ALERT_INFO_OFF 0 michael@0: /** Definitions for alert_info in vcmToneStartWithSpeakerAsBackup API */ michael@0: #define VCM_ALERT_INFO_ON 1 michael@0: michael@0: /** Definitions for DSP Codec Resources. */ michael@0: #define VCM_CODEC_RESOURCE_G711 0x00000001 michael@0: #define VCM_CODEC_RESOURCE_G729A 0x00000002 michael@0: #define VCM_CODEC_RESOURCE_G729B 0x00000004 michael@0: #define VCM_CODEC_RESOURCE_LINEAR 0x00000008 michael@0: #define VCM_CODEC_RESOURCE_G722 0x00000010 michael@0: #define VCM_CODEC_RESOURCE_iLBC 0x00000020 michael@0: #define VCM_CODEC_RESOURCE_iSAC 0x00000040 michael@0: #define VCM_CODEC_RESOURCE_H264 0x00000080 michael@0: #define VCM_CODEC_RESOURCE_H263 0x00000002 michael@0: #define VCM_CODEC_RESOURCE_VP8 0x00000100 michael@0: #define VCM_CODEC_RESOURCE_I420 0x00000200 michael@0: #define VCM_CODEC_RESOURCE_OPUS 0x00000400 michael@0: michael@0: #define VCM_DSP_DECODEONLY 0 michael@0: #define VCM_DSP_ENCODEONLY 1 michael@0: #define VCM_DSP_FULLDUPLEX 2 michael@0: #define VCM_DSP_IGNORE 3 michael@0: michael@0: #define CC_KFACTOR_STAT_LEN (256) michael@0: michael@0: /* Should be enough for any reasonable use-case */ michael@0: #define MAX_SSRCS_PER_MEDIA_LINE 16 michael@0: #define MAX_PTS_PER_MEDIA_LINE 16 michael@0: michael@0: /** michael@0: * vcm_tones_t michael@0: * Enum identifying various tones that the media layer should implement michael@0: */ michael@0: michael@0: typedef enum michael@0: { michael@0: VCM_INSIDE_DIAL_TONE, michael@0: VCM_OUTSIDE_DIAL_TONE, michael@0: VCM_DEFAULT_TONE = 1, michael@0: VCM_LINE_BUSY_TONE, michael@0: VCM_ALERTING_TONE, michael@0: VCM_BUSY_VERIFY_TONE, michael@0: VCM_STUTTER_TONE, michael@0: VCM_MSG_WAITING_TONE, michael@0: VCM_REORDER_TONE, michael@0: VCM_CALL_WAITING_TONE, michael@0: VCM_CALL_WAITING_2_TONE, michael@0: VCM_CALL_WAITING_3_TONE, michael@0: VCM_CALL_WAITING_4_TONE, michael@0: VCM_HOLD_TONE, michael@0: VCM_CONFIRMATION_TONE, michael@0: VCM_PERMANENT_SIGNAL_TONE, michael@0: VCM_REMINDER_RING_TONE, michael@0: VCM_NO_TONE, michael@0: VCM_ZIP_ZIP, michael@0: VCM_ZIP, michael@0: VCM_BEEP_BONK, michael@0: /*#$#$#$#$#@$#$#$#$#$#$#$#$#$#$#$#$$#$#$#$#$#$#$#$#$ michael@0: * There is a corresponding table defined in michael@0: * dialplan.c tone_names[]. Make sure to add tone michael@0: * name in that table if you add any new entry above michael@0: */ michael@0: VCM_RECORDERWARNING_TONE, michael@0: VCM_RECORDERDETECTED_TONE, michael@0: VCM_MONITORWARNING_TONE, michael@0: VCM_SECUREWARNING_TONE, michael@0: VCM_NONSECUREWARNING_TONE, michael@0: VCM_MAX_TONE, michael@0: VCM_MAX_DIALTONE = VCM_BEEP_BONK michael@0: } vcm_tones_t; michael@0: michael@0: michael@0: /** michael@0: * vcm_tones_t michael@0: * Enum identifying various tones that the media layer should implement michael@0: */ michael@0: michael@0: michael@0: /** michael@0: * vcm_ring_mode_t michael@0: * VCM_RING_OFFSET is used to map the list michael@0: * of ring names to the correct enum type michael@0: * when parsing the alert-info header. michael@0: */ michael@0: typedef enum michael@0: { michael@0: VCM_RING_OFF = 0x1, michael@0: VCM_INSIDE_RING = 0x2, michael@0: VCM_OUTSIDE_RING = 0x3, michael@0: VCM_FEATURE_RING = 0x4, michael@0: VCM_BELLCORE_DR1 = 0x5, michael@0: VCM_RING_OFFSET = 0x5, michael@0: VCM_BELLCORE_DR2 = 0x6, michael@0: VCM_BELLCORE_DR3 = 0x7, michael@0: VCM_BELLCORE_DR4 = 0x8, michael@0: VCM_BELLCORE_DR5 = 0x9, michael@0: VCM_BELLCORE_MAX = VCM_BELLCORE_DR5, michael@0: VCM_FLASHONLY_RING = 0xA, michael@0: VCM_STATION_PRECEDENCE_RING = 0xB, michael@0: VCM_MAX_RING = 0xC michael@0: } vcm_ring_mode_t; michael@0: michael@0: /** michael@0: * vcm_ring_duration_t michael@0: * Enums for specifying normal vs single ring michael@0: */ michael@0: typedef enum { michael@0: vcm_station_normal_ring = 0x1, michael@0: vcm_station_single_ring = 0x2 michael@0: } vcm_ring_duration_t; michael@0: michael@0: /** michael@0: * Structure to carry key codec information michael@0: */ michael@0: typedef struct michael@0: { michael@0: rtp_ptype codec_type; michael@0: michael@0: /* michael@0: * NOTE: We keep track of the RTP "PT" field for sending separate from the michael@0: * one for receiving. This is to support asymmetric payload type values michael@0: * for a given codec. When we get an offer, we answer with the same payload michael@0: * type value that the remote offers. If we send an offer and the remote michael@0: * choses to answer with different value than we offer, we support asymmetric. michael@0: */ michael@0: michael@0: /* RTP "PT" field we use to send this codec ("remote") */ michael@0: int remote_rtp_pt; michael@0: michael@0: /* RTP "PT" field we use to receive this codec ("local") */ michael@0: int local_rtp_pt; michael@0: michael@0: /* Parameters for specific media types */ michael@0: union michael@0: { michael@0: struct michael@0: { michael@0: int frequency; michael@0: int packet_size; /* Number of samples in a packet */ michael@0: int channels; michael@0: int bitrate; /* Wire bitrate of RTP packet payloads */ michael@0: } audio; michael@0: michael@0: struct michael@0: { michael@0: int width; michael@0: int height; michael@0: uint32_t rtcp_fb_types; michael@0: uint32_t max_fs; /* Max frame size */ michael@0: uint32_t max_fr; /* Max frame rate */ michael@0: } video; michael@0: }; michael@0: michael@0: /* Codec-specific parameters */ michael@0: union michael@0: { michael@0: struct { michael@0: uint16_t mode; michael@0: } ilbc; michael@0: michael@0: /* These are outdated, and need to be updated to match the current michael@0: specification. */ michael@0: struct { michael@0: uint32_t max_average_bitrate; michael@0: const char *maxcodedaudiobandwidth; michael@0: boolean usedtx; michael@0: boolean stereo; michael@0: boolean useinbandfec; michael@0: boolean cbr; michael@0: } opus; michael@0: }; michael@0: } vcm_payload_info_t; michael@0: michael@0: /** michael@0: * vcm_vad_t michael@0: * Enums for Voice Activity Detection michael@0: */ michael@0: typedef enum vcm_vad_t_ { michael@0: VCM_VAD_OFF = 0, michael@0: VCM_VAD_ON = 1 michael@0: } vcm_vad_t; michael@0: michael@0: /** michael@0: * vcm_audio_bits_t michael@0: * Enums for indicating audio path michael@0: */ michael@0: typedef enum vcm_audio_bits_ { michael@0: VCM_AUDIO_NONE, michael@0: VCM_AUDIO_HANDSET, michael@0: VCM_AUDIO_HEADSET, michael@0: VCM_AUDIO_SPEAKER michael@0: } vcm_audio_bits_t; michael@0: michael@0: /** michael@0: * vcm_crypto_algorithmID michael@0: * Crypto parameters for SRTP media michael@0: */ michael@0: typedef enum { michael@0: VCM_INVLID_ALGORITM_ID = -1, /* invalid algorithm ID. */ michael@0: VCM_NO_ENCRYPTION = 0, /* no encryption */ michael@0: VCM_AES_128_COUNTER /* AES 128 counter mode (32 bits HMAC)*/ michael@0: } vcm_crypto_algorithmID; michael@0: michael@0: /** michael@0: * vcm_mixing_mode_t michael@0: * Mixing mode for media michael@0: */ michael@0: typedef enum { michael@0: VCM_NO_MIX, michael@0: VCM_MIX michael@0: } vcm_mixing_mode_t; michael@0: michael@0: /** michael@0: * vcm_session_t michael@0: * Media Session Specification enum michael@0: */ michael@0: typedef enum { michael@0: PRIMARY_SESSION, michael@0: MIX_SESSION, michael@0: NO_SESSION michael@0: } vcm_session_t; michael@0: michael@0: michael@0: /** michael@0: * vcm_mixing_party_t michael@0: * Media mix party enum michael@0: * Indicates the party to be mixed none/local/remote/both/TxBOTH_RxNONE michael@0: * TxBOTH_RxNONE means that for Tx stream it's both, for Rx stream it's none michael@0: */ michael@0: typedef enum { michael@0: VCM_PARTY_NONE, michael@0: VCM_PARTY_LOCAL, michael@0: VCM_PARTY_REMOTE, michael@0: VCM_PARTY_BOTH, michael@0: VCM_PARTY_TxBOTH_RxNONE michael@0: } vcm_mixing_party_t; michael@0: michael@0: /** michael@0: * media_control_to_encoder_t michael@0: * Enums for far end control for media michael@0: * Only Fast Picture Update for video is supported michael@0: */ michael@0: typedef enum { michael@0: VCM_MEDIA_CONTROL_PICTURE_FAST_UPDATE michael@0: } vcm_media_control_to_encoder_t; michael@0: michael@0: /** michael@0: * Maximum key and salt must be adjust to the largest possible michael@0: * supported key. michael@0: */ michael@0: #define VCM_SRTP_MAX_KEY_SIZE 16 /* maximum key in bytes (128 bits) */ michael@0: /** michael@0: * Maximum key and salt must be adjust to the largest possible michael@0: * supported salt. michael@0: */ michael@0: #define VCM_SRTP_MAX_SALT_SIZE 14 /* maximum salt in bytes (112 bits)*/ michael@0: michael@0: /** Key size in bytes for AES128 algorithm */ michael@0: #define VCM_AES_128_COUNTER_KEY_SIZE 16 michael@0: /** Salt size in bytes for AES128 algorithm */ michael@0: #define VCM_AES_128_COUNTER_SALT_SIZE 14 michael@0: michael@0: /** Structure to carry crypto key and salt for SRTP streams */ michael@0: typedef struct vcm_crypto_key_t_ { michael@0: cc_uint8_t key_len; /**< key length*/ michael@0: cc_uint8_t key[VCM_SRTP_MAX_KEY_SIZE]; /**< key*/ michael@0: cc_uint8_t salt_len; /**< salt length*/ michael@0: cc_uint8_t salt[VCM_SRTP_MAX_SALT_SIZE]; /**< salt*/ michael@0: } vcm_crypto_key_t; michael@0: michael@0: /** michael@0: * vcm_videoAttrs_t michael@0: * An opaque handle to store and pass video attributes michael@0: */ michael@0: typedef struct vcm_videoAttrs_t_ { michael@0: void * opaque; /**< pointer to opaque data from application as received from vcm_negotiate_attrs()*/ michael@0: } vcm_videoAttrs_t; michael@0: michael@0: /** A structure carrying audio media specific attributes */ michael@0: typedef struct vcm_audioAttrs_t_ { michael@0: cc_uint16_t packetization_period; /**< ptime value received in SDP */ michael@0: cc_uint16_t max_packetization_period; /**< ptime value received in SDP */ michael@0: cc_int32_t avt_payload_type; /**< RTP payload type for AVT */ michael@0: vcm_vad_t vad; /**< Voice Activity Detection on or off */ michael@0: vcm_mixing_party_t mixing_party; /**< mixing_party */ michael@0: vcm_mixing_mode_t mixing_mode; /**< mixing_mode*/ michael@0: } vcm_audioAttrs_t; michael@0: michael@0: michael@0: /** michael@0: * vcm_mediaAttrs_t michael@0: * A structure to contain audio or video media attributes michael@0: */ michael@0: typedef struct vcm_attrs_t_ { michael@0: cc_boolean mute; michael@0: cc_boolean is_video; michael@0: cc_boolean rtcp_mux; michael@0: cc_boolean audio_level; michael@0: uint8_t audio_level_id; michael@0: vcm_audioAttrs_t audio; /**< audio line attribs */ michael@0: vcm_videoAttrs_t video; /**< Video Atrribs */ michael@0: uint32_t bundle_level; /**< Where bundle transport info lives, if any */ michael@0: /* Some stuff for assisting in stream correlation for bundle */ michael@0: /** RTP correlator specified here: michael@0: * http://tools.ietf.org/html/draft-roach-mmusic-unified-plan */ michael@0: cc_uint32_t bundle_stream_correlator; michael@0: cc_uint32_t ssrcs[MAX_SSRCS_PER_MEDIA_LINE]; michael@0: cc_uint8_t num_ssrcs; michael@0: /** Payload type ids that appear on this m-line, but no other. Used as a michael@0: * last-ditch correlator for bundle */ michael@0: cc_uint8_t unique_payload_types[MAX_PTS_PER_MEDIA_LINE]; michael@0: cc_uint8_t num_unique_payload_types; michael@0: } vcm_mediaAttrs_t; michael@0: michael@0: //Using C++ for gips. This is required for gips. michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif michael@0: michael@0: /** michael@0: * The initialization of the VCM module michael@0: * michael@0: */ michael@0: michael@0: void vcmInit(); michael@0: michael@0: /** michael@0: * The unloading of the VCM module michael@0: */ michael@0: void vcmUnload(); michael@0: michael@0: michael@0: /** michael@0: * Should we remove this from external API michael@0: * michael@0: * @param[in] mcap_id - group identifier to which stream belongs. michael@0: * @param[in] group_id - group identifier michael@0: * @param[in] stream_id - stream identifier michael@0: * @param[in] call_handle - call handle michael@0: * @param[in] port_requested - requested port. michael@0: * @param[in] listen_ip - local IP for listening michael@0: * @param[in] is_multicast - multicast stream? michael@0: * @param[in,out] port_allocated - allocated(reserved) port michael@0: * michael@0: * tbd need to see if we can deprecate this API michael@0: * michael@0: * @return 0 success, ERROR failure. michael@0: * michael@0: */ michael@0: michael@0: short vcmRxOpen(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle, michael@0: cc_uint16_t port_requested, michael@0: cpr_ip_addr_t *listen_ip, michael@0: cc_boolean is_multicast, michael@0: int *port_allocated); michael@0: /*! michael@0: * should we remove from external API michael@0: * michael@0: * @param[in] mcap_id - Media Capability ID michael@0: * @param[in] group_id - group to which stream belongs michael@0: * @param[in] stream_id - stream identifier michael@0: * @param[in] call_handle - call handle michael@0: * michael@0: * @return zero(0) for success; otherwise, ERROR for failure michael@0: * michael@0: */ michael@0: michael@0: short vcmTxOpen(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle); michael@0: michael@0: /*! michael@0: * Allocate(Reserve) a receive port. michael@0: * michael@0: * @param[in] mcap_id - Media Capability ID michael@0: * @param[in] group_id - group identifier to which stream belongs. michael@0: * @param[in] stream_id - stream identifier michael@0: * @param[in] call_handle - call handle michael@0: * @param[in] port_requested - port requested (if zero -> give any) michael@0: * @param[out] port_allocated - port that was actually allocated. michael@0: * michael@0: * @return 0 for success; VCM_ERROR for failure michael@0: * michael@0: */ michael@0: michael@0: void vcmRxAllocPort(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle, michael@0: cc_uint16_t port_requested, michael@0: int *port_allocated); michael@0: michael@0: michael@0: short vcmRxAllocICE(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle, michael@0: const char *peerconnection, michael@0: uint16_t level, michael@0: char **default_addr, /* Out */ michael@0: int *default_port, /* Out */ michael@0: char ***candidates, /* Out */ michael@0: int *candidate_ct /* Out */ michael@0: ); michael@0: michael@0: michael@0: /* Get ICE global parameters (ufrag and pwd) michael@0: * michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[out] ufragp - where to put the ufrag michael@0: * @param[out] pwdp - where to put the pwd michael@0: * michael@0: * @return 0 for success; VCM_ERROR for failure michael@0: */ michael@0: short vcmGetIceParams(const char *peerconnection, char **ufragp, char **pwdp); michael@0: michael@0: /* Set remote ICE global parameters. michael@0: * michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[in] ufrag - the ufrag michael@0: * @param[in] pwd - the pwd michael@0: * michael@0: * @return 0 success, error failure michael@0: */ michael@0: short vcmSetIceSessionParams(const char *peerconnection, char *ufrag, char *pwd); michael@0: michael@0: /* Set ice candidate for trickle ICE. michael@0: * michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[in] icecandidate - the icecandidate michael@0: * @param[in] level - the m line level michael@0: * michael@0: * @return 0 success, error failure michael@0: */ michael@0: short vcmSetIceCandidate(const char *peerconnection, const char *icecandidate, uint16_t level); michael@0: michael@0: /* Set remote ICE media-level parameters. michael@0: * michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[in] level - the m-line michael@0: * @param[in] ufrag - the ufrag michael@0: * @param[in] pwd - the pwd michael@0: * @param[in] candidates - the candidates michael@0: * @param[in] candidate_ct - the number of candidates michael@0: * @return 0 success, error failure michael@0: */ michael@0: short vcmSetIceMediaParams(const char *peerconnection, int level, char *ufrag, char *pwd, michael@0: char **candidates, int candidate_ct); michael@0: michael@0: /* Start ICE checks michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[in] isControlling - true if controlling, false if controlled michael@0: * @return 0 success, error failure michael@0: */ michael@0: short vcmStartIceChecks(const char *peerconnection, cc_boolean isControlling); michael@0: michael@0: michael@0: michael@0: /* michael@0: * Create a remote stream michael@0: * michael@0: * @param[in] mcap_id - group identifier to which stream belongs. michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[out] pc_stream_id - the id of the allocated stream michael@0: * michael@0: * TODO(ekr@rtfm.com): Revise along with everything else for the michael@0: * new stream model. michael@0: * michael@0: * Returns: zero(0) for success; otherwise, ERROR for failure michael@0: */ michael@0: short vcmCreateRemoteStream( michael@0: cc_mcapid_t mcap_id, michael@0: const char *peerconnection, michael@0: int *pc_stream_id); michael@0: michael@0: /* michael@0: * Add remote stream hint michael@0: * michael@0: * We are sending track information up to PeerConnection before michael@0: * the tracks exist so it knows when the stream is fully constructed. michael@0: * michael@0: * @param[in] peerconnection michael@0: * @param[in] pc_stream_id michael@0: * @param[in] is_video michael@0: * michael@0: * Returns: zero(0) for success; otherwise, ERROR for failure michael@0: */ michael@0: short vcmAddRemoteStreamHint( michael@0: const char *peerconnection, michael@0: int pc_stream_id, michael@0: cc_boolean is_video); michael@0: michael@0: /*! michael@0: * Release the allocated port michael@0: * @param[in] mcap_id - media capability id (0 is audio) michael@0: * @param[in] group_id - group identifier michael@0: * @param[in] stream_id - stream identifier michael@0: * @param[in] call_handle - call handle michael@0: * @param[in] port - port to be released michael@0: * michael@0: * @return void michael@0: */ michael@0: void vcmRxReleasePort(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle, michael@0: int port); michael@0: michael@0: /*! michael@0: * Start receive stream michael@0: * Note: For video calls, for a given call handle there will be michael@0: * two media lines and the corresponding group_id/stream_id pair. michael@0: * One RTP session is requested from media server for each michael@0: * media line(group/stream) i.e. a video call would result in michael@0: * two rtp_sessions in our session info list created by two michael@0: * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively. michael@0: * michael@0: * @param[in] mcap_id - media type id michael@0: * @param[in] group_id - group identifier associated with the stream michael@0: * @param[in] stream_id - id of the stream one per each media line michael@0: * @param[in] call_handle - call handle michael@0: * @param[in] payload - payload information michael@0: * @param[in] local_addr - local ip address to use. michael@0: * @param[in] port - local port (receive) michael@0: * @param[in] algorithmID - crypto alogrithm ID michael@0: * @param[in] rx_key - rx key used when algorithm ID is encrypting michael@0: * @param[in] attrs - media attributes michael@0: * michael@0: * @return zero(0) for success; otherwise, -1 for failure michael@0: * michael@0: */ michael@0: michael@0: int vcmRxStart(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle, michael@0: const vcm_payload_info_t *payload, michael@0: cpr_ip_addr_t *local_addr, michael@0: cc_uint16_t port, michael@0: vcm_crypto_algorithmID algorithmID, michael@0: vcm_crypto_key_t *rx_key, michael@0: vcm_mediaAttrs_t *attrs); michael@0: michael@0: michael@0: /** michael@0: * start rx stream michael@0: * Same concept as vcmRxStart but for ICE/PeerConnection-based flows michael@0: * michael@0: * @param[in] mcap_id - media cap id michael@0: * @param[in] group_id - group identifier to which the stream belongs michael@0: * @param[in] stream_id - stream id of the given media type. michael@0: * @param[in] level - the m-line index michael@0: * @param[in] pc_stream_id - the media stream index (from PC.addStream()) michael@0: * @param[in] pc_track_id - the track within the media stream michael@0: * @param[in] call_handle - call handle michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[in] num_payloads - number of codecs negotiated michael@0: * @param[in] payloads - list of negotiated codec details michael@0: * @param[in] setup_t - whether playing client or server role michael@0: * @param[in] fingerprint_alg - the DTLS fingerprint algorithm michael@0: * @param[in] fingerprint - the DTLS fingerprint michael@0: * @param[in] attrs - media attributes michael@0: * michael@0: * Returns: zero(0) for success; otherwise, ERROR for failure michael@0: * michael@0: */ michael@0: michael@0: int vcmRxStartICE(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: int level, michael@0: int pc_stream_id, michael@0: int pc_track_id, michael@0: cc_call_handle_t call_handle, michael@0: const char *peerconnection, michael@0: int num_payloads, michael@0: const vcm_payload_info_t* payloads, michael@0: sdp_setup_type_e setup_type, michael@0: const char *fingerprint_alg, michael@0: const char *fingerprint, michael@0: vcm_mediaAttrs_t *attrs); michael@0: michael@0: /** michael@0: * start tx stream michael@0: * Note: For video calls, for a given call handle there will be michael@0: * two media lines and the corresponding group_id/stream_id pair. michael@0: * One RTP session is requested from media server for each michael@0: * media line(group/stream) i.e. a video call would result in michael@0: * two rtp_sessions in our session info list created by two michael@0: * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively. michael@0: * michael@0: * @param[in] mcap_id - media cap id michael@0: * @param[in] group_id - group identifier to which the stream belongs michael@0: * @param[in] stream_id - stream id of the given media type. michael@0: * @param[in] call_handle - call handle michael@0: * @param[in] payload - payload information michael@0: * @param[in] tos - bit marking michael@0: * @param[in] local_addr - local address michael@0: * @param[in] local_port - local port michael@0: * @param[in] remote_ip_addr - remote ip address michael@0: * @param[in] remote_port - remote port michael@0: * @param[in] algorithmID - crypto alogrithm ID michael@0: * @param[in] tx_key - tx key used when algorithm ID is encrypting. michael@0: * @param[in] attrs - media attributes michael@0: * michael@0: * Returns: zero(0) for success; otherwise, ERROR for failure michael@0: * michael@0: */ michael@0: michael@0: int vcmTxStart(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle, michael@0: const vcm_payload_info_t *payload, michael@0: short tos, michael@0: cpr_ip_addr_t *local_addr, michael@0: cc_uint16_t local_port, michael@0: cpr_ip_addr_t *remote_ip_addr, michael@0: cc_uint16_t remote_port, michael@0: vcm_crypto_algorithmID algorithmID, michael@0: vcm_crypto_key_t *tx_key, michael@0: vcm_mediaAttrs_t *attrs); michael@0: michael@0: michael@0: /** michael@0: * start tx stream michael@0: * Same concept as vcmTxStart but for ICE/PeerConnection-based flowso michael@0: * michael@0: * @param[in] mcap_id - media cap id michael@0: * @param[in] group_id - group identifier to which the stream belongs michael@0: * @param[in] stream_id - stream id of the given media type. michael@0: * @param[in] level - the m-line index michael@0: * @param[in] pc_stream_id - the media stream index (from PC.addStream()) michael@0: * @param[in] pc_track_id - the track within the media stream michael@0: * @param[in] call_handle - call handle michael@0: * @param[in] peerconnection - the peerconnection in use michael@0: * @param[in] payload - payload information michael@0: * @param[in] tos - bit marking michael@0: * @param[in] setup_type - whether playing client or server role michael@0: * @param[in] fingerprint_alg - the DTLS fingerprint algorithm michael@0: * @param[in] fingerprint - the DTLS fingerprint michael@0: * @param[in] attrs - media attributes michael@0: * michael@0: * Returns: zero(0) for success; otherwise, ERROR for failure michael@0: * michael@0: */ michael@0: michael@0: int vcmTxStartICE(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: int level, michael@0: int pc_stream_id, michael@0: int pc_track_id, michael@0: cc_call_handle_t call_handle, michael@0: const char *peerconnection, michael@0: const vcm_payload_info_t *payload, michael@0: short tos, michael@0: sdp_setup_type_e setup_type, michael@0: const char *fingerprint_alg, michael@0: const char *fingerprint, michael@0: vcm_mediaAttrs_t *attrs); michael@0: michael@0: michael@0: short vcmGetDtlsIdentity(const char *peerconnection, michael@0: char *digest_alg, michael@0: size_t max_digest_alg_len, michael@0: char *digest, michael@0: size_t max_digest_len); michael@0: michael@0: michael@0: short vcmInitializeDataChannel(const char *peerconnection, michael@0: int track_id, michael@0: cc_uint16_t streams, michael@0: int local_datachannel_port, michael@0: int remote_datachannel_port, michael@0: const char* protocol); michael@0: michael@0: /*! michael@0: * Close the receive stream. michael@0: * michael@0: * @param[in] mcap_id - Media Capability ID michael@0: * @param[in] group_id - group identifier that belongs to the stream. michael@0: * @param[in] stream_id - stream id of the given media type. michael@0: * @param[in] call_handle - call handle michael@0: * michael@0: * @return 0 for success; VCM_ERROR for failure michael@0: * michael@0: */ michael@0: michael@0: short vcmRxClose(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle); michael@0: michael@0: /** michael@0: * Close the transmit stream michael@0: * michael@0: * @param[in] mcap_id - Media Capability ID michael@0: * @param[in] group_id - identifier of the group to which stream belongs michael@0: * @param[in] stream_id - stream id of the given media type. michael@0: * @param[in] call_handle - call handle michael@0: * michael@0: * @return 0 for success; VCM_ERROR for failure michael@0: */ michael@0: michael@0: short vcmTxClose(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle); michael@0: michael@0: /** michael@0: * To be Deprecated michael@0: * This may be needed to be implemented if the DSP doesn't automatically enable the side tone michael@0: * The stack will make a call to this method based on the call state. Provide a stub if this is not needed. michael@0: * michael@0: * @param[in] side_tone - cc_boolean to enable/disable side tone michael@0: * michael@0: * @return void michael@0: * michael@0: */ michael@0: void vcmEnableSidetone(cc_uint16_t side_tone); michael@0: michael@0: /** michael@0: * Start a tone (continuous) michael@0: * michael@0: * Parameters: michael@0: * @param[in] tone - tone type michael@0: * @param[in] alert_info - alertinfo header michael@0: * @param[in] call_handle- call handle michael@0: * @param[in] group_id - identifier of the group to which stream belongs michael@0: * @param[in] stream_id - stream identifier. michael@0: * @param[in] direction - network, speaker, both michael@0: * michael@0: * @return void michael@0: * michael@0: */ michael@0: michael@0: void vcmToneStart(vcm_tones_t tone, michael@0: short alert_info, michael@0: cc_call_handle_t call_handle, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_uint16_t direction); michael@0: michael@0: /** michael@0: * Plays a short tone. uses the open audio path. michael@0: * If no audio path is open, plays on speaker. michael@0: * michael@0: * @param[in] tone - tone type michael@0: * @param[in] alert_info - alertinfo header michael@0: * @param[in] call_handle- call handle michael@0: * @param[in] group_id - identifier of the group to which stream belongs michael@0: * @param[in] stream_id - stream identifier. michael@0: * @param[in] direction - network, speaker, both michael@0: * michael@0: * @return void michael@0: */ michael@0: michael@0: void vcmToneStartWithSpeakerAsBackup(vcm_tones_t tone, michael@0: short alert_info, michael@0: cc_call_handle_t call_handle, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_uint16_t direction); michael@0: michael@0: /** michael@0: * Stop the tone being played. michael@0: * michael@0: * Description: Stop the tone being played currently michael@0: * michael@0: * michael@0: * @param[in] tone - tone to be stopeed michael@0: * @param[in] group_id - associated stream's group michael@0: * @param[in] stream_id - associated stream id michael@0: * @param[in] call_handle - the context (call) for this tone. michael@0: * michael@0: * @return void michael@0: * michael@0: */ michael@0: michael@0: void vcmToneStop(vcm_tones_t tone, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle); michael@0: michael@0: /** michael@0: * start/stop ringing michael@0: * michael@0: * @param[in] ringMode - VCM ring mode (ON/OFF) michael@0: * @param[in] once - type of ring - continuous or one shot. michael@0: * @param[in] alert_info - header specified ring mode. michael@0: * @param[in] line - the line on which to start/stop ringing michael@0: * michael@0: * @return void michael@0: */ michael@0: michael@0: void vcmControlRinger(vcm_ring_mode_t ringMode, michael@0: short once, michael@0: cc_boolean alert_info, michael@0: int line, michael@0: cc_callid_t call_id); michael@0: michael@0: michael@0: /** michael@0: * Get current list of audio codec that could be used michael@0: * @param request_type - michael@0: * The request_type should be VCM_DECODEONLY/ENCODEONLY/FULLDUPLEX/IGNORE michael@0: * michael@0: * @return A bit mask should be returned that specifies the list of the audio michael@0: * codecs. The bit mask should conform to the defines in this file. michael@0: * #define VCM_RESOURCE_G711 0x00000001 michael@0: * #define VCM_RESOURCE_G729A 0x00000002 michael@0: * .... michael@0: */ michael@0: michael@0: int vcmGetAudioCodecList(int request_type); michael@0: michael@0: /** michael@0: * Get current list of video codec that could be used michael@0: * @param request_type - michael@0: * The request_type should be VCM_DECODEONLY/ENCODEONLY/FULLDUPLEX/IGNORE michael@0: * michael@0: * @return A bit mask should be returned that specifies the list of the audio michael@0: * codecs. The bit mask should conform to the defines in this file. michael@0: * #define VCM_RESOURCE_G711 0x00000001 michael@0: * #define VCM_RESOURCE_G729A 0x00000002 michael@0: * .... michael@0: */ michael@0: michael@0: int vcmGetVideoCodecList(int request_type); michael@0: michael@0: /** michael@0: * Get max supported H.264 video packetization mode. michael@0: * @return maximum supported video packetization mode for H.264. Value returned michael@0: * must be 0 or 1. Value 2 is not supported yet. michael@0: */ michael@0: int vcmGetVideoMaxSupportedPacketizationMode(); michael@0: michael@0: /** michael@0: * Get the rx/tx stream statistics associated with the call. michael@0: * The rx/tx stats are defined as comma seperated string as follows. michael@0: * Rx_stats: michael@0: * snprintf(rx_stats, CC_KFACTOR_STAT_LEN, michael@0: * "Dur=%d,Pkt=%d,Oct=%d,LatePkt=%d,LostPkt=%d,AvgJit=%d,VQMetrics=\"%s\"", michael@0: * duration, numberOfPackageReceived, numberOfByteReceived, numberOfLatePackage, numberOfPackageLost, averageJitter, qualityMatrics); michael@0: * Tx_stats: michael@0: * snprintf(tx_stats, CC_KFACTOR_STAT_LEN, "Dur=%d,Pkt=%d,Oct=%d", michael@0: * duration, numberOfPackageSent, numberOfByteSend); michael@0: * michael@0: *Example: michael@0: * michael@0: * vcm_rtp_get_stats : rx_stats:Dur=1,Pkt=90,Oct=15480,LatePkt=0,LostPkt=0,AvgJit=0,VQMetrics="MLQK=0.0;MLQKav=0.0;MLQKmn=0.0;MLQKmx=0.0;MLQKvr=0.95;CCR=0.0;ICR=0.0;ICRmx=0.0;CS=0;SCS=0" michael@0: * vcm_rtp_get_stats : tx_stats:Dur=1,Pkt=92,Oct=14720 michael@0: * Where the duration can be calculated, the numberOfLatePackage set to 0. michael@0: * michael@0: * @param[in] mcap_id - media type (audio/video) michael@0: * @param[in] group_id - group id of the stream michael@0: * @param[in] stream_id - stram id of the stream michael@0: * @param[in] call_handle - call handle michael@0: * @param[out] rx_stats - ptr to the rx field in the stats struct, see above. michael@0: * @param[out] tx_stats - ptr to the tx field in the stats struct, see above. michael@0: * michael@0: */ michael@0: michael@0: int vcmGetRtpStats(cc_mcapid_t mcap_id, michael@0: cc_groupid_t group_id, michael@0: cc_streamid_t stream_id, michael@0: cc_call_handle_t call_handle, michael@0: char *rx_stats, michael@0: char *tx_stats); michael@0: michael@0: /** michael@0: * michael@0: * The wlan interface puts into unique situation where call control michael@0: * has to allocate the worst case bandwith before creating a michael@0: * inbound or outbound call. The function call will interface through michael@0: * media API into wlan to get the call bandwidth. The function michael@0: * return is asynchronous and will block till the return media michael@0: * callback signals to continue the execution. michael@0: * michael@0: * @note If not using WLAN interface simply return true michael@0: * michael@0: * @return true if the bandwidth can be allocated else false. michael@0: */ michael@0: michael@0: cc_boolean vcmAllocateBandwidth(cc_call_handle_t call_handle, int sessions); michael@0: michael@0: /** michael@0: * michael@0: * Free the bandwidth allocated for this call michael@0: * using the vcmAllocateBandwidth API michael@0: * michael@0: * @note If not using WLAN provide a stub michael@0: */ michael@0: michael@0: void vcmRemoveBandwidth(cc_call_handle_t call_handle); michael@0: michael@0: /** michael@0: * @brief vcmActivateWlan michael@0: * michael@0: * Free the bandwidth allocated for this call michael@0: * using the vcmAllocateBandwidth API michael@0: * michael@0: * @note If not using WLAN provide a stub michael@0: */ michael@0: michael@0: void vcmActivateWlan(cc_boolean is_active); michael@0: michael@0: /** michael@0: * free the media pointer allocated in vcm_negotiate_attrs method michael@0: * michael@0: * @param ptr - pointer to be freed michael@0: * michael@0: * @return void michael@0: */ michael@0: void vcmFreeMediaPtr(void *ptr); michael@0: michael@0: /** michael@0: * MEDIA control received from far end on signaling path michael@0: * michael@0: * @param call_handle - call handle of the call michael@0: * @param to_encoder - the control request received michael@0: * Only FAST_PICTURE_UPDATE is supported michael@0: * michael@0: * @return void michael@0: * michael@0: */ michael@0: michael@0: void vcmMediaControl(cc_call_handle_t call_handle, vcm_media_control_to_encoder_t to_encoder); michael@0: michael@0: /** michael@0: * specifies DSCP marking for RTCP streams michael@0: * michael@0: * @param group_id - group id of the stream michael@0: * @param dscp - the DSCP value to be used michael@0: * michael@0: * @return void michael@0: */ michael@0: michael@0: void vcmSetRtcpDscp(cc_groupid_t group_id, int dscp); michael@0: michael@0: /** michael@0: * Verify if the SDP attributes for the requested video codec are acceptable michael@0: * michael@0: * This method is called for video codecs only. This method should parse the michael@0: * Video SDP attributes using the SDP helper API and verify if received michael@0: * attributes are acceptable. If the attributes are acceptable any attribute michael@0: * values if needed by vcmTxStart method should be bundled in the desired michael@0: * structure and its pointer should be returned in rccappptr. This opaque michael@0: * pointer shall be provided again when vcmTxStart is invoked. michael@0: * michael@0: * @param [in] media_type - codec for which we are negotiating michael@0: * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs michael@0: * @param [in] level - Parameter to be used with SDP helper APIs michael@0: * @param [out] rcapptr - variable to return the allocated attrib structure michael@0: * michael@0: * @return cc_boolean - true if attributes are accepted false otherwise michael@0: */ michael@0: michael@0: cc_boolean vcmCheckAttribs(cc_uint32_t media_type, void *sdp_p, int level, void **rcapptr); michael@0: michael@0: /** michael@0: * Add Video attributes in the offer/answer SDP michael@0: * michael@0: * This method is called for video codecs only. This method should populate the michael@0: * Video SDP attributes using the SDP helper API michael@0: * michael@0: * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs michael@0: * @param [in] level - Parameter to be used with SDP helper APIs michael@0: * @param [in] media_type - codec for which the SDP attributes are to be populated michael@0: * @param [in] payload_number - RTP payload type used for the SDP michael@0: * @param [in] isOffer - cc_boolean indicating we are encoding an offer or an aswer michael@0: * michael@0: * @return void michael@0: */ michael@0: michael@0: michael@0: void vcmPopulateAttribs(void *sdp_p, int level, cc_uint32_t media_type, michael@0: cc_uint16_t payload_number, cc_boolean isOffer); michael@0: michael@0: michael@0: /** michael@0: * Send a DTMF digit michael@0: * michael@0: * This method is called for sending a DTMF tone for the specified duration michael@0: * michael@0: * @param [in] digit - the DTMF digit that needs to be played out. michael@0: * @param [in] duration - duration of the tone michael@0: * @param [in] direction - direction in which the tone needs to be played. michael@0: * michael@0: * @return void michael@0: */ michael@0: int vcmDtmfBurst(int digit, int duration, int direction); michael@0: michael@0: /** michael@0: * vcmGetILBCMode michael@0: * michael@0: * This method should return the mode that needs to be used in michael@0: * SDP michael@0: * @return int michael@0: */ michael@0: int vcmGetILBCMode(); michael@0: michael@0: /** michael@0: * vcmOnSdpParseError michael@0: * michael@0: * This method is called for each parsing error of SDP. It does not necessarily michael@0: * mean the SDP read was fatal and can be called many times for the same SDP. michael@0: * michael@0: */ michael@0: int vcmOnSdpParseError(const char *peercconnection, const char *message); michael@0: michael@0: /** michael@0: * vcmDisableRtcpComponent michael@0: * michael@0: * If we are doing rtcp-mux we need to disable component number 2 in the ICE michael@0: * layer. Otherwise we will wait for it to connect when it is unused michael@0: */ michael@0: int vcmDisableRtcpComponent(const char *peerconnection, int level); michael@0: michael@0: short vcmGetVideoMaxFs(uint16_t codec, int32_t *max_fs); michael@0: michael@0: short vcmGetVideoMaxFr(uint16_t codec, int32_t *max_fs); michael@0: michael@0: //Using C++ for gips. This is the end of extern "C" above. michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif michael@0: michael@0: michael@0: michael@0: michael@0: #endif /* _VCM_H_ */