Generate initial bindings for gstreamer-rtp

This mostly wraps enums, flags, and constants, will wrap RTPBuffer
next
This commit is contained in:
Mathieu Duponchelle 2019-08-13 19:12:09 +02:00 committed by Sebastian Dröge
parent 85d01e853e
commit ee014a6df2
13 changed files with 9020 additions and 0 deletions

View file

@ -16,6 +16,7 @@ members = [
"gstreamer-check",
"gstreamer-editing-services",
"gstreamer-gl",
"gstreamer-rtp",
"examples",
"tutorials",
]

52
Gir_GstRtp.toml Normal file
View file

@ -0,0 +1,52 @@
[options]
girs_dir = "gir-files"
library = "GstRtp"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-rtp"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
single_version_file = true
doc_target_path = "docs/gstreamer-rtp/docs.md"
generate_display_trait = false
external_libraries = [
"GLib",
"GObject",
"Gst",
]
generate = [
"GstRtp.RTCPFBType",
"GstRtp.RTCPSDESType",
"GstRtp.RTCPType",
"GstRtp.RTCPXRType",
"GstRtp.RTPPayload",
"GstRtp.RTPProfile",
"GstRtp.RTPBufferFlags",
"GstRtp.RTPBufferMapFlags",
]
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstRtp.*"
status = "generate"
# expected enum `std::ffi::c_void`, found u8
[[object.function]]
name = "rtp_hdrext_get_ntp_56"
ignore = true
# expected enum `std::ffi::c_void`, found u8
[[object.function]]
name = "rtp_hdrext_get_ntp_64"
ignore = true
# manual bindings are needed for GstMeta
[[object.function]]
name = "rtp_source_meta_api_get_type"
ignore = true

View file

@ -0,0 +1 @@
<!-- file * -->

7843
gir-files/GstRtp-1.0.gir Normal file

File diff suppressed because it is too large Load diff

39
gstreamer-rtp/Cargo.toml Normal file
View file

@ -0,0 +1,39 @@
[package]
name = "gstreamer-rtp"
version = "0.15.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>", "Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Rtp library"
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://slomo.pages.freedesktop.org/rustdocs/gstreamer/gstreamer_rtp"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "1.0"
lazy_static = "1.0"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] }
gstreamer-rtp-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] }
glib = { git = "https://github.com/gtk-rs/glib" }
gstreamer = { path = "../gstreamer" }
[build-dependencies.rustdoc-stripper]
version = "0.1"
optional = true
[features]
default = []
v1_10 = ["gstreamer/v1_10", "gstreamer-rtp-sys/v1_10"]
v1_12 = ["gstreamer/v1_12", "gstreamer-rtp-sys/v1_12", "v1_10"]
v1_14 = ["gstreamer/v1_14", "gstreamer-rtp-sys/v1_14", "v1_12"]
v1_16 = ["gstreamer/v1_16", "gstreamer-rtp-sys/v1_16", "v1_14"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
["package.metadata.docs.rs"]
dox = ["gstreamer-rtp-sys/dox", "glib/dox", "gstreamer/dox"]

34
gstreamer-rtp/build.rs Normal file
View file

@ -0,0 +1,34 @@
fn main() {
manage_docs();
}
#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))]
fn manage_docs() {
extern crate stripper_lib;
use std::io;
let path = "src";
let ignores: &[&str] = &[];
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::strip_comments(w, s, &mut io::sink(), true),
&ignores,
false,
);
#[cfg(feature = "embed-lgpl-docs")]
{
let docs = include_str!("../docs/gstreamer-rtp/docs.md");
let mut infos = stripper_lib::parse_cmts(docs.lines(), true);
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::regenerate_comments(w, s, &mut infos, true, true),
&ignores,
false,
);
}
}
#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))]
fn manage_docs() {}

View file

