📄 payloads.sgml
字号:
<refentry id="ortp-RTP-payloads-and-profiles"><refmeta><refentrytitle>RTP payloads and profiles</refentrytitle><manvolnum>3</manvolnum><refmiscinfo>ORTP Library</refmiscinfo></refmeta><refnamediv><refname>RTP payloads and profiles</refname><refpurpose>This section describes the way that the oRTP stack manages RTP profiles and payload types.</refpurpose></refnamediv><refsynopsisdiv><title>Synopsis</title><synopsis>#include <payloadtype.h>struct <link linkend="PayloadType">PayloadType</link>;struct <link linkend="RtpProfile">RtpProfile</link>;extern RtpProfile <link linkend="av-profile">av_profile</link>;#define <link linkend="rtp-profile-clear-all">rtp_profile_clear_all</link> (profile)#define <link linkend="rtp-profile-get-name">rtp_profile_get_name</link> (profile)#define <link linkend="rtp-profile-set-name">rtp_profile_set_name</link> (profile,nm)#define <link linkend="rtp-profile-set-payload">rtp_profile_set_payload</link> (profile,index,pt)#define <link linkend="rtp-profile-get-payload">rtp_profile_get_payload</link> (profile,index)#define <link linkend="rtp-profile-clear-payload">rtp_profile_clear_payload</link> (profile,index)#define <link linkend="rtp-profile-clear-all">rtp_profile_clear_all</link> (profile)</synopsis></refsynopsisdiv><refsect1><title>Description</title><para>A rtp payload type is a number between 0 and 127 that identifies a particular payload (GSM, PCMU, MPEG,...) within a given rtp profile. The <link linkend="PayloadType">PayloadType</link> object in oRTP describesa payload.An RTP profile is a table that assigns particular payloads (GSM, MPEG...) to a payload typenumber within the range 0..127. In oRTP, profiles are represented by the <link linkend="RtpProfile">RtpProfile</link> object.For example in the AV profile (Audio Video profile, defined in RFC1890), often used by telephony applications, the payload type number 8 is assigned to PCMA (A-law compressed audio) at sampling frequency 8000 Hz, mono.By default, all RTP sessions created by oRTP use the AV profile, but you can change the profileof an RTP session using <link linkend="rtp-session-set-profile">rtp_session_set_profile</link>().</para></refsect1><refsect1><title>Details</title><refsect2><title><anchor id="PayloadType">struct PayloadType</title><programlisting>struct PayloadType{ gint type; #define PAYLOAD_AUDIO_CONTINUOUS 0 #define PAYLOAD_AUDIO_PACKETIZED 1 #define PAYLOAD_VIDEO 2 #define PAYLOAD_OTHER 3 /* ?? */ gint clock_rate; double bytes_per_sample; /* in case of continuous audio data */ char *zero_pattern; gint pattern_length; /* other usefull information */ gint normal_bitrate; /*in bit/s */ char *mime_type; guint32 flags;};</programlisting><para></para></refsect2><refsect2><title><anchor id="RtpProfile">struct RtpProfile</title><programlisting>struct RtpProfile{ char *name; PayloadType *payload[127];};</programlisting><para></para></refsect2><refsect2><title><anchor id="av-profile">av_profile</title><programlisting>extern RtpProfile av_profile;</programlisting><para>This is the Audio Video profile defined in RFC1890.</para></refsect2><refsect2><title><anchor id="rtp-profile-clear-all">rtp_profile_clear_all()</title><programlisting>#define rtp_profile_clear_all(profile) memset((void*)(profile),0,sizeof(RtpProfile))</programlisting><para>Initialize the profile to the empty profile (all payload type are unassigned).</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>profile</parameter> :</entry><entry> an RTP profile (<link linkend="RtpProfile">RtpProfile</link> object)</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-profile-get-name">rtp_profile_get_name()</title><programlisting>#define rtp_profile_get_name(profile) (profile)->name</programlisting><para></para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>profile</parameter> :</entry><entry> a rtp profile object (<link linkend="RtpProfile">RtpProfile</link>)</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-profile-set-name">rtp_profile_set_name()</title><programlisting>#define rtp_profile_set_name(profile,nm) (profile)->name=(nm)</programlisting><para>Set a name to the rtp profile. (This is not required)</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>profile</parameter> :</entry><entry> a rtp profile object (<link linkend="RtpProfile">RtpProfile</link>)</entry></row><row><entry align="right"><parameter>nm</parameter> :</entry><entry> a string</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-profile-set-payload">rtp_profile_set_payload()</title><programlisting>#define rtp_profile_set_payload(profile,index,pt) (profile)->payload[(index)]=(pt)</programlisting><para>Assign payload type number <parameter>index</parameter> to payload type desribed in <parameter>pt</parameter> for the RTP profile<parameter>profile</parameter>.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>profile</parameter> :</entry><entry> an RTP profile (a <link linkend="RtpProfile">RtpProfile</link> object)</entry></row><row><entry align="right"><parameter>index</parameter> :</entry><entry> the payload type number</entry></row><row><entry align="right"><parameter>pt</parameter> :</entry><entry> the payload type description (a <link linkend="PayloadType">PayloadType</link> object )</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-profile-get-payload">rtp_profile_get_payload()</title><programlisting>#define rtp_profile_get_payload(profile,index) ((profile)->payload[(index)])</programlisting><para>Gets the payload description of the payload type <parameter>index</parameter> in the profile <parameter>profile</parameter>.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>profile</parameter> :</entry><entry> an RTP profile (a <link linkend="RtpProfile">RtpProfile</link> object)</entry></row><row><entry align="right"><parameter>index</parameter> :</entry><entry> the payload type number</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-profile-clear-payload">rtp_profile_clear_payload()</title><programlisting>#define rtp_profile_clear_payload(profile,index) (profile)->payload[(index)]=NULL</programlisting><para>Set payload type number <parameter>index</parameter> unassigned in profile <parameter>profile</parameter>.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>profile</parameter> :</entry><entry> an RTP profile (a <link linkend="RtpProfile">RtpProfile</link> object)</entry></row><row><entry align="right"><parameter>index</parameter> :</entry><entry> the payload type number</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="rtp-profile-clear-all">rtp_profile_clear_all()</title><programlisting>#define rtp_profile_clear_all(profile) memset((void*)(profile),0,sizeof(RtpProfile))</programlisting><para>Initialize the profile to the empty profile (all payload type are unassigned).</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>profile</parameter> :</entry><entry> an RTP profile (<link linkend="RtpProfile">RtpProfile</link> object)</entry></row></tbody></tgroup></informaltable></refsect2></refsect1><refsect1><title>See Also</title><para><link linkend="rtp-session-set-profile">rtp_session_set_profile</link>()</para></refsect1></refentry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -