/*
This file is a part of JRTPLIB
Copyright (c) 1999-2011 Jori Liesenborgs
Contact: jori.liesenborgs@gmail.com
This library was developed at the Expertise Centre for Digital Media
(http://www.edm.uhasselt.be), a research center of the Hasselt University
(http://www.uhasselt.be). The library is based upon work done for
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
/**
* \file rtpsession.h
*/
#ifndef RTPSESSION_H
#define RTPSESSION_H
#include "rtpconfig.h"
#include "rtplibraryversion.h"
#include "rtppacketbuilder.h"
#include "rtpsessionsources.h"
#include "rtptransmitter.h"
#include "rtpcollisionlist.h"
#include "rtcpscheduler.h"
#include "rtcppacketbuilder.h"
#include "rtptimeutilities.h"
#include "rtcpcompoundpacketbuilder.h"
#include "rtpmemoryobject.h"
#include <list>
#ifdef RTP_SUPPORT_THREAD
//#include <jthread/jmutex.h>
#include "jmutex.h"
#endif // RTP_SUPPORT_THREAD
namespace jrtplib
{
class RTPTransmitter;
class RTPSessionParams;
class RTPTransmissionParams;
class RTPAddress;
class RTPSourceData;
class RTPPacket;
class RTPPollThread;
class RTPTransmissionInfo;
class RTCPCompoundPacket;
class RTCPPacket;
class RTCPAPPPacket;
/** High level class for using RTP.
* For most RTP based applications, the RTPSession class will probably be the one to use. It handles
* the RTCP part completely internally, so the user can focus on sending and receiving the actual data.
* \note The RTPSession class is not meant to be thread safe. The user should use some kind of locking
* mechanism to prevent different threads from using the same RTPSession instance.
*/
class JRTPLIB_IMPORTEXPORT RTPSession : public RTPMemoryObject
{
public:
/** Constructs an RTPSession instance, optionally using a specific instance of a random
* number generator, and optionally installing a memory manager.
* Constructs an RTPSession instance, optionally using a specific instance of a random
* number generator, and optionally installing a memory manager. If no random number generator
* is specified, the RTPSession object will try to use either a RTPRandomURandom or
* RTPRandomRandS instance. If neither is available on the current platform, a RTPRandomRand48
* instance will be used instead. By specifying a random number generator yourself, it is
* possible to use the same generator in several RTPSession instances.
*/
RTPSession(RTPRandom *rnd = 0, RTPMemoryManager *mgr = 0);
virtual ~RTPSession();
/** Creates an RTP session.
* This function creates an RTP session with parameters \c sessparams, which will use a transmitter
* corresponding to \c proto. Parameters for this transmitter can be specified as well. If \c
* proto is of type RTPTransmitter::UserDefinedProto, the NewUserDefinedTransmitter function must
* be implemented.
*/
int Create(const RTPSessionParams &sessparams,const RTPTransmissionParams *transparams = 0, RTPTransmitter::TransmissionProtocol proto = RTPTransmitter::IPv4UDPProto);
/** Creates an RTP session using \c transmitter as transmission component.
* This function creates an RTP session with parameters \c sessparams, which will use the
* transmission component \c transmitter. Initialization and destruction of the transmitter
* will not be done by the RTPSession class if this Create function is used. This function
* can be useful if you which to reuse the transmission component in another RTPSession
* instance, once the original RTPSession isn't using the transmitter anymore.
*/
int Create(const RTPSessionParams &sessparams,RTPTransmitter *transmitter);
/** Leaves the session without sending a BYE packet. */
void Destroy();
/** Sends a BYE packet and leaves the session.
* Sends a BYE packet and leaves the session. At most a time \c maxwaittime will be waited to
* send the BYE packet. If this time expires, the session will be left without sending a BYE packet.
* The BYE packet will contain as reason for leaving \c reason with length \c reasonlength.
*/
void BYEDestroy(const RTPTime &maxwaittime,const void *reason,size_t reasonlength);
/** Returns whether the session has been created or not. */
bool IsActive();
/** Returns our own SSRC. */
uint32_t GetLocalSSRC();
/** Adds \c addr to the list of destinations. */
int AddDestination(const RTPAddress &addr);
/** Deletes \c addr from the list of destinations. */
int DeleteDestination(const RTPAddress &addr);
/** Clears the list of destinations. */
void ClearDestinations();
/** Returns \c true if multicasting is supported. */
bool SupportsMulticasting();
/** Joins the multicast group specified by \c addr. */
int JoinMulticastGroup(const RTPAddress &addr);
/** Leaves the multicast group specified by \c addr. */
int LeaveMulticastGroup(const RTPAddress &addr);
/** Leaves all multicast groups. */
void LeaveAllMulticastGroups();
/** Sends the RTP packet with payload \c data which has length \c len.
* Sends the RTP packet with payload \c data which has length \c len.
* The used payload type, marker and timestamp increment will be those that have been set
* using the \c SetDefault member functions.
*/
int SendPacket(const void *data,size_t len);
/** Sends the RTP packet with payload \c data which has length \c len.
* It will use payload type \c pt, marker \c mark and after the packet has been built, the
* timestamp will be incremented by \c timestampinc.
*/
int SendPacket(const void *data,size_t len,
uint8_t pt,bool mark,uint32_t timestampinc);
/** Sends the RTP packet with payload \c data which has length \c len.
* The packet will contain a header extension with identifier \c hdrextID and containing data
* \c hdrextdata. The length of this data is given by \c numhdrextwords and is specified in a
* number of 32-bit words. The used payload type, marker and timestamp increment will be those that
* have been set using the \c SetDefault member functions.
*/
int SendPacketEx(const void *data,size_t len,
uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords);
/** Sends the RTP packet with payload \c data which has length \c len.
* It will use payload type \c pt, marker \c mark and after the packet has been built, the
* timestamp will be incremented by \c timestampinc. The packet will contain a header
* extension with identifier \c hdrextID and containing data \c hdrextdata. The length
* of this data is given by \c numhdrextwords and is specified in a number of 32-bit words.
*/
int SendPacketEx(const void *data,size_t len,
uint8_t pt,bool mark,uint32_t timestampinc,
uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords);
#ifdef RTP_SUPPORT_SENDAPP
/** If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet
*
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
myJRTPLIBHeader.zip (58个子文件)
myJRTPLIBHeader
rtppollthread.h 2KB
rtcpunknownpacket.h 3KB
rtcpscheduler.h 7KB
rtpmemoryobject.h 2KB
rtphashtable.h 8KB
rtpdebug.h 2KB
rtprawpacket.h 4KB
rtptypes_win.h 2KB
rtpipv6address.h 4KB
rtppacketbuilder.h 10KB
rtprandom.h 2KB
rtcpsdespacket.h 11KB
rtprandomrands.h 2KB
rtperrors.h 11KB
rtpcollisionlist.h 3KB
rtppacket.h 7KB
jrtplib.lib 1.79MB
rtpmemorymanager.h 8KB
rtpconfig.h 2KB
rtplibraryversion.h 2KB
jmutexautolock.h 2KB
rtpipv4destination.h 3KB
rtpsessionparams.h 11KB
rtpipv6destination.h 3KB
jthreadconfig.h 2KB
rtcpcompoundpacketbuilder.h 12KB
rtpkeyhashtable.h 9KB
jthread.h 2KB
rtprandomrand48.h 2KB
rtcpsdesinfo.h 8KB
rtpsources.h 17KB
rtcpcompoundpacket.h 4KB
rtpipv4address.h 4KB
rtpinternalsourcedata.h 5KB
rtpudpv4transmitter.h 11KB
rtpstructs.h 3KB
rtptimeutilities.h 8KB
rtpbyteaddress.h 4KB
rtpexternaltransmitter.h 9KB
jthread_d.lib 55KB
rtcpbyepacket.h 4KB
jrtplib_d.lib 5.79MB
rtcpsrpacket.h 8KB
rtpaddress.h 3KB
rtcprrpacket.h 6KB
rtpdefines.h 3KB
jthread.lib 11KB
rtptransmitter.h 11KB
rtpsourcedata.h 20KB
rtcppacket.h 3KB
rtpsessionsources.h 3KB
rtprandomurandom.h 2KB
jmutex.h 2KB
rtcpapppacket.h 4KB
rtpsession.h 26KB
rtcppacketbuilder.h 12KB
rtptypes.h 237B
rtpudpv6transmitter.h 11KB
共 58 条
- 1
iskyseraph
- 粉丝: 108
- 资源: 42
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页