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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::{ffi, RTCPSDESType};
use glib::translate::*;

//#[cfg(feature = "v1_16")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
//#[doc(alias = "gst_buffer_add_rtp_source_meta")]
//pub fn buffer_add_rtp_source_meta(buffer: &gst::Buffer, ssrc: u32, csrc: &[u32]) -> /*Ignored*/RTPSourceMeta {
//    unsafe { TODO: call ffi:gst_buffer_add_rtp_source_meta() }
//}

//#[cfg(feature = "v1_16")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
//#[doc(alias = "gst_buffer_get_rtp_source_meta")]
//pub fn buffer_get_rtp_source_meta(buffer: &gst::Buffer) -> /*Ignored*/Option<RTPSourceMeta> {
//    unsafe { TODO: call ffi:gst_buffer_get_rtp_source_meta() }
//}

/// Converts an NTP time to UNIX nanoseconds. `ntptime` can typically be
/// the NTP time of an SR RTCP message and contains, in the upper 32 bits, the
/// number of seconds since 1900 and, in the lower 32 bits, the fractional
/// seconds. The resulting value will be the number of nanoseconds since 1970.
/// ## `ntptime`
/// an NTP timestamp
///
/// # Returns
///
/// the UNIX time for `ntptime` in nanoseconds.
#[doc(alias = "gst_rtcp_ntp_to_unix")]
pub fn rtcp_ntp_to_unix(ntptime: u64) -> u64 {
    assert_initialized_main_thread!();
    unsafe { ffi::gst_rtcp_ntp_to_unix(ntptime) }
}

/// Convert `name` into a [`RTCPSDESType`][crate::RTCPSDESType]. `name` is typically a key in a
/// [`gst::Structure`][crate::gst::Structure] containing SDES items.
/// ## `name`
/// a SDES name
///
/// # Returns
///
/// the [`RTCPSDESType`][crate::RTCPSDESType] for `name` or [`RTCPSDESType::Priv`][crate::RTCPSDESType::Priv] when `name`
/// is a private sdes item.
#[doc(alias = "gst_rtcp_sdes_name_to_type")]
pub fn rtcp_sdes_name_to_type(name: &str) -> RTCPSDESType {
    assert_initialized_main_thread!();
    unsafe { from_glib(ffi::gst_rtcp_sdes_name_to_type(name.to_glib_none().0)) }
}

/// Converts `type_` to the string equivalent. The string is typically used as a
/// key in a [`gst::Structure`][crate::gst::Structure] containing SDES items.
/// ## `type_`
/// a [`RTCPSDESType`][crate::RTCPSDESType]
///
/// # Returns
///
/// the string equivalent of `type_`
#[doc(alias = "gst_rtcp_sdes_type_to_name")]
pub fn rtcp_sdes_type_to_name(type_: RTCPSDESType) -> glib::GString {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_rtcp_sdes_type_to_name(type_.into_glib())) }
}

/// Converts a UNIX timestamp in nanoseconds to an NTP time. The caller should
/// pass a value with nanoseconds since 1970. The NTP time will, in the upper
/// 32 bits, contain the number of seconds since 1900 and, in the lower 32
/// bits, the fractional seconds. The resulting value can be used as an ntptime
/// for constructing SR RTCP packets.
/// ## `unixtime`
/// an UNIX timestamp in nanoseconds
///
/// # Returns
///
/// the NTP time for `unixtime`.
#[doc(alias = "gst_rtcp_unix_to_ntp")]
pub fn rtcp_unix_to_ntp(unixtime: u64) -> u64 {
    assert_initialized_main_thread!();
    unsafe { ffi::gst_rtcp_unix_to_ntp(unixtime) }
}

/// Retrieve all the factories of the currently registered RTP header
/// extensions. Call [`ElementFactory::create()`][crate::gst::ElementFactory::create()] with each factory to create
/// the associated [`RTPHeaderExtension`][crate::RTPHeaderExtension].
///
/// # Returns
///
/// a `GList` of
///  [`gst::ElementFactory`][crate::gst::ElementFactory]'s. Use `gst_plugin_feature_list_free()` after use
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_rtp_get_header_extension_list")]
pub fn rtp_get_header_extension_list() -> Vec<gst::ElementFactory> {
    assert_initialized_main_thread!();
    unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_rtp_get_header_extension_list()) }
}

//#[doc(alias = "gst_rtp_hdrext_set_ntp_56")]
//pub fn rtp_hdrext_set_ntp_56(data: /*Unimplemented*/Option<Basic: Pointer>, size: u32, ntptime: u64) -> bool {
//    unsafe { TODO: call ffi:gst_rtp_hdrext_set_ntp_56() }
//}

//#[doc(alias = "gst_rtp_hdrext_set_ntp_64")]
//pub fn rtp_hdrext_set_ntp_64(data: /*Unimplemented*/Option<Basic: Pointer>, size: u32, ntptime: u64) -> bool {
//    unsafe { TODO: call ffi:gst_rtp_hdrext_set_ntp_64() }
//}