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[4] = {0x00, 0x00, 0x00, 0x00};
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 CHANNELS(val)           .channels=(val)
00043 #define FMTP(val)               .FMTP=(val)
00044 #elif defined(__GNUC__)
00045 // GCC's legacy tagged syntax (even old versions have it)
00046 #define TYPE(val)               type: (val)
00047 #define CLOCK_RATE(val)         clock_rate: (val)
00048 #define BITS_PER_SAMPLE(val)    bits_per_sample: (val)
00049 #define ZERO_PATTERN(val)       zero_pattern: (val)
00050 #define PATTERN_LENGTH(val)     pattern_length: (val)
00051 #define NORMAL_BITRATE(val)     normal_bitrate: (val)
00052 #define MIME_TYPE(val)          mime_type: (val)
00053 #define CHANNELS(val)           channels: (val)
00054 #define FMTP(val)               FMTP: (val)
00055 #else
00056 // No tagged syntax supported
00057 #define TYPE(val)               (val)
00058 #define CLOCK_RATE(val)         (val)
00059 #define BITS_PER_SAMPLE(val)    (val)
00060 #define ZERO_PATTERN(val)       (val)
00061 #define PATTERN_LENGTH(val)     (val)
00062 #define NORMAL_BITRATE(val)     (val)
00063 #define MIME_TYPE(val)          (val)
00064 #define CHANNELS(val)           (val)
00065 #define FMTP(val)               (val)
00066 
00067 #endif
00068 
00069 PayloadType payload_type_pcmu8000={
00070         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00071         CLOCK_RATE( 8000),
00072         BITS_PER_SAMPLE(8),
00073         ZERO_PATTERN( &offset127),
00074         PATTERN_LENGTH( 1),
00075         NORMAL_BITRATE( 64000),
00076         MIME_TYPE ("PCMU"),
00077         CHANNELS(1)
00078 };
00079 
00080 PayloadType payload_type_pcma8000={
00081         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00082         CLOCK_RATE(8000),
00083         BITS_PER_SAMPLE(8),
00084         ZERO_PATTERN( &offset0xD5),
00085         PATTERN_LENGTH( 1),
00086         NORMAL_BITRATE( 64000),
00087         MIME_TYPE ("PCMA"),
00088         CHANNELS(1)
00089 };
00090 
00091 PayloadType payload_type_pcm8000={
00092         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00093         CLOCK_RATE(8000),
00094         BITS_PER_SAMPLE(16),
00095         ZERO_PATTERN( offset0),
00096         PATTERN_LENGTH(1),
00097         NORMAL_BITRATE( 128000),
00098         MIME_TYPE ("PCM"),
00099         CHANNELS(1)
00100 };
00101 
00102 PayloadType payload_type_l16_mono={
00103         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00104         CLOCK_RATE(44100),
00105         BITS_PER_SAMPLE(16),
00106         ZERO_PATTERN( offset0 ),
00107         PATTERN_LENGTH(2),
00108         NORMAL_BITRATE(705600),                         /* (44100 x 16bits per frame x 1 channel) */
00109         MIME_TYPE ("L16"),
00110         CHANNELS(1)
00111 };
00112 
00113 PayloadType payload_type_l16_stereo={
00114         TYPE( PAYLOAD_AUDIO_CONTINUOUS),
00115         CLOCK_RATE(44100),
00116         BITS_PER_SAMPLE(32),                            /* 16bits x 2 channels */
00117         ZERO_PATTERN( offset0 ),
00118         PATTERN_LENGTH(4),
00119         NORMAL_BITRATE(1411200),                        /* (44100 x 16bits per frame x 2 channels) */
00120         MIME_TYPE ("L16"),
00121         CHANNELS(2)
00122 };
00123 
00124 PayloadType payload_type_lpc1016={
00125         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00126         CLOCK_RATE(8000),
00127         BITS_PER_SAMPLE( 0),
00128         ZERO_PATTERN( NULL),
00129         PATTERN_LENGTH( 0),
00130         NORMAL_BITRATE( 2400),
00131         MIME_TYPE ("1016"),
00132         CHANNELS(1)
00133 };
00134 
00135 
00136 PayloadType payload_type_gsm=
00137 {
00138         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00139         CLOCK_RATE(8000),
00140         BITS_PER_SAMPLE( 0),
00141         ZERO_PATTERN(NULL),
00142         PATTERN_LENGTH( 0),
00143         NORMAL_BITRATE( 13500),
00144         MIME_TYPE ("GSM"),
00145         CHANNELS(1)
00146 };
00147 
00148 PayloadType payload_type_lpc=
00149 {
00150         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00151         CLOCK_RATE(8000),
00152         BITS_PER_SAMPLE( 0),
00153         ZERO_PATTERN(NULL),
00154         PATTERN_LENGTH( 0),
00155         NORMAL_BITRATE( 5600),          /* 20ms / 14 octets per frame */
00156         MIME_TYPE ("LPC"),
00157         CHANNELS(1)
00158 };
00159 
00160 PayloadType payload_type_g7231=
00161 {
00162         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00163         CLOCK_RATE(8000),
00164         BITS_PER_SAMPLE( 0),
00165         ZERO_PATTERN(NULL),
00166         PATTERN_LENGTH( 0),
00167         NORMAL_BITRATE( 6300),
00168         MIME_TYPE ("G723"),
00169         CHANNELS(1)
00170 };
00171 
00172 PayloadType payload_type_g729={
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( 8000),
00179         MIME_TYPE ("G729"),
00180         CHANNELS(1)
00181 };
00182 
00183 PayloadType payload_type_mpv=
00184 {
00185         TYPE( PAYLOAD_VIDEO),
00186         CLOCK_RATE(90000),
00187         BITS_PER_SAMPLE(0),
00188         ZERO_PATTERN(NULL),
00189         PATTERN_LENGTH(0),
00190         NORMAL_BITRATE( 256000),
00191         MIME_TYPE ("MPV"),
00192         CHANNELS(0)
00193 };
00194 
00195 
00196 PayloadType payload_type_h261={
00197         TYPE( PAYLOAD_VIDEO),
00198         CLOCK_RATE(90000),
00199         BITS_PER_SAMPLE(0),
00200         ZERO_PATTERN(NULL),
00201         PATTERN_LENGTH(0),
00202         NORMAL_BITRATE(0),
00203         MIME_TYPE ("H261"),
00204         CHANNELS(0)
00205 };
00206 
00207 PayloadType payload_type_h263={
00208         TYPE( PAYLOAD_VIDEO),
00209         CLOCK_RATE(90000),
00210         BITS_PER_SAMPLE(0),
00211         ZERO_PATTERN(NULL),
00212         PATTERN_LENGTH(0),
00213         NORMAL_BITRATE(256000),
00214         MIME_TYPE ("H263"),
00215         CHANNELS(0)
00216 };
00217 
00218 PayloadType payload_type_truespeech=
00219 {
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(8536),
00226         MIME_TYPE ("TSP0"),
00227         CHANNELS(0)
00228 };
00229 
00230 
00231 #ifdef __cplusplus
00232 extern "C"
00233 {
00234 #endif
00235 RtpProfile av_profile;
00236 #ifdef __cplusplus
00237 }
00238 #endif
00239 
00240 
00241 void av_profile_init(RtpProfile *profile)
00242 {
00243         rtp_profile_clear_all(profile);
00244         profile->name="AV profile";
00245         rtp_profile_set_payload(profile,0,&payload_type_pcmu8000);
00246         rtp_profile_set_payload(profile,1,&payload_type_lpc1016);
00247         rtp_profile_set_payload(profile,3,&payload_type_gsm);
00248         rtp_profile_set_payload(profile,7,&payload_type_lpc);
00249         rtp_profile_set_payload(profile,4,&payload_type_g7231);
00250         rtp_profile_set_payload(profile,8,&payload_type_pcma8000);
00251         rtp_profile_set_payload(profile,10,&payload_type_l16_stereo);
00252         rtp_profile_set_payload(profile,11,&payload_type_l16_mono);
00253         rtp_profile_set_payload(profile,18,&payload_type_g729);
00254         rtp_profile_set_payload(profile,31,&payload_type_h261);
00255         rtp_profile_set_payload(profile,32,&payload_type_mpv);
00256         rtp_profile_set_payload(profile,34,&payload_type_h263);
00257 }
00258         
00259 /* these are extra payload types that can be used dynamically */
00260 PayloadType payload_type_lpc1015={
00261         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00262         CLOCK_RATE(8000),
00263         BITS_PER_SAMPLE(0),
00264         ZERO_PATTERN(NULL),
00265         PATTERN_LENGTH(0),
00266         NORMAL_BITRATE(2400),
00267         MIME_TYPE ("1015"),
00268         CHANNELS(1)
00269 };
00270 
00271 PayloadType payload_type_speex_nb={
00272         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00273         CLOCK_RATE(8000),
00274         BITS_PER_SAMPLE(0),
00275         ZERO_PATTERN(NULL),
00276         PATTERN_LENGTH(0),
00277         NORMAL_BITRATE(8000),   /*not true: 8000 is the minimum*/
00278         MIME_TYPE ("speex"),
00279         CHANNELS(1)
00280 };
00281 
00282 PayloadType payload_type_speex_wb={
00283         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00284         CLOCK_RATE(16000),
00285         BITS_PER_SAMPLE(0),
00286         ZERO_PATTERN(NULL),
00287         PATTERN_LENGTH(0),
00288         NORMAL_BITRATE(28000),
00289         MIME_TYPE ("speex"),
00290         CHANNELS(1)
00291 };
00292 
00293 PayloadType payload_type_ilbc={
00294         TYPE( PAYLOAD_AUDIO_PACKETIZED),
00295         CLOCK_RATE(8000),
00296         BITS_PER_SAMPLE(0),
00297         ZERO_PATTERN(NULL),
00298         PATTERN_LENGTH(0),
00299         NORMAL_BITRATE(13300), /* the minimum, with 30ms frames */ 
00300         MIME_TYPE ("iLBC"),
00301         CHANNELS(1),
00302 };
00303 
00304 PayloadType payload_type_amr={
00305         TYPE(PAYLOAD_AUDIO_PACKETIZED),
00306         CLOCK_RATE(8000),
00307         BITS_PER_SAMPLE(0),
00308         ZERO_PATTERN(NULL),
00309         PATTERN_LENGTH(0),
00310         NORMAL_BITRATE(0),
00311         MIME_TYPE ("AMR"),
00312         CHANNELS(1)
00313 };
00314 
00315 PayloadType payload_type_amrwb={
00316         TYPE(PAYLOAD_AUDIO_PACKETIZED),
00317         CLOCK_RATE(16000),
00318         BITS_PER_SAMPLE(0),
00319         ZERO_PATTERN(NULL),
00320         PATTERN_LENGTH(0),
00321         NORMAL_BITRATE(0),
00322         MIME_TYPE ("AMR-WB"),
00323         CHANNELS(1)
00324 };
00325 
00326 PayloadType payload_type_mp4v={
00327         TYPE( PAYLOAD_VIDEO),
00328         CLOCK_RATE(90000),
00329         BITS_PER_SAMPLE(0),
00330         ZERO_PATTERN(NULL),
00331         PATTERN_LENGTH(0),
00332         NORMAL_BITRATE(0),
00333         MIME_TYPE ("MP4V-ES"),
00334         CHANNELS(0)
00335 };
00336 
00337 
00338 PayloadType payload_type_evrc0={
00339         TYPE(PAYLOAD_AUDIO_PACKETIZED),
00340         CLOCK_RATE(8000),
00341         BITS_PER_SAMPLE(0),
00342         ZERO_PATTERN(NULL),
00343         PATTERN_LENGTH(0),
00344         NORMAL_BITRATE(0),
00345         MIME_TYPE ("EVRC0"),
00346         CHANNELS(1)
00347 };
00348 
00349  
00350 PayloadType payload_type_h263_1998={
00351         TYPE( PAYLOAD_VIDEO),
00352         CLOCK_RATE(90000),
00353         BITS_PER_SAMPLE(0),
00354         ZERO_PATTERN(NULL),
00355         PATTERN_LENGTH(0),
00356         NORMAL_BITRATE(256000),
00357         MIME_TYPE ("H263-1998"),
00358         CHANNELS(0)
00359 };
00360 
00361 PayloadType payload_type_h263_2000={
00362         TYPE( PAYLOAD_VIDEO),
00363         CLOCK_RATE(90000),
00364         BITS_PER_SAMPLE(0),
00365         ZERO_PATTERN(NULL),
00366         PATTERN_LENGTH(0),
00367         NORMAL_BITRATE(0),
00368         MIME_TYPE ("H263-2000"),
00369         CHANNELS(0)
00370 };
00371 
00372 PayloadType payload_type_theora={
00373         TYPE( PAYLOAD_VIDEO),
00374         CLOCK_RATE(90000),
00375         BITS_PER_SAMPLE(0),
00376         ZERO_PATTERN(NULL),
00377         PATTERN_LENGTH(0),
00378         NORMAL_BITRATE(256000),
00379         MIME_TYPE ("theora"),
00380         CHANNELS(0)
00381 };
00382 
00383 PayloadType payload_type_h264={
00384         TYPE( PAYLOAD_VIDEO),
00385         CLOCK_RATE(90000),
00386         BITS_PER_SAMPLE(0),
00387         ZERO_PATTERN(NULL),
00388         PATTERN_LENGTH(0),
00389         NORMAL_BITRATE(256000),
00390         MIME_TYPE ("H264"),
00391         CHANNELS(0)
00392 };
00393 
00394 PayloadType     payload_type_t140={
00395         PAYLOAD_AUDIO_PACKETIZED, /*type */
00396         1000,
00397         0,
00398         NULL,
00399         0,
00400         0,
00401         "t140",
00402         0,
00403         0
00404 };
00405 
00406 

Generated on Thu Feb 14 16:11:17 2008 for oRTP by  doxygen 1.5.4