📄 rtp.h
字号:
/*********************************************************************** Copyright (c) 2002 RADVISION Ltd.************************************************************************NOTICE:This document contains information that is confidential and proprietaryto RADVISION Ltd.. No part of this document may be reproduced in anyform whatsoever without written prior approval by RADVISION Ltd..RADVISION Ltd. reserve the right to revise this publication and makechanges without obligation to notify any person of such revisions orchanges.***********************************************************************/#ifndef __RTP_H#define __RTP_H#include "rvtypes.h"/* Definition of "old" seli and timer pool*/#ifndef RV_SELI_HANDLE#define RV_SELI_HANDLERV_DECLARE_HANDLE(RV_SELI_Handle);#endif /*RV_SELI_HANDLE*/#ifdef __cplusplusextern "C" {#endif#define RVVXDAPI RVAPI#define VXDCALLCONV RVCALLCONV#define CALLCONVCRV_DECLARE_HANDLE(HRTPSESSION);#ifndef __RTCP_HRV_DECLARE_HANDLE(HRTCPSESSION);#endiftypedef struct{ IN OUT RvUint32 timestamp; IN OUT RvBool marker; IN OUT RvUint8 payload; OUT RvUint32 sSrc; OUT RvUint16 sequenceNumber; OUT int sByte; OUT int len;} rtpParam;typedef void (*LPRTPEVENTHANDLER) ( IN HRTPSESSION hRTP, IN void * context ); /* == Basic RTP Functions == */RVAPIRvInt32 RVCALLCONV rtpInit(void);RVAPIRvInt32 RVCALLCONV rtpInitEx(RvUint32);RVAPIvoid RVCALLCONV rtpEnd(void);/************************************************************************************ * rtpSetLocalAddress * description: Set the local address to use for calls to rtpOpenXXX functions. * This parameter overrides the value given in rtpInitEx() for all * subsequent calls. * input: ip - Local IP address to use * output: none. * return value: Non-negative value on success * Negative value on failure ***********************************************************************************/RVAPIint RVCALLCONV rtpSetLocalAddress(IN RvUint32 ip);RVAPIint RVCALLCONV rtpGetAllocationSize(void);/************************************************************************************ * rtpOpenFrom * description: Opens an RTP session in the memory that the application allocated. * input: port - The UDP port number to be used for the RTP session. * ssrcPattern - Synchronization source Pattern value for the RTP session. * ssrcMask - Synchronization source Mask value for the RTP session. * buffer - Application allocated buffer with a value no less than the * value returned by the function rtpGetAllocationSize(). * bufferSize - size of the buffer. * output: none. * return value: If no error occurs, the function returns the handle for the opened RTP * session. Otherwise, it returns NULL. ***********************************************************************************/RVAPIHRTPSESSION RVCALLCONV rtpOpenFrom( IN RvUint16 port, IN RvUint32 ssrcPattern, IN RvUint32 ssrcMask, IN void* buffer, IN int bufferSize);/************************************************************************************ * rtpOpen * description: Opens an RTP session. The RTP Stack allocates an object and the * memory needed for the RTP session. It also opens a socket and waits * for packets. rtpOpen() also returns the handle of this session to * the application. * input: port - The UDP port number to be used for the RTP session. * ssrcPattern - Synchronization source Pattern value for the RTP session. * ssrcMask - Synchronization source Mask value for the RTP session. * output: none. * return value: If no error occurs, the function returns the handle for the opened RTP * session. Otherwise, it returns NULL. ***********************************************************************************/RVAPIHRTPSESSION RVCALLCONV rtpOpen( IN RvUint16 port, IN RvUint32 ssrcPattern, IN RvUint32 ssrcMask);/************************************************************************************ * rtpOpenEx * description: Opens an RTP session and an associated RTCP session. * input: port - The UDP port number to be used for the RTP session. * ssrcPattern - Synchronization source Pattern value for the RTP session. * ssrcMask - Synchronization source Mask value for the RTP session. * cname - The unique name representing the source of the RTP data. * output: none. * return value: If no error occurs, the function returns the handle for the open * RTP session. Otherwise, the function returns NULL. ***********************************************************************************/RVAPIHRTPSESSION RVCALLCONV rtpOpenEx( IN RvUint16 port, IN RvUint32 ssrcPattern, IN RvUint32 ssrcMask, IN char * cname);/************************************************************************************ * rtpClose * description: Close RTP session. * input: hRTP - Handle of the RTP session. * output: none. * return value: If an error occurs, the function returns a negative value. * If no error occurs, the function returns a non-negative value. ***********************************************************************************/RVAPIRvUint32 RVCALLCONV rtpClose( IN HRTPSESSION hRTP);/************************************************************************************ * rtpGetSSRC * description: Returns the current SSRC (synchronization source value) of the RTP session. * input: hRTP - Handle of the RTP session. * output: none. * return value: If no error occurs, the function returns the current SSRC value. * Otherwise, it returns a negative value. ***********************************************************************************/RVAPIRvUint32 RVCALLCONV rtpGetSSRC( IN HRTPSESSION hRTP);/************************************************************************************ * rtpSetEventHandler * description: Set an Event Handler for the RTP session. The application must set * an Event Handler for each RTP session. * input: hRTP - Handle of the RTP session. * eventHandler - Pointer to the callback function that is called each time a * new RTP packet arrives to the RTP session. * context - The parameter is an application handle that identifies the * particular RTP session. The application passes the handle to * the Event Handler. * output: none. * return value: none. ***********************************************************************************/RVAPIvoid RVCALLCONV rtpSetEventHandler( IN HRTPSESSION hRTP, IN LPRTPEVENTHANDLER eventHandler, IN void * context);/************************************************************************************ * rtpSetRemoteAddress * description: Defines the address of the remote peer or the address of a multicast * group to which the RTP stream will be sent. * input: hRTP - Handle of the RTP session. * ip - IP address to which RTP packets should be sent. * port - UDP port to which RTP packets should be sent. * output: none. * return value: none. ***********************************************************************************/RVAPIvoid RVCALLCONV rtpSetRemoteAddress( IN HRTPSESSION hRTP, IN RvUint32 ip, IN RvUint16 port);/************************************************************************************ * rtpWrite * description: This routine sets the RTP header. * input: hRTP - Handle of the RTP session. * buf - Pointer to buffer containing the RTP packet with room before first * payload byte for RTP header. * len - Length in bytes of buf. * p - A struct of RTP param. * output: none. * return value: If no error occurs, the function returns the non-negative value. * Otherwise, it returns a negative value. ***********************************************************************************/RVAPIRvInt32 RVCALLCONV rtpWrite( IN HRTPSESSION hRTP, IN void * buf, IN RvInt32 len, IN rtpParam * p);/************************************************************************************ * rtpPack * description: This routine sets the RTP header. * input: hRTP - Handle of the RTP session. * buf - Pointer to buffer containing the RTP packet with room before first * payload byte for RTP header. * len - Length in bytes of buf. * p - A struct of RTP param. * output: none. * return value: If no error occurs, the function returns the non-negative value. * Otherwise, it returns a negative value. ***********************************************************************************/RVAPIRvInt32 RVCALLCONV rtpPack( IN HRTPSESSION hRTP, IN void * buf, IN RvInt32 len, IN rtpParam * p);RVAPIRvInt32 RVCALLCONV rtpUnpack( IN HRTPSESSION hRTP, IN void * buf, IN RvInt32 len, OUT rtpParam* p);/************************************************************************************ * rtpRead * description: This routine sets the header of the RTP message. * input: hRTP - Handle of the RTP session. * buf - Pointer to buffer containing the RTP packet with room before first * payload byte for RTP header.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -