oRTP  0.24.0
include/ortp/rtpprofile.h
Go to the documentation of this file.
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 
00026 #ifndef RTPPROFILE_H
00027 #define RTPPROFILE_H
00028 #include <ortp/port.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C"{
00032 #endif
00033 
00034 #define RTP_PROFILE_MAX_PAYLOADS 128
00035 
00041 struct _RtpProfile
00042 {
00043         char *name;
00044         PayloadType *payload[RTP_PROFILE_MAX_PAYLOADS];
00045 };
00046 
00047 
00048 typedef struct _RtpProfile RtpProfile;
00049 
00050 ORTP_VAR_PUBLIC RtpProfile av_profile;
00051 
00052 #define rtp_profile_get_name(profile)   (const char*)((profile)->name)
00053 
00054 ORTP_PUBLIC void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt);
00055 
00062 #define rtp_profile_clear_payload(profile,index) \
00063         rtp_profile_set_payload(profile,index,NULL)
00064 
00065 /* I prefer have this function inlined because it is very often called in the code */
00074 static ORTP_INLINE PayloadType * rtp_profile_get_payload(const RtpProfile *prof, int idx){
00075         if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
00076                 return NULL;
00077         }
00078         return prof->payload[idx];
00079 }
00080 ORTP_PUBLIC void rtp_profile_clear_all(RtpProfile *prof);
00081 ORTP_PUBLIC void rtp_profile_set_name(RtpProfile *prof, const char *name);
00082 ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime);
00083 ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap);
00084 ORTP_PUBLIC int rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime);
00085 ORTP_PUBLIC int rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile, const char *rtpmap);
00086 ORTP_PUBLIC int rtp_profile_find_payload_number(RtpProfile *prof,const char *mime,int rate, int channels);
00087 ORTP_PUBLIC PayloadType * rtp_profile_find_payload(RtpProfile *prof,const char *mime,int rate, int channels);
00088 ORTP_PUBLIC int rtp_profile_move_payload(RtpProfile *prof,int oldpos,int newpos);
00089 
00090 ORTP_PUBLIC RtpProfile * rtp_profile_new(const char *name);
00091 /* clone a profile, payload are not cloned */
00092 ORTP_PUBLIC RtpProfile * rtp_profile_clone(RtpProfile *prof);
00093 
00094 
00095 /*clone a profile and its payloads (ie payload type are newly allocated, not reusing payload types of the reference profile) */
00096 ORTP_PUBLIC RtpProfile * rtp_profile_clone_full(RtpProfile *prof);
00097 /* frees the profile and all its PayloadTypes*/
00098 ORTP_PUBLIC void rtp_profile_destroy(RtpProfile *prof);
00099 
00100 #ifdef __cplusplus
00101 }
00102 #endif
00103 
00104 #endif