@ -0,0 +1,245 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use gst_rtp_sys;
use std::ffi::CStr;
lazy_static! {
pub static ref RTP_HDREXT_BASE: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_HDREXT_BASE)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_HDREXT_NTP_56: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_HDREXT_NTP_56)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_HDREXT_NTP_64: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_HDREXT_NTP_64)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_1016_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_1016_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_CELLB_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_CELLB_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_CN_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_CN_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_DVI4_11025_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_11025_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_DVI4_16000_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_16000_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_DVI4_22050_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_22050_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_DVI4_8000_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_8000_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_DYNAMIC_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DYNAMIC_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_G721_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G721_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_G722_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G722_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_G723_53_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G723_53_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_G723_63_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G723_63_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_G723_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G723_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_G728_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G728_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_G729_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G729_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_GSM_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_GSM_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_H261_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_H261_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_H263_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_H263_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_JPEG_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_JPEG_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_L16_MONO_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_L16_MONO_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_L16_STEREO_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_L16_STEREO_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_LPC_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_LPC_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_MP2T_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_MP2T_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_MPA_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_MPA_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_MPV_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_MPV_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_NV_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_NV_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_PCMA_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_PCMA_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_PCMU_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_PCMU_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_QCELP_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_QCELP_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_TS41_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_TS41_STRING)
.to_str()
.unwrap()
};
}
lazy_static! {
pub static ref RTP_PAYLOAD_TS48_STRING: &'static str = unsafe {
CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_TS48_STRING)
.to_str()
.unwrap()
};
}

View file

