oRTP  0.24.0
rtpprofile.h
Go to the documentation of this file.
1 /*
2  The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
3  Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
26 #ifndef RTPPROFILE_H
27 #define RTPPROFILE_H
28 #include <ortp/port.h>
29 
30 #ifdef __cplusplus
31 extern "C"{
32 #endif
33 
34 #define RTP_PROFILE_MAX_PAYLOADS 128
35 
42 {
43  char *name;
44  PayloadType *payload[RTP_PROFILE_MAX_PAYLOADS];
45 };
46 
47 
48 typedef struct _RtpProfile RtpProfile;
49 
50 ORTP_VAR_PUBLIC RtpProfile av_profile;
51 
52 #define rtp_profile_get_name(profile) (const char*)((profile)->name)
53 
54 ORTP_PUBLIC void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt);
55 
62 #define rtp_profile_clear_payload(profile,index) \
63  rtp_profile_set_payload(profile,index,NULL)
64 
65 /* I prefer have this function inlined because it is very often called in the code */
74 static ORTP_INLINE PayloadType * rtp_profile_get_payload(const RtpProfile *prof, int idx){
75  if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
76  return NULL;
77  }
78  return prof->payload[idx];
79 }
80 ORTP_PUBLIC void rtp_profile_clear_all(RtpProfile *prof);
81 ORTP_PUBLIC void rtp_profile_set_name(RtpProfile *prof, const char *name);
82 ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime);
83 ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap);
84 ORTP_PUBLIC int rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime);
85 ORTP_PUBLIC int rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile, const char *rtpmap);
86 ORTP_PUBLIC int rtp_profile_find_payload_number(RtpProfile *prof,const char *mime,int rate, int channels);
87 ORTP_PUBLIC PayloadType * rtp_profile_find_payload(RtpProfile *prof,const char *mime,int rate, int channels);
88 ORTP_PUBLIC int rtp_profile_move_payload(RtpProfile *prof,int oldpos,int newpos);
89 
90 ORTP_PUBLIC RtpProfile * rtp_profile_new(const char *name);
91 /* clone a profile, payload are not cloned */
92 ORTP_PUBLIC RtpProfile * rtp_profile_clone(RtpProfile *prof);
93 
94 
95 /*clone a profile and its payloads (ie payload type are newly allocated, not reusing payload types of the reference profile) */
96 ORTP_PUBLIC RtpProfile * rtp_profile_clone_full(RtpProfile *prof);
97 /* frees the profile and all its PayloadTypes*/
98 ORTP_PUBLIC void rtp_profile_destroy(RtpProfile *prof);
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif
Definition: payloadtype.h:67
ORTP_PUBLIC void rtp_profile_set_name(RtpProfile *prof, const char *name)
Definition: rtpprofile.c:180
Definition: rtpprofile.h:41
ORTP_PUBLIC void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt)
Definition: rtpprofile.c:153
ORTP_PUBLIC void rtp_profile_clear_all(RtpProfile *prof)
Definition: rtpprofile.c:166