⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ortp-rtpsession-api.html

📁 ortp协议栈(实时传输协议)
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<HTML><HEAD><TITLE>RtpSession API</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="oRTP Reference Manual"HREF="book1.html"><LINKREL="UP"TITLE="oRTP API"HREF="ortpapi.html"><LINKREL="PREVIOUS"TITLE="Stack management functions"HREF="ortp-stack-management-functions.html"><LINKREL="NEXT"TITLE="RTP payloads and profiles"HREF="ortp-rtp-payloads-and-profiles.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"BGCOLOR="#000000"CELLPADDING="1"CELLSPACING="0"><TR><THCOLSPAN="4"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="5">oRTP Reference Manual</FONT></TH></TR><TR><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="left"><AHREF="ortp-stack-management-functions.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>&#60;&#60;&#60; Previous Page</B></FONT></A></TD><TDWIDTH="25%"BGCOLOR="#0000C0"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="book1.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Home</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#00C000"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="ortpapi.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Up</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="right"><AHREF="ortp-rtp-payloads-and-profiles.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Next Page &#62;&#62;&#62;</B></FONT></A></TD></TR></TABLE></DIV><H1><ANAME="ORTP-RTPSESSION-API">RtpSession API</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN52"></A><H2>Name</H2>RtpSession API&nbsp;--&nbsp;The RtpSession object provides control on a RTP session as defined in RFC 1889.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN55"><H2>Synopsis</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS">&#13;#include &lt;ortp.h&gt;struct      <AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A>;enum        <AHREF="ortp-rtpsession-api.html#RTPSESSIONMODE">RtpSessionMode</A>;#define     <AHREF="ortp-rtpsession-api.html#RTP-CALLBACK-TABLE-MAX-ENTRIES-CAPS">RTP_CALLBACK_TABLE_MAX_ENTRIES</A><AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A>* <AHREF="ortp-rtpsession-api.html#RTP-SESSION-NEW">rtp_session_new</A>                 (gint mode);void        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-SCHEDULING-MODE">rtp_session_set_scheduling_mode</A> (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gint yesno);void        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-BLOCKING-MODE">rtp_session_set_blocking_mode</A>   (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gint yesno);void        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-PROFILE">rtp_session_set_profile</A>         (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             <AHREF="ortp-rtp-payloads-and-profiles.html#RTPPROFILE">RtpProfile</A> *profile);int         <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-LOCAL-ADDR">rtp_session_set_local_addr</A>      (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gchar *addr,                                             gint port);gint        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-REMOTE-ADDR">rtp_session_set_remote_addr</A>     (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             struct sockaddr_in *dest);void        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-JITTER-COMPENSATION">rtp_session_set_jitter_compensation</A>                                            (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             int milisec);void        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-SSRC">rtp_session_set_ssrc</A>            (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             guint32 ssrc);int         <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SET-PAYLOAD-TYPE">rtp_session_set_payload_type</A>    (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             int paytype);int         <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SIGNAL-CONNECT">rtp_session_signal_connect</A>      (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             char *signal,                                             RtpCallback cb,                                             gpointer user_data);int         <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SIGNAL-DISCONNECT-BY-CALLBACK">rtp_session_signal_disconnect_by_callback</A>                                            (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             char *signal,                                             RtpCallback cb);gint        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SEND-WITH-TS">rtp_session_send_with_ts</A>        (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gchar *buffer,                                             gint len,                                             guint32 userts);gint        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-RECV-WITH-TS">rtp_session_recv_with_ts</A>        (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gchar *buffer,                                             gint len,                                             guint32 time,                                             gint *have_more);gint        <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SENDM-WITH-TS">rtp_session_sendm_with_ts</A>       (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             mblk_t *mp,                                             guint32 userts);mblk_t*     <AHREF="ortp-rtpsession-api.html#RTP-SESSION-RECVM-WITH-TS">rtp_session_recvm_with_ts</A>       (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             guint32 user_ts);mblk_t*     <AHREF="ortp-rtpsession-api.html#RTP-SESSION-CREATE-PACKET">rtp_session_create_packet</A>       (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gint header_size,                                             char *payload,                                             gint payload_size);</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN122"></A><H2>Description</H2><P>The following api provides the application a way to define a RTP session, send or receivesdata through it, and to keep informed of the evolution of the RTP session through a simplecallback mecanism (see <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SIGNAL-CONNECT">rtp_session_signal_connect</A>() for details).</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN126"></A><H2>Details</H2><DIVCLASS="REFSECT2"><ANAME="AEN128"></A><H3><ANAME="RTPSESSION"></A>struct RtpSession</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct RtpSession{	RtpSession *next;	/* next RtpSession, when the session are enqueued by the scheduler */	RtpProfile *profile;	GMutex *lock;	guint32 ssrc;	gint payload_type;#ifndef TARGET_IS_HPUXKERNEL	gint highest_fd;	fd_set scanfd;#else	mblk_t *dest_mproto; 	/* a M_PROTO that contains the destination address for outgoing packets*/#endif	gint max_buf_size;	RtpSignalTable on_ssrc_changed;	RtpSignalTable on_payload_type_changed;	RtpSignalTable on_telephone_event_packet;	RtpSignalTable on_telephone_event;	RtpStream rtp;	RtcpStream rtcp;	RtpSessionMode mode;#ifdef BUILD_SCHEDULER	struct _RtpScheduler *sched;#endif	guint32 flags;	rtp_stats_t stats;	gint mask_pos;	/* the position in the scheduler mask of RtpSession */	gpointer user_data;		/* telephony events extension */	gint telephone_events_pt;	/* the payload type used for telephony events */	mblk_t *current_tev;		/* the pending telephony events */};</PRE></TD></TR></TABLE><P>Users should not manipulate this structure directly.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN133"></A><H3><ANAME="RTPSESSIONMODE"></A>enum RtpSessionMode</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">typedef enum {	RTP_SESSION_RECVONLY,	RTP_SESSION_SENDONLY,	RTP_SESSION_SENDRECV} RtpSessionMode;</PRE></TD></TR></TABLE><P></P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN138"></A><H3><ANAME="RTP-CALLBACK-TABLE-MAX-ENTRIES-CAPS"></A>RTP_CALLBACK_TABLE_MAX_ENTRIES</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">#define RTP_CALLBACK_TABLE_MAX_ENTRIES	5</PRE></TD></TR></TABLE><P></P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN143"></A><H3><ANAME="RTP-SESSION-NEW"></A>rtp_session_new ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A>* rtp_session_new                 (gint mode);</PRE></TD></TR></TABLE><P>Creates a new rtp session.</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN151"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>mode</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> One of the <AHREF="ortp-rtpsession-api.html#RTPSESSIONMODE">RtpSessionMode</A> flags.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">Returns</I></SPAN> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> the newly created rtp session.</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN165"></A><H3><ANAME="RTP-SESSION-SET-SCHEDULING-MODE"></A>rtp_session_set_scheduling_mode ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        rtp_session_set_scheduling_mode (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gint yesno);</PRE></TD></TR></TABLE><P>Sets the scheduling mode of the rtp session. If <TTCLASS="PARAMETER"><I>yesno</I></TT> is 1, the rtp session is inthe scheduled mode: this means that packet input/output for that sessionis done by a thread that is in charge of getting and sending packet at regular timeinterval. This is very usefull for outgoing packets, that have to be sent at a time thatmatches their timestamp.If <TTCLASS="PARAMETER"><I>yesno</I></TT> is zero, then the session is not scheduled. All recv and send operation willoccur when calling respectively <AHREF="ortp-rtpsession-api.html#RTP-SESSION-RECV-WITH-TS">rtp_session_recv_with_ts</A>() and <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SEND-WITH-TS">rtp_session_send_with_ts</A>().</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN177"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp session.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>yesno</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">	a boolean to indicate the scheduling mode.</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN190"></A><H3><ANAME="RTP-SESSION-SET-BLOCKING-MODE"></A>rtp_session_set_blocking_mode ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        rtp_session_set_blocking_mode   (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             gint yesno);</PRE></TD></TR></TABLE><P>This function defines the behaviour of the <AHREF="ortp-rtpsession-api.html#RTP-SESSION-RECV-WITH-TS">rtp_session_recv_with_ts</A>() and <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SEND-WITH-TS">rtp_session_send_with_ts</A>() functions. If <TTCLASS="PARAMETER"><I>yesno</I></TT> is 1, <AHREF="ortp-rtpsession-api.html#RTP-SESSION-RECV-WITH-TS">rtp_session_recv_with_ts</A>()will block until it is time for the packet to be received, according to the timestamppassed to the function. After this time, the function returns.For <AHREF="ortp-rtpsession-api.html#RTP-SESSION-SEND-WITH-TS">rtp_session_send_with_ts</A>(), it will block until it is time for the packet to be sent.If <TTCLASS="PARAMETER"><I>yesno</I></TT> is 0, then the two functions will return immediately.</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN204"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp session</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>yesno</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a boolean</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN217"></A><H3><ANAME="RTP-SESSION-SET-PROFILE"></A>rtp_session_set_profile ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        rtp_session_set_profile         (<AHREF="ortp-rtpsession-api.html#RTPSESSION">RtpSession</A> *session,                                             <AHREF="ortp-rtp-payloads-and-profiles.html#RTPPROFILE">RtpProfile</A> *profile);</PRE></TD></TR></TABLE><P>Set the RTP profile to be used for the session. By default, all session are created by<AHREF="ortp-rtpsession-api.html#RTP-SESSION-NEW">rtp_session_new</A>() are initialized with the AV profile, as defined in RFC 1890. The applicationcan set any other profile instead using that function.</P><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN226"><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>session</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp session</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>profile</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> a rtp profile</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -