Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ffi.rs « jitterbuffer « src « threadshare « generic - gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cc1eb41d233076ee68a0ab260edb7201ed4da4e9 (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
// Copyright (C) 2019 Sebastian Dröge <sebastian@centricular.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.

use glib::ffi::{gboolean, gpointer, GList, GType};

use gst::ffi::GstClockTime;
use libc::{c_int, c_uint, c_ulonglong, c_ushort, c_void};

#[repr(C)]
#[derive(Copy, Clone)]
pub struct RTPJitterBufferItem {
    pub data: gpointer,
    pub next: *mut GList,
    pub prev: *mut GList,
    pub r#type: c_uint,
    pub dts: GstClockTime,
    pub pts: GstClockTime,
    pub seqnum: c_uint,
    pub count: c_uint,
    pub rtptime: c_uint,
}

#[repr(C)]
pub struct RTPJitterBuffer(c_void);

#[repr(C)]
#[derive(Copy, Clone)]
pub struct RTPPacketRateCtx {
    probed: gboolean,
    clock_rate: c_int,
    last_seqnum: c_ushort,
    last_ts: c_ulonglong,
    avg_packet_rate: c_uint,
}

pub type RTPJitterBufferMode = c_int;
pub const RTP_JITTER_BUFFER_MODE_NONE: RTPJitterBufferMode = 0;
pub const RTP_JITTER_BUFFER_MODE_SLAVE: RTPJitterBufferMode = 1;
pub const RTP_JITTER_BUFFER_MODE_BUFFER: RTPJitterBufferMode = 2;
pub const RTP_JITTER_BUFFER_MODE_SYNCED: RTPJitterBufferMode = 4;

extern "C" {
    pub fn rtp_jitter_buffer_new() -> *mut RTPJitterBuffer;
    pub fn rtp_jitter_buffer_get_type() -> GType;
    #[allow(dead_code)]
    pub fn rtp_jitter_buffer_get_mode(jbuf: *mut RTPJitterBuffer) -> RTPJitterBufferMode;
    #[allow(dead_code)]
    pub fn rtp_jitter_buffer_set_mode(jbuf: *mut RTPJitterBuffer, mode: RTPJitterBufferMode);
    #[allow(dead_code)]
    pub fn rtp_jitter_buffer_get_delay(jbuf: *mut RTPJitterBuffer) -> GstClockTime;
    pub fn rtp_jitter_buffer_set_delay(jbuf: *mut RTPJitterBuffer, delay: GstClockTime);
    pub fn rtp_jitter_buffer_set_clock_rate(jbuf: *mut RTPJitterBuffer, clock_rate: c_uint);
    #[allow(dead_code)]
    pub fn rtp_jitter_buffer_get_clock_rate(jbuf: *mut RTPJitterBuffer) -> c_uint;
    pub fn rtp_jitter_buffer_reset_skew(jbuf: *mut RTPJitterBuffer);

    pub fn rtp_jitter_buffer_flush(jbuf: *mut RTPJitterBuffer, free_func: glib::ffi::GFunc);
    pub fn rtp_jitter_buffer_find_earliest(
        jbuf: *mut RTPJitterBuffer,
        pts: *mut GstClockTime,
        seqnum: *mut c_uint,
    );
    pub fn rtp_jitter_buffer_calculate_pts(
        jbuf: *mut RTPJitterBuffer,
        dts: GstClockTime,
        estimated_dts: gboolean,
        rtptime: c_uint,
        base_time: GstClockTime,
        gap: c_int,
        is_rtx: gboolean,
    ) -> GstClockTime;
    pub fn rtp_jitter_buffer_insert(
        jbuf: *mut RTPJitterBuffer,
        item: *mut RTPJitterBufferItem,
        head: *mut gboolean,
        percent: *mut c_int,
    ) -> gboolean;
    pub fn rtp_jitter_buffer_pop(
        jbuf: *mut RTPJitterBuffer,
        percent: *mut c_int,
    ) -> *mut RTPJitterBufferItem;
    pub fn rtp_jitter_buffer_peek(jbuf: *mut RTPJitterBuffer) -> *mut RTPJitterBufferItem;

    pub fn gst_rtp_packet_rate_ctx_reset(ctx: *mut RTPPacketRateCtx, clock_rate: c_int);
    pub fn gst_rtp_packet_rate_ctx_update(
        ctx: *mut RTPPacketRateCtx,
        seqnum: c_ushort,
        ts: c_uint,
    ) -> c_uint;
    pub fn gst_rtp_packet_rate_ctx_get_max_dropout(
        ctx: *mut RTPPacketRateCtx,
        time_ms: c_int,
    ) -> c_uint;
    #[allow(dead_code)]
    pub fn gst_rtp_packet_rate_ctx_get_max_disorder(
        ctx: *mut RTPPacketRateCtx,
        time_ms: c_int,
    ) -> c_uint;
}