oRTP 0.23.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
31extern "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
48typedef struct _RtpProfile RtpProfile;
49
50ORTP_VAR_PUBLIC RtpProfile av_profile;
51
52#define rtp_profile_get_name(profile) (const char*)((profile)->name)
53
54ORTP_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 */
74static inline PayloadType * rtp_profile_get_payload(RtpProfile *prof, int idx){
75 if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
76 return NULL;
77 }
78 return prof->payload[idx];
79}
80ORTP_PUBLIC void rtp_profile_clear_all(RtpProfile *prof);
81ORTP_PUBLIC void rtp_profile_set_name(RtpProfile *prof, const char *name);
82ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime);
83ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap);
84ORTP_PUBLIC int rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime);
85ORTP_PUBLIC int rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile, const char *rtpmap);
86ORTP_PUBLIC int rtp_profile_find_payload_number(RtpProfile *prof,const char *mime,int rate, int channels);
87ORTP_PUBLIC PayloadType * rtp_profile_find_payload(RtpProfile *prof,const char *mime,int rate, int channels);
88ORTP_PUBLIC int rtp_profile_move_payload(RtpProfile *prof,int oldpos,int newpos);
89
90ORTP_PUBLIC RtpProfile * rtp_profile_new(const char *name);
91/* clone a profile, payload are not cloned */
92ORTP_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) */
96ORTP_PUBLIC RtpProfile * rtp_profile_clone_full(RtpProfile *prof);
97/* frees the profile and all its PayloadTypes*/
98ORTP_PUBLIC void rtp_profile_destroy(RtpProfile *prof);
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif
ORTP_PUBLIC void rtp_profile_set_name(RtpProfile *prof, const char *name)
Definition: rtpprofile.c:180
ORTP_PUBLIC void rtp_profile_clear_all(RtpProfile *prof)
Definition: rtpprofile.c:166
ORTP_PUBLIC void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt)
Definition: rtpprofile.c:153
Definition: payloadtype.h:54
Definition: rtpprofile.h:42