src/avprofile.c

00001 /*
00002   The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
00003   Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 
00021 #include <ortp/payloadtype.h>
00022 
00023 char offset127=127; 
00024 char offset0xD5=(char)0xD5; 
00025 char offset0=0;
00026 
00027 /* 
00028  * IMPORTANT : some compiler don't support the tagged-field syntax. Those
00029  * macros are there to trap the problem This means that if you want to keep
00030  * portability, payload types must be defined with their fields in the right
00031  * order.
00032  */
00033 #if defined(_ISOC99_SOURCE)
00034 // ISO C99's tagged syntax
00035 #define TYPE(val)               .type=(val)
00036 #define CLOCK_RATE(val)         .clock_rate=(val)
00037 #define BITS_PER_SAMPLE(val)    .bits_per_sample=(val)
00038 #define ZERO_PATTERN(val)       .zero_pattern=(val)
00039 #define PATTERN_LENGTH(val)     .pattern_length=(val)
00040 #define NORMAL_BITRATE(val)     .normal_bitrate=(val)
00041 #define MIME_TYPE(val)          .mime_type=(val)
00042 #define FMTP(val)               .FMTP=(val)
00043 #elif defined(__GNUC__)
00044 // GCC's legacy tagged syntax (even old versions have it)
00045 #define TYPE(val)               type: (val)
00046 #define CLOCK_RATE(val)         clock_rate: (val)
00047 #define BITS_PER_SAMPLE(val)    bits_per_sample: (val)
00048 #define ZERO_PATTERN(val)       zero_pattern: (val)
00049 #define PATTERN_LENGTH(val)     pattern_length: (val)
00050 #define NORMAL_BITRATE(val)     normal_bitrate: (val)
00051 #define MIME_TYPE(val)          mime_type: (val)
00052 #define FMTP(val)               FMTP: (val)
00053 #else
00054 // No tagged syntax supported
00055 #define TYPE(val)               (val)
00056 #define CLOCK_RATE(val)         (val)
00057 #define BITS_PER_SAMPLE(val)    (val)
00058 #define ZERO_PATTERN(val)       (val)
00059 #define PATTERN_LENGTH(val)     (val)
00060 #define NORMAL_BITRATE(val)     (val)
00061 #define MIME_TYPE(val)          (val)
00062 #define FMTP(val)               (val)
00063 
00064 #endif
00065 
00066 PayloadType payload_type_pcmu8000={
00067         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00068         CLOCK_RATE( 8000),
00069         BITS_PER_SAMPLE(8),
00070         ZERO_PATTERN( &offset127),
00071         PATTERN_LENGTH( 1),
00072         NORMAL_BITRATE( 64000),
00073         MIME_TYPE ("PCMU")
00074 };
00075 
00076 PayloadType payload_type_pcma8000={
00077         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00078         CLOCK_RATE(8000),
00079         BITS_PER_SAMPLE(8),
00080         ZERO_PATTERN( &offset0xD5),
00081         PATTERN_LENGTH( 1),
00082         NORMAL_BITRATE( 64000),
00083         MIME_TYPE ("PCMA")
00084 };
00085 
00086 PayloadType payload_type_pcm8000={
00087         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00088         CLOCK_RATE(8000),
00089         BITS_PER_SAMPLE(16),
00090         ZERO_PATTERN( &offset0),
00091         PATTERN_LENGTH(1),
00092         NORMAL_BITRATE( 128000),
00093         MIME_TYPE ("PCM")
00094 };
00095 
00096 PayloadType payload_type_lpc1016={
00097         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00098         CLOCK_RATE(8000),
00099         BITS_PER_SAMPLE( 0),
00100         ZERO_PATTERN( NULL),
00101         PATTERN_LENGTH( 0),
00102         NORMAL_BITRATE( 2400),
00103         MIME_TYPE ("1016")
00104 };
00105 
00106 
00107 PayloadType payload_type_gsm=
00108 {
00109         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00110         CLOCK_RATE(8000),
00111         BITS_PER_SAMPLE( 0),
00112         ZERO_PATTERN(NULL),
00113         PATTERN_LENGTH( 0),
00114         NORMAL_BITRATE( 13500),
00115         MIME_TYPE ("GSM")
00116 };
00117 
00118 PayloadType payload_type_g7231=
00119 {
00120         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00121         CLOCK_RATE(8000),
00122         BITS_PER_SAMPLE( 0),
00123         ZERO_PATTERN(NULL),
00124         PATTERN_LENGTH( 0),
00125         NORMAL_BITRATE( 6300),
00126         MIME_TYPE ("G723")
00127 };
00128 
00129 PayloadType payload_type_g729={
00130         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00131         CLOCK_RATE(8000),
00132         BITS_PER_SAMPLE( 0),
00133         ZERO_PATTERN(NULL),
00134         PATTERN_LENGTH( 0),
00135         NORMAL_BITRATE( 8000),
00136         MIME_TYPE ("G729")
00137 };
00138 
00139 PayloadType payload_type_mpv=
00140 {
00141         TYPE( PAYLOAD_VIDEO),
00142         CLOCK_RATE(90000),
00143         BITS_PER_SAMPLE(0),
00144         ZERO_PATTERN(NULL),
00145         PATTERN_LENGTH(0),
00146         NORMAL_BITRATE( 256000),
00147         MIME_TYPE ("MPV")
00148 };
00149 
00150 
00151 PayloadType payload_type_h261={
00152         TYPE( PAYLOAD_VIDEO),
00153         CLOCK_RATE(90000),
00154         BITS_PER_SAMPLE(0),
00155         ZERO_PATTERN(NULL),
00156         PATTERN_LENGTH(0),
00157         NORMAL_BITRATE(0),
00158         MIME_TYPE ("H261")
00159 };
00160 
00161 PayloadType payload_type_h263={
00162         TYPE( PAYLOAD_VIDEO),
00163         CLOCK_RATE(90000),
00164         BITS_PER_SAMPLE(0),
00165         ZERO_PATTERN(NULL),
00166         PATTERN_LENGTH(0),
00167         NORMAL_BITRATE(256000),
00168         MIME_TYPE ("H263")
00169 };
00170 
00171 PayloadType payload_type_truespeech=
00172 {
00173         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00174         CLOCK_RATE(8000),
00175         BITS_PER_SAMPLE( 0),
00176         ZERO_PATTERN(NULL),
00177         PATTERN_LENGTH( 0),
00178         NORMAL_BITRATE(8536),
00179         MIME_TYPE ("TSP0")
00180 };
00181 
00182 
00183 #ifdef __cplusplus
00184 extern "C"
00185 {
00186 #endif
00187 RtpProfile av_profile;
00188 #ifdef __cplusplus
00189 }
00190 #endif
00191 
00192 
00193 void av_profile_init(RtpProfile *profile)
00194 {
00195         rtp_profile_clear_all(profile);
00196         profile->name="AV profile";
00197         rtp_profile_set_payload(profile,0,&payload_type_pcmu8000);
00198         rtp_profile_set_payload(profile,1,&payload_type_lpc1016);
00199         rtp_profile_set_payload(profile,3,&payload_type_gsm);
00200         rtp_profile_set_payload(profile,4,&payload_type_g7231);
00201         rtp_profile_set_payload(profile,8,&payload_type_pcma8000);
00202         rtp_profile_set_payload(profile,18,&payload_type_g729);
00203         rtp_profile_set_payload(profile,31,&payload_type_h261);
00204         rtp_profile_set_payload(profile,32,&payload_type_mpv);
00205         rtp_profile_set_payload(profile,34,&payload_type_h263);
00206 }
00207         
00208 /* these are extra payload types that can be used dynamically */
00209 PayloadType payload_type_lpc1015={
00210     TYPE( PAYLOAD_AUDIO_PACKETIZED),
00211     CLOCK_RATE(8000),
00212     BITS_PER_SAMPLE(0),
00213     ZERO_PATTERN(NULL),
00214     PATTERN_LENGTH(0),
00215     NORMAL_BITRATE(2400),
00216     MIME_TYPE ("1015")
00217 };
00218 
00219 PayloadType payload_type_speex_nb={
00220     TYPE( PAYLOAD_AUDIO_PACKETIZED),
00221     CLOCK_RATE(8000),
00222     BITS_PER_SAMPLE(0),
00223     ZERO_PATTERN(NULL),
00224     PATTERN_LENGTH(0),
00225     NORMAL_BITRATE(8000),   /*not true: 8000 is the minimum*/
00226     MIME_TYPE ("speex")
00227 };
00228 
00229 PayloadType payload_type_speex_wb={
00230     TYPE( PAYLOAD_AUDIO_PACKETIZED),
00231     CLOCK_RATE(16000),
00232     BITS_PER_SAMPLE(0),
00233     ZERO_PATTERN(NULL),
00234     PATTERN_LENGTH(0),
00235     NORMAL_BITRATE(28000),
00236     MIME_TYPE ("speex")
00237 };
00238 
00239 PayloadType payload_type_ilbc={
00240          TYPE( PAYLOAD_AUDIO_PACKETIZED),
00241     CLOCK_RATE(8000),
00242     BITS_PER_SAMPLE(0),
00243     ZERO_PATTERN(NULL),
00244     PATTERN_LENGTH(0),
00245     NORMAL_BITRATE(13300), /* the minimum, with 30ms frames */ 
00246     MIME_TYPE ("iLBC"),
00247 };
00248 
00249 PayloadType payload_type_amr={
00250         TYPE(PAYLOAD_AUDIO_PACKETIZED),
00251         CLOCK_RATE(8000),
00252         BITS_PER_SAMPLE(0),
00253         ZERO_PATTERN(NULL),
00254         PATTERN_LENGTH(0),
00255         NORMAL_BITRATE(0),
00256         MIME_TYPE ("AMR")
00257 };
00258 
00259 PayloadType payload_type_amrwb={
00260         TYPE(PAYLOAD_AUDIO_PACKETIZED),
00261         CLOCK_RATE(16000),
00262         BITS_PER_SAMPLE(0),
00263         ZERO_PATTERN(NULL),
00264         PATTERN_LENGTH(0),
00265         NORMAL_BITRATE(0),
00266         MIME_TYPE ("AMR-WB")
00267 };
00268 
00269 PayloadType payload_type_mp4v={
00270         TYPE( PAYLOAD_VIDEO),
00271         CLOCK_RATE(90000),
00272         BITS_PER_SAMPLE(0),
00273         ZERO_PATTERN(NULL),
00274         PATTERN_LENGTH(0),
00275         NORMAL_BITRATE(0),
00276         MIME_TYPE ("MP4V-ES")
00277 };
00278 
00279 
00280 PayloadType payload_type_evrc0={
00281         TYPE(PAYLOAD_AUDIO_PACKETIZED),
00282         CLOCK_RATE(8000),
00283         BITS_PER_SAMPLE(0),
00284         ZERO_PATTERN(NULL),
00285         PATTERN_LENGTH(0),
00286         NORMAL_BITRATE(0),
00287         MIME_TYPE ("EVRC0")
00288 };
00289 
00290  
00291 PayloadType payload_type_h263_1998={
00292         TYPE( PAYLOAD_VIDEO),
00293         CLOCK_RATE(90000),
00294         BITS_PER_SAMPLE(0),
00295         ZERO_PATTERN(NULL),
00296         PATTERN_LENGTH(0),
00297         NORMAL_BITRATE(256000),
00298         MIME_TYPE ("H263-1998")
00299 };
00300 
00301 PayloadType payload_type_h263_2000={
00302         TYPE( PAYLOAD_VIDEO),
00303         CLOCK_RATE(90000),
00304         BITS_PER_SAMPLE(0),
00305         ZERO_PATTERN(NULL),
00306         PATTERN_LENGTH(0),
00307         NORMAL_BITRATE(0),
00308         MIME_TYPE ("H263-2000")
00309 };
00310 
00311 PayloadType payload_type_theora={
00312         TYPE( PAYLOAD_VIDEO),
00313         CLOCK_RATE(90000),
00314         BITS_PER_SAMPLE(0),
00315         ZERO_PATTERN(NULL),
00316         PATTERN_LENGTH(0),
00317         NORMAL_BITRATE(256000),
00318         MIME_TYPE ("theora")
00319 };
00320 

Generated on Mon Sep 3 00:46:33 2007 for oRTP by  doxygen 1.5.2