@ -0,0 +1,527 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_rtp_sys;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum RTCPFBType {
FbTypeInvalid,
RtpfbTypeNack,
RtpfbTypeTmmbr,
RtpfbTypeTmmbn,
RtpfbTypeRtcpSrReq,
PsfbTypeSli,
PsfbTypeAfb,
PsfbTypeTstn,
PsfbTypeVbcn,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTCPFBType {
type GlibType = gst_rtp_sys::GstRTCPFBType;
fn to_glib(&self) -> gst_rtp_sys::GstRTCPFBType {
match *self {
RTCPFBType::FbTypeInvalid => gst_rtp_sys::GST_RTCP_FB_TYPE_INVALID,
RTCPFBType::RtpfbTypeNack => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_NACK,
RTCPFBType::RtpfbTypeTmmbr => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_TMMBR,
RTCPFBType::RtpfbTypeTmmbn => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_TMMBN,
RTCPFBType::RtpfbTypeRtcpSrReq => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ,
RTCPFBType::PsfbTypeSli => gst_rtp_sys::GST_RTCP_PSFB_TYPE_SLI,
RTCPFBType::PsfbTypeAfb => gst_rtp_sys::GST_RTCP_PSFB_TYPE_AFB,
RTCPFBType::PsfbTypeTstn => gst_rtp_sys::GST_RTCP_PSFB_TYPE_TSTN,
RTCPFBType::PsfbTypeVbcn => gst_rtp_sys::GST_RTCP_PSFB_TYPE_VBCN,
RTCPFBType::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTCPFBType> for RTCPFBType {
fn from_glib(value: gst_rtp_sys::GstRTCPFBType) -> Self {
skip_assert_initialized!();
match value {
0 => RTCPFBType::FbTypeInvalid,
1 => RTCPFBType::RtpfbTypeNack,
3 => RTCPFBType::RtpfbTypeTmmbr,
4 => RTCPFBType::RtpfbTypeTmmbn,
5 => RTCPFBType::RtpfbTypeRtcpSrReq,
2 => RTCPFBType::PsfbTypeSli,
15 => RTCPFBType::PsfbTypeAfb,
6 => RTCPFBType::PsfbTypeTstn,
7 => RTCPFBType::PsfbTypeVbcn,
value => RTCPFBType::__Unknown(value),
}
}
}
impl StaticType for RTCPFBType {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtcpfb_type_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTCPFBType {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTCPFBType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for RTCPFBType {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum RTCPSDESType {
Invalid,
End,
Cname,
Name,
Email,
Phone,
Loc,
Tool,
Note,
Priv,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTCPSDESType {
type GlibType = gst_rtp_sys::GstRTCPSDESType;
fn to_glib(&self) -> gst_rtp_sys::GstRTCPSDESType {
match *self {
RTCPSDESType::Invalid => gst_rtp_sys::GST_RTCP_SDES_INVALID,
RTCPSDESType::End => gst_rtp_sys::GST_RTCP_SDES_END,
RTCPSDESType::Cname => gst_rtp_sys::GST_RTCP_SDES_CNAME,
RTCPSDESType::Name => gst_rtp_sys::GST_RTCP_SDES_NAME,
RTCPSDESType::Email => gst_rtp_sys::GST_RTCP_SDES_EMAIL,
RTCPSDESType::Phone => gst_rtp_sys::GST_RTCP_SDES_PHONE,
RTCPSDESType::Loc => gst_rtp_sys::GST_RTCP_SDES_LOC,
RTCPSDESType::Tool => gst_rtp_sys::GST_RTCP_SDES_TOOL,
RTCPSDESType::Note => gst_rtp_sys::GST_RTCP_SDES_NOTE,
RTCPSDESType::Priv => gst_rtp_sys::GST_RTCP_SDES_PRIV,
RTCPSDESType::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTCPSDESType> for RTCPSDESType {
fn from_glib(value: gst_rtp_sys::GstRTCPSDESType) -> Self {
skip_assert_initialized!();
match value {
-1 => RTCPSDESType::Invalid,
0 => RTCPSDESType::End,
1 => RTCPSDESType::Cname,
2 => RTCPSDESType::Name,
3 => RTCPSDESType::Email,
4 => RTCPSDESType::Phone,
5 => RTCPSDESType::Loc,
6 => RTCPSDESType::Tool,
7 => RTCPSDESType::Note,
8 => RTCPSDESType::Priv,
value => RTCPSDESType::__Unknown(value),
}
}
}
impl StaticType for RTCPSDESType {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtcpsdes_type_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTCPSDESType {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTCPSDESType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for RTCPSDESType {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum RTCPType {
Invalid,
Sr,
Rr,
Sdes,
Bye,
App,
Rtpfb,
Psfb,
Xr,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTCPType {
type GlibType = gst_rtp_sys::GstRTCPType;
fn to_glib(&self) -> gst_rtp_sys::GstRTCPType {
match *self {
RTCPType::Invalid => gst_rtp_sys::GST_RTCP_TYPE_INVALID,
RTCPType::Sr => gst_rtp_sys::GST_RTCP_TYPE_SR,
RTCPType::Rr => gst_rtp_sys::GST_RTCP_TYPE_RR,
RTCPType::Sdes => gst_rtp_sys::GST_RTCP_TYPE_SDES,
RTCPType::Bye => gst_rtp_sys::GST_RTCP_TYPE_BYE,
RTCPType::App => gst_rtp_sys::GST_RTCP_TYPE_APP,
RTCPType::Rtpfb => gst_rtp_sys::GST_RTCP_TYPE_RTPFB,
RTCPType::Psfb => gst_rtp_sys::GST_RTCP_TYPE_PSFB,
RTCPType::Xr => gst_rtp_sys::GST_RTCP_TYPE_XR,
RTCPType::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTCPType> for RTCPType {
fn from_glib(value: gst_rtp_sys::GstRTCPType) -> Self {
skip_assert_initialized!();
match value {
0 => RTCPType::Invalid,
200 => RTCPType::Sr,
201 => RTCPType::Rr,
202 => RTCPType::Sdes,
203 => RTCPType::Bye,
204 => RTCPType::App,
205 => RTCPType::Rtpfb,
206 => RTCPType::Psfb,
207 => RTCPType::Xr,
value => RTCPType::__Unknown(value),
}
}
}
impl StaticType for RTCPType {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtcp_type_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTCPType {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTCPType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for RTCPType {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[cfg(any(feature = "v1_16", feature = "dox"))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum RTCPXRType {
Invalid,
Lrle,
Drle,
Prt,
Rrt,
Dlrr,
Ssumm,
VoipMetrics,
#[doc(hidden)]
__Unknown(i32),
}
#[cfg(any(feature = "v1_16", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for RTCPXRType {
type GlibType = gst_rtp_sys::GstRTCPXRType;
fn to_glib(&self) -> gst_rtp_sys::GstRTCPXRType {
match *self {
RTCPXRType::Invalid => gst_rtp_sys::GST_RTCP_XR_TYPE_INVALID,
RTCPXRType::Lrle => gst_rtp_sys::GST_RTCP_XR_TYPE_LRLE,
RTCPXRType::Drle => gst_rtp_sys::GST_RTCP_XR_TYPE_DRLE,
RTCPXRType::Prt => gst_rtp_sys::GST_RTCP_XR_TYPE_PRT,
RTCPXRType::Rrt => gst_rtp_sys::GST_RTCP_XR_TYPE_RRT,
RTCPXRType::Dlrr => gst_rtp_sys::GST_RTCP_XR_TYPE_DLRR,
RTCPXRType::Ssumm => gst_rtp_sys::GST_RTCP_XR_TYPE_SSUMM,
RTCPXRType::VoipMetrics => gst_rtp_sys::GST_RTCP_XR_TYPE_VOIP_METRICS,
RTCPXRType::__Unknown(value) => value,
}
}
}
#[cfg(any(feature = "v1_16", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTCPXRType> for RTCPXRType {
fn from_glib(value: gst_rtp_sys::GstRTCPXRType) -> Self {
skip_assert_initialized!();
match value {
-1 => RTCPXRType::Invalid,
1 => RTCPXRType::Lrle,
2 => RTCPXRType::Drle,
3 => RTCPXRType::Prt,
4 => RTCPXRType::Rrt,
5 => RTCPXRType::Dlrr,
6 => RTCPXRType::Ssumm,
7 => RTCPXRType::VoipMetrics,
value => RTCPXRType::__Unknown(value),
}
}
}
#[cfg(any(feature = "v1_16", feature = "dox"))]
impl StaticType for RTCPXRType {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtcpxr_type_get_type()) }
}
}
#[cfg(any(feature = "v1_16", feature = "dox"))]
impl<'a> FromValueOptional<'a> for RTCPXRType {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
#[cfg(any(feature = "v1_16", feature = "dox"))]
impl<'a> FromValue<'a> for RTCPXRType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
#[cfg(any(feature = "v1_16", feature = "dox"))]
impl SetValue for RTCPXRType {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum RTPPayload {
Pcmu,
_1016,
G721,
Gsm,
G723,
Dvi48000,
Dvi416000,
Lpc,
Pcma,
G722,
L16Stereo,
L16Mono,
Qcelp,
Cn,
Mpa,
G728,
Dvi411025,
Dvi422050,
G729,
Cellb,
Jpeg,
Nv,
H261,
Mpv,
Mp2t,
H263,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTPPayload {
type GlibType = gst_rtp_sys::GstRTPPayload;
fn to_glib(&self) -> gst_rtp_sys::GstRTPPayload {
match *self {
RTPPayload::Pcmu => gst_rtp_sys::GST_RTP_PAYLOAD_PCMU,
RTPPayload::_1016 => gst_rtp_sys::GST_RTP_PAYLOAD_1016,
RTPPayload::G721 => gst_rtp_sys::GST_RTP_PAYLOAD_G721,
RTPPayload::Gsm => gst_rtp_sys::GST_RTP_PAYLOAD_GSM,
RTPPayload::G723 => gst_rtp_sys::GST_RTP_PAYLOAD_G723,
RTPPayload::Dvi48000 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_8000,
RTPPayload::Dvi416000 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_16000,
RTPPayload::Lpc => gst_rtp_sys::GST_RTP_PAYLOAD_LPC,
RTPPayload::Pcma => gst_rtp_sys::GST_RTP_PAYLOAD_PCMA,
RTPPayload::G722 => gst_rtp_sys::GST_RTP_PAYLOAD_G722,
RTPPayload::L16Stereo => gst_rtp_sys::GST_RTP_PAYLOAD_L16_STEREO,
RTPPayload::L16Mono => gst_rtp_sys::GST_RTP_PAYLOAD_L16_MONO,
RTPPayload::Qcelp => gst_rtp_sys::GST_RTP_PAYLOAD_QCELP,
RTPPayload::Cn => gst_rtp_sys::GST_RTP_PAYLOAD_CN,
RTPPayload::Mpa => gst_rtp_sys::GST_RTP_PAYLOAD_MPA,
RTPPayload::G728 => gst_rtp_sys::GST_RTP_PAYLOAD_G728,
RTPPayload::Dvi411025 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_11025,
RTPPayload::Dvi422050 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_22050,
RTPPayload::G729 => gst_rtp_sys::GST_RTP_PAYLOAD_G729,
RTPPayload::Cellb => gst_rtp_sys::GST_RTP_PAYLOAD_CELLB,
RTPPayload::Jpeg => gst_rtp_sys::GST_RTP_PAYLOAD_JPEG,
RTPPayload::Nv => gst_rtp_sys::GST_RTP_PAYLOAD_NV,
RTPPayload::H261 => gst_rtp_sys::GST_RTP_PAYLOAD_H261,
RTPPayload::Mpv => gst_rtp_sys::GST_RTP_PAYLOAD_MPV,
RTPPayload::Mp2t => gst_rtp_sys::GST_RTP_PAYLOAD_MP2T,
RTPPayload::H263 => gst_rtp_sys::GST_RTP_PAYLOAD_H263,
RTPPayload::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTPPayload> for RTPPayload {
fn from_glib(value: gst_rtp_sys::GstRTPPayload) -> Self {
skip_assert_initialized!();
match value {
0 => RTPPayload::Pcmu,
1 => RTPPayload::_1016,
2 => RTPPayload::G721,
3 => RTPPayload::Gsm,
4 => RTPPayload::G723,
5 => RTPPayload::Dvi48000,
6 => RTPPayload::Dvi416000,
7 => RTPPayload::Lpc,
8 => RTPPayload::Pcma,
9 => RTPPayload::G722,
10 => RTPPayload::L16Stereo,
11 => RTPPayload::L16Mono,
12 => RTPPayload::Qcelp,
13 => RTPPayload::Cn,
14 => RTPPayload::Mpa,
15 => RTPPayload::G728,
16 => RTPPayload::Dvi411025,
17 => RTPPayload::Dvi422050,
18 => RTPPayload::G729,
25 => RTPPayload::Cellb,
26 => RTPPayload::Jpeg,
28 => RTPPayload::Nv,
31 => RTPPayload::H261,
32 => RTPPayload::Mpv,
33 => RTPPayload::Mp2t,
34 => RTPPayload::H263,
value => RTPPayload::__Unknown(value),
}
}
}
impl StaticType for RTPPayload {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtp_payload_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTPPayload {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTPPayload {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for RTPPayload {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum RTPProfile {
Unknown,
Avp,
Savp,
Avpf,
Savpf,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTPProfile {
type GlibType = gst_rtp_sys::GstRTPProfile;
fn to_glib(&self) -> gst_rtp_sys::GstRTPProfile {
match *self {
RTPProfile::Unknown => gst_rtp_sys::GST_RTP_PROFILE_UNKNOWN,
RTPProfile::Avp => gst_rtp_sys::GST_RTP_PROFILE_AVP,
RTPProfile::Savp => gst_rtp_sys::GST_RTP_PROFILE_SAVP,
RTPProfile::Avpf => gst_rtp_sys::GST_RTP_PROFILE_AVPF,
RTPProfile::Savpf => gst_rtp_sys::GST_RTP_PROFILE_SAVPF,
RTPProfile::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTPProfile> for RTPProfile {
fn from_glib(value: gst_rtp_sys::GstRTPProfile) -> Self {
skip_assert_initialized!();
match value {
0 => RTPProfile::Unknown,
1 => RTPProfile::Avp,
2 => RTPProfile::Savp,
3 => RTPProfile::Avpf,
4 => RTPProfile::Savpf,
value => RTPProfile::__Unknown(value),
}
}
}
impl StaticType for RTPProfile {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtp_profile_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTPProfile {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTPProfile {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for RTPProfile {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}

View file

@ -0,0 +1,117 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_rtp_sys;
#[cfg(any(feature = "v1_10", feature = "dox"))]
bitflags! {
pub struct RTPBufferFlags: u32 {
const RETRANSMISSION = 1048576;
const REDUNDANT = 2097152;
const LAST = 268435456;
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for RTPBufferFlags {
type GlibType = gst_rtp_sys::GstRTPBufferFlags;
fn to_glib(&self) -> gst_rtp_sys::GstRTPBufferFlags {
self.bits()
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTPBufferFlags> for RTPBufferFlags {
fn from_glib(value: gst_rtp_sys::GstRTPBufferFlags) -> RTPBufferFlags {
skip_assert_initialized!();
RTPBufferFlags::from_bits_truncate(value)
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl StaticType for RTPBufferFlags {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtp_buffer_flags_get_type()) }
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> FromValueOptional<'a> for RTPBufferFlags {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> FromValue<'a> for RTPBufferFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
impl SetValue for RTPBufferFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
}
}
bitflags! {
pub struct RTPBufferMapFlags: u32 {
const SKIP_PADDING = 65536;
const LAST = 16777216;
}
}
#[doc(hidden)]
impl ToGlib for RTPBufferMapFlags {
type GlibType = gst_rtp_sys::GstRTPBufferMapFlags;
fn to_glib(&self) -> gst_rtp_sys::GstRTPBufferMapFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<gst_rtp_sys::GstRTPBufferMapFlags> for RTPBufferMapFlags {
fn from_glib(value: gst_rtp_sys::GstRTPBufferMapFlags) -> RTPBufferMapFlags {
skip_assert_initialized!();
RTPBufferMapFlags::from_bits_truncate(value)
}
}
impl StaticType for RTPBufferMapFlags {
fn static_type() -> Type {
unsafe { from_glib(gst_rtp_sys::gst_rtp_buffer_map_flags_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTPBufferMapFlags {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTPBufferMapFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
}
}
impl SetValue for RTPBufferMapFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
}
}

View file

@ -0,0 +1,50 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use glib::GString;
use gst_rtp_sys;
use RTCPSDESType;
//#[cfg(any(feature = "v1_16", feature = "dox"))]
//pub fn buffer_add_rtp_source_meta(buffer: &gst::Buffer, ssrc: u32, csrc: u32, csrc_count: u32) -> /*Ignored*/Option<RTPSourceMeta> {
// unsafe { TODO: call gst_rtp_sys:gst_buffer_add_rtp_source_meta() }
//}
//#[cfg(any(feature = "v1_16", feature = "dox"))]
//pub fn buffer_get_rtp_source_meta(buffer: &gst::Buffer) -> /*Ignored*/Option<RTPSourceMeta> {
// unsafe { TODO: call gst_rtp_sys:gst_buffer_get_rtp_source_meta() }
//}
pub fn rtcp_ntp_to_unix(ntptime: u64) -> u64 {
assert_initialized_main_thread!();
unsafe { gst_rtp_sys::gst_rtcp_ntp_to_unix(ntptime) }
}
pub fn rtcp_sdes_name_to_type(name: &str) -> RTCPSDESType {
assert_initialized_main_thread!();
unsafe {
from_glib(gst_rtp_sys::gst_rtcp_sdes_name_to_type(
name.to_glib_none().0,
))
}
}
pub fn rtcp_sdes_type_to_name(type_: RTCPSDESType) -> Option<GString> {
assert_initialized_main_thread!();
unsafe { from_glib_none(gst_rtp_sys::gst_rtcp_sdes_type_to_name(type_.to_glib())) }
}
pub fn rtcp_unix_to_ntp(unixtime: u64) -> u64 {
assert_initialized_main_thread!();
unsafe { gst_rtp_sys::gst_rtcp_unix_to_ntp(unixtime) }
}
//pub fn rtp_hdrext_set_ntp_56(data: /*Unimplemented*/Option<Fundamental: Pointer>, size: u32, ntptime: u64) -> bool {
// unsafe { TODO: call gst_rtp_sys:gst_rtp_hdrext_set_ntp_56() }
//}
//pub fn rtp_hdrext_set_ntp_64(data: /*Unimplemented*/Option<Fundamental: Pointer>, size: u32, ntptime: u64) -> bool {
// unsafe { TODO: call gst_rtp_sys:gst_rtp_hdrext_set_ntp_64() }
//}

View file

@ -0,0 +1,58 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
mod enums;
pub use self::enums::RTCPFBType;
pub use self::enums::RTCPSDESType;
pub use self::enums::RTCPType;
#[cfg(any(feature = "v1_16", feature = "dox"))]
pub use self::enums::RTCPXRType;
pub use self::enums::RTPPayload;
pub use self::enums::RTPProfile;
mod flags;
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub use self::flags::RTPBufferFlags;
pub use self::flags::RTPBufferMapFlags;
pub mod functions;
mod constants;
pub use self::constants::RTP_HDREXT_BASE;
pub use self::constants::RTP_HDREXT_NTP_56;
pub use self::constants::RTP_HDREXT_NTP_64;
pub use self::constants::RTP_PAYLOAD_1016_STRING;
pub use self::constants::RTP_PAYLOAD_CELLB_STRING;
pub use self::constants::RTP_PAYLOAD_CN_STRING;
pub use self::constants::RTP_PAYLOAD_DVI4_11025_STRING;
pub use self::constants::RTP_PAYLOAD_DVI4_16000_STRING;
pub use self::constants::RTP_PAYLOAD_DVI4_22050_STRING;
pub use self::constants::RTP_PAYLOAD_DVI4_8000_STRING;
pub use self::constants::RTP_PAYLOAD_DYNAMIC_STRING;
pub use self::constants::RTP_PAYLOAD_G721_STRING;
pub use self::constants::RTP_PAYLOAD_G722_STRING;
pub use self::constants::RTP_PAYLOAD_G723_53_STRING;
pub use self::constants::RTP_PAYLOAD_G723_63_STRING;
pub use self::constants::RTP_PAYLOAD_G723_STRING;
pub use self::constants::RTP_PAYLOAD_G728_STRING;
pub use self::constants::RTP_PAYLOAD_G729_STRING;
pub use self::constants::RTP_PAYLOAD_GSM_STRING;
pub use self::constants::RTP_PAYLOAD_H261_STRING;
pub use self::constants::RTP_PAYLOAD_H263_STRING;
pub use self::constants::RTP_PAYLOAD_JPEG_STRING;
pub use self::constants::RTP_PAYLOAD_L16_MONO_STRING;
pub use self::constants::RTP_PAYLOAD_L16_STEREO_STRING;
pub use self::constants::RTP_PAYLOAD_LPC_STRING;
pub use self::constants::RTP_PAYLOAD_MP2T_STRING;
pub use self::constants::RTP_PAYLOAD_MPA_STRING;
pub use self::constants::RTP_PAYLOAD_MPV_STRING;
pub use self::constants::RTP_PAYLOAD_NV_STRING;
pub use self::constants::RTP_PAYLOAD_PCMA_STRING;
pub use self::constants::RTP_PAYLOAD_PCMU_STRING;
pub use self::constants::RTP_PAYLOAD_QCELP_STRING;
pub use self::constants::RTP_PAYLOAD_TS41_STRING;
pub use self::constants::RTP_PAYLOAD_TS48_STRING;
#[doc(hidden)]
pub mod traits {}

View file

@ -0,0 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 11e59a0)
from gir-files (https://github.com/gtk-rs/gir-files @ ???)

51
gstreamer-rtp/src/lib.rs Normal file
View file

@ -0,0 +1,51 @@
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate lazy_static;
#[allow(unused_imports)]
#[macro_use]
extern crate glib;
extern crate glib_sys;
extern crate gobject_sys;
extern crate gstreamer as gst;
extern crate gstreamer_rtp_sys as gst_rtp_sys;
extern crate gstreamer_sys as gst_sys;
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
};
}
macro_rules! skip_assert_initialized {
() => {};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
#[allow(clippy::unreadable_literal)]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)]
#[allow(non_snake_case)]
mod auto;
pub use auto::*;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts
pub mod prelude {
pub use glib::prelude::*;
pub use gst::prelude::*;
pub use auto::traits::*;
}