gstreamer/gst-libs/gst/rtp/gstrtppayloads.c
Wim Taymans d874f65f6e Update documentation.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-docs.sgml:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/rtp/gstrtppayloads.c:
Update documentation.
2007-10-01 13:37:31 +00:00

229 lines
9.2 KiB
C

/* GStreamer
* Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
*
* gstrtppayloads.h: various helper functions to deal with RTP payload
* types.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:gstrtppayloads
* @short_description: Helper methods for dealing with RTP payloads
* @see_also: gstrtpbuffer
*
* <refsect2>
* <para>
* The GstRTPPayloads helper functions makes it easy to deal with static and dynamic
* payloads. Its main purpose is to retrieve properties such as the default clock-rate
* and get session bandwidth information.
* </para>
* </refsect2>
*
* Last reviewed on 2007-10-01 (0.10.15)
*/
#include <string.h>
#include "gstrtppayloads.h"
/* pt, encoding_name, media, rate, params, bitrate */
static const GstRTPPayloadInfo info[] = {
/* static audio */
{0, "audio", "PCMU", 8000, "1", 64000},
/* { 1, "audio", "reserved", 0, NULL, 0 }, */
/* { 2, "audio", "reserved", 0, NULL, 0 }, */
{3, "audio", "GSM", 8000, "1", 0},
{4, "audio", "G723", 8000, "1", 0},
{5, "audio", "DVI4", 8000, "1", 32000},
{6, "audio", "DVI4", 16000, "1", 64000},
{7, "audio", "LPC", 8000, "1", 0},
{8, "audio", "PCMA", 8000, "1", 64000},
{9, "audio", "G722", 8000, "1", 64000},
{10, "audio", "L16", 44100, "2", 1411200},
{11, "audio", "L16", 44100, "1", 705600},
{12, "audio", "QCELP", 8000, "1", 0},
{13, "audio", "CN", 8000, "1", 0},
{14, "audio", "MPA", 90000, NULL, 0},
{15, "audio", "G728", 8000, "1", 0},
{16, "audio", "DVI4", 11025, "1", 44100},
{17, "audio", "DVI4", 22050, "1", 88200},
{18, "audio", "G729", 8000, "1", 0},
/* { 19, "audio", "reserved", 0, NULL, 0 }, */
/* { 20, "audio", "unassigned", 0, NULL, 0 }, */
/* { 21, "audio", "unassigned", 0, NULL, 0 }, */
/* { 22, "audio", "unassigned", 0, NULL, 0 }, */
/* { 23, "audio", "unassigned", 0, NULL, 0 }, */
/* video and video/audio */
/* { 24, "video", "unassigned", 0, NULL, 0 }, */
{25, "video", "CelB", 90000, NULL, 0},
{26, "video", "JPEG", 90000, NULL, 0},
/* { 27, "video", "unassigned", 0, NULL, 0 }, */
{28, "video", "nv", 90000, NULL, 0},
/* { 29, "video", "unassigned", 0, NULL, 0 }, */
/* { 30, "video", "unassigned", 0, NULL, 0 }, */
{31, "video", "H261", 90000, NULL, 0},
{32, "video", "MPV", 90000, NULL, 0},
{33, "video", "MP2T", 90000, NULL, 0},
{34, "video", "H263", 90000, NULL, 0},
/* { 35-71, "unassigned", 0, 0, NULL, 0 }, */
/* { 72-76, "reserved", 0, 0, NULL, 0 }, */
/* { 77-95, "unassigned", 0, 0, NULL, 0 }, */
/* { 96-127, "dynamic", 0, 0, NULL, 0 }, */
/* dynamic stuff */
{-1, "application", "parityfec", 0, NULL, 0}, /* [RFC3009] */
{-1, "application", "rtx", 0, NULL, 0}, /* [RFC4588] */
{-1, "audio", "AMR", 8000, NULL, 0}, /* [RFC4867][RFC3267] */
{-1, "audio", "AMR-WB", 16000, NULL, 0}, /* [RFC4867][RFC3267] */
{-1, "audio", "DAT12", 0, NULL, 0}, /* [RFC3190] */
{-1, "audio", "dsr-es201108", 0, NULL, 0}, /* [RFC3557] */
{-1, "audio", "EVRC", 8000, "1", 0}, /* [RFC4788] */
{-1, "audio", "EVRC0", 8000, "1", 0}, /* [RFC4788] */
{-1, "audio", "EVRC1", 8000, "1", 0}, /* [RFC4788] */
{-1, "audio", "EVRCB", 8000, "1", 0}, /* [RFC4788] */
{-1, "audio", "EVRCB0", 8000, "1", 0}, /* [RFC4788] */
{-1, "audio", "EVRCB1", 8000, "1", 0}, /* [RFC4788] */
{-1, "audio", "G7221", 16000, "1", 0}, /* [RFC3047] */
{-1, "audio", "G726-16", 8000, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "G726-24", 8000, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "G726-32", 8000, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "G726-40", 8000, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "G729D", 8000, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "G729E", 8000, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "GSM-EFR", 8000, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "L8", 0, NULL, 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "RED", 0, NULL, 0}, /* [RFC2198][RFC3555] */
{-1, "audio", "rtx", 0, NULL, 0}, /* [RFC4588] */
{-1, "audio", "VDVI", 0, "1", 0}, /* [RFC3551][RFC4856] */
{-1, "audio", "L20", 0, NULL, 0}, /* [RFC3190] */
{-1, "audio", "L24", 0, NULL, 0}, /* [RFC3190] */
{-1, "audio", "MP4A-LATM", 0, NULL, 0}, /* [RFC3016] */
{-1, "audio", "mpa-robust", 90000, NULL, 0}, /* [RFC3119] */
{-1, "audio", "parityfec", 0, NULL, 0}, /* [RFC3009] */
{-1, "audio", "SMV", 8000, "1", 0}, /* [RFC3558] */
{-1, "audio", "SMV0", 8000, "1", 0}, /* [RFC3558] */
{-1, "audio", "t140c", 0, NULL, 0}, /* [RFC4351] */
{-1, "audio", "t38", 0, NULL, 0}, /* [RFC4612] */
{-1, "audio", "telephone-event", 0, NULL, 0}, /* [RFC4733] */
{-1, "audio", "tone", 0, NULL, 0}, /* [RFC4733] */
{-1, "audio", "DVI4", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "G722", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "G723", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "G728", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "G729", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "GSM", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "L16", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "LPC", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "PCMA", 0, NULL, 0}, /* [RFC4856] */
{-1, "audio", "PCMU", 0, NULL, 0}, /* [RFC4856] */
{-1, "text", "parityfec", 0, NULL, 0}, /* [RFC3009] */
{-1, "text", "red", 1000, NULL, 0}, /* [RFC4102] */
{-1, "text", "rtx", 0, NULL, 0}, /* [RFC4588] */
{-1, "text", "t140", 1000, NULL, 0}, /* [RFC4103] */
{-1, "video", "BMPEG", 90000, NULL, 0}, /* [RFC2343][RFC3555] */
{-1, "video", "BT656", 90000, NULL, 0}, /* [RFC2431][RFC3555] */
{-1, "video", "DV", 90000, NULL, 0}, /* [RFC3189] */
{-1, "video", "H263-1998", 90000, NULL, 0}, /* [RFC2429][RFC3555] */
{-1, "video", "H263-2000", 90000, NULL, 0}, /* [RFC2429][RFC3555] */
{-1, "video", "MP1S", 90000, NULL, 0}, /* [RFC2250][RFC3555] */
{-1, "video", "MP2P", 90000, NULL, 0}, /* [RFC2250][RFC3555] */
{-1, "video", "MP4V-ES", 90000, NULL, 0}, /* [RFC3016] */
{-1, "video", "parityfec", 0, NULL, 0}, /* [RFC3009] */
{-1, "video", "pointer", 90000, NULL, 0}, /* [RFC2862] */
{-1, "video", "raw", 90000, NULL, 0}, /* [RFC4175] */
{-1, "video", "rtx", 0, NULL, 0}, /* [RFC4588] */
{-1, "video", "SMPTE292M", 0, NULL, 0}, /* [RFC3497] */
{-1, "video", "vc1", 90000, NULL, 0}, /* [RFC4425] */
/* not in http://www.iana.org/assignments/rtp-parameters */
{-1, "audio", "AC3", 0, NULL, 0},
{-1, "audio", "ILBC", 8000, NULL, 0},
{-1, "audio", "MPEG4-GENERIC", 0, NULL, 0},
{-1, "audio", "SPEEX", 0, NULL, 0},
{-1, "application", "MPEG4-GENERIC", 0, NULL, 0},
{-1, "video", "H264", 90000, NULL, 0},
{-1, "video", "MPEG4-GENERIC", 90000, NULL, 0},
{-1, "video", "THEORA", 0, NULL, 0},
{-1, "video", "VORBIS", 0, NULL, 0},
{-1, "video", "X-SV3V-ES", 90000, NULL, 0},
{-1, "video", "X-SORENSON-VIDEO", 90000, NULL, 0},
/* real stuff */
{-1, "video", "x-pn-realvideo", 1000, NULL, 0},
{-1, "audio", "x-pn-realaudio", 1000, NULL, 0},
{-1, "application", "x-pn-realmedia", 1000, NULL, 0},
/* terminator */
{-1, NULL, NULL, 0, NULL, 0}
};
/**
* gst_rtp_payload_info_for_pt:
* @payload_type: the payload_type to find
*
* Get the #GstRTPPayloadInfo for @payload_type. This function is
* mostly used to get the default clock-rate and bandwidth for static payload
* types specified with @payload_type.
*
* Returns: a #GstRTPPayloadInfo or NULL when no info could be found.
*/
const GstRTPPayloadInfo *
gst_rtp_payload_info_for_pt (guint8 payload_type)
{
const GstRTPPayloadInfo *result = NULL;
gint i;
for (i = 0; info[i].media; i++) {
if (info[i].payload_type == payload_type) {
result = &info[i];
break;
}
}
return result;
}
/**
* gst_rtp_payload_info_for_name:
* @media: the media to find
* @encoding_name: the encoding name to find
*
* Get the #GstRTPPayloadInfo for @media and @encoding_name. This function is
* mostly used to get the default clock-rate and bandwidth for dynamic payload
* types specified with @media and @encoding name.
*
* The search for @encoding_name will be performed in a case insensitve way.
*
* Returns: a #GstRTPPayloadInfo or NULL when no info could be found.
*/
const GstRTPPayloadInfo *
gst_rtp_payload_info_for_name (const gchar * media, const gchar * encoding_name)
{
const GstRTPPayloadInfo *result = NULL;
gint i;
for (i = 0; info[i].media; i++) {
if (strcmp (media, info[i].media) == 0
&& strcasecmp (encoding_name, info[i].encoding_name) == 0) {
result = &info[i];
break;
}
}
return result;
}