/
gstrtppayloads.go
337 lines (303 loc) · 9.5 KB
/
gstrtppayloads.go
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
// Code generated by girgen. DO NOT EDIT.
package gstrtp
import (
"fmt"
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <glib-object.h>
// #include <gst/rtp/rtp.h>
import "C"
// GType values.
var (
GTypeRTPPayload = coreglib.Type(C.gst_rtp_payload_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeRTPPayload, F: marshalRTPPayload},
})
}
const RTP_PAYLOAD_1016_STRING = "1"
const RTP_PAYLOAD_CELLB_STRING = "25"
const RTP_PAYLOAD_CN_STRING = "13"
const RTP_PAYLOAD_DVI4_11025_STRING = "16"
const RTP_PAYLOAD_DVI4_16000_STRING = "6"
const RTP_PAYLOAD_DVI4_22050_STRING = "17"
const RTP_PAYLOAD_DVI4_8000_STRING = "5"
const RTP_PAYLOAD_DYNAMIC_STRING = "[96, 127]"
const RTP_PAYLOAD_G721_STRING = "2"
const RTP_PAYLOAD_G722_STRING = "9"
const RTP_PAYLOAD_G723_53 = 17
const RTP_PAYLOAD_G723_53_STRING = "17"
const RTP_PAYLOAD_G723_63 = 16
const RTP_PAYLOAD_G723_63_STRING = "16"
const RTP_PAYLOAD_G723_STRING = "4"
const RTP_PAYLOAD_G728_STRING = "15"
const RTP_PAYLOAD_G729_STRING = "18"
const RTP_PAYLOAD_GSM_STRING = "3"
const RTP_PAYLOAD_H261_STRING = "31"
const RTP_PAYLOAD_H263_STRING = "34"
const RTP_PAYLOAD_JPEG_STRING = "26"
const RTP_PAYLOAD_L16_MONO_STRING = "11"
const RTP_PAYLOAD_L16_STEREO_STRING = "10"
const RTP_PAYLOAD_LPC_STRING = "7"
const RTP_PAYLOAD_MP2T_STRING = "33"
const RTP_PAYLOAD_MPA_STRING = "14"
const RTP_PAYLOAD_MPV_STRING = "32"
const RTP_PAYLOAD_NV_STRING = "28"
const RTP_PAYLOAD_PCMA_STRING = "8"
const RTP_PAYLOAD_PCMU_STRING = "0"
const RTP_PAYLOAD_QCELP_STRING = "12"
const RTP_PAYLOAD_TS41 = 19
const RTP_PAYLOAD_TS41_STRING = "19"
const RTP_PAYLOAD_TS48 = 18
const RTP_PAYLOAD_TS48_STRING = "18"
// RTPPayload: standard predefined fixed payload types.
//
// The official list is at: http://www.iana.org/assignments/rtp-parameters
//
// Audio: reserved: 19 unassigned: 20-23,
//
// Video: unassigned: 24, 27, 29, 30, 35-71, 77-95 Reserved for RTCP conflict
// avoidance: 72-76.
type RTPPayload C.gint
const (
// RtpPayloadPcmu: ITU-T G.711. mu-law audio (RFC 3551).
RtpPayloadPcmu RTPPayload = 0
// RtpPayload1016: RFC 3551 says reserved.
RtpPayload1016 RTPPayload = 1
// RtpPayloadG721: RFC 3551 says reserved.
RtpPayloadG721 RTPPayload = 2
// RtpPayloadGsm: GSM audio.
RtpPayloadGsm RTPPayload = 3
// RtpPayloadG723: ITU G.723.1 audio.
RtpPayloadG723 RTPPayload = 4
// RtpPayloadDvi48000: IMA ADPCM wave type (RFC 3551).
RtpPayloadDvi48000 RTPPayload = 5
// RtpPayloadDvi416000: IMA ADPCM wave type (RFC 3551).
RtpPayloadDvi416000 RTPPayload = 6
// RtpPayloadLpc: experimental linear predictive encoding.
RtpPayloadLpc RTPPayload = 7
// RtpPayloadPcma: ITU-T G.711 A-law audio (RFC 3551).
RtpPayloadPcma RTPPayload = 8
// RtpPayloadG722: ITU-T G.722 (RFC 3551).
RtpPayloadG722 RTPPayload = 9
// RtpPayloadL16Stereo: stereo PCM.
RtpPayloadL16Stereo RTPPayload = 10
// RtpPayloadL16Mono: mono PCM.
RtpPayloadL16Mono RTPPayload = 11
// RtpPayloadQcelp: EIA & TIA standard IS-733.
RtpPayloadQcelp RTPPayload = 12
// RtpPayloadCn: comfort Noise (RFC 3389).
RtpPayloadCn RTPPayload = 13
// RtpPayloadMpa: audio MPEG 1-3.
RtpPayloadMpa RTPPayload = 14
// RtpPayloadG728: ITU-T G.728 Speech coder (RFC 3551).
RtpPayloadG728 RTPPayload = 15
// RtpPayloadDvi411025: IMA ADPCM wave type (RFC 3551).
RtpPayloadDvi411025 RTPPayload = 16
// RtpPayloadDvi422050: IMA ADPCM wave type (RFC 3551).
RtpPayloadDvi422050 RTPPayload = 17
// RtpPayloadG729: ITU-T G.729 Speech coder (RFC 3551).
RtpPayloadG729 RTPPayload = 18
// RtpPayloadCellb: see RFC 2029.
RtpPayloadCellb RTPPayload = 25
// RtpPayloadJPEG: ISO Standards 10918-1 and 10918-2 (RFC 2435).
RtpPayloadJPEG RTPPayload = 26
// RtpPayloadNv: nv encoding by Ron Frederick.
RtpPayloadNv RTPPayload = 28
// RtpPayloadH261: ITU-T Recommendation H.261 (RFC 2032).
RtpPayloadH261 RTPPayload = 31
// RtpPayloadMpv: video MPEG 1 & 2 (RFC 2250).
RtpPayloadMpv RTPPayload = 32
// RtpPayloadMp2T: MPEG-2 transport stream (RFC 2250).
RtpPayloadMp2T RTPPayload = 33
// RtpPayloadH263: video H263 (RFC 2190).
RtpPayloadH263 RTPPayload = 34
)
func marshalRTPPayload(p uintptr) (interface{}, error) {
return RTPPayload(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil
}
// String returns the name in string for RTPPayload.
func (r RTPPayload) String() string {
switch r {
case RtpPayloadPcmu:
return "Pcmu"
case RtpPayload1016:
return "1016"
case RtpPayloadG721:
return "G721"
case RtpPayloadGsm:
return "Gsm"
case RtpPayloadG723:
return "G723"
case RtpPayloadDvi48000:
return "Dvi48000"
case RtpPayloadDvi416000:
return "Dvi416000"
case RtpPayloadLpc:
return "Lpc"
case RtpPayloadPcma:
return "Pcma"
case RtpPayloadG722:
return "G722"
case RtpPayloadL16Stereo:
return "L16Stereo"
case RtpPayloadL16Mono:
return "L16Mono"
case RtpPayloadQcelp:
return "Qcelp"
case RtpPayloadCn:
return "Cn"
case RtpPayloadMpa:
return "Mpa"
case RtpPayloadG728:
return "G728"
case RtpPayloadDvi411025:
return "Dvi411025"
case RtpPayloadDvi422050:
return "Dvi422050"
case RtpPayloadG729:
return "G729"
case RtpPayloadCellb:
return "Cellb"
case RtpPayloadJPEG:
return "JPEG"
case RtpPayloadNv:
return "Nv"
case RtpPayloadH261:
return "H261"
case RtpPayloadMpv:
return "Mpv"
case RtpPayloadMp2T:
return "Mp2T"
case RtpPayloadH263:
return "H263"
default:
return fmt.Sprintf("RTPPayload(%d)", r)
}
}
// RTPPayloadInfo: structure holding default payload type information.
//
// An instance of this type is always passed by reference.
type RTPPayloadInfo struct {
*rtpPayloadInfo
}
// rtpPayloadInfo is the struct that's finalized.
type rtpPayloadInfo struct {
native *C.GstRTPPayloadInfo
}
// PayloadType: payload type, -1 means dynamic.
func (r *RTPPayloadInfo) PayloadType() byte {
valptr := &r.native.payload_type
var _v byte // out
_v = byte(*valptr)
return _v
}
// Media: media type(s), usually "audio", "video", "application", "text",
// "message".
func (r *RTPPayloadInfo) Media() string {
valptr := &r.native.media
var _v string // out
_v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr)))
return _v
}
// EncodingName: encoding name of pt.
func (r *RTPPayloadInfo) EncodingName() string {
valptr := &r.native.encoding_name
var _v string // out
_v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr)))
return _v
}
// ClockRate: default clock rate, 0 = unknown/variable.
func (r *RTPPayloadInfo) ClockRate() uint {
valptr := &r.native.clock_rate
var _v uint // out
_v = uint(*valptr)
return _v
}
// EncodingParameters: encoding parameters. For audio this is the number of
// channels. NULL = not applicable.
func (r *RTPPayloadInfo) EncodingParameters() string {
valptr := &r.native.encoding_parameters
var _v string // out
_v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr)))
return _v
}
// Bitrate: bitrate of the media. 0 = unknown/variable.
func (r *RTPPayloadInfo) Bitrate() uint {
valptr := &r.native.bitrate
var _v uint // out
_v = uint(*valptr)
return _v
}
// PayloadType: payload type, -1 means dynamic.
func (r *RTPPayloadInfo) SetPayloadType(payloadType byte) {
valptr := &r.native.payload_type
*valptr = C.guint8(payloadType)
}
// ClockRate: default clock rate, 0 = unknown/variable.
func (r *RTPPayloadInfo) SetClockRate(clockRate uint) {
valptr := &r.native.clock_rate
*valptr = C.guint(clockRate)
}
// Bitrate: bitrate of the media. 0 = unknown/variable.
func (r *RTPPayloadInfo) SetBitrate(bitrate uint) {
valptr := &r.native.bitrate
*valptr = C.guint(bitrate)
}
// RTPPayloadInfoForName: get the RTPPayloadInfo for media and encoding_name.
// This function is mostly used to get the default clock-rate and bandwidth for
// dynamic payload types specified with media and encoding name.
//
// The search for encoding_name will be performed in a case insensitive way.
//
// The function takes the following parameters:
//
// - media to find.
// - encodingName: encoding name to find.
//
// The function returns the following values:
//
// - rtpPayloadInfo or NULL when no info could be found.
//
func RTPPayloadInfoForName(media, encodingName string) *RTPPayloadInfo {
var _arg1 *C.gchar // out
var _arg2 *C.gchar // out
var _cret *C.GstRTPPayloadInfo // in
_arg1 = (*C.gchar)(unsafe.Pointer(C.CString(media)))
defer C.free(unsafe.Pointer(_arg1))
_arg2 = (*C.gchar)(unsafe.Pointer(C.CString(encodingName)))
defer C.free(unsafe.Pointer(_arg2))
_cret = C.gst_rtp_payload_info_for_name(_arg1, _arg2)
runtime.KeepAlive(media)
runtime.KeepAlive(encodingName)
var _rtpPayloadInfo *RTPPayloadInfo // out
_rtpPayloadInfo = (*RTPPayloadInfo)(gextras.NewStructNative(unsafe.Pointer(_cret)))
return _rtpPayloadInfo
}
// RTPPayloadInfoForPt: get the RTPPayloadInfo for payload_type. This function
// is mostly used to get the default clock-rate and bandwidth for static payload
// types specified with payload_type.
//
// The function takes the following parameters:
//
// - payloadType: payload_type to find.
//
// The function returns the following values:
//
// - rtpPayloadInfo or NULL when no info could be found.
//
func RTPPayloadInfoForPt(payloadType byte) *RTPPayloadInfo {
var _arg1 C.guint8 // out
var _cret *C.GstRTPPayloadInfo // in
_arg1 = C.guint8(payloadType)
_cret = C.gst_rtp_payload_info_for_pt(_arg1)
runtime.KeepAlive(payloadType)
var _rtpPayloadInfo *RTPPayloadInfo // out
_rtpPayloadInfo = (*RTPPayloadInfo)(gextras.NewStructNative(unsafe.Pointer(_cret)))
return _rtpPayloadInfo
}