summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jingle/libjingle/talk/third_party/ortp/payloadtype.h
blob: e5efa7970891d0fc864ba82ad77fe41a2c6df3c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
  The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
  Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef PAYLOADTYPE_H
#define PAYLOADTYPE_H
#include <rtpport.h>

typedef enum{
	PAYLOAD_TYPE_ALLOCATED = 1
}PayloadTypeFlags;

struct _PayloadType
{
	gint type;
	#define PAYLOAD_AUDIO_CONTINUOUS 0
	#define PAYLOAD_AUDIO_PACKETIZED 1
	#define	PAYLOAD_VIDEO 2
	#define PAYLOAD_OTHER 3  /* ?? */
	gint clock_rate;
	char bits_per_sample;		/* in case of continuous audio data */
	char *zero_pattern;
	gint pattern_length;
	/* other usefull information */
	gint normal_bitrate;	/*in bit/s */
	char *mime_type;
	char *fmtp;	/*various parameters, as a string */
	PayloadTypeFlags flags;
	void *user_data;
};

#ifndef PayloadType_defined
#define PayloadType_defined
typedef struct _PayloadType PayloadType;
#endif

#ifdef __cplusplus
extern "C"{
#endif
PayloadType *payload_type_new();
PayloadType *payload_type_clone(PayloadType *payload);
void payload_type_destroy(PayloadType *pt);
#ifdef __cplusplus
}
#endif

#define payload_type_set_flag(pt,flag) (pt)->flags|=(flag)
#define payload_type_unset_flag(pt,flag) (pt)->flags&=(~flag)

#define RTP_PROFILE_MAX_PAYLOADS 128

struct _RtpProfile
{
	char *name;
	PayloadType *payload[RTP_PROFILE_MAX_PAYLOADS];
};


typedef struct _RtpProfile RtpProfile;


extern RtpProfile av_profile;

#define payload_type_set_user_data(pt,p)	(pt)->user_data=(p)
#define payload_type_get_user_data(pt)		((pt)->user_data)



#define rtp_profile_get_name(profile) 	(const char*)((profile)->name)
#define rtp_profile_set_payload(profile,index,pt)  (profile)->payload[(index)]=(pt)
#define rtp_profile_clear_payload(profile,index)	(profile)->payload[(index)]=NULL
#define rtp_profile_clear_all(profile)	memset((void*)(profile),0,sizeof(RtpProfile))
#define rtp_profile_get_payload(profile,index)	((profile)->payload[(index)])
#ifdef __cplusplus
extern "C"{
#endif
void rtp_profile_set_name(RtpProfile *prof, const char *name);
PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime);
PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap);
gint rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime);
gint rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile, const char *rtpmap);
gint rtp_profile_find_payload_number(RtpProfile *prof,const gchar *mime,int rate);
PayloadType * rtp_profile_find_payload(RtpProfile *prof,const gchar *mime,int rate);
gint rtp_profile_move_payload(RtpProfile *prof,int oldpos,int newpos);

RtpProfile * rtp_profile_new(const char *name);
/* clone a profile, payload are not cloned */
RtpProfile * rtp_profile_clone(RtpProfile *prof);
/* copy a profile into another one; payload are not cloned */
void rtp_profile_copy(const RtpProfile *orig, RtpProfile *dest);

/*clone a profile and its payloads (ie payload type are newly allocated, not reusing payload types of the reference profile) */
RtpProfile * rtp_profile_clone_full(RtpProfile *prof);
/* frees the profile and all its PayloadTypes*/
void rtp_profile_destroy(RtpProfile *prof);
#ifdef __cplusplus
}
#endif

/* some payload types */
/* audio */
extern PayloadType pcmu8000;
extern PayloadType pcma8000;
extern PayloadType pcm8000;
extern PayloadType lpc1016;
extern PayloadType gsm;
extern PayloadType lpc1015;
extern PayloadType speex_nb;
extern PayloadType speex_wb;
extern PayloadType payload_type_ilbc;
extern PayloadType truespeech;

/* video */
extern PayloadType mpv;
extern PayloadType h261;
extern PayloadType h263;




#endif