chenqiyang
2021-08-20 7b95fb4d4549d3452ee17165236186afc1f2b393
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
 * Copyright (c) 2010-2019 Belledonne Communications SARL.
 *
 * This file is part of Liblinphone.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
 
#ifndef LINPHONE_PAYLOAD_TYPE_H_
#define LINPHONE_PAYLOAD_TYPE_H_
 
#include "linphone/types.h"
 
/**
 * @addtogroup media_parameters
 * @{
**/
 
 
#ifdef __cplusplus
extern "C" {
#endif
 
/**
 * Take a reference on a #LinphonePayloadType.
 */
LINPHONE_PUBLIC LinphonePayloadType *linphone_payload_type_ref(LinphonePayloadType *pt);
 
/**
 * Release a reference on a #LinphonePayloadType.
 */
LINPHONE_PUBLIC void linphone_payload_type_unref(LinphonePayloadType *pt);
 
/**
 * Get the type of a payload type.
 * @param[in] pt The payload type.
 * @return The type of the payload e.g. PAYLOAD_AUDIO_CONTINUOUS or PAYLOAD_VIDEO.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_type(const LinphonePayloadType *pt);
 
/**
 * Enable/disable a payload type.
 * @param[in] pt The payload type to enable/disable.
 * @param[in] enabled Set TRUE for enabling and FALSE for disabling.
 * @return 0 for success, -1 for failure.
 */
LINPHONE_PUBLIC int linphone_payload_type_enable(LinphonePayloadType *pt, bool_t enabled);
 
/**
 * Check whether a palyoad type is enabled.
 * @return TRUE if enabled, FALSE if disabled.
 */
LINPHONE_PUBLIC bool_t linphone_payload_type_enabled(const LinphonePayloadType *pt);
 
/**
 * Return a string describing a payload type. The format of the string is
 * &lt;mime_type&gt;/&lt;clock_rate&gt;/&lt;channels&gt;.
 * @param[in] pt The payload type.
 * @return The description of the payload type. Must be release after use.
 */
LINPHONE_PUBLIC char *linphone_payload_type_get_description(const LinphonePayloadType *pt);
 
/**
 * Get a description of the encoder used to provide a payload type.
 * @param[in] pt The payload type.
 * @return The description of the encoder. Can be NULL if the payload type is not supported by Mediastreamer2.
 */
LINPHONE_PUBLIC const char *linphone_payload_type_get_encoder_description(const LinphonePayloadType *pt);
 
/**
 * Get the normal bitrate in bits/s.
 * @param[in] pt The payload type.
 * @return The normal bitrate in bits/s or -1 if an error has occured.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_normal_bitrate(const LinphonePayloadType *pt);
 
/**
 * Change the normal bitrate of a payload type..
 * @param[in] pt The payload type to change.
 * @param[in] bitrate The new bitrate in bits/s.
 */
LINPHONE_PUBLIC void linphone_payload_type_set_normal_bitrate(LinphonePayloadType *pt, int bitrate);
 
/**
 * Get the mime type.
 * @param[in] pt The payload type.
 * @return The mime type.
 */
LINPHONE_PUBLIC const char * linphone_payload_type_get_mime_type(const LinphonePayloadType *pt);
 
/**
 * Get the number of channels.
 * @param[in] pt The payload type.
 * @return The number of channels.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_channels(const LinphonePayloadType *pt);
 
/**
 * Returns the payload type number assigned for this codec.
 * @param[in] pt The payload type.
 * @return The number of the payload type.
**/
LINPHONE_PUBLIC int linphone_payload_type_get_number(const LinphonePayloadType *pt);
 
/**
 * Force a number for a payload type. The #LinphoneCore does payload type number assignment automatically.
 * This function is mainly to be used for tests, in order to override the automatic assignment mechanism.
 * @param[in] pt The payload type.
 * @param[in] number The number to assign to the payload type.
**/
LINPHONE_PUBLIC void linphone_payload_type_set_number(LinphonePayloadType *pt, int number);
 
/**
 * Get the format parameters for incoming streams.
 * @param[in] pt The payload type.
 * @return The format parameters as string.
 */
LINPHONE_PUBLIC const char *linphone_payload_type_get_recv_fmtp(const LinphonePayloadType *pt);
 
/**
 * Set the format parameters for incoming streams.
 * @param[in] pt The payload type.
 * @param[in] recv_fmtp The new format parameters as string. The string will be copied.
 */
LINPHONE_PUBLIC void linphone_payload_type_set_recv_fmtp(LinphonePayloadType *pt, const char *recv_fmtp);
 
/**
 * Get the format parameters for outgoing streams.
 * @param[in] pt The payload type.
 * @return The format parameters as string.
 */
LINPHONE_PUBLIC const char *linphone_payload_type_get_send_fmtp(const LinphonePayloadType *pt);
 
/**
 * Set the format parameters for outgoing streams.
 * @param[in] pt The payload type.
 * @param[in] send_fmtp The new format parameters as string. The string will be copied.
 */
LINPHONE_PUBLIC void linphone_payload_type_set_send_fmtp(LinphonePayloadType *pt, const char *send_fmtp);
 
/**
 * Get the clock rate of a payload type.
 * @param[in] pt The payload type.
 * @return[in] The clock rate in Hz.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_clock_rate(const LinphonePayloadType *pt);
 
/**
 * Tells whether the specified payload type represents a variable bitrate codec.
 * @param[in] pt The payload type.
 * @return TRUE if the payload type represents a VBR codec, FALSE instead.
 */
LINPHONE_PUBLIC bool_t linphone_payload_type_is_vbr(const LinphonePayloadType *pt);
 
/**
 * Check whether the payload is usable according the bandwidth targets set in the core.
 * @param[in] pt The payload type to test.
 * @return TRUE if the payload type is usable.
 */
LINPHONE_PUBLIC bool_t linphone_payload_type_is_usable(const LinphonePayloadType *pt);
 
 
#ifdef __cplusplus
}
#endif
 
/**
 * @}
**/
 
#endif /* LINPHONE_PAYLOAD_TYPE_H_ */