gst_plugins_base/gst-libs/gst/rtp/gstrtppayloads.h
changeset 0 0e761a78d257
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer
       
     2  * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
       
     3  *
       
     4  * gstrtppayloads.h: various helper functions to deal with RTP payload
       
     5  *     types.
       
     6  *
       
     7  * This library is free software; you can redistribute it and/or
       
     8  * modify it under the terms of the GNU Library General Public
       
     9  * License as published by the Free Software Foundation; either
       
    10  * version 2 of the License, or (at your option) any later version.
       
    11  *
       
    12  * This library is distributed in the hope that it will be useful,
       
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    15  * Library General Public License for more details.
       
    16  *
       
    17  * You should have received a copy of the GNU Library General Public
       
    18  * License along with this library; if not, write to the
       
    19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    20  * Boston, MA 02111-1307, USA.
       
    21  */
       
    22 
       
    23 #ifndef __GST_RTPPAYLOADS_H__
       
    24 #define __GST_RTPPAYLOADS_H__
       
    25 
       
    26 #include <gst/gst.h>
       
    27 
       
    28 G_BEGIN_DECLS
       
    29 
       
    30 /** 
       
    31  * GstRTPPayload:
       
    32  * @GST_RTP_PAYLOAD_PCMU: ITU-T G.711. mu-law audio (RFC 3551)
       
    33  * @GST_RTP_PAYLOAD_1016: RFC 3551 says reserved
       
    34  * @GST_RTP_PAYLOAD_G721: RFC 3551 says reserved
       
    35  * @GST_RTP_PAYLOAD_GSM: GSM audio
       
    36  * @GST_RTP_PAYLOAD_G723: ITU G.723.1 audio
       
    37  * @GST_RTP_PAYLOAD_DVI4_8000: IMA ADPCM wave type (RFC 3551)
       
    38  * @GST_RTP_PAYLOAD_DVI4_16000: IMA ADPCM wave type (RFC 3551)
       
    39  * @GST_RTP_PAYLOAD_LPC: experimental linear predictive encoding
       
    40  * @GST_RTP_PAYLOAD_PCMA: ITU-T G.711 A-law audio (RFC 3551)
       
    41  * @GST_RTP_PAYLOAD_G722: ITU-T G.722 (RFC 3551)
       
    42  * @GST_RTP_PAYLOAD_L16_STEREO: stereo PCM
       
    43  * @GST_RTP_PAYLOAD_L16_MONO: mono PCM
       
    44  * @GST_RTP_PAYLOAD_QCELP: EIA & TIA standard IS-733
       
    45  * @GST_RTP_PAYLOAD_CN: Comfort Noise (RFC 3389)
       
    46  * @GST_RTP_PAYLOAD_MPA: Audio MPEG 1-3.
       
    47  * @GST_RTP_PAYLOAD_G728: ITU-T G.728 Speech coder (RFC 3551)
       
    48  * @GST_RTP_PAYLOAD_DVI4_11025: IMA ADPCM wave type (RFC 3551)
       
    49  * @GST_RTP_PAYLOAD_DVI4_22050: IMA ADPCM wave type (RFC 3551)
       
    50  * @GST_RTP_PAYLOAD_G729: ITU-T G.729 Speech coder (RFC 3551)
       
    51  * @GST_RTP_PAYLOAD_CELLB: See RFC 2029
       
    52  * @GST_RTP_PAYLOAD_JPEG: ISO Standards 10918-1 and 10918-2 (RFC 2435)
       
    53  * @GST_RTP_PAYLOAD_NV: nv encoding by Ron Frederick
       
    54  * @GST_RTP_PAYLOAD_H261: ITU-T Recommendation H.261 (RFC 2032)
       
    55  * @GST_RTP_PAYLOAD_MPV: Video MPEG 1 & 2 (RFC 2250)
       
    56  * @GST_RTP_PAYLOAD_MP2T: MPEG-2 transport stream (RFC 2250)
       
    57  * @GST_RTP_PAYLOAD_H263: Video H263 (RFC 2190)
       
    58  *
       
    59  *
       
    60  * Standard predefined fixed payload types.
       
    61  *
       
    62  * The official list is at:
       
    63  * http://www.iana.org/assignments/rtp-parameters
       
    64  *
       
    65  * Audio:
       
    66  * reserved: 19
       
    67  * unassigned: 20-23, 
       
    68  *
       
    69  * Video:
       
    70  * unassigned: 24, 27, 29, 30, 35-71, 77-95
       
    71  * Reserved for RTCP conflict avoidance: 72-76
       
    72  */
       
    73 typedef enum
       
    74 {
       
    75   /* Audio: */
       
    76   GST_RTP_PAYLOAD_PCMU = 0,
       
    77   GST_RTP_PAYLOAD_1016 = 1, /* RFC 3551 says reserved */
       
    78   GST_RTP_PAYLOAD_G721 = 2, /* RFC 3551 says reserved */
       
    79   GST_RTP_PAYLOAD_GSM = 3,
       
    80   GST_RTP_PAYLOAD_G723 = 4,
       
    81   GST_RTP_PAYLOAD_DVI4_8000 = 5,
       
    82   GST_RTP_PAYLOAD_DVI4_16000 = 6,
       
    83   GST_RTP_PAYLOAD_LPC = 7,
       
    84   GST_RTP_PAYLOAD_PCMA = 8,
       
    85   GST_RTP_PAYLOAD_G722 = 9,
       
    86   GST_RTP_PAYLOAD_L16_STEREO = 10,
       
    87   GST_RTP_PAYLOAD_L16_MONO = 11,
       
    88   GST_RTP_PAYLOAD_QCELP = 12,
       
    89   GST_RTP_PAYLOAD_CN = 13,
       
    90   GST_RTP_PAYLOAD_MPA = 14,
       
    91   GST_RTP_PAYLOAD_G728 = 15,
       
    92   GST_RTP_PAYLOAD_DVI4_11025 = 16,
       
    93   GST_RTP_PAYLOAD_DVI4_22050 = 17,
       
    94   GST_RTP_PAYLOAD_G729 = 18,   
       
    95 
       
    96   /* Video: */
       
    97 
       
    98   GST_RTP_PAYLOAD_CELLB = 25,
       
    99   GST_RTP_PAYLOAD_JPEG = 26,
       
   100   GST_RTP_PAYLOAD_NV = 28,
       
   101   GST_RTP_PAYLOAD_H261 = 31,
       
   102   GST_RTP_PAYLOAD_MPV = 32,
       
   103   GST_RTP_PAYLOAD_MP2T = 33,
       
   104   GST_RTP_PAYLOAD_H263 = 34,
       
   105 
       
   106   /* BOTH */
       
   107 } GstRTPPayload;
       
   108 
       
   109 /* backward compatibility */
       
   110 #define GST_RTP_PAYLOAD_G723_63 16
       
   111 #define GST_RTP_PAYLOAD_G723_53 17
       
   112 #define GST_RTP_PAYLOAD_TS48 18
       
   113 #define GST_RTP_PAYLOAD_TS41 19
       
   114 
       
   115 #define GST_RTP_PAYLOAD_G723_63_STRING "16"
       
   116 #define GST_RTP_PAYLOAD_G723_53_STRING "17"
       
   117 #define GST_RTP_PAYLOAD_TS48_STRING "18"
       
   118 #define GST_RTP_PAYLOAD_TS41_STRING "19"
       
   119 
       
   120 /* Defining the above as strings, to make the declaration of pad_templates
       
   121  * easier. So if please keep these synchronized with the above.
       
   122  */
       
   123 #define GST_RTP_PAYLOAD_PCMU_STRING "0"
       
   124 #define GST_RTP_PAYLOAD_1016_STRING "1"
       
   125 #define GST_RTP_PAYLOAD_G721_STRING "2"
       
   126 #define GST_RTP_PAYLOAD_GSM_STRING "3"
       
   127 #define GST_RTP_PAYLOAD_G723_STRING "4"
       
   128 #define GST_RTP_PAYLOAD_DVI4_8000_STRING "5"
       
   129 #define GST_RTP_PAYLOAD_DVI4_16000_STRING "6"
       
   130 #define GST_RTP_PAYLOAD_LPC_STRING "7"
       
   131 #define GST_RTP_PAYLOAD_PCMA_STRING "8"
       
   132 #define GST_RTP_PAYLOAD_G722_STRING "9"
       
   133 #define GST_RTP_PAYLOAD_L16_STEREO_STRING "10"
       
   134 #define GST_RTP_PAYLOAD_L16_MONO_STRING "11"
       
   135 #define GST_RTP_PAYLOAD_QCELP_STRING "12"
       
   136 #define GST_RTP_PAYLOAD_CN_STRING "13"
       
   137 #define GST_RTP_PAYLOAD_MPA_STRING "14"
       
   138 #define GST_RTP_PAYLOAD_G728_STRING "15"
       
   139 #define GST_RTP_PAYLOAD_DVI4_11025_STRING "16"
       
   140 #define GST_RTP_PAYLOAD_DVI4_22050_STRING "17"
       
   141 #define GST_RTP_PAYLOAD_G729_STRING "18"
       
   142 
       
   143 #define GST_RTP_PAYLOAD_CELLB_STRING "25"
       
   144 #define GST_RTP_PAYLOAD_JPEG_STRING "26"
       
   145 #define GST_RTP_PAYLOAD_NV_STRING "28"
       
   146 
       
   147 #define GST_RTP_PAYLOAD_H261_STRING "31"
       
   148 #define GST_RTP_PAYLOAD_MPV_STRING "32"
       
   149 #define GST_RTP_PAYLOAD_MP2T_STRING "33"
       
   150 #define GST_RTP_PAYLOAD_H263_STRING "34"
       
   151 
       
   152 #define GST_RTP_PAYLOAD_DYNAMIC_STRING "[96, 127]"
       
   153 
       
   154 /**
       
   155  * GST_RTP_PAYLOAD_IS_DYNAMIC:
       
   156  * @pt: a payload type
       
   157  *
       
   158  * Check if @pt is a dynamic payload type.
       
   159  */
       
   160 #define GST_RTP_PAYLOAD_IS_DYNAMIC(pt) ((pt) >= 96 && (pt) <= 127)
       
   161 
       
   162 typedef struct _GstRTPPayloadInfo GstRTPPayloadInfo;
       
   163 
       
   164 /**
       
   165  * GstRTPPayloadInfo:
       
   166  * @payload_type: payload type, -1 means dynamic
       
   167  * @media: the media type(s), usually "audio", "video", "application", "text",
       
   168  * "message".
       
   169  * @encoding_name: the encoding name of @pt
       
   170  * @clock_rate: default clock rate, 0 = unknown/variable
       
   171  * @encoding_parameters: encoding parameters. For audio this is the number of
       
   172  * channels. NULL = not applicable.
       
   173  * @bitrate: the bitrate of the media. 0 = unknown/variable.
       
   174  *
       
   175  * Structure holding default payload type information.
       
   176  */
       
   177 struct _GstRTPPayloadInfo
       
   178 {
       
   179   guint8       payload_type;
       
   180   const gchar *media;
       
   181   const gchar *encoding_name;
       
   182   guint        clock_rate;
       
   183   const gchar *encoding_parameters;
       
   184   guint        bitrate;
       
   185 };
       
   186 #ifdef __SYMBIAN32__
       
   187 IMPORT_C
       
   188 #endif
       
   189 
       
   190 
       
   191 const GstRTPPayloadInfo *  gst_rtp_payload_info_for_pt     (guint8 payload_type);
       
   192 #ifdef __SYMBIAN32__
       
   193 IMPORT_C
       
   194 #endif
       
   195 
       
   196 const GstRTPPayloadInfo *  gst_rtp_payload_info_for_name   (const gchar *media, const gchar *encoding_name);
       
   197 
       
   198 G_END_DECLS
       
   199 
       
   200 #endif /* __GST_RTPPAYLOADS_H__ */
       
   201