Add initial libgstsdp, libgstrtsp and libgstrtspserver bindings

Only automatic bindings for now, which is enough to allow
implementing a simple rtsp-server example.

Depends on https://github.com/sdroege/gstreamer-sys/pull/8

Uses a new gir feature proposed at
https://github.com/gtk-rs/gir/pull/539 to make doc regeneration
easier.

Fixes https://github.com/sdroege/gstreamer-rs/pull/80
This commit is contained in:
Mathieu Duponchelle 2018-02-09 03:30:08 +01:00 committed by Sebastian Dröge
parent 08dbde4c0e
commit a00243d529
63 changed files with 30931 additions and 0 deletions

View file

@ -7,6 +7,9 @@ members = [
"gstreamer-base", "gstreamer-base",
"gstreamer-net", "gstreamer-net",
"gstreamer-player", "gstreamer-player",
"gstreamer-rtsp",
"gstreamer-rtsp-server",
"gstreamer-sdp",
"gstreamer-video", "gstreamer-video",
"examples", "examples",
"tutorials", "tutorials",

67
Gir_GstRtsp.toml Normal file
View file

@ -0,0 +1,67 @@
[options]
girs_dir = "gir-files"
library = "GstRtsp"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-rtsp"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
doc_target_path = "docs/gstreamer-rtsp/docs.md"
external_libraries = [
"GLib",
"GObject",
"Gio",
"GstSdp"
]
generate = [
"GstRtsp.RTSPAuthMethod",
"GstRtsp.RTSPEvent",
"GstRtsp.RTSPFamily",
"GstRtsp.RTSPHeaderField",
"GstRtsp.RTSPLowerTrans",
"GstRtsp.RTSPMethod",
"GstRtsp.RTSPMsgType",
"GstRtsp.RTSPProfile",
"GstRtsp.RTSPRangeUnit",
"GstRtsp.RTSPResult",
"GstRtsp.RTSPState",
"GstRtsp.RTSPStatusCode",
"GstRtsp.RTSPTimeType",
"GstRtsp.RTSPTransMode"
]
manual = [
"GLib.MainContext",
]
[[object]]
name = "GstRtsp.RTSPUrl"
status = "generate"
concurrency = "send"
[[object.function]]
name = "get_port"
ignore = true
[[object]]
name = "GstRtsp.RTSPAuthParam"
status = "generate"
concurrency="send"
[[object]]
name = "Gst.ClockTime"
status = "manual"
conversion_type = "scalar"
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Structure"
status = "manual"
ref_mode = "ref-mut"

226
Gir_GstRtspServer.toml Normal file
View file

@ -0,0 +1,226 @@
[options]
girs_dir = "gir-files"
library = "GstRtspServer"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-rtsp-server"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
doc_target_path = "docs/gstreamer-rtsp-server/docs.md"
external_libraries = [
"GLib",
"GObject",
"Gio",
"Gst",
"GstNet",
"GstRtsp",
"GstSDP"
]
generate = [
"GstRtspServer.RTSPAddressFlags",
"GstRtspServer.RTSPAddressPoolResult",
"GstRtspServer.RTSPMediaFactory",
"GstRtspServer.RTSPMediaFactoryURI",
"GstRtspServer.RTSPMediaStatus",
"GstRtspServer.RTSPMountPoints",
"GstRtspServer.RTSPPublishClockMode",
"GstRtspServer.RTSPSession",
"GstRtspServer.RTSPSuspendMode",
"GstRtspServer.RTSPThreadPool",
"GstRtspServer.RTSPThreadType",
"GstRtspServer.RTSPTransportMode"
]
manual = [
"GLib.MainContext",
"GLib.IOCondition",
"GLib.Source",
"GLib.MainLoop",
"GLib.ThreadPool",
"GLib.Error",
"GObject.Object",
"Gio.TlsCertificateFlags",
"Gio.TlsCertificate",
"Gio.Socket",
"Gio.Cancellable",
"Gio.SocketFamily",
"Gst.Element",
"Gst.State",
"Gst.Clock",
"Gst.Pipeline",
"Gst.Pad",
"Gst.Bin",
"Gst.FlowReturn",
"GstRtsp.RTSPAuthMethod",
"GstRtsp.RTSPUrl",
"GstRtsp.RTSPResult",
"GstRtsp.RTSPStatusCode",
"GstRtsp.RTSPRangeUnit",
"GstRtsp.RTSPProfile",
"GstRtsp.RTSPLowerTrans"
]
[[object]]
name = "Gst.Message"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Structure"
status = "manual"
ref_mode = "ref-mut"
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.ClockTime"
status = "manual"
conversion_type = "scalar"
[[object]]
name = "GstRtspServer.RTSPServer"
status = "generate"
[[object.function]]
name = "attach"
ignore = true
[[object]]
name = "GstRtspServer.RTSPClient"
status = "generate"
[[object.function]]
name = "attach"
ignore = true
[[object]]
name = "GstRtspServer.RTSPStream"
status = "generate"
[[object.function]]
name = "query_position"
ignore = true
[[object.function]]
name = "query_stop"
ignore = true
[[object.function]]
name = "add_transport"
[object.function.return]
bool_return_is_error = "Failed to add transport"
[[object.function]]
name = "remove_transport"
[object.function.return]
bool_return_is_error = "Failed to remove transport"
[[object.function]]
name = "join_bin"
[object.function.return]
bool_return_is_error = "Failed to join bin"
[[object.function]]
name = "leave_bin"
[object.function.return]
bool_return_is_error = "Failed to leave bin"
[[object]]
name = "GstRtspServer.RTSPAddress"
status = "generate"
concurrency = "send"
[[object]]
name = "GstRtspServer.RTSPStreamTransport"
status = "generate"
concurrency = "none"
[[object.function]]
name = "send_rtcp"
[object.function.return]
bool_return_is_error = "Failed to send rtcp"
[[object.function]]
name = "send_rtp"
[object.function.return]
bool_return_is_error = "Failed to send rtp"
[[object.function]]
name = "set_active"
[object.function.return]
bool_return_is_error = "Failed to set active"
[[object]]
name = "GstRtspServer.RTSPAddressPool"
status = "generate"
[[object.function]]
name = "add_range"
[object.function.return]
bool_return_is_error = "Failed to add address range"
[[object.function]]
name = "reserve_address"
ignore = true
[[object]]
name = "GstRtspServer.RTSPMedia"
status = "generate"
[[object.function]]
name = "suspend"
[object.function.return]
bool_return_is_error = "Failed to suspend media"
[[object.function]]
name = "unprepare"
[object.function.return]
bool_return_is_error = "Failed to unprepare media"
[[object.function]]
name = "unsuspend"
[object.function.return]
bool_return_is_error = "Failed to unsuspend media"
[[object]]
name = "GstRtspServer.RTSPSessionMedia"
status = "generate"
[[object.function]]
name = "set_state"
[object.function.return]
bool_return_is_error = "Failed to set state of session media"
[[object]]
name = "GstRtspServer.RTSPSessionPool"
status = "generate"
[[object.function]]
name = "remove"
[object.function.return]
bool_return_is_error = "Failed to remove session from pool"
[[object.function]]
name = "create_watch"
# GSource return
ignore = true
[[object]]
name="GstRtspServer.RTSPAuth"
status="generate"
[[object.function]]
name = "make_basic"
[object.function.return]
nullable = false

40
Gir_GstSdp.toml Normal file
View file

@ -0,0 +1,40 @@
[options]
girs_dir = "gir-files"
library = "GstSdp"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-sdp"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
doc_target_path = "docs/gstreamer-sdp/docs.md"
external_libraries = [
"GLib",
"GObject",
"Gst",
]
generate = [
"GstSdp.MIKEYCacheType",
"GstSdp.MIKEYEncAlg",
"GstSdp.MIKEYKVType",
"GstSdp.MIKEYKeyDataType",
"GstSdp.MIKEYMacAlg",
"GstSdp.MIKEYMapType",
"GstSdp.MIKEYPRFFunc",
"GstSdp.MIKEYPayloadType",
"GstSdp.MIKEYSecProto",
"GstSdp.MIKEYSecSRTP",
"GstSdp.MIKEYTSType",
"GstSdp.MIKEYType",
"GstSdp.SDPResult"
]
manual = [
]
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"

File diff suppressed because it is too large Load diff

172
docs/gstreamer-rtsp/docs.md Normal file
View file

@ -0,0 +1,172 @@
<!-- file * -->
<!-- enum RTSPAuthMethod -->
Authentication methods, ordered by strength
<!-- enum RTSPAuthMethod::variant None -->
no authentication
<!-- enum RTSPAuthMethod::variant Basic -->
basic authentication
<!-- enum RTSPAuthMethod::variant Digest -->
digest authentication
<!-- struct RTSPAuthParam -->
<!-- enum RTSPFamily -->
The possible network families.
<!-- enum RTSPFamily::variant None -->
unknown network family
<!-- enum RTSPFamily::variant Inet -->
internet
<!-- enum RTSPFamily::variant Inet6 -->
internet V6
<!-- enum RTSPHeaderField -->
Enumeration of rtsp header fields
<!-- enum RTSPMsgType -->
The type of a message.
<!-- enum RTSPMsgType::variant Invalid -->
invalid message type
<!-- enum RTSPMsgType::variant Request -->
RTSP request message
<!-- enum RTSPMsgType::variant Response -->
RTSP response message
<!-- enum RTSPMsgType::variant HttpRequest -->
HTTP request message.
<!-- enum RTSPMsgType::variant HttpResponse -->
HTTP response message.
<!-- enum RTSPMsgType::variant Data -->
data message
<!-- enum RTSPRangeUnit -->
Different possible time range units.
<!-- enum RTSPRangeUnit::variant Smpte -->
SMPTE timecode
<!-- enum RTSPRangeUnit::variant Smpte30Drop -->
29.97 frames per second
<!-- enum RTSPRangeUnit::variant Smpte25 -->
25 frames per second
<!-- enum RTSPRangeUnit::variant Npt -->
Normal play time
<!-- enum RTSPRangeUnit::variant Clock -->
Absolute time expressed as ISO 8601 timestamps
<!-- enum RTSPResult -->
Result codes from the RTSP functions.
<!-- enum RTSPResult::variant Ok -->
no error
<!-- enum RTSPResult::variant Error -->
some unspecified error occured
<!-- enum RTSPResult::variant Einval -->
invalid arguments were provided to a function
<!-- enum RTSPResult::variant Eintr -->
an operation was canceled
<!-- enum RTSPResult::variant Enomem -->
no memory was available for the operation
<!-- enum RTSPResult::variant Eresolv -->
a host resolve error occured
<!-- enum RTSPResult::variant Enotimpl -->
function not implemented
<!-- enum RTSPResult::variant Esys -->
a system error occured, errno contains more details
<!-- enum RTSPResult::variant Eparse -->
a persing error occured
<!-- enum RTSPResult::variant Ewsastart -->
windows networking could not start
<!-- enum RTSPResult::variant Ewsaversion -->
windows networking stack has wrong version
<!-- enum RTSPResult::variant Eeof -->
end-of-file was reached
<!-- enum RTSPResult::variant Enet -->
a network problem occured, h_errno contains more details
<!-- enum RTSPResult::variant Enotip -->
the host is not an IP host
<!-- enum RTSPResult::variant Etimeout -->
a timeout occured
<!-- enum RTSPResult::variant Etget -->
the tunnel GET request has been performed
<!-- enum RTSPResult::variant Etpost -->
the tunnel POST request has been performed
<!-- enum RTSPResult::variant Elast -->
last error
<!-- enum RTSPState -->
The different RTSP states.
<!-- enum RTSPState::variant Invalid -->
invalid state
<!-- enum RTSPState::variant Init -->
initializing
<!-- enum RTSPState::variant Ready -->
ready for operation
<!-- enum RTSPState::variant Seeking -->
seeking in progress
<!-- enum RTSPState::variant Playing -->
playing
<!-- enum RTSPState::variant Recording -->
recording
<!-- enum RTSPStatusCode -->
Enumeration of rtsp status codes
<!-- enum RTSPTimeType -->
Possible time types.
<!-- enum RTSPTimeType::variant Seconds -->
seconds
<!-- enum RTSPTimeType::variant Now -->
now
<!-- enum RTSPTimeType::variant End -->
end
<!-- enum RTSPTimeType::variant Frames -->
frames and subframes
<!-- enum RTSPTimeType::variant Utc -->
UTC time
<!-- struct RTSPUrl -->
Provides helper functions to handle RTSP urls.
<!-- impl RTSPUrl::fn copy -->
Make a copy of `self`.
# Returns
a copy of `self`. Free with gst_rtsp_url_free () after usage.
<!-- impl RTSPUrl::fn decode_path_components -->
Splits the path of `self` on '/' boundaries, decoding the resulting components,
The decoding performed by this routine is "URI decoding", as defined in RFC
3986, commonly known as percent-decoding. For example, a string "foo\%2fbar"
will decode to "foo/bar" -- the \%2f being replaced by the corresponding byte
with hex value 0x2f. Note that there is no guarantee that the resulting byte
sequence is valid in any given encoding. As a special case, \%00 is not
unescaped to NUL, as that would prematurely terminate the string.
Also note that since paths usually start with a slash, the first component
will usually be the empty string.
# Returns
`None`-terminated array of URL components. Free with
`g_strfreev` when no longer needed.
<!-- impl RTSPUrl::fn free -->
Free the memory used by `self`.
<!-- impl RTSPUrl::fn get_port -->
Get the port number of `self`.
## `port`
location to hold the port
# Returns
`RTSPResult::Ok`.
<!-- impl RTSPUrl::fn get_request_uri -->
Get a newly allocated string describing the request URI for `self`.
# Returns
a string with the request URI. `g_free` after usage.
<!-- impl RTSPUrl::fn set_port -->
Set the port number in `self` to `port`.
## `port`
the port
# Returns
`RTSPResult::Ok`.
<!-- impl RTSPUrl::fn parse -->
Parse the RTSP `urlstr` into a newly allocated `RTSPUrl`. Free after usage
with `RTSPUrl::free`.
## `urlstr`
the url string to parse
## `url`
location to hold the result.
# Returns
a `RTSPResult`.

139
docs/gstreamer-sdp/docs.md Normal file
View file

@ -0,0 +1,139 @@
<!-- file * -->
<!-- enum MIKEYCacheType -->
The different cache types
<!-- enum MIKEYCacheType::variant None -->
The envelope key MUST NOT be cached
<!-- enum MIKEYCacheType::variant Always -->
The envelope key MUST be cached
<!-- enum MIKEYCacheType::variant ForCsb -->
The envelope key MUST be cached, but only
to be used for the specific CSB.
<!-- enum MIKEYEncAlg -->
The encryption algorithm used to encrypt the Encr data field
<!-- enum MIKEYEncAlg::variant Null -->
no encryption
<!-- enum MIKEYEncAlg::variant AesCm128 -->
AES-CM using a 128-bit key
<!-- enum MIKEYEncAlg::variant AesKw128 -->
AES Key Wrap using a 128-bit key
<!-- enum MIKEYKVType -->
The key validity type
<!-- enum MIKEYKVType::variant Null -->
No specific usage rule
<!-- enum MIKEYKVType::variant Spi -->
The key is associated with the SPI/MKI
<!-- enum MIKEYKVType::variant Interval -->
The key has a start and expiration time
<!-- enum MIKEYKeyDataType -->
The type of key.
<!-- enum MIKEYKeyDataType::variant Tgk -->
a TEK Generation Key
<!-- enum MIKEYKeyDataType::variant Tek -->
Traffic-Encrypting Key
<!-- enum MIKEYMacAlg -->
Specifies the authentication algorithm used
<!-- enum MIKEYMacAlg::variant Null -->
no authentication
<!-- enum MIKEYMacAlg::variant HmacSha1160 -->
HMAC-SHA-1-160
<!-- enum MIKEYMapType -->
Specifies the method of uniquely mapping Crypto Sessions to the security
protocol sessions.
<!-- enum MIKEYPRFFunc -->
The PRF function that has been/will be used for key derivation
<!-- enum MIKEYPRFFunc::variant MikeyPrfMikey1 -->
MIKEY-1 PRF function
<!-- enum MIKEYPayloadType -->
Different MIKEY Payload types.
<!-- enum MIKEYPayloadType::variant Last -->
Last payload
<!-- enum MIKEYPayloadType::variant Kemac -->
Key data transport payload
<!-- enum MIKEYPayloadType::variant Pke -->
Envelope data payload
<!-- enum MIKEYPayloadType::variant Dh -->
DH data payload
<!-- enum MIKEYPayloadType::variant Sign -->
Signature payload
<!-- enum MIKEYPayloadType::variant T -->
Timestamp payload
<!-- enum MIKEYPayloadType::variant Id -->
ID payload
<!-- enum MIKEYPayloadType::variant Cert -->
Certificate Payload
<!-- enum MIKEYPayloadType::variant Chash -->
Cert hash payload
<!-- enum MIKEYPayloadType::variant V -->
Verfication message payload
<!-- enum MIKEYPayloadType::variant Sp -->
Security Policy payload
<!-- enum MIKEYPayloadType::variant Rand -->
RAND payload
<!-- enum MIKEYPayloadType::variant Err -->
Error payload
<!-- enum MIKEYPayloadType::variant KeyData -->
Key data sub-payload
<!-- enum MIKEYPayloadType::variant GenExt -->
General Extension Payload
<!-- enum MIKEYSecProto -->
Specifies the security protocol
<!-- enum MIKEYSecSRTP -->
This policy specifies the parameters for SRTP and SRTCP
<!-- enum MIKEYSecSRTP::variant EncAlg -->
Encryption algorithm
<!-- enum MIKEYSecSRTP::variant EncKeyLen -->
Session Encr. key length
<!-- enum MIKEYSecSRTP::variant AuthAlg -->
Authentication algorithm
<!-- enum MIKEYSecSRTP::variant AuthKeyLen -->
Session Auth. key length
<!-- enum MIKEYSecSRTP::variant SaltKeyLen -->
Session Salt key length
<!-- enum MIKEYSecSRTP::variant Prf -->
SRTP Pseudo Random Function
<!-- enum MIKEYSecSRTP::variant KeyDerivRate -->
Key derivation rate
<!-- enum MIKEYSecSRTP::variant SrtpEnc -->
SRTP encryption off/on, 0 if off, 1 if on
<!-- enum MIKEYSecSRTP::variant SrtcpEnc -->
SRTCP encryption off/on, 0 if off, 1 if on
<!-- enum MIKEYSecSRTP::variant FecOrder -->
sender's FEC order
<!-- enum MIKEYSecSRTP::variant SrtpAuth -->
SRTP authentication off/on, 0 if off, 1 if on
<!-- enum MIKEYSecSRTP::variant AuthTagLen -->
Authentication tag length
<!-- enum MIKEYSecSRTP::variant SrtpPrefixLen -->
SRTP prefix length
<!-- enum MIKEYTSType -->
Specifies the timestamp type.
<!-- enum MIKEYTSType::variant NtpUtc -->
an NTP time in UTC timezone
<!-- enum MIKEYTSType::variant Ntp -->
an NTP time
<!-- enum MIKEYTSType::variant Counter -->
a counter
<!-- enum MIKEYType -->
Different MIKEY data types.
<!-- enum MIKEYType::variant Invalid -->
Invalid type
<!-- enum MIKEYType::variant PskInit -->
Initiator's pre-shared key message
<!-- enum MIKEYType::variant PskVerify -->
Verification message of a Pre-shared key message
<!-- enum MIKEYType::variant PkInit -->
Initiator's public-key transport message
<!-- enum MIKEYType::variant PkVerify -->
Verification message of a public-key message
<!-- enum MIKEYType::variant DhInit -->
Initiator's DH exchange message
<!-- enum MIKEYType::variant DhResp -->
Responder's DH exchange message
<!-- enum MIKEYType::variant Error -->
Error message
<!-- enum SDPResult -->
Return values for the SDP functions.
<!-- enum SDPResult::variant Ok -->
A successful return value
<!-- enum SDPResult::variant Einval -->
a function was given invalid parameters

View file

@ -10,6 +10,7 @@ gstreamer-app = { path = "../gstreamer-app" }
gstreamer-audio = { path = "../gstreamer-audio" } gstreamer-audio = { path = "../gstreamer-audio" }
gstreamer-video = { path = "../gstreamer-video" } gstreamer-video = { path = "../gstreamer-video" }
gstreamer-player = { path = "../gstreamer-player", optional = true } gstreamer-player = { path = "../gstreamer-player", optional = true }
gstreamer-rtsp-server = { path = "../gstreamer-rtsp-server", optional = true }
gtk = { git = "https://github.com/gtk-rs/gtk", features = ["v3_6"], optional = true } gtk = { git = "https://github.com/gtk-rs/gtk", features = ["v3_6"], optional = true }
gdk = { git = "https://github.com/gtk-rs/gdk", optional = true } gdk = { git = "https://github.com/gtk-rs/gdk", optional = true }
gio = { git = "https://github.com/gtk-rs/gio", optional = true } gio = { git = "https://github.com/gtk-rs/gio", optional = true }
@ -27,6 +28,7 @@ gtkvideooverlay = ["gtk", "gdk", "gio"]
gtkvideooverlay-x11 = ["gtkvideooverlay"] gtkvideooverlay-x11 = ["gtkvideooverlay"]
gtkvideooverlay-quartz = ["gtkvideooverlay"] gtkvideooverlay-quartz = ["gtkvideooverlay"]
tokio = ["gstreamer/futures", "futures", "tokio-core"] tokio = ["gstreamer/futures", "futures", "tokio-core"]
gst-rtsp-server = ["gstreamer-rtsp-server"]
default-features = [] default-features = []
v1_10 = ["gstreamer/v1_10"] v1_10 = ["gstreamer/v1_10"]

View file

@ -0,0 +1,78 @@
#[cfg(feature = "gst-rtsp-server")]
use std::env;
extern crate gstreamer as gst;
#[cfg(feature = "gst-rtsp-server")]
extern crate gstreamer_rtsp_server as gst_rtsp_server;
#[cfg(feature = "gst-rtsp-server")]
use gst_rtsp_server::prelude::*;
extern crate glib;
extern crate failure;
use failure::Error;
#[cfg(feature = "gst-rtsp-server")]
#[macro_use]
extern crate failure_derive;
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Fail)]
#[fail(display = "Could not get mount points")]
#[cfg(feature = "gst-rtsp-server")]
struct NoMountPoints;
#[derive(Debug, Fail)]
#[fail(display = "Usage: {} LAUNCH_LINE", _0)]
#[cfg(feature = "gst-rtsp-server")]
struct UsageError(String);
#[cfg(feature = "gst-rtsp-server")]
fn main_loop() -> Result<(), Error> {
let args: Vec<_> = env::args().collect();
if args.len() != 2 {
return Err(Error::from(UsageError(args[0].clone())));
}
let main_loop = glib::MainLoop::new(None, false);
let server = gst_rtsp_server::RTSPServer::new();
let factory = gst_rtsp_server::RTSPMediaFactory::new();
let mounts = server.get_mount_points().ok_or(NoMountPoints)?;
factory.set_launch(args[1].as_str());
factory.set_shared(true);
mounts.add_factory("/test", &factory);
server.attach(None);
println!("Stream ready at rtsp://127.0.0.1:{}/test", server.get_bound_port());
main_loop.run();
Ok(())
}
fn example_main() -> Result<(), Error> {
gst::init()?;
#[cfg(not(feature = "gst-rtsp-server"))]
{
eprintln!("Feature gst-rtsp-server is required. Please rebuild with --features gst-rtsp-server");
std::process::exit(-1)
}
#[cfg(feature = "gst-rtsp-server")]
main_loop()
}
fn main() {
match examples_common::run(example_main) {
Ok(r) => r,
Err(e) => eprintln!("Error! {}", e),
}
}

5018
gir-files/GstRtsp-1.0.gir Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

4309
gir-files/GstSdp-1.0.gir Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,218 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.10.1] - 2018-01-03
### Fixed
- Don't require &mut self for TagSetterExtManual::add()
### Added
- A TagSetter example application
- Bindings for gst_video::convert_sample() and ::convert_sample_async()
- Bindings for gst_video::VideoRectangle
- Debug impl for Sample and ::with_buffer_list() constructor
- A borrowing version of VideoFrame: VideoFrameRef
- Bindings for GstVideoFilter
### Changed
- Deprecated Sample::get_info() in favour of ::get_structure()
- Player has gst::Object as another parent class now
## [0.10.0] - 2017-12-22
### Fixed
- Various clippy warnings
- Memory leak of the tag list in Toc::merge_tags()
- Property getters use Values of the correct type
- Event::get_structure(), Message::get_structure() and
Query::get_structure() can return None for the structure
- Various other nullability fixes all over the API, changing functions to
accept Option<> or returning Option<>, or only plain types
- Functions taking paths/filenames now actually take Paths instead of &strs
- Element::remove_pad() is not giving away a new reference to the pad
anymore, which caused a memory leak of all pads ever removed
- Precision handling in ClockTime's Display impl
- Video/AudioInfo are only Send, not Sync
### Added
- Various enums now also derive useful traits like Copy, Clone and Hash in
addition to PartialEq, Eq and Debug
- TagList::merge() and insert() for combining tag lists
- EventType gained many useful functions to work with event types and
a PartialOrd impl to check expected event order of event types where it matters
- MessageRef/EventRef/QueryRef implement ToOwned
- Bindings for Registry and PluginFeature
- Event::set_running_time_offset() for adjusting the offset while events
pass through the pipeline
- Event/Message GroupIds and Seqnums now have a newtype wrapper around u32
instead of the plain value, making usage of them slightly more typesafe.
Also add an "invalid" value for both, as exists in latest GStreamer now.
- FormattedValue, GenericFormattedValue and related types were
implemented now, which allows more convenient and type-safe usage of
formatted values (time, bytes, etc)
- Bindings for force-keyunit and still-frame events were added
- MappedBuffer/BufferMap now implement various other useful traits, including
AsRef<[u8]>, AsMut, Deref, DerefMut, Debug, PartialEq and Eq
- Add VideoMultiviewFramePacking enum, and use it in Player
- Bindings for the GStreamer Net library, including PTP/NTP/network client
clocks and the GStreamer NetClock provider for network synchronization of
pipelines
- IteratorError implements std::error:Error
- Plugin::add_dependency() and ::add_dependency_simple() was added
- Rank and TypeFindProbability implement PartialOrd/Ord now
- Bindings for TypeFind, TypeFindFactory and the typefind helpers
- StreamCollection::iter() for iterating over all contained streams
- ErrorMessage type that can be used e.g. in a Result for passing an error
message from somewhere to upper layers to then be posted on an element the
same way gst_element_error!() would've done
### Changed
- Sample::new(), TagList::add(), Structure::set() and similar
functions take the values (ToSendValue impls) by reference instead of value.
They were not consumed by the function before.
- The Debug impls of various types, including Event/Buffer/Message/Query/Structure
were improved to print all the fields, similar to what GST_PTR_FORMAT would
do in C
- Switched to lazy_static 1.0
- Gap event and Duration tag are using ClockTimes now, as well as various
Player signals
- Segment is now based on a generic type FormattedSegment that can
take any format (time, bytes, etc) or a GenericFormattedValue for more
type-safety and convenience. Also functions for "casting" between a generic
segment and a segment with a specific format exist on this now
- AppSrc and AppSink now have a builder for the callbacks, making it
unnecessary to always provide all callbacks even if only one is actually
needed
- Various functions that returned bool for errors, are now returning a Result
- Player configuration is now a custom type with more convenient API
- Player VideoInfo uses a Fraction instead of (u32,u32) for the framerate and
pixel-aspect-ratio
- VideoFrame API has more consistent API between writable and read-only
variants
- Buffer::copy_into() was added, and ::copy_region() now takes a
BufferCopyFlags parameter instead of always using the default flags
- ChildProxy::set_child_property() takes a &ToValue now to follow the API of
Object::set_property() and improve usability
- Proxy/GhostPad default pad functions use the correct specific pad type now
instead of a generic Pad
- Bus::add_signal_watch_full() takes a Priority for the priority instead of u32
- Clock::(un)adjust_with_calibration() takes no clock parameter anymore
### Removed
- FormatValue was removed in favour of GenericFormattedValue and the
connected traits and specific format impls
## [0.9.1] - 2017-11-26
### Fixed
- Export `FlowError`/`FlowSuccess`, `ClockError`/`ClockSuccess`,
`PadLinkError`/`PadLinkSuccess` too
## [0.9.0] - 2017-11-26
### Added
- Bindings for (outputting to) the GStreamer logging system
- Bindings for the GStreamer base library
- Bindings for all the `Pad` functions to override pad behaviour, and pad task
functions
- Bindings for `StaticCaps` and `StaticPadTemplate`
- Bindings for `deep-notify` signal on `Object`
- Support for directly creating `Error`/`Warning`/`Info` `Messages` and posting them
from an element with context information (file, line, module, etc.) similar
to the C `GST_ELEMENT_ERROR` macro
- Support for setting custom fields in `Messages`/`Events` during construction
- Support for creating Buffers out of anything that is `AsRef<[u8]>` or
`AsMut<[u8]>`
- Support for using the `Read` trait on `Adapter`
- Functions for getting all sink/src/all pads of an `Element`, and all children
of a `Bin`
- Builder for `Caps` and `Structures` in addition to the existing functions
- `AppSrc`/`AppSink` implement `BaseSrc`/`BaseSink` and `URIHandler`
- Rust ports of the basic tutorials 1 to 8 from
https://gstreamer.freedesktop.org/documentation/tutorials/
- "Getting started" and "Installation" sections to the README.md
- "dox" feature for generating documentation for all available configurations
### Fixed
- `StackTraceFlags` are only available since 1.12
- Worked around macOS requiring a `NSRunLoop` running on the main thread in all
examples and tutorials, to be able to show a window or anything else
### Changed
- `ClockTime` is now a wrapper around `Option<u64>` to handle the
`CLOCK_TIME_NONE` case better. This wrapper implements all the arithmetic
and other traits as needed and ensures that no accidential calculations with
`CLOCK_TIME_NONE` can happen
- "Values with format", like in `Duration`/`Position`/`Convert` queries or
`Seek` events now return a `FormatValue` type. This contains the actual
`Format` together with the value and does any required conversions. This
also makes it harder to accidentially mix e.g. values in bytes and time
- `PadProbeId` does not implement `Clone`/`Copy` anymore
- Property notify watches return a custom type instead of ulong
- `Error`/`Warning`/`Info` `Messages` can only be created with specific kinds of
`glib::Error` now. Using arbitrary ones does not work
- `Iterator` bindings were completely rewritten and provide the item type as a
generic type parameter now, greatly simplifying its usage
- All `glib::Values` are now `glib::SendValue` instead, e.g. in `Caps` and
`Structures`, as their content must be possible to send to different threads
safely
- `Message::get_src()` can return `None`
- Allow `None` as `Caps` in `AppSrc`/`AppSink`
- Allow everything implementing `Into<Option<&str>>` to be used as a pad name
- Moved `copy()` from `GstRc` directly to `MiniObject`
- Success/Error enums (like `FlowReturn`, `PadLinkReturn`, `StateChangeReturn`) now
implement an `into_result()` function that splits them into a `Result` with
the good and bad cases. Also mark them as `#[must_use]` to make it harder to
accidentially ignore errors.
- Error enums implement the `Error` trait
- Many examples use the `failure` crate for error handling now, cleaning up the
error handling code quite a bit
- Lots of other code cleanup, compiler/clippy warning cleanup, etc.
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.10.1...HEAD
[0.10.1]: https://github.com/sdroege/gstreamer-rs/compare/0.10.0...0.10.1
[0.10.0]: https://github.com/sdroege/gstreamer-rs/compare/0.9.1...0.10.0
[0.9.1]: https://github.com/sdroege/gstreamer-rs/compare/0.9.0...0.9.1
[0.9.0]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...0.9.0
[0.8.2]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...0.8.2
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

View file

@ -0,0 +1,44 @@
[package]
name = "gstreamer-rtsp-server"
version = "0.11.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>", "Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer RTSP Server library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_rtsp_server"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gio-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-rtsp-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-rtsp-server-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-net-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { git = "https://github.com/gtk-rs/glib" }
gio = { git = "https://github.com/gtk-rs/gio" }
gstreamer = { path = "../gstreamer" }
gstreamer-rtsp = { path = "../gstreamer-rtsp" }
gstreamer-net = { path = "../gstreamer-net" }
[build-dependencies.rustdoc-stripper]
version = "0.1"
optional = true
[features]
v1_10 = ["gstreamer-sys/v1_10", "gstreamer-rtsp-sys/v1_10", "gstreamer-net-sys/v1_10", "gstreamer-rtsp-server-sys/v1_10"]
v1_12 = ["gstreamer-sys/v1_12", "gstreamer-rtsp-sys/v1_12", "gstreamer-net-sys/v1_12", "gstreamer-rtsp-server-sys/v1_12", "v1_10"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
dox = ["gstreamer-rtsp-server-sys/dox", "glib/dox", "gstreamer/dox"]
default-features = []
[badges]
travis-ci = { repository = "sdroege/gstreamer-rs", branch = "master" }

View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-rtsp-server.svg)](https://crates.io/crates/gstreamer-rtsp-server) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (Rtsp Server library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## Table of Contents
1. [Installation](#installation)
1. [Linux/BSDs](#installation-linux)
1. [macOS](#installation-macos)
1. [Windows](#installation-windows)
1. [Getting Started](#getting-started)
1. [License](#license)
1. [Contribution](#contribution)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 installed. In addition,
some of the examples/tutorials require various GStreamer plugins to be
available, which can be found in gst-plugins-base, gst-plugins-good,
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
<a name="installation-linux"/>
### Linux/BSDs
You need to install the above mentioned packages with your distributions
package manager, or build them from source.
On Debian/Ubuntu they can be installed with
```
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### macOS
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
#### MSYS2 / pacman
```
$ pacman -S pkg-config mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/), however it is
only the Rust API reference and does not explain any of the concepts.
For getting started with GStreamer development, the best would be to follow
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
GStreamer website, especially the [Application Development
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
While being C-centric, it explains all the fundamental concepts of GStreamer
and the code examples should be relatively easily translatable to Rust. The
API is basically the same, function/struct names are the same and everything
is only more convenient (hopefully) and safer.
In addition there are
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
GStreamer website. Many of them were ported to Rust already and the code can
be found in the
[tutorials](https://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

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-rtsp-server/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,254 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use gobject_ffi;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum RTSPAddressPoolResult {
Ok,
Einval,
Ereserved,
Erange,
Elast,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTSPAddressPoolResult {
type GlibType = ffi::GstRTSPAddressPoolResult;
fn to_glib(&self) -> ffi::GstRTSPAddressPoolResult {
match *self {
RTSPAddressPoolResult::Ok => ffi::GST_RTSP_ADDRESS_POOL_OK,
RTSPAddressPoolResult::Einval => ffi::GST_RTSP_ADDRESS_POOL_EINVAL,
RTSPAddressPoolResult::Ereserved => ffi::GST_RTSP_ADDRESS_POOL_ERESERVED,
RTSPAddressPoolResult::Erange => ffi::GST_RTSP_ADDRESS_POOL_ERANGE,
RTSPAddressPoolResult::Elast => ffi::GST_RTSP_ADDRESS_POOL_ELAST,
RTSPAddressPoolResult::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPAddressPoolResult> for RTSPAddressPoolResult {
fn from_glib(value: ffi::GstRTSPAddressPoolResult) -> Self {
skip_assert_initialized!();
match value {
0 => RTSPAddressPoolResult::Ok,
-1 => RTSPAddressPoolResult::Einval,
-2 => RTSPAddressPoolResult::Ereserved,
-3 => RTSPAddressPoolResult::Erange,
-4 => RTSPAddressPoolResult::Elast,
value => RTSPAddressPoolResult::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum RTSPMediaStatus {
Unprepared,
Unpreparing,
Preparing,
Prepared,
Suspended,
Error,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTSPMediaStatus {
type GlibType = ffi::GstRTSPMediaStatus;
fn to_glib(&self) -> ffi::GstRTSPMediaStatus {
match *self {
RTSPMediaStatus::Unprepared => ffi::GST_RTSP_MEDIA_STATUS_UNPREPARED,
RTSPMediaStatus::Unpreparing => ffi::GST_RTSP_MEDIA_STATUS_UNPREPARING,
RTSPMediaStatus::Preparing => ffi::GST_RTSP_MEDIA_STATUS_PREPARING,
RTSPMediaStatus::Prepared => ffi::GST_RTSP_MEDIA_STATUS_PREPARED,
RTSPMediaStatus::Suspended => ffi::GST_RTSP_MEDIA_STATUS_SUSPENDED,
RTSPMediaStatus::Error => ffi::GST_RTSP_MEDIA_STATUS_ERROR,
RTSPMediaStatus::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPMediaStatus> for RTSPMediaStatus {
fn from_glib(value: ffi::GstRTSPMediaStatus) -> Self {
skip_assert_initialized!();
match value {
0 => RTSPMediaStatus::Unprepared,
1 => RTSPMediaStatus::Unpreparing,
2 => RTSPMediaStatus::Preparing,
3 => RTSPMediaStatus::Prepared,
4 => RTSPMediaStatus::Suspended,
5 => RTSPMediaStatus::Error,
value => RTSPMediaStatus::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum RTSPPublishClockMode {
None,
Clock,
ClockAndOffset,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTSPPublishClockMode {
type GlibType = ffi::GstRTSPPublishClockMode;
fn to_glib(&self) -> ffi::GstRTSPPublishClockMode {
match *self {
RTSPPublishClockMode::None => ffi::GST_RTSP_PUBLISH_CLOCK_MODE_NONE,
RTSPPublishClockMode::Clock => ffi::GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK,
RTSPPublishClockMode::ClockAndOffset => ffi::GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET,
RTSPPublishClockMode::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPPublishClockMode> for RTSPPublishClockMode {
fn from_glib(value: ffi::GstRTSPPublishClockMode) -> Self {
skip_assert_initialized!();
match value {
0 => RTSPPublishClockMode::None,
1 => RTSPPublishClockMode::Clock,
2 => RTSPPublishClockMode::ClockAndOffset,
value => RTSPPublishClockMode::__Unknown(value),
}
}
}
impl StaticType for RTSPPublishClockMode {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_publish_clock_mode_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPPublishClockMode {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPPublishClockMode {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for RTSPPublishClockMode {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum RTSPSuspendMode {
None,
Pause,
Reset,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTSPSuspendMode {
type GlibType = ffi::GstRTSPSuspendMode;
fn to_glib(&self) -> ffi::GstRTSPSuspendMode {
match *self {
RTSPSuspendMode::None => ffi::GST_RTSP_SUSPEND_MODE_NONE,
RTSPSuspendMode::Pause => ffi::GST_RTSP_SUSPEND_MODE_PAUSE,
RTSPSuspendMode::Reset => ffi::GST_RTSP_SUSPEND_MODE_RESET,
RTSPSuspendMode::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPSuspendMode> for RTSPSuspendMode {
fn from_glib(value: ffi::GstRTSPSuspendMode) -> Self {
skip_assert_initialized!();
match value {
0 => RTSPSuspendMode::None,
1 => RTSPSuspendMode::Pause,
2 => RTSPSuspendMode::Reset,
value => RTSPSuspendMode::__Unknown(value),
}
}
}
impl StaticType for RTSPSuspendMode {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_suspend_mode_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPSuspendMode {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPSuspendMode {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for RTSPSuspendMode {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum RTSPThreadType {
Client,
Media,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RTSPThreadType {
type GlibType = ffi::GstRTSPThreadType;
fn to_glib(&self) -> ffi::GstRTSPThreadType {
match *self {
RTSPThreadType::Client => ffi::GST_RTSP_THREAD_TYPE_CLIENT,
RTSPThreadType::Media => ffi::GST_RTSP_THREAD_TYPE_MEDIA,
RTSPThreadType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPThreadType> for RTSPThreadType {
fn from_glib(value: ffi::GstRTSPThreadType) -> Self {
skip_assert_initialized!();
match value {
0 => RTSPThreadType::Client,
1 => RTSPThreadType::Media,
value => RTSPThreadType::__Unknown(value),
}
}
}

View file

@ -0,0 +1,90 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use gobject_ffi;
bitflags! {
pub struct RTSPAddressFlags: u32 {
const NONE = 0;
const IPV4 = 1;
const IPV6 = 2;
const EVEN_PORT = 4;
const MULTICAST = 8;
const UNICAST = 16;
}
}
#[doc(hidden)]
impl ToGlib for RTSPAddressFlags {
type GlibType = ffi::GstRTSPAddressFlags;
fn to_glib(&self) -> ffi::GstRTSPAddressFlags {
ffi::GstRTSPAddressFlags::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPAddressFlags> for RTSPAddressFlags {
fn from_glib(value: ffi::GstRTSPAddressFlags) -> RTSPAddressFlags {
skip_assert_initialized!();
RTSPAddressFlags::from_bits_truncate(value.bits())
}
}
bitflags! {
pub struct RTSPTransportMode: u32 {
const PLAY = 1;
const RECORD = 2;
}
}
#[doc(hidden)]
impl ToGlib for RTSPTransportMode {
type GlibType = ffi::GstRTSPTransportMode;
fn to_glib(&self) -> ffi::GstRTSPTransportMode {
ffi::GstRTSPTransportMode::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPTransportMode> for RTSPTransportMode {
fn from_glib(value: ffi::GstRTSPTransportMode) -> RTSPTransportMode {
skip_assert_initialized!();
RTSPTransportMode::from_bits_truncate(value.bits())
}
}
impl StaticType for RTSPTransportMode {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_transport_mode_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPTransportMode {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPTransportMode {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstRTSPTransportMode::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for RTSPTransportMode {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}

View file

@ -0,0 +1,91 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
mod r_t_s_p_address_pool;
pub use self::r_t_s_p_address_pool::RTSPAddressPool;
pub use self::r_t_s_p_address_pool::RTSPAddressPoolExt;
mod r_t_s_p_auth;
pub use self::r_t_s_p_auth::RTSPAuth;
pub use self::r_t_s_p_auth::RTSPAuthExt;
mod r_t_s_p_client;
pub use self::r_t_s_p_client::RTSPClient;
pub use self::r_t_s_p_client::RTSPClientExt;
mod r_t_s_p_media;
pub use self::r_t_s_p_media::RTSPMedia;
pub use self::r_t_s_p_media::RTSPMediaExt;
mod r_t_s_p_media_factory;
pub use self::r_t_s_p_media_factory::RTSPMediaFactory;
pub use self::r_t_s_p_media_factory::RTSPMediaFactoryExt;
mod r_t_s_p_media_factory_u_r_i;
pub use self::r_t_s_p_media_factory_u_r_i::RTSPMediaFactoryURI;
pub use self::r_t_s_p_media_factory_u_r_i::RTSPMediaFactoryURIExt;
mod r_t_s_p_mount_points;
pub use self::r_t_s_p_mount_points::RTSPMountPoints;
pub use self::r_t_s_p_mount_points::RTSPMountPointsExt;
mod r_t_s_p_server;
pub use self::r_t_s_p_server::RTSPServer;
pub use self::r_t_s_p_server::RTSPServerExt;
mod r_t_s_p_session;
pub use self::r_t_s_p_session::RTSPSession;
pub use self::r_t_s_p_session::RTSPSessionExt;
mod r_t_s_p_session_media;
pub use self::r_t_s_p_session_media::RTSPSessionMedia;
pub use self::r_t_s_p_session_media::RTSPSessionMediaExt;
mod r_t_s_p_session_pool;
pub use self::r_t_s_p_session_pool::RTSPSessionPool;
pub use self::r_t_s_p_session_pool::RTSPSessionPoolExt;
mod r_t_s_p_stream;
pub use self::r_t_s_p_stream::RTSPStream;
pub use self::r_t_s_p_stream::RTSPStreamExt;
mod r_t_s_p_stream_transport;
pub use self::r_t_s_p_stream_transport::RTSPStreamTransport;
pub use self::r_t_s_p_stream_transport::RTSPStreamTransportExt;
mod r_t_s_p_thread_pool;
pub use self::r_t_s_p_thread_pool::RTSPThreadPool;
pub use self::r_t_s_p_thread_pool::RTSPThreadPoolExt;
mod r_t_s_p_address;
pub use self::r_t_s_p_address::RTSPAddress;
mod enums;
pub use self::enums::RTSPAddressPoolResult;
pub use self::enums::RTSPMediaStatus;
pub use self::enums::RTSPPublishClockMode;
pub use self::enums::RTSPSuspendMode;
pub use self::enums::RTSPThreadType;
mod flags;
pub use self::flags::RTSPAddressFlags;
pub use self::flags::RTSPTransportMode;
#[doc(hidden)]
pub mod traits {
pub use super::RTSPAddressPoolExt;
pub use super::RTSPAuthExt;
pub use super::RTSPClientExt;
pub use super::RTSPMediaExt;
pub use super::RTSPMediaFactoryExt;
pub use super::RTSPMediaFactoryURIExt;
pub use super::RTSPMountPointsExt;
pub use super::RTSPServerExt;
pub use super::RTSPSessionExt;
pub use super::RTSPSessionMediaExt;
pub use super::RTSPSessionPoolExt;
pub use super::RTSPStreamExt;
pub use super::RTSPStreamTransportExt;
pub use super::RTSPThreadPoolExt;
}

View file

@ -0,0 +1,22 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPAddress(Boxed<ffi::GstRTSPAddress>);
match fn {
copy => |ptr| ffi::gst_rtsp_address_copy(mut_override(ptr)),
free => |ptr| ffi::gst_rtsp_address_free(ptr),
get_type => || ffi::gst_rtsp_address_get_type(),
}
}
unsafe impl Send for RTSPAddress {}

View file

@ -0,0 +1,84 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPAddress;
use RTSPAddressFlags;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPAddressPool(Object<ffi::GstRTSPAddressPool, ffi::GstRTSPAddressPoolClass>);
match fn {
get_type => || ffi::gst_rtsp_address_pool_get_type(),
}
}
impl RTSPAddressPool {
pub fn new() -> RTSPAddressPool {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_address_pool_new())
}
}
}
impl Default for RTSPAddressPool {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPAddressPool {}
unsafe impl Sync for RTSPAddressPool {}
pub trait RTSPAddressPoolExt {
fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option<RTSPAddress>;
fn add_range(&self, min_address: &str, max_address: &str, min_port: u16, max_port: u16, ttl: u8) -> Result<(), glib::error::BoolError>;
fn clear(&self);
fn dump(&self);
fn has_unicast_addresses(&self) -> bool;
}
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExt for O {
fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option<RTSPAddress> {
unsafe {
from_glib_full(ffi::gst_rtsp_address_pool_acquire_address(self.to_glib_none().0, flags.to_glib(), n_ports))
}
}
fn add_range(&self, min_address: &str, max_address: &str, min_port: u16, max_port: u16, ttl: u8) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_address_pool_add_range(self.to_glib_none().0, min_address.to_glib_none().0, max_address.to_glib_none().0, min_port, max_port, ttl), "Failed to add address range")
}
}
fn clear(&self) {
unsafe {
ffi::gst_rtsp_address_pool_clear(self.to_glib_none().0);
}
}
fn dump(&self) {
unsafe {
ffi::gst_rtsp_address_pool_dump(self.to_glib_none().0);
}
}
fn has_unicast_addresses(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_address_pool_has_unicast_addresses(self.to_glib_none().0))
}
}
}

View file

@ -0,0 +1,170 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use gio;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
#[cfg(any(feature = "v1_12", feature = "dox"))]
use gst_rtsp;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPAuth(Object<ffi::GstRTSPAuth, ffi::GstRTSPAuthClass>);
match fn {
get_type => || ffi::gst_rtsp_auth_get_type(),
}
}
impl RTSPAuth {
pub fn new() -> RTSPAuth {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_auth_new())
}
}
pub fn check(check: &str) -> bool {
assert_initialized_main_thread!();
unsafe {
from_glib(ffi::gst_rtsp_auth_check(check.to_glib_none().0))
}
}
pub fn make_basic(user: &str, pass: &str) -> String {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_auth_make_basic(user.to_glib_none().0, pass.to_glib_none().0))
}
}
}
impl Default for RTSPAuth {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPAuth {}
unsafe impl Sync for RTSPAuth {}
pub trait RTSPAuthExt {
//fn add_basic(&self, basic: &str, token: /*Ignored*/&mut RTSPToken);
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn add_digest(&self, user: &str, pass: &str, token: /*Ignored*/&mut RTSPToken);
//fn get_default_token(&self) -> /*Ignored*/Option<RTSPToken>;
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn get_supported_methods(&self) -> gst_rtsp::RTSPAuthMethod;
//fn get_tls_authentication_mode(&self) -> /*Ignored*/gio::TlsAuthenticationMode;
fn get_tls_certificate(&self) -> Option<gio::TlsCertificate>;
//fn get_tls_database(&self) -> /*Ignored*/Option<gio::TlsDatabase>;
fn remove_basic(&self, basic: &str);
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn remove_digest(&self, user: &str);
//fn set_default_token<'a, P: Into<Option<&'a /*Ignored*/RTSPToken>>>(&self, token: P);
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn set_supported_methods(&self, methods: gst_rtsp::RTSPAuthMethod);
//fn set_tls_authentication_mode<'a, P: Into<Option<&'a /*Ignored*/gio::TlsAuthenticationMode>>>(&self, mode: P);
fn set_tls_certificate<'a, P: Into<Option<&'a gio::TlsCertificate>>>(&self, cert: P);
//fn set_tls_database<'a, P: IsA</*Ignored*/gio::TlsDatabase> + 'a, Q: Into<Option<&'a P>>>(&self, database: Q);
//fn connect_accept_certificate<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPAuth>> RTSPAuthExt for O {
//fn add_basic(&self, basic: &str, token: /*Ignored*/&mut RTSPToken) {
// unsafe { TODO: call ffi::gst_rtsp_auth_add_basic() }
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn add_digest(&self, user: &str, pass: &str, token: /*Ignored*/&mut RTSPToken) {
// unsafe { TODO: call ffi::gst_rtsp_auth_add_digest() }
//}
//fn get_default_token(&self) -> /*Ignored*/Option<RTSPToken> {
// unsafe { TODO: call ffi::gst_rtsp_auth_get_default_token() }
//}
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn get_supported_methods(&self) -> gst_rtsp::RTSPAuthMethod {
unsafe {
from_glib(ffi::gst_rtsp_auth_get_supported_methods(self.to_glib_none().0))
}
}
//fn get_tls_authentication_mode(&self) -> /*Ignored*/gio::TlsAuthenticationMode {
// unsafe { TODO: call ffi::gst_rtsp_auth_get_tls_authentication_mode() }
//}
fn get_tls_certificate(&self) -> Option<gio::TlsCertificate> {
unsafe {
from_glib_full(ffi::gst_rtsp_auth_get_tls_certificate(self.to_glib_none().0))
}
}
//fn get_tls_database(&self) -> /*Ignored*/Option<gio::TlsDatabase> {
// unsafe { TODO: call ffi::gst_rtsp_auth_get_tls_database() }
//}
fn remove_basic(&self, basic: &str) {
unsafe {
ffi::gst_rtsp_auth_remove_basic(self.to_glib_none().0, basic.to_glib_none().0);
}
}
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn remove_digest(&self, user: &str) {
unsafe {
ffi::gst_rtsp_auth_remove_digest(self.to_glib_none().0, user.to_glib_none().0);
}
}
//fn set_default_token<'a, P: Into<Option<&'a /*Ignored*/RTSPToken>>>(&self, token: P) {
// unsafe { TODO: call ffi::gst_rtsp_auth_set_default_token() }
//}
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn set_supported_methods(&self, methods: gst_rtsp::RTSPAuthMethod) {
unsafe {
ffi::gst_rtsp_auth_set_supported_methods(self.to_glib_none().0, methods.to_glib());
}
}
//fn set_tls_authentication_mode<'a, P: Into<Option<&'a /*Ignored*/gio::TlsAuthenticationMode>>>(&self, mode: P) {
// unsafe { TODO: call ffi::gst_rtsp_auth_set_tls_authentication_mode() }
//}
fn set_tls_certificate<'a, P: Into<Option<&'a gio::TlsCertificate>>>(&self, cert: P) {
let cert = cert.into();
let cert = cert.to_glib_none();
unsafe {
ffi::gst_rtsp_auth_set_tls_certificate(self.to_glib_none().0, cert.0);
}
}
//fn set_tls_database<'a, P: IsA</*Ignored*/gio::TlsDatabase> + 'a, Q: Into<Option<&'a P>>>(&self, database: Q) {
// unsafe { TODO: call ffi::gst_rtsp_auth_set_tls_database() }
//}
//fn connect_accept_certificate<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored connection: Gio.TlsConnection
//}
}

View file

@ -0,0 +1,432 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPAuth;
use RTSPMountPoints;
use RTSPSession;
use RTSPSessionPool;
use RTSPThreadPool;
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPClient(Object<ffi::GstRTSPClient, ffi::GstRTSPClientClass>);
match fn {
get_type => || ffi::gst_rtsp_client_get_type(),
}
}
impl RTSPClient {
pub fn new() -> RTSPClient {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_client_new())
}
}
}
impl Default for RTSPClient {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPClient {}
unsafe impl Sync for RTSPClient {}
pub trait RTSPClientExt {
fn close(&self);
fn get_auth(&self) -> Option<RTSPAuth>;
//fn get_connection(&self) -> /*Ignored*/Option<gst_rtsp::RTSPConnection>;
fn get_mount_points(&self) -> Option<RTSPMountPoints>;
fn get_session_pool(&self) -> Option<RTSPSessionPool>;
fn get_thread_pool(&self) -> Option<RTSPThreadPool>;
//fn handle_message(&self, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult;
//fn send_message<'a, P: Into<Option<&'a RTSPSession>>>(&self, session: P, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult;
//fn session_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPClientSessionFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession>;
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P);
//fn set_connection(&self, conn: /*Ignored*/&mut gst_rtsp::RTSPConnection) -> bool;
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P);
//fn set_send_func<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, func: /*Unknown conversion*//*Unimplemented*/RTSPClientSendFunc, user_data: P, notify: Q);
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P);
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P);
fn get_property_drop_backlog(&self) -> bool;
fn set_property_drop_backlog(&self, drop_backlog: bool);
//fn connect_announce_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_check_requirements<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
fn connect_closed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
//fn connect_describe_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_get_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_handle_response<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
fn connect_new_session<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
//fn connect_options_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_pause_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_play_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_announce_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_describe_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_get_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_options_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_pause_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_play_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_record_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_set_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_setup_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_teardown_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_record_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_send_message<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_set_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_setup_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_teardown_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
fn connect_property_drop_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPClient> + IsA<glib::object::Object>> RTSPClientExt for O {
fn close(&self) {
unsafe {
ffi::gst_rtsp_client_close(self.to_glib_none().0);
}
}
fn get_auth(&self) -> Option<RTSPAuth> {
unsafe {
from_glib_full(ffi::gst_rtsp_client_get_auth(self.to_glib_none().0))
}
}
//fn get_connection(&self) -> /*Ignored*/Option<gst_rtsp::RTSPConnection> {
// unsafe { TODO: call ffi::gst_rtsp_client_get_connection() }
//}
fn get_mount_points(&self) -> Option<RTSPMountPoints> {
unsafe {
from_glib_full(ffi::gst_rtsp_client_get_mount_points(self.to_glib_none().0))
}
}
fn get_session_pool(&self) -> Option<RTSPSessionPool> {
unsafe {
from_glib_full(ffi::gst_rtsp_client_get_session_pool(self.to_glib_none().0))
}
}
fn get_thread_pool(&self) -> Option<RTSPThreadPool> {
unsafe {
from_glib_full(ffi::gst_rtsp_client_get_thread_pool(self.to_glib_none().0))
}
}
//fn handle_message(&self, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult {
// unsafe { TODO: call ffi::gst_rtsp_client_handle_message() }
//}
//fn send_message<'a, P: Into<Option<&'a RTSPSession>>>(&self, session: P, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult {
// unsafe { TODO: call ffi::gst_rtsp_client_send_message() }
//}
//fn session_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPClientSessionFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession> {
// unsafe { TODO: call ffi::gst_rtsp_client_session_filter() }
//}
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P) {
let auth = auth.into();
let auth = auth.to_glib_none();
unsafe {
ffi::gst_rtsp_client_set_auth(self.to_glib_none().0, auth.0);
}
}
//fn set_connection(&self, conn: /*Ignored*/&mut gst_rtsp::RTSPConnection) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_client_set_connection() }
//}
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P) {
let mounts = mounts.into();
let mounts = mounts.to_glib_none();
unsafe {
ffi::gst_rtsp_client_set_mount_points(self.to_glib_none().0, mounts.0);
}
}
//fn set_send_func<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, func: /*Unknown conversion*//*Unimplemented*/RTSPClientSendFunc, user_data: P, notify: Q) {
// unsafe { TODO: call ffi::gst_rtsp_client_set_send_func() }
//}
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P) {
let pool = pool.into();
let pool = pool.to_glib_none();
unsafe {
ffi::gst_rtsp_client_set_session_pool(self.to_glib_none().0, pool.0);
}
}
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P) {
let pool = pool.into();
let pool = pool.to_glib_none();
unsafe {
ffi::gst_rtsp_client_set_thread_pool(self.to_glib_none().0, pool.0);
}
}
fn get_property_drop_backlog(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "drop-backlog".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_property_drop_backlog(&self, drop_backlog: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "drop-backlog".to_glib_none().0, Value::from(&drop_backlog).to_glib_none().0);
}
}
//fn connect_announce_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_check_requirements<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
// Empty ctype arr: *.CArray TypeId { ns_id: 0, id: 28 }
//}
fn connect_closed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "closed",
transmute(closed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
//fn connect_describe_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_get_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_handle_response<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
fn connect_new_session<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPSession) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "new-session",
transmute(new_session_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
//fn connect_options_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_pause_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_play_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_announce_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_describe_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_get_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_options_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_pause_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_play_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_record_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_set_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_setup_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//#[cfg(any(feature = "v1_12", feature = "dox"))]
//fn connect_pre_teardown_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_record_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_send_message<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored message: GstRtsp.RTSPMessage
//}
//fn connect_set_parameter_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_setup_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
//fn connect_teardown_request<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored ctx: GstRtspServer.RTSPContext
//}
fn connect_property_drop_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::drop-backlog",
transmute(notify_drop_backlog_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::mount-points",
transmute(notify_mount_points_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::session-pool",
transmute(notify_session_pool_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn closed_trampoline<P>(this: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn new_session_trampoline<P>(this: *mut ffi::GstRTSPClient, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> {
callback_guard!();
let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn notify_drop_backlog_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_mount_points_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_session_pool_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,845 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPAddressPool;
use RTSPMediaStatus;
use RTSPPublishClockMode;
use RTSPStream;
use RTSPSuspendMode;
use RTSPTransportMode;
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_rtsp;
use libc;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPMedia(Object<ffi::GstRTSPMedia, ffi::GstRTSPMediaClass>);
match fn {
get_type => || ffi::gst_rtsp_media_get_type(),
}
}
impl RTSPMedia {
pub fn new<P: IsA<gst::Element>>(element: &P) -> RTSPMedia {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_media_new(element.to_glib_full()))
}
}
}
unsafe impl Send for RTSPMedia {}
unsafe impl Sync for RTSPMedia {}
pub trait RTSPMediaExt {
fn collect_streams(&self);
fn create_stream<P: IsA<gst::Element>, Q: IsA<gst::Pad>>(&self, payloader: &P, pad: &Q) -> Option<RTSPStream>;
fn find_stream(&self, control: &str) -> Option<RTSPStream>;
fn get_address_pool(&self) -> Option<RTSPAddressPool>;
fn get_base_time(&self) -> gst::ClockTime;
fn get_buffer_size(&self) -> u32;
fn get_clock(&self) -> Option<gst::Clock>;
fn get_element(&self) -> Option<gst::Element>;
fn get_latency(&self) -> u32;
fn get_multicast_iface(&self) -> Option<String>;
//fn get_permissions(&self) -> /*Ignored*/Option<RTSPPermissions>;
fn get_profiles(&self) -> gst_rtsp::RTSPProfile;
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans;
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode;
fn get_range_string(&self, play: bool, unit: gst_rtsp::RTSPRangeUnit) -> Option<String>;
fn get_retransmission_time(&self) -> gst::ClockTime;
fn get_status(&self) -> RTSPMediaStatus;
fn get_stream(&self, idx: u32) -> Option<RTSPStream>;
fn get_suspend_mode(&self) -> RTSPSuspendMode;
//fn get_time_provider<'a, P: Into<Option<&'a str>>>(&self, address: P, port: u16) -> /*Ignored*/Option<gst_net::NetTimeProvider>;
fn get_transport_mode(&self) -> RTSPTransportMode;
//fn handle_sdp(&self, sdp: /*Ignored*/&mut gst_sdp::SDPMessage) -> bool;
fn is_eos_shutdown(&self) -> bool;
fn is_reusable(&self) -> bool;
fn is_shared(&self) -> bool;
fn is_stop_on_disconnect(&self) -> bool;
fn is_time_provider(&self) -> bool;
fn n_streams(&self) -> u32;
//fn prepare<'a, P: Into<Option<&'a /*Ignored*/RTSPThread>>>(&self, thread: P) -> bool;
//fn seek(&self, range: /*Ignored*/&mut gst_rtsp::RTSPTimeRange) -> bool;
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P);
fn set_buffer_size(&self, size: u32);
fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q);
fn set_eos_shutdown(&self, eos_shutdown: bool);
fn set_latency(&self, latency: u32);
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P);
//fn set_permissions<'a, P: Into<Option<&'a /*Ignored*/RTSPPermissions>>>(&self, permissions: P);
fn set_pipeline_state(&self, state: gst::State);
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile);
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans);
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode);
fn set_retransmission_time(&self, time: gst::ClockTime);
fn set_reusable(&self, reusable: bool);
fn set_shared(&self, shared: bool);
//fn set_state(&self, state: gst::State, transports: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 26 }) -> bool;
fn set_stop_on_disconnect(&self, stop_on_disconnect: bool);
fn set_suspend_mode(&self, mode: RTSPSuspendMode);
fn set_transport_mode(&self, mode: RTSPTransportMode);
//fn setup_sdp(&self, sdp: /*Ignored*/&mut gst_sdp::SDPMessage, info: /*Ignored*/&mut SDPInfo) -> bool;
fn suspend(&self) -> Result<(), glib::error::BoolError>;
fn take_pipeline(&self, pipeline: &gst::Pipeline);
fn unprepare(&self) -> Result<(), glib::error::BoolError>;
fn unsuspend(&self) -> Result<(), glib::error::BoolError>;
fn use_time_provider(&self, time_provider: bool);
fn get_property_eos_shutdown(&self) -> bool;
fn get_property_reusable(&self) -> bool;
fn get_property_shared(&self) -> bool;
fn get_property_stop_on_disconnect(&self) -> bool;
fn set_property_time_provider(&self, time_provider: bool);
fn connect_new_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_new_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_prepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_removed_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_target_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_unprepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_element_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_reusable_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_time_provider_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPMedia> + IsA<glib::object::Object>> RTSPMediaExt for O {
fn collect_streams(&self) {
unsafe {
ffi::gst_rtsp_media_collect_streams(self.to_glib_none().0);
}
}
fn create_stream<P: IsA<gst::Element>, Q: IsA<gst::Pad>>(&self, payloader: &P, pad: &Q) -> Option<RTSPStream> {
unsafe {
from_glib_none(ffi::gst_rtsp_media_create_stream(self.to_glib_none().0, payloader.to_glib_none().0, pad.to_glib_none().0))
}
}
fn find_stream(&self, control: &str) -> Option<RTSPStream> {
unsafe {
from_glib_none(ffi::gst_rtsp_media_find_stream(self.to_glib_none().0, control.to_glib_none().0))
}
}
fn get_address_pool(&self) -> Option<RTSPAddressPool> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_get_address_pool(self.to_glib_none().0))
}
}
fn get_base_time(&self) -> gst::ClockTime {
unsafe {
from_glib(ffi::gst_rtsp_media_get_base_time(self.to_glib_none().0))
}
}
fn get_buffer_size(&self) -> u32 {
unsafe {
ffi::gst_rtsp_media_get_buffer_size(self.to_glib_none().0)
}
}
fn get_clock(&self) -> Option<gst::Clock> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_get_clock(self.to_glib_none().0))
}
}
fn get_element(&self) -> Option<gst::Element> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_get_element(self.to_glib_none().0))
}
}
fn get_latency(&self) -> u32 {
unsafe {
ffi::gst_rtsp_media_get_latency(self.to_glib_none().0)
}
}
fn get_multicast_iface(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_get_multicast_iface(self.to_glib_none().0))
}
}
//fn get_permissions(&self) -> /*Ignored*/Option<RTSPPermissions> {
// unsafe { TODO: call ffi::gst_rtsp_media_get_permissions() }
//}
fn get_profiles(&self) -> gst_rtsp::RTSPProfile {
unsafe {
from_glib(ffi::gst_rtsp_media_get_profiles(self.to_glib_none().0))
}
}
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans {
unsafe {
from_glib(ffi::gst_rtsp_media_get_protocols(self.to_glib_none().0))
}
}
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode {
unsafe {
from_glib(ffi::gst_rtsp_media_get_publish_clock_mode(self.to_glib_none().0))
}
}
fn get_range_string(&self, play: bool, unit: gst_rtsp::RTSPRangeUnit) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_get_range_string(self.to_glib_none().0, play.to_glib(), unit.to_glib()))
}
}
fn get_retransmission_time(&self) -> gst::ClockTime {
unsafe {
from_glib(ffi::gst_rtsp_media_get_retransmission_time(self.to_glib_none().0))
}
}
fn get_status(&self) -> RTSPMediaStatus {
unsafe {
from_glib(ffi::gst_rtsp_media_get_status(self.to_glib_none().0))
}
}
fn get_stream(&self, idx: u32) -> Option<RTSPStream> {
unsafe {
from_glib_none(ffi::gst_rtsp_media_get_stream(self.to_glib_none().0, idx))
}
}
fn get_suspend_mode(&self) -> RTSPSuspendMode {
unsafe {
from_glib(ffi::gst_rtsp_media_get_suspend_mode(self.to_glib_none().0))
}
}
//fn get_time_provider<'a, P: Into<Option<&'a str>>>(&self, address: P, port: u16) -> /*Ignored*/Option<gst_net::NetTimeProvider> {
// unsafe { TODO: call ffi::gst_rtsp_media_get_time_provider() }
//}
fn get_transport_mode(&self) -> RTSPTransportMode {
unsafe {
from_glib(ffi::gst_rtsp_media_get_transport_mode(self.to_glib_none().0))
}
}
//fn handle_sdp(&self, sdp: /*Ignored*/&mut gst_sdp::SDPMessage) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_media_handle_sdp() }
//}
fn is_eos_shutdown(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_is_eos_shutdown(self.to_glib_none().0))
}
}
fn is_reusable(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_is_reusable(self.to_glib_none().0))
}
}
fn is_shared(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_is_shared(self.to_glib_none().0))
}
}
fn is_stop_on_disconnect(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_is_stop_on_disconnect(self.to_glib_none().0))
}
}
fn is_time_provider(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_is_time_provider(self.to_glib_none().0))
}
}
fn n_streams(&self) -> u32 {
unsafe {
ffi::gst_rtsp_media_n_streams(self.to_glib_none().0)
}
}
//fn prepare<'a, P: Into<Option<&'a /*Ignored*/RTSPThread>>>(&self, thread: P) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_media_prepare() }
//}
//fn seek(&self, range: /*Ignored*/&mut gst_rtsp::RTSPTimeRange) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_media_seek() }
//}
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P) {
let pool = pool.into();
let pool = pool.to_glib_none();
unsafe {
ffi::gst_rtsp_media_set_address_pool(self.to_glib_none().0, pool.0);
}
}
fn set_buffer_size(&self, size: u32) {
unsafe {
ffi::gst_rtsp_media_set_buffer_size(self.to_glib_none().0, size);
}
}
fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) {
let clock = clock.into();
let clock = clock.to_glib_none();
unsafe {
ffi::gst_rtsp_media_set_clock(self.to_glib_none().0, clock.0);
}
}
fn set_eos_shutdown(&self, eos_shutdown: bool) {
unsafe {
ffi::gst_rtsp_media_set_eos_shutdown(self.to_glib_none().0, eos_shutdown.to_glib());
}
}
fn set_latency(&self, latency: u32) {
unsafe {
ffi::gst_rtsp_media_set_latency(self.to_glib_none().0, latency);
}
}
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) {
let multicast_iface = multicast_iface.into();
let multicast_iface = multicast_iface.to_glib_none();
unsafe {
ffi::gst_rtsp_media_set_multicast_iface(self.to_glib_none().0, multicast_iface.0);
}
}
//fn set_permissions<'a, P: Into<Option<&'a /*Ignored*/RTSPPermissions>>>(&self, permissions: P) {
// unsafe { TODO: call ffi::gst_rtsp_media_set_permissions() }
//}
fn set_pipeline_state(&self, state: gst::State) {
unsafe {
ffi::gst_rtsp_media_set_pipeline_state(self.to_glib_none().0, state.to_glib());
}
}
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
unsafe {
ffi::gst_rtsp_media_set_profiles(self.to_glib_none().0, profiles.to_glib());
}
}
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
unsafe {
ffi::gst_rtsp_media_set_protocols(self.to_glib_none().0, protocols.to_glib());
}
}
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
unsafe {
ffi::gst_rtsp_media_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib());
}
}
fn set_retransmission_time(&self, time: gst::ClockTime) {
unsafe {
ffi::gst_rtsp_media_set_retransmission_time(self.to_glib_none().0, time.to_glib());
}
}
fn set_reusable(&self, reusable: bool) {
unsafe {
ffi::gst_rtsp_media_set_reusable(self.to_glib_none().0, reusable.to_glib());
}
}
fn set_shared(&self, shared: bool) {
unsafe {
ffi::gst_rtsp_media_set_shared(self.to_glib_none().0, shared.to_glib());
}
}
//fn set_state(&self, state: gst::State, transports: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 26 }) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_media_set_state() }
//}
fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) {
unsafe {
ffi::gst_rtsp_media_set_stop_on_disconnect(self.to_glib_none().0, stop_on_disconnect.to_glib());
}
}
fn set_suspend_mode(&self, mode: RTSPSuspendMode) {
unsafe {
ffi::gst_rtsp_media_set_suspend_mode(self.to_glib_none().0, mode.to_glib());
}
}
fn set_transport_mode(&self, mode: RTSPTransportMode) {
unsafe {
ffi::gst_rtsp_media_set_transport_mode(self.to_glib_none().0, mode.to_glib());
}
}
//fn setup_sdp(&self, sdp: /*Ignored*/&mut gst_sdp::SDPMessage, info: /*Ignored*/&mut SDPInfo) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_media_setup_sdp() }
//}
fn suspend(&self) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_media_suspend(self.to_glib_none().0), "Failed to suspend media")
}
}
fn take_pipeline(&self, pipeline: &gst::Pipeline) {
unsafe {
ffi::gst_rtsp_media_take_pipeline(self.to_glib_none().0, pipeline.to_glib_full());
}
}
fn unprepare(&self) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_media_unprepare(self.to_glib_none().0), "Failed to unprepare media")
}
}
fn unsuspend(&self) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_media_unsuspend(self.to_glib_none().0), "Failed to unsuspend media")
}
}
fn use_time_provider(&self, time_provider: bool) {
unsafe {
ffi::gst_rtsp_media_use_time_provider(self.to_glib_none().0, time_provider.to_glib());
}
}
fn get_property_eos_shutdown(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "eos-shutdown".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_reusable(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "reusable".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_shared(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "shared".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_stop_on_disconnect(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "stop-on-disconnect".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_property_time_provider(&self, time_provider: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "time-provider".to_glib_none().0, Value::from(&time_provider).to_glib_none().0);
}
}
fn connect_new_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "new-state",
transmute(new_state_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_new_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPStream) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "new-stream",
transmute(new_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_prepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "prepared",
transmute(prepared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_removed_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPStream) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "removed-stream",
transmute(removed_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_target_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "target-state",
transmute(target_state_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_unprepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "unprepared",
transmute(unprepared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::buffer-size",
transmute(notify_buffer_size_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::clock",
transmute(notify_clock_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_element_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::element",
transmute(notify_element_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::eos-shutdown",
transmute(notify_eos_shutdown_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::latency",
transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::profiles",
transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::protocols",
transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_reusable_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::reusable",
transmute(notify_reusable_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::shared",
transmute(notify_shared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::stop-on-disconnect",
transmute(notify_stop_on_disconnect_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::suspend-mode",
transmute(notify_suspend_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_time_provider_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::time-provider",
transmute(notify_time_provider_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::transport-mode",
transmute(notify_transport_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn new_state_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), object)
}
unsafe extern "C" fn new_stream_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn prepared_trampoline<P>(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn removed_stream_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn target_state_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), object)
}
unsafe extern "C" fn unprepared_trampoline<P>(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_clock_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_element_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_eos_shutdown_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_reusable_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_shared_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_stop_on_disconnect_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_suspend_mode_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_time_provider_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_transport_mode_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,603 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPAddressPool;
use RTSPMedia;
use RTSPPublishClockMode;
use RTSPSuspendMode;
use RTSPTransportMode;
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_rtsp;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPMediaFactory(Object<ffi::GstRTSPMediaFactory, ffi::GstRTSPMediaFactoryClass>);
match fn {
get_type => || ffi::gst_rtsp_media_factory_get_type(),
}
}
impl RTSPMediaFactory {
pub fn new() -> RTSPMediaFactory {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_new())
}
}
}
impl Default for RTSPMediaFactory {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPMediaFactory {}
unsafe impl Sync for RTSPMediaFactory {}
pub trait RTSPMediaFactoryExt {
//fn add_role(&self, role: &str, fieldname: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option<RTSPMedia>;
fn create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option<gst::Element>;
fn get_address_pool(&self) -> Option<RTSPAddressPool>;
fn get_buffer_size(&self) -> u32;
fn get_clock(&self) -> Option<gst::Clock>;
fn get_latency(&self) -> u32;
fn get_launch(&self) -> Option<String>;
fn get_media_gtype(&self) -> glib::types::Type;
fn get_multicast_iface(&self) -> Option<String>;
//fn get_permissions(&self) -> /*Ignored*/Option<RTSPPermissions>;
fn get_profiles(&self) -> gst_rtsp::RTSPProfile;
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans;
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode;
fn get_retransmission_time(&self) -> gst::ClockTime;
fn get_suspend_mode(&self) -> RTSPSuspendMode;
fn get_transport_mode(&self) -> RTSPTransportMode;
fn is_eos_shutdown(&self) -> bool;
fn is_shared(&self) -> bool;
fn is_stop_on_disonnect(&self) -> bool;
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P);
fn set_buffer_size(&self, size: u32);
fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q);
fn set_eos_shutdown(&self, eos_shutdown: bool);
fn set_latency(&self, latency: u32);
fn set_launch(&self, launch: &str);
fn set_media_gtype(&self, media_gtype: glib::types::Type);
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P);
//fn set_permissions<'a, P: Into<Option<&'a /*Ignored*/RTSPPermissions>>>(&self, permissions: P);
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile);
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans);
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode);
fn set_retransmission_time(&self, time: gst::ClockTime);
fn set_shared(&self, shared: bool);
fn set_stop_on_disconnect(&self, stop_on_disconnect: bool);
fn set_suspend_mode(&self, mode: RTSPSuspendMode);
fn set_transport_mode(&self, mode: RTSPTransportMode);
fn get_property_eos_shutdown(&self) -> bool;
fn get_property_shared(&self) -> bool;
fn get_property_stop_on_disconnect(&self) -> bool;
fn connect_media_configure<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_media_constructed<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_launch_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPMediaFactory> + IsA<glib::object::Object>> RTSPMediaFactoryExt for O {
//fn add_role(&self, role: &str, fieldname: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
// unsafe { TODO: call ffi::gst_rtsp_media_factory_add_role() }
//}
fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option<RTSPMedia> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_construct(self.to_glib_none().0, url.to_glib_none().0))
}
}
fn create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option<gst::Element> {
unsafe {
from_glib_none(ffi::gst_rtsp_media_factory_create_element(self.to_glib_none().0, url.to_glib_none().0))
}
}
fn get_address_pool(&self) -> Option<RTSPAddressPool> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_address_pool(self.to_glib_none().0))
}
}
fn get_buffer_size(&self) -> u32 {
unsafe {
ffi::gst_rtsp_media_factory_get_buffer_size(self.to_glib_none().0)
}
}
fn get_clock(&self) -> Option<gst::Clock> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_clock(self.to_glib_none().0))
}
}
fn get_latency(&self) -> u32 {
unsafe {
ffi::gst_rtsp_media_factory_get_latency(self.to_glib_none().0)
}
}
fn get_launch(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_launch(self.to_glib_none().0))
}
}
fn get_media_gtype(&self) -> glib::types::Type {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_media_gtype(self.to_glib_none().0))
}
}
fn get_multicast_iface(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_multicast_iface(self.to_glib_none().0))
}
}
//fn get_permissions(&self) -> /*Ignored*/Option<RTSPPermissions> {
// unsafe { TODO: call ffi::gst_rtsp_media_factory_get_permissions() }
//}
fn get_profiles(&self) -> gst_rtsp::RTSPProfile {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_profiles(self.to_glib_none().0))
}
}
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_protocols(self.to_glib_none().0))
}
}
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_publish_clock_mode(self.to_glib_none().0))
}
}
fn get_retransmission_time(&self) -> gst::ClockTime {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time(self.to_glib_none().0))
}
}
fn get_suspend_mode(&self) -> RTSPSuspendMode {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_suspend_mode(self.to_glib_none().0))
}
}
fn get_transport_mode(&self) -> RTSPTransportMode {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_transport_mode(self.to_glib_none().0))
}
}
fn is_eos_shutdown(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_is_eos_shutdown(self.to_glib_none().0))
}
}
fn is_shared(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_is_shared(self.to_glib_none().0))
}
}
fn is_stop_on_disonnect(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_media_factory_is_stop_on_disonnect(self.to_glib_none().0))
}
}
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P) {
let pool = pool.into();
let pool = pool.to_glib_none();
unsafe {
ffi::gst_rtsp_media_factory_set_address_pool(self.to_glib_none().0, pool.0);
}
}
fn set_buffer_size(&self, size: u32) {
unsafe {
ffi::gst_rtsp_media_factory_set_buffer_size(self.to_glib_none().0, size);
}
}
fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) {
let clock = clock.into();
let clock = clock.to_glib_none();
unsafe {
ffi::gst_rtsp_media_factory_set_clock(self.to_glib_none().0, clock.0);
}
}
fn set_eos_shutdown(&self, eos_shutdown: bool) {
unsafe {
ffi::gst_rtsp_media_factory_set_eos_shutdown(self.to_glib_none().0, eos_shutdown.to_glib());
}
}
fn set_latency(&self, latency: u32) {
unsafe {
ffi::gst_rtsp_media_factory_set_latency(self.to_glib_none().0, latency);
}
}
fn set_launch(&self, launch: &str) {
unsafe {
ffi::gst_rtsp_media_factory_set_launch(self.to_glib_none().0, launch.to_glib_none().0);
}
}
fn set_media_gtype(&self, media_gtype: glib::types::Type) {
unsafe {
ffi::gst_rtsp_media_factory_set_media_gtype(self.to_glib_none().0, media_gtype.to_glib());
}
}
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) {
let multicast_iface = multicast_iface.into();
let multicast_iface = multicast_iface.to_glib_none();
unsafe {
ffi::gst_rtsp_media_factory_set_multicast_iface(self.to_glib_none().0, multicast_iface.0);
}
}
//fn set_permissions<'a, P: Into<Option<&'a /*Ignored*/RTSPPermissions>>>(&self, permissions: P) {
// unsafe { TODO: call ffi::gst_rtsp_media_factory_set_permissions() }
//}
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
unsafe {
ffi::gst_rtsp_media_factory_set_profiles(self.to_glib_none().0, profiles.to_glib());
}
}
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
unsafe {
ffi::gst_rtsp_media_factory_set_protocols(self.to_glib_none().0, protocols.to_glib());
}
}
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
unsafe {
ffi::gst_rtsp_media_factory_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib());
}
}
fn set_retransmission_time(&self, time: gst::ClockTime) {
unsafe {
ffi::gst_rtsp_media_factory_set_retransmission_time(self.to_glib_none().0, time.to_glib());
}
}
fn set_shared(&self, shared: bool) {
unsafe {
ffi::gst_rtsp_media_factory_set_shared(self.to_glib_none().0, shared.to_glib());
}
}
fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) {
unsafe {
ffi::gst_rtsp_media_factory_set_stop_on_disconnect(self.to_glib_none().0, stop_on_disconnect.to_glib());
}
}
fn set_suspend_mode(&self, mode: RTSPSuspendMode) {
unsafe {
ffi::gst_rtsp_media_factory_set_suspend_mode(self.to_glib_none().0, mode.to_glib());
}
}
fn set_transport_mode(&self, mode: RTSPTransportMode) {
unsafe {
ffi::gst_rtsp_media_factory_set_transport_mode(self.to_glib_none().0, mode.to_glib());
}
}
fn get_property_eos_shutdown(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "eos-shutdown".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_shared(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "shared".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_stop_on_disconnect(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "stop-on-disconnect".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn connect_media_configure<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "media-configure",
transmute(media_configure_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_media_constructed<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "media-constructed",
transmute(media_constructed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::buffer-size",
transmute(notify_buffer_size_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::clock",
transmute(notify_clock_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::eos-shutdown",
transmute(notify_eos_shutdown_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::latency",
transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_launch_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::launch",
transmute(notify_launch_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::profiles",
transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::protocols",
transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::shared",
transmute(notify_shared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::stop-on-disconnect",
transmute(notify_stop_on_disconnect_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::suspend-mode",
transmute(notify_suspend_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::transport-mode",
transmute(notify_transport_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn media_configure_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn media_constructed_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_clock_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_eos_shutdown_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_launch_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_shared_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_stop_on_disconnect_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_suspend_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_transport_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,118 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPMediaFactory;
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPMediaFactoryURI(Object<ffi::GstRTSPMediaFactoryURI, ffi::GstRTSPMediaFactoryURIClass>): RTSPMediaFactory;
match fn {
get_type => || ffi::gst_rtsp_media_factory_uri_get_type(),
}
}
impl RTSPMediaFactoryURI {
pub fn new() -> RTSPMediaFactoryURI {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_uri_new())
}
}
}
impl Default for RTSPMediaFactoryURI {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPMediaFactoryURI {}
unsafe impl Sync for RTSPMediaFactoryURI {}
pub trait RTSPMediaFactoryURIExt {
fn get_uri(&self) -> Option<String>;
fn set_uri(&self, uri: &str);
fn get_property_use_gstpay(&self) -> bool;
fn set_property_use_gstpay(&self, use_gstpay: bool);
fn connect_property_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_use_gstpay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPMediaFactoryURI> + IsA<glib::object::Object>> RTSPMediaFactoryURIExt for O {
fn get_uri(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(self.to_glib_none().0))
}
}
fn set_uri(&self, uri: &str) {
unsafe {
ffi::gst_rtsp_media_factory_uri_set_uri(self.to_glib_none().0, uri.to_glib_none().0);
}
}
fn get_property_use_gstpay(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "use-gstpay".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_property_use_gstpay(&self, use_gstpay: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "use-gstpay".to_glib_none().0, Value::from(&use_gstpay).to_glib_none().0);
}
}
fn connect_property_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::uri",
transmute(notify_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_use_gstpay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::use-gstpay",
transmute(notify_use_gstpay_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_uri_trampoline<P>(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactoryURI> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactoryURI::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_use_gstpay_trampoline<P>(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactoryURI> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactoryURI::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,77 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPMediaFactory;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst_rtsp;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPMountPoints(Object<ffi::GstRTSPMountPoints, ffi::GstRTSPMountPointsClass>);
match fn {
get_type => || ffi::gst_rtsp_mount_points_get_type(),
}
}
impl RTSPMountPoints {
pub fn new() -> RTSPMountPoints {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_mount_points_new())
}
}
}
impl Default for RTSPMountPoints {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPMountPoints {}
unsafe impl Sync for RTSPMountPoints {}
pub trait RTSPMountPointsExt {
fn add_factory<P: IsA<RTSPMediaFactory>>(&self, path: &str, factory: &P);
fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<String>;
fn match_(&self, path: &str) -> (RTSPMediaFactory, i32);
fn remove_factory(&self, path: &str);
}
impl<O: IsA<RTSPMountPoints>> RTSPMountPointsExt for O {
fn add_factory<P: IsA<RTSPMediaFactory>>(&self, path: &str, factory: &P) {
unsafe {
ffi::gst_rtsp_mount_points_add_factory(self.to_glib_none().0, path.to_glib_none().0, factory.to_glib_full());
}
}
fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_mount_points_make_path(self.to_glib_none().0, url.to_glib_none().0))
}
}
fn match_(&self, path: &str) -> (RTSPMediaFactory, i32) {
unsafe {
let mut matched = mem::uninitialized();
let ret = from_glib_full(ffi::gst_rtsp_mount_points_match(self.to_glib_none().0, path.to_glib_none().0, &mut matched));
(ret, matched)
}
}
fn remove_factory(&self, path: &str) {
unsafe {
ffi::gst_rtsp_mount_points_remove_factory(self.to_glib_none().0, path.to_glib_none().0);
}
}
}

View file

@ -0,0 +1,348 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use Error;
use RTSPAuth;
use RTSPClient;
use RTSPMountPoints;
use RTSPSessionPool;
use RTSPThreadPool;
use ffi;
use gio;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPServer(Object<ffi::GstRTSPServer, ffi::GstRTSPServerClass>);
match fn {
get_type => || ffi::gst_rtsp_server_get_type(),
}
}
impl RTSPServer {
pub fn new() -> RTSPServer {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_server_new())
}
}
pub fn io_func(socket: &gio::Socket, condition: glib::IOCondition, server: &RTSPServer) -> bool {
skip_assert_initialized!();
unsafe {
from_glib(ffi::gst_rtsp_server_io_func(socket.to_glib_none().0, condition.to_glib(), server.to_glib_none().0))
}
}
}
impl Default for RTSPServer {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPServer {}
unsafe impl Sync for RTSPServer {}
pub trait RTSPServerExt {
//fn client_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPServerClientFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPClient>;
fn create_socket<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<gio::Socket, Error>;
fn create_source<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<glib::Source, Error>;
fn get_address(&self) -> Option<String>;
fn get_auth(&self) -> Option<RTSPAuth>;
fn get_backlog(&self) -> i32;
fn get_bound_port(&self) -> i32;
fn get_mount_points(&self) -> Option<RTSPMountPoints>;
fn get_service(&self) -> Option<String>;
fn get_session_pool(&self) -> Option<RTSPSessionPool>;
fn get_thread_pool(&self) -> Option<RTSPThreadPool>;
fn set_address(&self, address: &str);
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P);
fn set_backlog(&self, backlog: i32);
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P);
fn set_service(&self, service: &str);
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P);
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P);
fn transfer_connection<'a, P: Into<Option<&'a str>>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool;
fn connect_client_connected<F: Fn(&Self, &RTSPClient) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_address_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_bound_port_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_service_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPServer> + IsA<glib::object::Object>> RTSPServerExt for O {
//fn client_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPServerClientFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPClient> {
// unsafe { TODO: call ffi::gst_rtsp_server_client_filter() }
//}
fn create_socket<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<gio::Socket, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::gst_rtsp_server_create_socket(self.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
fn create_source<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<glib::Source, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::gst_rtsp_server_create_source(self.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
fn get_address(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_server_get_address(self.to_glib_none().0))
}
}
fn get_auth(&self) -> Option<RTSPAuth> {
unsafe {
from_glib_full(ffi::gst_rtsp_server_get_auth(self.to_glib_none().0))
}
}
fn get_backlog(&self) -> i32 {
unsafe {
ffi::gst_rtsp_server_get_backlog(self.to_glib_none().0)
}
}
fn get_bound_port(&self) -> i32 {
unsafe {
ffi::gst_rtsp_server_get_bound_port(self.to_glib_none().0)
}
}
fn get_mount_points(&self) -> Option<RTSPMountPoints> {
unsafe {
from_glib_full(ffi::gst_rtsp_server_get_mount_points(self.to_glib_none().0))
}
}
fn get_service(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_server_get_service(self.to_glib_none().0))
}
}
fn get_session_pool(&self) -> Option<RTSPSessionPool> {
unsafe {
from_glib_full(ffi::gst_rtsp_server_get_session_pool(self.to_glib_none().0))
}
}
fn get_thread_pool(&self) -> Option<RTSPThreadPool> {
unsafe {
from_glib_full(ffi::gst_rtsp_server_get_thread_pool(self.to_glib_none().0))
}
}
fn set_address(&self, address: &str) {
unsafe {
ffi::gst_rtsp_server_set_address(self.to_glib_none().0, address.to_glib_none().0);
}
}
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P) {
let auth = auth.into();
let auth = auth.to_glib_none();
unsafe {
ffi::gst_rtsp_server_set_auth(self.to_glib_none().0, auth.0);
}
}
fn set_backlog(&self, backlog: i32) {
unsafe {
ffi::gst_rtsp_server_set_backlog(self.to_glib_none().0, backlog);
}
}
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P) {
let mounts = mounts.into();
let mounts = mounts.to_glib_none();
unsafe {
ffi::gst_rtsp_server_set_mount_points(self.to_glib_none().0, mounts.0);
}
}
fn set_service(&self, service: &str) {
unsafe {
ffi::gst_rtsp_server_set_service(self.to_glib_none().0, service.to_glib_none().0);
}
}
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P) {
let pool = pool.into();
let pool = pool.to_glib_none();
unsafe {
ffi::gst_rtsp_server_set_session_pool(self.to_glib_none().0, pool.0);
}
}
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P) {
let pool = pool.into();
let pool = pool.to_glib_none();
unsafe {
ffi::gst_rtsp_server_set_thread_pool(self.to_glib_none().0, pool.0);
}
}
fn transfer_connection<'a, P: Into<Option<&'a str>>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool {
let initial_buffer = initial_buffer.into();
let initial_buffer = initial_buffer.to_glib_none();
unsafe {
from_glib(ffi::gst_rtsp_server_transfer_connection(self.to_glib_none().0, socket.to_glib_full(), ip.to_glib_none().0, port, initial_buffer.0))
}
}
fn connect_client_connected<F: Fn(&Self, &RTSPClient) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPClient) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "client-connected",
transmute(client_connected_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_address_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::address",
transmute(notify_address_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::backlog",
transmute(notify_backlog_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_bound_port_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::bound-port",
transmute(notify_bound_port_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::mount-points",
transmute(notify_mount_points_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_service_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::service",
transmute(notify_service_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::session-pool",
transmute(notify_session_pool_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn client_connected_trampoline<P>(this: *mut ffi::GstRTSPServer, object: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> {
callback_guard!();
let f: &&(Fn(&P, &RTSPClient) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn notify_address_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_backlog_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_bound_port_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_mount_points_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_service_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_session_pool_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,230 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPMedia;
use RTSPSessionMedia;
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPSession(Object<ffi::GstRTSPSession, ffi::GstRTSPSessionClass>);
match fn {
get_type => || ffi::gst_rtsp_session_get_type(),
}
}
impl RTSPSession {
pub fn new(sessionid: &str) -> RTSPSession {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_session_new(sessionid.to_glib_none().0))
}
}
}
unsafe impl Send for RTSPSession {}
unsafe impl Sync for RTSPSession {}
pub trait RTSPSessionExt {
fn allow_expire(&self);
//fn filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPSessionFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSessionMedia>;
fn get_header(&self) -> Option<String>;
fn get_media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32);
fn get_sessionid(&self) -> Option<String>;
fn get_timeout(&self) -> u32;
//fn is_expired(&self, now: /*Ignored*/&mut glib::TimeVal) -> bool;
fn is_expired_usec(&self, now: i64) -> bool;
fn manage_media(&self, path: &str, media: &RTSPMedia) -> Option<RTSPSessionMedia>;
//fn next_timeout(&self, now: /*Ignored*/&mut glib::TimeVal) -> i32;
fn next_timeout_usec(&self, now: i64) -> i32;
fn prevent_expire(&self);
fn release_media(&self, media: &RTSPSessionMedia) -> bool;
fn set_timeout(&self, timeout: u32);
fn touch(&self);
fn get_property_timeout_always_visible(&self) -> bool;
fn set_property_timeout_always_visible(&self, timeout_always_visible: bool);
fn connect_property_sessionid_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_timeout_always_visible_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPSession> + IsA<glib::object::Object>> RTSPSessionExt for O {
fn allow_expire(&self) {
unsafe {
ffi::gst_rtsp_session_allow_expire(self.to_glib_none().0);
}
}
//fn filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPSessionFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSessionMedia> {
// unsafe { TODO: call ffi::gst_rtsp_session_filter() }
//}
fn get_header(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_session_get_header(self.to_glib_none().0))
}
}
fn get_media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32) {
unsafe {
let mut matched = mem::uninitialized();
let ret = from_glib_none(ffi::gst_rtsp_session_get_media(self.to_glib_none().0, path.to_glib_none().0, &mut matched));
(ret, matched)
}
}
fn get_sessionid(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_rtsp_session_get_sessionid(self.to_glib_none().0))
}
}
fn get_timeout(&self) -> u32 {
unsafe {
ffi::gst_rtsp_session_get_timeout(self.to_glib_none().0)
}
}
//fn is_expired(&self, now: /*Ignored*/&mut glib::TimeVal) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_session_is_expired() }
//}
fn is_expired_usec(&self, now: i64) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_session_is_expired_usec(self.to_glib_none().0, now))
}
}
fn manage_media(&self, path: &str, media: &RTSPMedia) -> Option<RTSPSessionMedia> {
unsafe {
from_glib_none(ffi::gst_rtsp_session_manage_media(self.to_glib_none().0, path.to_glib_none().0, media.to_glib_full()))
}
}
//fn next_timeout(&self, now: /*Ignored*/&mut glib::TimeVal) -> i32 {
// unsafe { TODO: call ffi::gst_rtsp_session_next_timeout() }
//}
fn next_timeout_usec(&self, now: i64) -> i32 {
unsafe {
ffi::gst_rtsp_session_next_timeout_usec(self.to_glib_none().0, now)
}
}
fn prevent_expire(&self) {
unsafe {
ffi::gst_rtsp_session_prevent_expire(self.to_glib_none().0);
}
}
fn release_media(&self, media: &RTSPSessionMedia) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_session_release_media(self.to_glib_none().0, media.to_glib_none().0))
}
}
fn set_timeout(&self, timeout: u32) {
unsafe {
ffi::gst_rtsp_session_set_timeout(self.to_glib_none().0, timeout);
}
}
fn touch(&self) {
unsafe {
ffi::gst_rtsp_session_touch(self.to_glib_none().0);
}
}
fn get_property_timeout_always_visible(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "timeout-always-visible".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_property_timeout_always_visible(&self, timeout_always_visible: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "timeout-always-visible".to_glib_none().0, Value::from(&timeout_always_visible).to_glib_none().0);
}
}
fn connect_property_sessionid_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::sessionid",
transmute(notify_sessionid_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::timeout",
transmute(notify_timeout_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_timeout_always_visible_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::timeout-always-visible",
transmute(notify_timeout_always_visible_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_sessionid_trampoline<P>(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPSession> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPSession::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_timeout_trampoline<P>(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPSession> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPSession::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_timeout_always_visible_trampoline<P>(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPSession> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPSession::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,113 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPMedia;
use RTSPStreamTransport;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPSessionMedia(Object<ffi::GstRTSPSessionMedia, ffi::GstRTSPSessionMediaClass>);
match fn {
get_type => || ffi::gst_rtsp_session_media_get_type(),
}
}
impl RTSPSessionMedia {
pub fn new(path: &str, media: &RTSPMedia) -> RTSPSessionMedia {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_rtsp_session_media_new(path.to_glib_none().0, media.to_glib_full()))
}
}
}
unsafe impl Send for RTSPSessionMedia {}
unsafe impl Sync for RTSPSessionMedia {}
pub trait RTSPSessionMediaExt {
//fn alloc_channels(&self, range: /*Ignored*/gst_rtsp::RTSPRange) -> bool;
fn get_base_time(&self) -> gst::ClockTime;
fn get_media(&self) -> Option<RTSPMedia>;
fn get_rtpinfo(&self) -> Option<String>;
//fn get_rtsp_state(&self) -> /*Ignored*/gst_rtsp::RTSPState;
fn get_transport(&self, idx: u32) -> Option<RTSPStreamTransport>;
fn matches(&self, path: &str) -> Option<i32>;
//fn set_rtsp_state(&self, state: /*Ignored*/gst_rtsp::RTSPState);
fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError>;
//fn set_transport(&self, stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option<RTSPStreamTransport>;
}
impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O {
//fn alloc_channels(&self, range: /*Ignored*/gst_rtsp::RTSPRange) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_session_media_alloc_channels() }
//}
fn get_base_time(&self) -> gst::ClockTime {
unsafe {
from_glib(ffi::gst_rtsp_session_media_get_base_time(self.to_glib_none().0))
}
}
fn get_media(&self) -> Option<RTSPMedia> {
unsafe {
from_glib_none(ffi::gst_rtsp_session_media_get_media(self.to_glib_none().0))
}
}
fn get_rtpinfo(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_session_media_get_rtpinfo(self.to_glib_none().0))
}
}
//fn get_rtsp_state(&self) -> /*Ignored*/gst_rtsp::RTSPState {
// unsafe { TODO: call ffi::gst_rtsp_session_media_get_rtsp_state() }
//}
fn get_transport(&self, idx: u32) -> Option<RTSPStreamTransport> {
unsafe {
from_glib_none(ffi::gst_rtsp_session_media_get_transport(self.to_glib_none().0, idx))
}
}
fn matches(&self, path: &str) -> Option<i32> {
unsafe {
let mut matched = mem::uninitialized();
let ret = from_glib(ffi::gst_rtsp_session_media_matches(self.to_glib_none().0, path.to_glib_none().0, &mut matched));
if ret { Some(matched) } else { None }
}
}
//fn set_rtsp_state(&self, state: /*Ignored*/gst_rtsp::RTSPState) {
// unsafe { TODO: call ffi::gst_rtsp_session_media_set_rtsp_state() }
//}
fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_session_media_set_state(self.to_glib_none().0, state.to_glib()), "Failed to set state of session media")
}
}
//fn set_transport(&self, stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option<RTSPStreamTransport> {
// unsafe { TODO: call ffi::gst_rtsp_session_media_set_transport() }
//}
}

View file

@ -0,0 +1,144 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPSession;
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPSessionPool(Object<ffi::GstRTSPSessionPool, ffi::GstRTSPSessionPoolClass>);
match fn {
get_type => || ffi::gst_rtsp_session_pool_get_type(),
}
}
impl RTSPSessionPool {
pub fn new() -> RTSPSessionPool {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_session_pool_new())
}
}
}
impl Default for RTSPSessionPool {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPSessionPool {}
unsafe impl Sync for RTSPSessionPool {}
pub trait RTSPSessionPoolExt {
fn cleanup(&self) -> u32;
fn create(&self) -> Option<RTSPSession>;
//fn filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPSessionPoolFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession>;
fn find(&self, sessionid: &str) -> Option<RTSPSession>;
fn get_max_sessions(&self) -> u32;
fn get_n_sessions(&self) -> u32;
fn remove(&self, sess: &RTSPSession) -> Result<(), glib::error::BoolError>;
fn set_max_sessions(&self, max: u32);
fn connect_session_removed<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_max_sessions_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPSessionPool> + IsA<glib::object::Object>> RTSPSessionPoolExt for O {
fn cleanup(&self) -> u32 {
unsafe {
ffi::gst_rtsp_session_pool_cleanup(self.to_glib_none().0)
}
}
fn create(&self) -> Option<RTSPSession> {
unsafe {
from_glib_full(ffi::gst_rtsp_session_pool_create(self.to_glib_none().0))
}
}
//fn filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPSessionPoolFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession> {
// unsafe { TODO: call ffi::gst_rtsp_session_pool_filter() }
//}
fn find(&self, sessionid: &str) -> Option<RTSPSession> {
unsafe {
from_glib_full(ffi::gst_rtsp_session_pool_find(self.to_glib_none().0, sessionid.to_glib_none().0))
}
}
fn get_max_sessions(&self) -> u32 {
unsafe {
ffi::gst_rtsp_session_pool_get_max_sessions(self.to_glib_none().0)
}
}
fn get_n_sessions(&self) -> u32 {
unsafe {
ffi::gst_rtsp_session_pool_get_n_sessions(self.to_glib_none().0)
}
}
fn remove(&self, sess: &RTSPSession) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_session_pool_remove(self.to_glib_none().0, sess.to_glib_none().0), "Failed to remove session from pool")
}
}
fn set_max_sessions(&self, max: u32) {
unsafe {
ffi::gst_rtsp_session_pool_set_max_sessions(self.to_glib_none().0, max);
}
}
fn connect_session_removed<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPSession) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "session-removed",
transmute(session_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_max_sessions_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::max-sessions",
transmute(notify_max_sessions_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn session_removed_trampoline<P>(this: *mut ffi::GstRTSPSessionPool, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer)
where P: IsA<RTSPSessionPool> {
callback_guard!();
let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f);
f(&RTSPSessionPool::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn notify_max_sessions_trampoline<P>(this: *mut ffi::GstRTSPSessionPool, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPSessionPool> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPSessionPool::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,591 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPAddress;
use RTSPAddressPool;
use RTSPPublishClockMode;
use RTSPStreamTransport;
use ffi;
use gio;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use gst_rtsp;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPStream(Object<ffi::GstRTSPStream, ffi::GstRTSPStreamClass>);
match fn {
get_type => || ffi::gst_rtsp_stream_get_type(),
}
}
impl RTSPStream {
pub fn new<P: IsA<gst::Element>, Q: IsA<gst::Pad>>(idx: u32, payloader: &P, pad: &Q) -> RTSPStream {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_stream_new(idx, payloader.to_glib_none().0, pad.to_glib_none().0))
}
}
}
unsafe impl Send for RTSPStream {}
unsafe impl Sync for RTSPStream {}
pub trait RTSPStreamExt {
fn add_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError>;
//fn allocate_udp_sockets(&self, family: gio::SocketFamily, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport, use_client_setttings: bool) -> bool;
fn get_address_pool(&self) -> Option<RTSPAddressPool>;
fn get_buffer_size(&self) -> u32;
fn get_caps(&self) -> Option<gst::Caps>;
fn get_control(&self) -> Option<String>;
fn get_current_seqnum(&self) -> u16;
fn get_dscp_qos(&self) -> i32;
fn get_index(&self) -> u32;
fn get_joined_bin(&self) -> Option<gst::Bin>;
fn get_mtu(&self) -> u32;
fn get_multicast_address(&self, family: gio::SocketFamily) -> Option<RTSPAddress>;
fn get_multicast_iface(&self) -> Option<String>;
fn get_profiles(&self) -> gst_rtsp::RTSPProfile;
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans;
fn get_pt(&self) -> u32;
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode;
fn get_retransmission_pt(&self) -> u32;
fn get_retransmission_time(&self) -> gst::ClockTime;
fn get_rtcp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket>;
fn get_rtp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket>;
fn get_rtpinfo(&self) -> Option<(u32, u32, u32, gst::ClockTime)>;
fn get_rtpsession(&self) -> Option<glib::Object>;
//fn get_server_port(&self, server_port: /*Ignored*/gst_rtsp::RTSPRange, family: gio::SocketFamily);
fn get_sinkpad(&self) -> Option<gst::Pad>;
fn get_srcpad(&self) -> Option<gst::Pad>;
fn get_srtp_encoder(&self) -> Option<gst::Element>;
fn get_ssrc(&self) -> u32;
fn has_control<'a, P: Into<Option<&'a str>>>(&self, control: P) -> bool;
fn is_blocking(&self) -> bool;
fn is_client_side(&self) -> bool;
//fn is_transport_supported(&self, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> bool;
fn join_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q, state: gst::State) -> Result<(), glib::error::BoolError>;
fn leave_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError>;
fn recv_rtcp(&self, buffer: &gst::Buffer) -> gst::FlowReturn;
fn recv_rtp(&self, buffer: &gst::Buffer) -> gst::FlowReturn;
fn remove_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError>;
fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element>;
fn reserve_address(&self, address: &str, port: u32, n_ports: u32, ttl: u32) -> Option<RTSPAddress>;
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P);
fn set_blocked(&self, blocked: bool) -> bool;
fn set_buffer_size(&self, size: u32);
fn set_client_side(&self, client_side: bool);
fn set_control<'a, P: Into<Option<&'a str>>>(&self, control: P);
fn set_dscp_qos(&self, dscp_qos: i32);
fn set_mtu(&self, mtu: u32);
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P);
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile);
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans);
fn set_pt_map(&self, pt: u32, caps: &gst::Caps);
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode);
fn set_retransmission_pt(&self, rtx_pt: u32);
fn set_retransmission_time(&self, time: gst::ClockTime);
fn set_seqnum_offset(&self, seqnum: u16);
//fn transport_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPStreamTransportFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPStreamTransport>;
fn update_crypto<'a, P: Into<Option<&'a gst::Caps>>>(&self, ssrc: u32, crypto: P) -> bool;
fn connect_new_rtcp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_new_rtp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_control_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPStream> + IsA<glib::object::Object>> RTSPStreamExt for O {
fn add_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_stream_add_transport(self.to_glib_none().0, trans.to_glib_none().0), "Failed to add transport")
}
}
//fn allocate_udp_sockets(&self, family: gio::SocketFamily, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport, use_client_setttings: bool) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_stream_allocate_udp_sockets() }
//}
fn get_address_pool(&self) -> Option<RTSPAddressPool> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_address_pool(self.to_glib_none().0))
}
}
fn get_buffer_size(&self) -> u32 {
unsafe {
ffi::gst_rtsp_stream_get_buffer_size(self.to_glib_none().0)
}
}
fn get_caps(&self) -> Option<gst::Caps> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_caps(self.to_glib_none().0))
}
}
fn get_control(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_control(self.to_glib_none().0))
}
}
fn get_current_seqnum(&self) -> u16 {
unsafe {
ffi::gst_rtsp_stream_get_current_seqnum(self.to_glib_none().0)
}
}
fn get_dscp_qos(&self) -> i32 {
unsafe {
ffi::gst_rtsp_stream_get_dscp_qos(self.to_glib_none().0)
}
}
fn get_index(&self) -> u32 {
unsafe {
ffi::gst_rtsp_stream_get_index(self.to_glib_none().0)
}
}
fn get_joined_bin(&self) -> Option<gst::Bin> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_joined_bin(self.to_glib_none().0))
}
}
fn get_mtu(&self) -> u32 {
unsafe {
ffi::gst_rtsp_stream_get_mtu(self.to_glib_none().0)
}
}
fn get_multicast_address(&self, family: gio::SocketFamily) -> Option<RTSPAddress> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_multicast_address(self.to_glib_none().0, family.to_glib()))
}
}
fn get_multicast_iface(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_multicast_iface(self.to_glib_none().0))
}
}
fn get_profiles(&self) -> gst_rtsp::RTSPProfile {
unsafe {
from_glib(ffi::gst_rtsp_stream_get_profiles(self.to_glib_none().0))
}
}
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans {
unsafe {
from_glib(ffi::gst_rtsp_stream_get_protocols(self.to_glib_none().0))
}
}
fn get_pt(&self) -> u32 {
unsafe {
ffi::gst_rtsp_stream_get_pt(self.to_glib_none().0)
}
}
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode {
unsafe {
from_glib(ffi::gst_rtsp_stream_get_publish_clock_mode(self.to_glib_none().0))
}
}
fn get_retransmission_pt(&self) -> u32 {
unsafe {
ffi::gst_rtsp_stream_get_retransmission_pt(self.to_glib_none().0)
}
}
fn get_retransmission_time(&self) -> gst::ClockTime {
unsafe {
from_glib(ffi::gst_rtsp_stream_get_retransmission_time(self.to_glib_none().0))
}
}
fn get_rtcp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtcp_socket(self.to_glib_none().0, family.to_glib()))
}
}
fn get_rtp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtp_socket(self.to_glib_none().0, family.to_glib()))
}
}
fn get_rtpinfo(&self) -> Option<(u32, u32, u32, gst::ClockTime)> {
unsafe {
let mut rtptime = mem::uninitialized();
let mut seq = mem::uninitialized();
let mut clock_rate = mem::uninitialized();
let mut running_time = mem::uninitialized();
let ret = from_glib(ffi::gst_rtsp_stream_get_rtpinfo(self.to_glib_none().0, &mut rtptime, &mut seq, &mut clock_rate, &mut running_time));
if ret { Some((rtptime, seq, clock_rate, from_glib(running_time))) } else { None }
}
}
fn get_rtpsession(&self) -> Option<glib::Object> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtpsession(self.to_glib_none().0))
}
}
//fn get_server_port(&self, server_port: /*Ignored*/gst_rtsp::RTSPRange, family: gio::SocketFamily) {
// unsafe { TODO: call ffi::gst_rtsp_stream_get_server_port() }
//}
fn get_sinkpad(&self) -> Option<gst::Pad> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_sinkpad(self.to_glib_none().0))
}
}
fn get_srcpad(&self) -> Option<gst::Pad> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_srcpad(self.to_glib_none().0))
}
}
fn get_srtp_encoder(&self) -> Option<gst::Element> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_srtp_encoder(self.to_glib_none().0))
}
}
fn get_ssrc(&self) -> u32 {
unsafe {
let mut ssrc = mem::uninitialized();
ffi::gst_rtsp_stream_get_ssrc(self.to_glib_none().0, &mut ssrc);
ssrc
}
}
fn has_control<'a, P: Into<Option<&'a str>>>(&self, control: P) -> bool {
let control = control.into();
let control = control.to_glib_none();
unsafe {
from_glib(ffi::gst_rtsp_stream_has_control(self.to_glib_none().0, control.0))
}
}
fn is_blocking(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_stream_is_blocking(self.to_glib_none().0))
}
}
fn is_client_side(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_stream_is_client_side(self.to_glib_none().0))
}
}
//fn is_transport_supported(&self, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> bool {
// unsafe { TODO: call ffi::gst_rtsp_stream_is_transport_supported() }
//}
fn join_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q, state: gst::State) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_stream_join_bin(self.to_glib_none().0, bin.to_glib_none().0, rtpbin.to_glib_none().0, state.to_glib()), "Failed to join bin")
}
}
fn leave_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_stream_leave_bin(self.to_glib_none().0, bin.to_glib_none().0, rtpbin.to_glib_none().0), "Failed to leave bin")
}
}
fn recv_rtcp(&self, buffer: &gst::Buffer) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_rtsp_stream_recv_rtcp(self.to_glib_none().0, buffer.to_glib_full()))
}
}
fn recv_rtp(&self, buffer: &gst::Buffer) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_rtsp_stream_recv_rtp(self.to_glib_none().0, buffer.to_glib_full()))
}
}
fn remove_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_stream_remove_transport(self.to_glib_none().0, trans.to_glib_none().0), "Failed to remove transport")
}
}
fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_request_aux_sender(self.to_glib_none().0, sessid))
}
}
fn reserve_address(&self, address: &str, port: u32, n_ports: u32, ttl: u32) -> Option<RTSPAddress> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_reserve_address(self.to_glib_none().0, address.to_glib_none().0, port, n_ports, ttl))
}
}
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P) {
let pool = pool.into();
let pool = pool.to_glib_none();
unsafe {
ffi::gst_rtsp_stream_set_address_pool(self.to_glib_none().0, pool.0);
}
}
fn set_blocked(&self, blocked: bool) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_stream_set_blocked(self.to_glib_none().0, blocked.to_glib()))
}
}
fn set_buffer_size(&self, size: u32) {
unsafe {
ffi::gst_rtsp_stream_set_buffer_size(self.to_glib_none().0, size);
}
}
fn set_client_side(&self, client_side: bool) {
unsafe {
ffi::gst_rtsp_stream_set_client_side(self.to_glib_none().0, client_side.to_glib());
}
}
fn set_control<'a, P: Into<Option<&'a str>>>(&self, control: P) {
let control = control.into();
let control = control.to_glib_none();
unsafe {
ffi::gst_rtsp_stream_set_control(self.to_glib_none().0, control.0);
}
}
fn set_dscp_qos(&self, dscp_qos: i32) {
unsafe {
ffi::gst_rtsp_stream_set_dscp_qos(self.to_glib_none().0, dscp_qos);
}
}
fn set_mtu(&self, mtu: u32) {
unsafe {
ffi::gst_rtsp_stream_set_mtu(self.to_glib_none().0, mtu);
}
}
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) {
let multicast_iface = multicast_iface.into();
let multicast_iface = multicast_iface.to_glib_none();
unsafe {
ffi::gst_rtsp_stream_set_multicast_iface(self.to_glib_none().0, multicast_iface.0);
}
}
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
unsafe {
ffi::gst_rtsp_stream_set_profiles(self.to_glib_none().0, profiles.to_glib());
}
}
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
unsafe {
ffi::gst_rtsp_stream_set_protocols(self.to_glib_none().0, protocols.to_glib());
}
}
fn set_pt_map(&self, pt: u32, caps: &gst::Caps) {
unsafe {
ffi::gst_rtsp_stream_set_pt_map(self.to_glib_none().0, pt, caps.to_glib_none().0);
}
}
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
unsafe {
ffi::gst_rtsp_stream_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib());
}
}
fn set_retransmission_pt(&self, rtx_pt: u32) {
unsafe {
ffi::gst_rtsp_stream_set_retransmission_pt(self.to_glib_none().0, rtx_pt);
}
}
fn set_retransmission_time(&self, time: gst::ClockTime) {
unsafe {
ffi::gst_rtsp_stream_set_retransmission_time(self.to_glib_none().0, time.to_glib());
}
}
fn set_seqnum_offset(&self, seqnum: u16) {
unsafe {
ffi::gst_rtsp_stream_set_seqnum_offset(self.to_glib_none().0, seqnum);
}
}
//fn transport_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPStreamTransportFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPStreamTransport> {
// unsafe { TODO: call ffi::gst_rtsp_stream_transport_filter() }
//}
fn update_crypto<'a, P: Into<Option<&'a gst::Caps>>>(&self, ssrc: u32, crypto: P) -> bool {
let crypto = crypto.into();
let crypto = crypto.to_glib_none();
unsafe {
from_glib(ffi::gst_rtsp_stream_update_crypto(self.to_glib_none().0, ssrc, crypto.0))
}
}
fn connect_new_rtcp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "new-rtcp-encoder",
transmute(new_rtcp_encoder_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_new_rtp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "new-rtp-encoder",
transmute(new_rtp_encoder_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_control_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::control",
transmute(notify_control_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::profiles",
transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::protocols",
transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn new_rtcp_encoder_trampoline<P>(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> {
callback_guard!();
let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn new_rtp_encoder_trampoline<P>(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> {
callback_guard!();
let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}
unsafe extern "C" fn notify_control_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,147 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPStream;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_rtsp;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPStreamTransport(Object<ffi::GstRTSPStreamTransport, ffi::GstRTSPStreamTransportClass>);
match fn {
get_type => || ffi::gst_rtsp_stream_transport_get_type(),
}
}
impl RTSPStreamTransport {
//pub fn new(stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> RTSPStreamTransport {
// unsafe { TODO: call ffi::gst_rtsp_stream_transport_new() }
//}
}
pub trait RTSPStreamTransportExt {
fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option<String>;
fn get_stream(&self) -> Option<RTSPStream>;
//fn get_transport(&self) -> /*Ignored*/Option<gst_rtsp::RTSPTransport>;
fn get_url(&self) -> Option<gst_rtsp::RTSPUrl>;
fn is_timed_out(&self) -> bool;
fn keep_alive(&self);
fn recv_data(&self, channel: u32, buffer: &gst::Buffer) -> gst::FlowReturn;
fn send_rtcp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError>;
fn send_rtp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError>;
fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError>;
//fn set_callbacks<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, send_rtp: /*Unknown conversion*//*Unimplemented*/RTSPSendFunc, send_rtcp: /*Unknown conversion*//*Unimplemented*/RTSPSendFunc, user_data: P, notify: Q);
//fn set_keepalive<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, keep_alive: /*Unknown conversion*//*Unimplemented*/RTSPKeepAliveFunc, user_data: P, notify: Q);
fn set_timed_out(&self, timedout: bool);
//fn set_transport(&self, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport);
fn set_url<'a, P: Into<Option<&'a gst_rtsp::RTSPUrl>>>(&self, url: P);
}
impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O {
fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_stream_transport_get_rtpinfo(self.to_glib_none().0, start_time.to_glib()))
}
}
fn get_stream(&self) -> Option<RTSPStream> {
unsafe {
from_glib_none(ffi::gst_rtsp_stream_transport_get_stream(self.to_glib_none().0))
}
}
//fn get_transport(&self) -> /*Ignored*/Option<gst_rtsp::RTSPTransport> {
// unsafe { TODO: call ffi::gst_rtsp_stream_transport_get_transport() }
//}
fn get_url(&self) -> Option<gst_rtsp::RTSPUrl> {
unsafe {
from_glib_none(ffi::gst_rtsp_stream_transport_get_url(self.to_glib_none().0))
}
}
fn is_timed_out(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_stream_transport_is_timed_out(self.to_glib_none().0))
}
}
fn keep_alive(&self) {
unsafe {
ffi::gst_rtsp_stream_transport_keep_alive(self.to_glib_none().0);
}
}
fn recv_data(&self, channel: u32, buffer: &gst::Buffer) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_rtsp_stream_transport_recv_data(self.to_glib_none().0, channel, buffer.to_glib_full()))
}
}
fn send_rtcp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_stream_transport_send_rtcp(self.to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtcp")
}
}
fn send_rtp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_stream_transport_send_rtp(self.to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtp")
}
}
fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_stream_transport_set_active(self.to_glib_none().0, active.to_glib()), "Failed to set active")
}
}
//fn set_callbacks<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, send_rtp: /*Unknown conversion*//*Unimplemented*/RTSPSendFunc, send_rtcp: /*Unknown conversion*//*Unimplemented*/RTSPSendFunc, user_data: P, notify: Q) {
// unsafe { TODO: call ffi::gst_rtsp_stream_transport_set_callbacks() }
//}
//fn set_keepalive<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, keep_alive: /*Unknown conversion*//*Unimplemented*/RTSPKeepAliveFunc, user_data: P, notify: Q) {
// unsafe { TODO: call ffi::gst_rtsp_stream_transport_set_keepalive() }
//}
fn set_timed_out(&self, timedout: bool) {
unsafe {
ffi::gst_rtsp_stream_transport_set_timed_out(self.to_glib_none().0, timedout.to_glib());
}
}
//fn set_transport(&self, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) {
// unsafe { TODO: call ffi::gst_rtsp_stream_transport_set_transport() }
//}
fn set_url<'a, P: Into<Option<&'a gst_rtsp::RTSPUrl>>>(&self, url: P) {
let url = url.into();
let url = url.to_glib_none();
unsafe {
ffi::gst_rtsp_stream_transport_set_url(self.to_glib_none().0, url.0);
}
}
}

View file

@ -0,0 +1,93 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct RTSPThreadPool(Object<ffi::GstRTSPThreadPool, ffi::GstRTSPThreadPoolClass>);
match fn {
get_type => || ffi::gst_rtsp_thread_pool_get_type(),
}
}
impl RTSPThreadPool {
pub fn new() -> RTSPThreadPool {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_rtsp_thread_pool_new())
}
}
pub fn cleanup() {
assert_initialized_main_thread!();
unsafe {
ffi::gst_rtsp_thread_pool_cleanup();
}
}
}
impl Default for RTSPThreadPool {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPThreadPool {}
unsafe impl Sync for RTSPThreadPool {}
pub trait RTSPThreadPoolExt {
fn get_max_threads(&self) -> i32;
//fn get_thread(&self, type_: RTSPThreadType, ctx: /*Ignored*/&mut RTSPContext) -> /*Ignored*/Option<RTSPThread>;
fn set_max_threads(&self, max_threads: i32);
fn connect_property_max_threads_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<RTSPThreadPool> + IsA<glib::object::Object>> RTSPThreadPoolExt for O {
fn get_max_threads(&self) -> i32 {
unsafe {
ffi::gst_rtsp_thread_pool_get_max_threads(self.to_glib_none().0)
}
}
//fn get_thread(&self, type_: RTSPThreadType, ctx: /*Ignored*/&mut RTSPContext) -> /*Ignored*/Option<RTSPThread> {
// unsafe { TODO: call ffi::gst_rtsp_thread_pool_get_thread() }
//}
fn set_max_threads(&self, max_threads: i32) {
unsafe {
ffi::gst_rtsp_thread_pool_set_max_threads(self.to_glib_none().0, max_threads);
}
}
fn connect_property_max_threads_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::max-threads",
transmute(notify_max_threads_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_max_threads_trampoline<P>(this: *mut ffi::GstRTSPThreadPool, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPThreadPool> {
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPThreadPool::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -0,0 +1,77 @@
// Copyright (C) 2018 Mathieu Duponchelle <mathieu@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;
extern crate libc;
#[macro_use]
extern crate glib;
extern crate glib_sys as glib_ffi;
extern crate gio;
extern crate gio_sys as gio_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer as gst;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_rtsp as gst_rtsp;
extern crate gstreamer_rtsp_sys as gst_rtsp_ffi;
extern crate gstreamer_net as gst_net;
extern crate gstreamer_net_sys as gst_net_ffi;
extern crate gstreamer_rtsp_server_sys as ffi;
macro_rules! callback_guard {
() => (
let _guard = ::glib::CallbackGuard::new();
)
}
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::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};
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
mod auto;
pub use auto::*;
mod r_t_s_p_server;
mod r_t_s_p_address_pool;
mod r_t_s_p_client;
mod r_t_s_p_session_pool;
pub use r_t_s_p_server::RTSPServerExtManual;
pub use r_t_s_p_address_pool::RTSPAddressPoolExtManual;
pub use r_t_s_p_client::RTSPClientExtManual;
pub use r_t_s_p_session_pool::RTSPSessionPoolExtManual;
// 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::*;
pub use r_t_s_p_server::RTSPServerExtManual;
pub use r_t_s_p_address_pool::RTSPAddressPoolExtManual;
pub use r_t_s_p_client::RTSPClientExtManual;
pub use r_t_s_p_session_pool::RTSPSessionPoolExtManual;
}

View file

@ -0,0 +1,24 @@
use RTSPAddress;
use RTSPAddressPool;
use RTSPAddressPoolResult;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use std::ptr;
pub trait RTSPAddressPoolExtManual {
fn reserve_address(&self, ip_address: &str, port: u32, n_ports: u32, ttl: u32) -> Result<RTSPAddress, RTSPAddressPoolResult>;
}
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {
fn reserve_address(&self, ip_address: &str, port: u32, n_ports: u32, ttl: u32) -> Result<RTSPAddress, RTSPAddressPoolResult> {
unsafe {
let mut address = ptr::null_mut();
let ret = from_glib(ffi::gst_rtsp_address_pool_reserve_address(self.to_glib_none().0, ip_address.to_glib_none().0, port, n_ports, ttl, &mut address));
match ret {
RTSPAddressPoolResult::Ok => Ok(from_glib_full(address)),
_ => Err(ret)
}
}
}
}

View file

@ -0,0 +1,20 @@
use RTSPClient;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib::source::SourceId;
pub trait RTSPClientExtManual {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId;
}
impl<O: IsA<RTSPClient>> RTSPClientExtManual for O {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId {
let context = context.into();
let context = context.to_glib_none();
unsafe {
from_glib(ffi::gst_rtsp_client_attach(self.to_glib_none().0, context.0))
}
}
}

View file

@ -0,0 +1,20 @@
use RTSPServer;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib::source::SourceId;
pub trait RTSPServerExtManual {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId;
}
impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId {
let context = context.into();
let context = context.to_glib_none();
unsafe {
from_glib(ffi::gst_rtsp_server_attach(self.to_glib_none().0, context.0))
}
}
}

View file

@ -0,0 +1,77 @@
use std::cell::RefCell;
use std::mem::transmute;
use RTSPSessionPool;
use ffi;
use glib;
use glib_ffi;
use glib::object::IsA;
use glib::translate::*;
use glib::source::{CallbackGuard, Continue, Priority};
use glib_ffi::{gboolean, gpointer};
unsafe extern "C" fn trampoline_watch(
pool: *mut ffi::GstRTSPSessionPool,
func: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &RefCell<Box<FnMut(&RTSPSessionPool) -> Continue + Send + 'static>> = transmute(func);
(&mut *func.borrow_mut())(&from_glib_borrow(pool)).to_glib()
}
unsafe extern "C" fn destroy_closure_watch(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<RefCell<Box<FnMut(&RTSPSessionPool) -> Continue + Send + 'static>>>::from_raw(
ptr as *mut _,
);
}
fn into_raw_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(func: F) -> gpointer {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
let func: Box<RefCell<Box<FnMut(&RTSPSessionPool) -> Continue + Send + 'static>>> =
Box::new(RefCell::new(Box::new(func)));
Box::into_raw(func) as gpointer
}
pub trait RTSPSessionPoolExtManual {
fn create_watch<'a, N: Into<Option<&'a str>>, F>(
&self,
name: N,
priority: Priority,
func: F,
) -> glib::Source
where
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static;
}
impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
fn create_watch<'a, N: Into<Option<&'a str>>, F>(
&self,
name: N,
priority: Priority,
func: F,
) -> glib::Source
where
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static
{
skip_assert_initialized!();
unsafe {
let source = ffi::gst_rtsp_session_pool_create_watch(self.to_glib_none().0);
let trampoline = trampoline_watch as gpointer;
glib_ffi::g_source_set_callback(
source,
Some(transmute(trampoline)),
into_raw_watch(func),
Some(destroy_closure_watch),
);
glib_ffi::g_source_set_priority(source, priority.to_glib());
let name = name.into();
if let Some(name) = name {
glib_ffi::g_source_set_name(source, name.to_glib_none().0);
}
from_glib_full(source)
}
}
}

218
gstreamer-rtsp/CHANGELOG.md Normal file
View file

@ -0,0 +1,218 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.10.1] - 2018-01-03
### Fixed
- Don't require &mut self for TagSetterExtManual::add()
### Added
- A TagSetter example application
- Bindings for gst_video::convert_sample() and ::convert_sample_async()
- Bindings for gst_video::VideoRectangle
- Debug impl for Sample and ::with_buffer_list() constructor
- A borrowing version of VideoFrame: VideoFrameRef
- Bindings for GstVideoFilter
### Changed
- Deprecated Sample::get_info() in favour of ::get_structure()
- Player has gst::Object as another parent class now
## [0.10.0] - 2017-12-22
### Fixed
- Various clippy warnings
- Memory leak of the tag list in Toc::merge_tags()
- Property getters use Values of the correct type
- Event::get_structure(), Message::get_structure() and
Query::get_structure() can return None for the structure
- Various other nullability fixes all over the API, changing functions to
accept Option<> or returning Option<>, or only plain types
- Functions taking paths/filenames now actually take Paths instead of &strs
- Element::remove_pad() is not giving away a new reference to the pad
anymore, which caused a memory leak of all pads ever removed
- Precision handling in ClockTime's Display impl
- Video/AudioInfo are only Send, not Sync
### Added
- Various enums now also derive useful traits like Copy, Clone and Hash in
addition to PartialEq, Eq and Debug
- TagList::merge() and insert() for combining tag lists
- EventType gained many useful functions to work with event types and
a PartialOrd impl to check expected event order of event types where it matters
- MessageRef/EventRef/QueryRef implement ToOwned
- Bindings for Registry and PluginFeature
- Event::set_running_time_offset() for adjusting the offset while events
pass through the pipeline
- Event/Message GroupIds and Seqnums now have a newtype wrapper around u32
instead of the plain value, making usage of them slightly more typesafe.
Also add an "invalid" value for both, as exists in latest GStreamer now.
- FormattedValue, GenericFormattedValue and related types were
implemented now, which allows more convenient and type-safe usage of
formatted values (time, bytes, etc)
- Bindings for force-keyunit and still-frame events were added
- MappedBuffer/BufferMap now implement various other useful traits, including
AsRef<[u8]>, AsMut, Deref, DerefMut, Debug, PartialEq and Eq
- Add VideoMultiviewFramePacking enum, and use it in Player
- Bindings for the GStreamer Net library, including PTP/NTP/network client
clocks and the GStreamer NetClock provider for network synchronization of
pipelines
- IteratorError implements std::error:Error
- Plugin::add_dependency() and ::add_dependency_simple() was added
- Rank and TypeFindProbability implement PartialOrd/Ord now
- Bindings for TypeFind, TypeFindFactory and the typefind helpers
- StreamCollection::iter() for iterating over all contained streams
- ErrorMessage type that can be used e.g. in a Result for passing an error
message from somewhere to upper layers to then be posted on an element the
same way gst_element_error!() would've done
### Changed
- Sample::new(), TagList::add(), Structure::set() and similar
functions take the values (ToSendValue impls) by reference instead of value.
They were not consumed by the function before.
- The Debug impls of various types, including Event/Buffer/Message/Query/Structure
were improved to print all the fields, similar to what GST_PTR_FORMAT would
do in C
- Switched to lazy_static 1.0
- Gap event and Duration tag are using ClockTimes now, as well as various
Player signals
- Segment is now based on a generic type FormattedSegment that can
take any format (time, bytes, etc) or a GenericFormattedValue for more
type-safety and convenience. Also functions for "casting" between a generic
segment and a segment with a specific format exist on this now
- AppSrc and AppSink now have a builder for the callbacks, making it
unnecessary to always provide all callbacks even if only one is actually
needed
- Various functions that returned bool for errors, are now returning a Result
- Player configuration is now a custom type with more convenient API
- Player VideoInfo uses a Fraction instead of (u32,u32) for the framerate and
pixel-aspect-ratio
- VideoFrame API has more consistent API between writable and read-only
variants
- Buffer::copy_into() was added, and ::copy_region() now takes a
BufferCopyFlags parameter instead of always using the default flags
- ChildProxy::set_child_property() takes a &ToValue now to follow the API of
Object::set_property() and improve usability
- Proxy/GhostPad default pad functions use the correct specific pad type now
instead of a generic Pad
- Bus::add_signal_watch_full() takes a Priority for the priority instead of u32
- Clock::(un)adjust_with_calibration() takes no clock parameter anymore
### Removed
- FormatValue was removed in favour of GenericFormattedValue and the
connected traits and specific format impls
## [0.9.1] - 2017-11-26
### Fixed
- Export `FlowError`/`FlowSuccess`, `ClockError`/`ClockSuccess`,
`PadLinkError`/`PadLinkSuccess` too
## [0.9.0] - 2017-11-26
### Added
- Bindings for (outputting to) the GStreamer logging system
- Bindings for the GStreamer base library
- Bindings for all the `Pad` functions to override pad behaviour, and pad task
functions
- Bindings for `StaticCaps` and `StaticPadTemplate`
- Bindings for `deep-notify` signal on `Object`
- Support for directly creating `Error`/`Warning`/`Info` `Messages` and posting them
from an element with context information (file, line, module, etc.) similar
to the C `GST_ELEMENT_ERROR` macro
- Support for setting custom fields in `Messages`/`Events` during construction
- Support for creating Buffers out of anything that is `AsRef<[u8]>` or
`AsMut<[u8]>`
- Support for using the `Read` trait on `Adapter`
- Functions for getting all sink/src/all pads of an `Element`, and all children
of a `Bin`
- Builder for `Caps` and `Structures` in addition to the existing functions
- `AppSrc`/`AppSink` implement `BaseSrc`/`BaseSink` and `URIHandler`
- Rust ports of the basic tutorials 1 to 8 from
https://gstreamer.freedesktop.org/documentation/tutorials/
- "Getting started" and "Installation" sections to the README.md
- "dox" feature for generating documentation for all available configurations
### Fixed
- `StackTraceFlags` are only available since 1.12
- Worked around macOS requiring a `NSRunLoop` running on the main thread in all
examples and tutorials, to be able to show a window or anything else
### Changed
- `ClockTime` is now a wrapper around `Option<u64>` to handle the
`CLOCK_TIME_NONE` case better. This wrapper implements all the arithmetic
and other traits as needed and ensures that no accidential calculations with
`CLOCK_TIME_NONE` can happen
- "Values with format", like in `Duration`/`Position`/`Convert` queries or
`Seek` events now return a `FormatValue` type. This contains the actual
`Format` together with the value and does any required conversions. This
also makes it harder to accidentially mix e.g. values in bytes and time
- `PadProbeId` does not implement `Clone`/`Copy` anymore
- Property notify watches return a custom type instead of ulong
- `Error`/`Warning`/`Info` `Messages` can only be created with specific kinds of
`glib::Error` now. Using arbitrary ones does not work
- `Iterator` bindings were completely rewritten and provide the item type as a
generic type parameter now, greatly simplifying its usage
- All `glib::Values` are now `glib::SendValue` instead, e.g. in `Caps` and
`Structures`, as their content must be possible to send to different threads
safely
- `Message::get_src()` can return `None`
- Allow `None` as `Caps` in `AppSrc`/`AppSink`
- Allow everything implementing `Into<Option<&str>>` to be used as a pad name
- Moved `copy()` from `GstRc` directly to `MiniObject`
- Success/Error enums (like `FlowReturn`, `PadLinkReturn`, `StateChangeReturn`) now
implement an `into_result()` function that splits them into a `Result` with
the good and bad cases. Also mark them as `#[must_use]` to make it harder to
accidentially ignore errors.
- Error enums implement the `Error` trait
- Many examples use the `failure` crate for error handling now, cleaning up the
error handling code quite a bit
- Lots of other code cleanup, compiler/clippy warning cleanup, etc.
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.10.1...HEAD
[0.10.1]: https://github.com/sdroege/gstreamer-rs/compare/0.10.0...0.10.1
[0.10.0]: https://github.com/sdroege/gstreamer-rs/compare/0.9.1...0.10.0
[0.9.1]: https://github.com/sdroege/gstreamer-rs/compare/0.9.0...0.9.1
[0.9.0]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...0.9.0
[0.8.2]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...0.8.2
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

42
gstreamer-rtsp/Cargo.toml Normal file
View file

@ -0,0 +1,42 @@
[package]
name = "gstreamer-rtsp"
version = "0.11.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>", "Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Rtsp library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_rtsp"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
gio-sys = { git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-rtsp-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-sdp-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { git = "https://github.com/gtk-rs/glib" }
gio = { git = "https://github.com/gtk-rs/gio" }
gstreamer = { path = "../gstreamer" }
gstreamer-sdp = { path = "../gstreamer-sdp" }
[build-dependencies.rustdoc-stripper]
version = "0.1"
optional = true
[features]
v1_10 = ["gstreamer-sys/v1_10", "gstreamer-rtsp-sys/v1_10", "gstreamer-sdp-sys/v1_10"]
v1_12 = ["gstreamer-sys/v1_12", "gstreamer-rtsp-sys/v1_12", "gstreamer-sdp-sys/v1_12", "v1_10"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
dox = ["gstreamer-rtsp-sys/dox", "glib/dox", "gstreamer/dox"]
default-features = []
[badges]
travis-ci = { repository = "sdroege/gstreamer-rs", branch = "master" }

View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

170
gstreamer-rtsp/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-sdp.svg)](https://crates.io/crates/gstreamer-sdp) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (Sdp library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## Table of Contents
1. [Installation](#installation)
1. [Linux/BSDs](#installation-linux)
1. [macOS](#installation-macos)
1. [Windows](#installation-windows)
1. [Getting Started](#getting-started)
1. [License](#license)
1. [Contribution](#contribution)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 installed. In addition,
some of the examples/tutorials require various GStreamer plugins to be
available, which can be found in gst-plugins-base, gst-plugins-good,
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
<a name="installation-linux"/>
### Linux/BSDs
You need to install the above mentioned packages with your distributions
package manager, or build them from source.
On Debian/Ubuntu they can be installed with
```
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### macOS
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
#### MSYS2 / pacman
```
$ pacman -S pkg-config mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/), however it is
only the Rust API reference and does not explain any of the concepts.
For getting started with GStreamer development, the best would be to follow
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
GStreamer website, especially the [Application Development
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
While being C-centric, it explains all the fundamental concepts of GStreamer
and the code examples should be relatively easily translatable to Rust. The
API is basically the same, function/struct names are the same and everything
is only more convenient (hopefully) and safer.
In addition there are
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
GStreamer website. Many of them were ported to Rust already and the code can
be found in the
[tutorials](https://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

34
gstreamer-rtsp/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-rtsp/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() {}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,274 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use gobject_ffi;
bitflags! {
pub struct RTSPEvent: u32 {
const READ = 1;
const WRITE = 2;
}
}
#[doc(hidden)]
impl ToGlib for RTSPEvent {
type GlibType = ffi::GstRTSPEvent;
fn to_glib(&self) -> ffi::GstRTSPEvent {
ffi::GstRTSPEvent::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPEvent> for RTSPEvent {
fn from_glib(value: ffi::GstRTSPEvent) -> RTSPEvent {
skip_assert_initialized!();
RTSPEvent::from_bits_truncate(value.bits())
}
}
impl StaticType for RTSPEvent {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_event_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPEvent {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPEvent {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstRTSPEvent::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for RTSPEvent {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct RTSPLowerTrans: u32 {
const UNKNOWN = 0;
const UDP = 1;
const UDP_MCAST = 2;
const TCP = 4;
const HTTP = 16;
const TLS = 32;
}
}
#[doc(hidden)]
impl ToGlib for RTSPLowerTrans {
type GlibType = ffi::GstRTSPLowerTrans;
fn to_glib(&self) -> ffi::GstRTSPLowerTrans {
ffi::GstRTSPLowerTrans::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPLowerTrans> for RTSPLowerTrans {
fn from_glib(value: ffi::GstRTSPLowerTrans) -> RTSPLowerTrans {
skip_assert_initialized!();
RTSPLowerTrans::from_bits_truncate(value.bits())
}
}
impl StaticType for RTSPLowerTrans {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_lower_trans_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPLowerTrans {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPLowerTrans {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstRTSPLowerTrans::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for RTSPLowerTrans {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct RTSPMethod: u32 {
const INVALID = 0;
const DESCRIBE = 1;
const ANNOUNCE = 2;
const GET_PARAMETER = 4;
const OPTIONS = 8;
const PAUSE = 16;
const PLAY = 32;
const RECORD = 64;
const REDIRECT = 128;
const SETUP = 256;
const SET_PARAMETER = 512;
const TEARDOWN = 1024;
const GET = 2048;
const POST = 4096;
}
}
#[doc(hidden)]
impl ToGlib for RTSPMethod {
type GlibType = ffi::GstRTSPMethod;
fn to_glib(&self) -> ffi::GstRTSPMethod {
ffi::GstRTSPMethod::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPMethod> for RTSPMethod {
fn from_glib(value: ffi::GstRTSPMethod) -> RTSPMethod {
skip_assert_initialized!();
RTSPMethod::from_bits_truncate(value.bits())
}
}
impl StaticType for RTSPMethod {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_method_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPMethod {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPMethod {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstRTSPMethod::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for RTSPMethod {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct RTSPProfile: u32 {
const UNKNOWN = 0;
const AVP = 1;
const SAVP = 2;
const AVPF = 4;
const SAVPF = 8;
}
}
#[doc(hidden)]
impl ToGlib for RTSPProfile {
type GlibType = ffi::GstRTSPProfile;
fn to_glib(&self) -> ffi::GstRTSPProfile {
ffi::GstRTSPProfile::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPProfile> for RTSPProfile {
fn from_glib(value: ffi::GstRTSPProfile) -> RTSPProfile {
skip_assert_initialized!();
RTSPProfile::from_bits_truncate(value.bits())
}
}
impl StaticType for RTSPProfile {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_profile_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPProfile {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPProfile {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstRTSPProfile::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for RTSPProfile {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct RTSPTransMode: u32 {
const UNKNOWN = 0;
const RTP = 1;
const RDT = 2;
}
}
#[doc(hidden)]
impl ToGlib for RTSPTransMode {
type GlibType = ffi::GstRTSPTransMode;
fn to_glib(&self) -> ffi::GstRTSPTransMode {
ffi::GstRTSPTransMode::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstRTSPTransMode> for RTSPTransMode {
fn from_glib(value: ffi::GstRTSPTransMode) -> RTSPTransMode {
skip_assert_initialized!();
RTSPTransMode::from_bits_truncate(value.bits())
}
}
impl StaticType for RTSPTransMode {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_rtsp_trans_mode_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for RTSPTransMode {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for RTSPTransMode {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstRTSPTransMode::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for RTSPTransMode {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}

View file

@ -0,0 +1,31 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
mod r_t_s_p_auth_param;
pub use self::r_t_s_p_auth_param::RTSPAuthParam;
mod r_t_s_p_url;
pub use self::r_t_s_p_url::RTSPUrl;
mod enums;
pub use self::enums::RTSPAuthMethod;
pub use self::enums::RTSPFamily;
pub use self::enums::RTSPHeaderField;
pub use self::enums::RTSPMsgType;
pub use self::enums::RTSPRangeUnit;
pub use self::enums::RTSPResult;
pub use self::enums::RTSPState;
pub use self::enums::RTSPStatusCode;
pub use self::enums::RTSPTimeType;
mod flags;
pub use self::flags::RTSPEvent;
pub use self::flags::RTSPLowerTrans;
pub use self::flags::RTSPMethod;
pub use self::flags::RTSPProfile;
pub use self::flags::RTSPTransMode;
#[doc(hidden)]
pub mod traits {
}

View file

@ -0,0 +1,22 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPAuthParam(Boxed<ffi::GstRTSPAuthParam>);
match fn {
copy => |ptr| ffi::gst_rtsp_auth_param_copy(mut_override(ptr)),
free => |ptr| ffi::gst_rtsp_auth_param_free(ptr),
get_type => || ffi::gst_rtsp_auth_param_get_type(),
}
}
unsafe impl Send for RTSPAuthParam {}

View file

@ -0,0 +1,52 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPResult;
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPUrl(Boxed<ffi::GstRTSPUrl>);
match fn {
copy => |ptr| ffi::gst_rtsp_url_copy(mut_override(ptr)),
free => |ptr| ffi::gst_rtsp_url_free(ptr),
get_type => || ffi::gst_rtsp_url_get_type(),
}
}
impl RTSPUrl {
pub fn decode_path_components(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_rtsp_url_decode_path_components(self.to_glib_none().0))
}
}
pub fn get_request_uri(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_rtsp_url_get_request_uri(self.to_glib_none().0))
}
}
pub fn set_port(&mut self, port: u16) -> RTSPResult {
unsafe {
from_glib(ffi::gst_rtsp_url_set_port(self.to_glib_none_mut().0, port))
}
}
pub fn parse(urlstr: &str) -> (RTSPResult, RTSPUrl) {
assert_initialized_main_thread!();
unsafe {
let mut url = ptr::null_mut();
let ret = from_glib(ffi::gst_rtsp_url_parse(urlstr.to_glib_none().0, &mut url));
(ret, from_glib_full(url))
}
}
}
unsafe impl Send for RTSPUrl {}

52
gstreamer-rtsp/src/lib.rs Normal file
View file

@ -0,0 +1,52 @@
// Copyright (C) 2018 Mathieu Duponchelle <mathieu@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;
extern crate libc;
#[macro_use]
extern crate glib;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer as gst;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_sdp as gst_sdp;
extern crate gstreamer_sdp_sys as gst_sdp_ffi;
extern crate gstreamer_rtsp_sys as ffi;
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::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};
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
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::*;
}

218
gstreamer-sdp/CHANGELOG.md Normal file
View file

@ -0,0 +1,218 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.10.1] - 2018-01-03
### Fixed
- Don't require &mut self for TagSetterExtManual::add()
### Added
- A TagSetter example application
- Bindings for gst_video::convert_sample() and ::convert_sample_async()
- Bindings for gst_video::VideoRectangle
- Debug impl for Sample and ::with_buffer_list() constructor
- A borrowing version of VideoFrame: VideoFrameRef
- Bindings for GstVideoFilter
### Changed
- Deprecated Sample::get_info() in favour of ::get_structure()
- Player has gst::Object as another parent class now
## [0.10.0] - 2017-12-22
### Fixed
- Various clippy warnings
- Memory leak of the tag list in Toc::merge_tags()
- Property getters use Values of the correct type
- Event::get_structure(), Message::get_structure() and
Query::get_structure() can return None for the structure
- Various other nullability fixes all over the API, changing functions to
accept Option<> or returning Option<>, or only plain types
- Functions taking paths/filenames now actually take Paths instead of &strs
- Element::remove_pad() is not giving away a new reference to the pad
anymore, which caused a memory leak of all pads ever removed
- Precision handling in ClockTime's Display impl
- Video/AudioInfo are only Send, not Sync
### Added
- Various enums now also derive useful traits like Copy, Clone and Hash in
addition to PartialEq, Eq and Debug
- TagList::merge() and insert() for combining tag lists
- EventType gained many useful functions to work with event types and
a PartialOrd impl to check expected event order of event types where it matters
- MessageRef/EventRef/QueryRef implement ToOwned
- Bindings for Registry and PluginFeature
- Event::set_running_time_offset() for adjusting the offset while events
pass through the pipeline
- Event/Message GroupIds and Seqnums now have a newtype wrapper around u32
instead of the plain value, making usage of them slightly more typesafe.
Also add an "invalid" value for both, as exists in latest GStreamer now.
- FormattedValue, GenericFormattedValue and related types were
implemented now, which allows more convenient and type-safe usage of
formatted values (time, bytes, etc)
- Bindings for force-keyunit and still-frame events were added
- MappedBuffer/BufferMap now implement various other useful traits, including
AsRef<[u8]>, AsMut, Deref, DerefMut, Debug, PartialEq and Eq
- Add VideoMultiviewFramePacking enum, and use it in Player
- Bindings for the GStreamer Net library, including PTP/NTP/network client
clocks and the GStreamer NetClock provider for network synchronization of
pipelines
- IteratorError implements std::error:Error
- Plugin::add_dependency() and ::add_dependency_simple() was added
- Rank and TypeFindProbability implement PartialOrd/Ord now
- Bindings for TypeFind, TypeFindFactory and the typefind helpers
- StreamCollection::iter() for iterating over all contained streams
- ErrorMessage type that can be used e.g. in a Result for passing an error
message from somewhere to upper layers to then be posted on an element the
same way gst_element_error!() would've done
### Changed
- Sample::new(), TagList::add(), Structure::set() and similar
functions take the values (ToSendValue impls) by reference instead of value.
They were not consumed by the function before.
- The Debug impls of various types, including Event/Buffer/Message/Query/Structure
were improved to print all the fields, similar to what GST_PTR_FORMAT would
do in C
- Switched to lazy_static 1.0
- Gap event and Duration tag are using ClockTimes now, as well as various
Player signals
- Segment is now based on a generic type FormattedSegment that can
take any format (time, bytes, etc) or a GenericFormattedValue for more
type-safety and convenience. Also functions for "casting" between a generic
segment and a segment with a specific format exist on this now
- AppSrc and AppSink now have a builder for the callbacks, making it
unnecessary to always provide all callbacks even if only one is actually
needed
- Various functions that returned bool for errors, are now returning a Result
- Player configuration is now a custom type with more convenient API
- Player VideoInfo uses a Fraction instead of (u32,u32) for the framerate and
pixel-aspect-ratio
- VideoFrame API has more consistent API between writable and read-only
variants
- Buffer::copy_into() was added, and ::copy_region() now takes a
BufferCopyFlags parameter instead of always using the default flags
- ChildProxy::set_child_property() takes a &ToValue now to follow the API of
Object::set_property() and improve usability
- Proxy/GhostPad default pad functions use the correct specific pad type now
instead of a generic Pad
- Bus::add_signal_watch_full() takes a Priority for the priority instead of u32
- Clock::(un)adjust_with_calibration() takes no clock parameter anymore
### Removed
- FormatValue was removed in favour of GenericFormattedValue and the
connected traits and specific format impls
## [0.9.1] - 2017-11-26
### Fixed
- Export `FlowError`/`FlowSuccess`, `ClockError`/`ClockSuccess`,
`PadLinkError`/`PadLinkSuccess` too
## [0.9.0] - 2017-11-26
### Added
- Bindings for (outputting to) the GStreamer logging system
- Bindings for the GStreamer base library
- Bindings for all the `Pad` functions to override pad behaviour, and pad task
functions
- Bindings for `StaticCaps` and `StaticPadTemplate`
- Bindings for `deep-notify` signal on `Object`
- Support for directly creating `Error`/`Warning`/`Info` `Messages` and posting them
from an element with context information (file, line, module, etc.) similar
to the C `GST_ELEMENT_ERROR` macro
- Support for setting custom fields in `Messages`/`Events` during construction
- Support for creating Buffers out of anything that is `AsRef<[u8]>` or
`AsMut<[u8]>`
- Support for using the `Read` trait on `Adapter`
- Functions for getting all sink/src/all pads of an `Element`, and all children
of a `Bin`
- Builder for `Caps` and `Structures` in addition to the existing functions
- `AppSrc`/`AppSink` implement `BaseSrc`/`BaseSink` and `URIHandler`
- Rust ports of the basic tutorials 1 to 8 from
https://gstreamer.freedesktop.org/documentation/tutorials/
- "Getting started" and "Installation" sections to the README.md
- "dox" feature for generating documentation for all available configurations
### Fixed
- `StackTraceFlags` are only available since 1.12
- Worked around macOS requiring a `NSRunLoop` running on the main thread in all
examples and tutorials, to be able to show a window or anything else
### Changed
- `ClockTime` is now a wrapper around `Option<u64>` to handle the
`CLOCK_TIME_NONE` case better. This wrapper implements all the arithmetic
and other traits as needed and ensures that no accidential calculations with
`CLOCK_TIME_NONE` can happen
- "Values with format", like in `Duration`/`Position`/`Convert` queries or
`Seek` events now return a `FormatValue` type. This contains the actual
`Format` together with the value and does any required conversions. This
also makes it harder to accidentially mix e.g. values in bytes and time
- `PadProbeId` does not implement `Clone`/`Copy` anymore
- Property notify watches return a custom type instead of ulong
- `Error`/`Warning`/`Info` `Messages` can only be created with specific kinds of
`glib::Error` now. Using arbitrary ones does not work
- `Iterator` bindings were completely rewritten and provide the item type as a
generic type parameter now, greatly simplifying its usage
- All `glib::Values` are now `glib::SendValue` instead, e.g. in `Caps` and
`Structures`, as their content must be possible to send to different threads
safely
- `Message::get_src()` can return `None`
- Allow `None` as `Caps` in `AppSrc`/`AppSink`
- Allow everything implementing `Into<Option<&str>>` to be used as a pad name
- Moved `copy()` from `GstRc` directly to `MiniObject`
- Success/Error enums (like `FlowReturn`, `PadLinkReturn`, `StateChangeReturn`) now
implement an `into_result()` function that splits them into a `Result` with
the good and bad cases. Also mark them as `#[must_use]` to make it harder to
accidentially ignore errors.
- Error enums implement the `Error` trait
- Many examples use the `failure` crate for error handling now, cleaning up the
error handling code quite a bit
- Lots of other code cleanup, compiler/clippy warning cleanup, etc.
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.10.1...HEAD
[0.10.1]: https://github.com/sdroege/gstreamer-rs/compare/0.10.0...0.10.1
[0.10.0]: https://github.com/sdroege/gstreamer-rs/compare/0.9.1...0.10.0
[0.9.1]: https://github.com/sdroege/gstreamer-rs/compare/0.9.0...0.9.1
[0.9.0]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...0.9.0
[0.8.2]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...0.8.2
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

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

@ -0,0 +1,39 @@
[package]
name = "gstreamer-sdp"
version = "0.11.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>", "Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Sdp library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_sdp"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-sdp-sys = { git = "https://github.com/sdroege/gstreamer-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]
v1_8_1 = ["gstreamer-sdp-sys/v1_8_1"]
v1_10 = ["gstreamer-sys/v1_10", "gstreamer-sdp-sys/v1_10", "v1_8_1"]
v1_12 = ["gstreamer-sys/v1_12", "gstreamer-sdp-sys/v1_12", "v1_10"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
dox = ["gstreamer-sdp-sys/dox", "glib/dox", "gstreamer/dox"]
default-features = []
[badges]
travis-ci = { repository = "sdroege/gstreamer-rs", branch = "master" }

View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

23
gstreamer-sdp/LICENSE-MIT Normal file
View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

170
gstreamer-sdp/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-sdp.svg)](https://crates.io/crates/gstreamer-sdp) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (Sdp library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## Table of Contents
1. [Installation](#installation)
1. [Linux/BSDs](#installation-linux)
1. [macOS](#installation-macos)
1. [Windows](#installation-windows)
1. [Getting Started](#getting-started)
1. [License](#license)
1. [Contribution](#contribution)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 installed. In addition,
some of the examples/tutorials require various GStreamer plugins to be
available, which can be found in gst-plugins-base, gst-plugins-good,
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
<a name="installation-linux"/>
### Linux/BSDs
You need to install the above mentioned packages with your distributions
package manager, or build them from source.
On Debian/Ubuntu they can be installed with
```
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### macOS
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
#### MSYS2 / pacman
```
$ pacman -S pkg-config mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/), however it is
only the Rust API reference and does not explain any of the concepts.
For getting started with GStreamer development, the best would be to follow
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
GStreamer website, especially the [Application Development
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
While being C-centric, it explains all the fundamental concepts of GStreamer
and the code examples should be relatively easily translatable to Rust. The
API is basically the same, function/struct names are the same and everything
is only more convenient (hopefully) and safer.
In addition there are
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
GStreamer website. Many of them were ported to Rust already and the code can
be found in the
[tutorials](https://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

34
gstreamer-sdp/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-sdp/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,529 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::translate::*;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYCacheType {
None,
Always,
ForCsb,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYCacheType {
type GlibType = ffi::GstMIKEYCacheType;
fn to_glib(&self) -> ffi::GstMIKEYCacheType {
match *self {
MIKEYCacheType::None => ffi::GST_MIKEY_CACHE_NONE,
MIKEYCacheType::Always => ffi::GST_MIKEY_CACHE_ALWAYS,
MIKEYCacheType::ForCsb => ffi::GST_MIKEY_CACHE_FOR_CSB,
MIKEYCacheType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYCacheType> for MIKEYCacheType {
fn from_glib(value: ffi::GstMIKEYCacheType) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYCacheType::None,
1 => MIKEYCacheType::Always,
2 => MIKEYCacheType::ForCsb,
value => MIKEYCacheType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYEncAlg {
Null,
AesCm128,
AesKw128,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYEncAlg {
type GlibType = ffi::GstMIKEYEncAlg;
fn to_glib(&self) -> ffi::GstMIKEYEncAlg {
match *self {
MIKEYEncAlg::Null => ffi::GST_MIKEY_ENC_NULL,
MIKEYEncAlg::AesCm128 => ffi::GST_MIKEY_ENC_AES_CM_128,
MIKEYEncAlg::AesKw128 => ffi::GST_MIKEY_ENC_AES_KW_128,
MIKEYEncAlg::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYEncAlg> for MIKEYEncAlg {
fn from_glib(value: ffi::GstMIKEYEncAlg) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYEncAlg::Null,
1 => MIKEYEncAlg::AesCm128,
2 => MIKEYEncAlg::AesKw128,
value => MIKEYEncAlg::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYKVType {
Null,
Spi,
Interval,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYKVType {
type GlibType = ffi::GstMIKEYKVType;
fn to_glib(&self) -> ffi::GstMIKEYKVType {
match *self {
MIKEYKVType::Null => ffi::GST_MIKEY_KV_NULL,
MIKEYKVType::Spi => ffi::GST_MIKEY_KV_SPI,
MIKEYKVType::Interval => ffi::GST_MIKEY_KV_INTERVAL,
MIKEYKVType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYKVType> for MIKEYKVType {
fn from_glib(value: ffi::GstMIKEYKVType) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYKVType::Null,
1 => MIKEYKVType::Spi,
2 => MIKEYKVType::Interval,
value => MIKEYKVType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYKeyDataType {
Tgk,
Tek,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYKeyDataType {
type GlibType = ffi::GstMIKEYKeyDataType;
fn to_glib(&self) -> ffi::GstMIKEYKeyDataType {
match *self {
MIKEYKeyDataType::Tgk => ffi::GST_MIKEY_KD_TGK,
MIKEYKeyDataType::Tek => ffi::GST_MIKEY_KD_TEK,
MIKEYKeyDataType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYKeyDataType> for MIKEYKeyDataType {
fn from_glib(value: ffi::GstMIKEYKeyDataType) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYKeyDataType::Tgk,
2 => MIKEYKeyDataType::Tek,
value => MIKEYKeyDataType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYMacAlg {
Null,
HmacSha1160,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYMacAlg {
type GlibType = ffi::GstMIKEYMacAlg;
fn to_glib(&self) -> ffi::GstMIKEYMacAlg {
match *self {
MIKEYMacAlg::Null => ffi::GST_MIKEY_MAC_NULL,
MIKEYMacAlg::HmacSha1160 => ffi::GST_MIKEY_MAC_HMAC_SHA_1_160,
MIKEYMacAlg::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYMacAlg> for MIKEYMacAlg {
fn from_glib(value: ffi::GstMIKEYMacAlg) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYMacAlg::Null,
1 => MIKEYMacAlg::HmacSha1160,
value => MIKEYMacAlg::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYMapType {
MikeyMapTypeSrtp,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYMapType {
type GlibType = ffi::GstMIKEYMapType;
fn to_glib(&self) -> ffi::GstMIKEYMapType {
match *self {
MIKEYMapType::MikeyMapTypeSrtp => ffi::GST_MIKEY_MAP_TYPE_SRTP,
MIKEYMapType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYMapType> for MIKEYMapType {
fn from_glib(value: ffi::GstMIKEYMapType) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYMapType::MikeyMapTypeSrtp,
value => MIKEYMapType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYPRFFunc {
MikeyPrfMikey1,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYPRFFunc {
type GlibType = ffi::GstMIKEYPRFFunc;
fn to_glib(&self) -> ffi::GstMIKEYPRFFunc {
match *self {
MIKEYPRFFunc::MikeyPrfMikey1 => ffi::GST_MIKEY_PRF_MIKEY_1,
MIKEYPRFFunc::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYPRFFunc> for MIKEYPRFFunc {
fn from_glib(value: ffi::GstMIKEYPRFFunc) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYPRFFunc::MikeyPrfMikey1,
value => MIKEYPRFFunc::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYPayloadType {
Last,
Kemac,
Pke,
Dh,
Sign,
T,
Id,
Cert,
Chash,
V,
Sp,
Rand,
Err,
KeyData,
GenExt,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYPayloadType {
type GlibType = ffi::GstMIKEYPayloadType;
fn to_glib(&self) -> ffi::GstMIKEYPayloadType {
match *self {
MIKEYPayloadType::Last => ffi::GST_MIKEY_PT_LAST,
MIKEYPayloadType::Kemac => ffi::GST_MIKEY_PT_KEMAC,
MIKEYPayloadType::Pke => ffi::GST_MIKEY_PT_PKE,
MIKEYPayloadType::Dh => ffi::GST_MIKEY_PT_DH,
MIKEYPayloadType::Sign => ffi::GST_MIKEY_PT_SIGN,
MIKEYPayloadType::T => ffi::GST_MIKEY_PT_T,
MIKEYPayloadType::Id => ffi::GST_MIKEY_PT_ID,
MIKEYPayloadType::Cert => ffi::GST_MIKEY_PT_CERT,
MIKEYPayloadType::Chash => ffi::GST_MIKEY_PT_CHASH,
MIKEYPayloadType::V => ffi::GST_MIKEY_PT_V,
MIKEYPayloadType::Sp => ffi::GST_MIKEY_PT_SP,
MIKEYPayloadType::Rand => ffi::GST_MIKEY_PT_RAND,
MIKEYPayloadType::Err => ffi::GST_MIKEY_PT_ERR,
MIKEYPayloadType::KeyData => ffi::GST_MIKEY_PT_KEY_DATA,
MIKEYPayloadType::GenExt => ffi::GST_MIKEY_PT_GEN_EXT,
MIKEYPayloadType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYPayloadType> for MIKEYPayloadType {
fn from_glib(value: ffi::GstMIKEYPayloadType) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYPayloadType::Last,
1 => MIKEYPayloadType::Kemac,
2 => MIKEYPayloadType::Pke,
3 => MIKEYPayloadType::Dh,
4 => MIKEYPayloadType::Sign,
5 => MIKEYPayloadType::T,
6 => MIKEYPayloadType::Id,
7 => MIKEYPayloadType::Cert,
8 => MIKEYPayloadType::Chash,
9 => MIKEYPayloadType::V,
10 => MIKEYPayloadType::Sp,
11 => MIKEYPayloadType::Rand,
12 => MIKEYPayloadType::Err,
20 => MIKEYPayloadType::KeyData,
21 => MIKEYPayloadType::GenExt,
value => MIKEYPayloadType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYSecProto {
MikeySecProtoSrtp,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYSecProto {
type GlibType = ffi::GstMIKEYSecProto;
fn to_glib(&self) -> ffi::GstMIKEYSecProto {
match *self {
MIKEYSecProto::MikeySecProtoSrtp => ffi::GST_MIKEY_SEC_PROTO_SRTP,
MIKEYSecProto::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYSecProto> for MIKEYSecProto {
fn from_glib(value: ffi::GstMIKEYSecProto) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYSecProto::MikeySecProtoSrtp,
value => MIKEYSecProto::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYSecSRTP {
EncAlg,
EncKeyLen,
AuthAlg,
AuthKeyLen,
SaltKeyLen,
Prf,
KeyDerivRate,
SrtpEnc,
SrtcpEnc,
FecOrder,
SrtpAuth,
AuthTagLen,
SrtpPrefixLen,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYSecSRTP {
type GlibType = ffi::GstMIKEYSecSRTP;
fn to_glib(&self) -> ffi::GstMIKEYSecSRTP {
match *self {
MIKEYSecSRTP::EncAlg => ffi::GST_MIKEY_SP_SRTP_ENC_ALG,
MIKEYSecSRTP::EncKeyLen => ffi::GST_MIKEY_SP_SRTP_ENC_KEY_LEN,
MIKEYSecSRTP::AuthAlg => ffi::GST_MIKEY_SP_SRTP_AUTH_ALG,
MIKEYSecSRTP::AuthKeyLen => ffi::GST_MIKEY_SP_SRTP_AUTH_KEY_LEN,
MIKEYSecSRTP::SaltKeyLen => ffi::GST_MIKEY_SP_SRTP_SALT_KEY_LEN,
MIKEYSecSRTP::Prf => ffi::GST_MIKEY_SP_SRTP_PRF,
MIKEYSecSRTP::KeyDerivRate => ffi::GST_MIKEY_SP_SRTP_KEY_DERIV_RATE,
MIKEYSecSRTP::SrtpEnc => ffi::GST_MIKEY_SP_SRTP_SRTP_ENC,
MIKEYSecSRTP::SrtcpEnc => ffi::GST_MIKEY_SP_SRTP_SRTCP_ENC,
MIKEYSecSRTP::FecOrder => ffi::GST_MIKEY_SP_SRTP_FEC_ORDER,
MIKEYSecSRTP::SrtpAuth => ffi::GST_MIKEY_SP_SRTP_SRTP_AUTH,
MIKEYSecSRTP::AuthTagLen => ffi::GST_MIKEY_SP_SRTP_AUTH_TAG_LEN,
MIKEYSecSRTP::SrtpPrefixLen => ffi::GST_MIKEY_SP_SRTP_SRTP_PREFIX_LEN,
MIKEYSecSRTP::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYSecSRTP> for MIKEYSecSRTP {
fn from_glib(value: ffi::GstMIKEYSecSRTP) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYSecSRTP::EncAlg,
1 => MIKEYSecSRTP::EncKeyLen,
2 => MIKEYSecSRTP::AuthAlg,
3 => MIKEYSecSRTP::AuthKeyLen,
4 => MIKEYSecSRTP::SaltKeyLen,
5 => MIKEYSecSRTP::Prf,
6 => MIKEYSecSRTP::KeyDerivRate,
7 => MIKEYSecSRTP::SrtpEnc,
8 => MIKEYSecSRTP::SrtcpEnc,
9 => MIKEYSecSRTP::FecOrder,
10 => MIKEYSecSRTP::SrtpAuth,
11 => MIKEYSecSRTP::AuthTagLen,
12 => MIKEYSecSRTP::SrtpPrefixLen,
value => MIKEYSecSRTP::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYTSType {
NtpUtc,
Ntp,
Counter,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYTSType {
type GlibType = ffi::GstMIKEYTSType;
fn to_glib(&self) -> ffi::GstMIKEYTSType {
match *self {
MIKEYTSType::NtpUtc => ffi::GST_MIKEY_TS_TYPE_NTP_UTC,
MIKEYTSType::Ntp => ffi::GST_MIKEY_TS_TYPE_NTP,
MIKEYTSType::Counter => ffi::GST_MIKEY_TS_TYPE_COUNTER,
MIKEYTSType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYTSType> for MIKEYTSType {
fn from_glib(value: ffi::GstMIKEYTSType) -> Self {
skip_assert_initialized!();
match value {
0 => MIKEYTSType::NtpUtc,
1 => MIKEYTSType::Ntp,
2 => MIKEYTSType::Counter,
value => MIKEYTSType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MIKEYType {
Invalid,
PskInit,
PskVerify,
PkInit,
PkVerify,
DhInit,
DhResp,
Error,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for MIKEYType {
type GlibType = ffi::GstMIKEYType;
fn to_glib(&self) -> ffi::GstMIKEYType {
match *self {
MIKEYType::Invalid => ffi::GST_MIKEY_TYPE_INVALID,
MIKEYType::PskInit => ffi::GST_MIKEY_TYPE_PSK_INIT,
MIKEYType::PskVerify => ffi::GST_MIKEY_TYPE_PSK_VERIFY,
MIKEYType::PkInit => ffi::GST_MIKEY_TYPE_PK_INIT,
MIKEYType::PkVerify => ffi::GST_MIKEY_TYPE_PK_VERIFY,
MIKEYType::DhInit => ffi::GST_MIKEY_TYPE_DH_INIT,
MIKEYType::DhResp => ffi::GST_MIKEY_TYPE_DH_RESP,
MIKEYType::Error => ffi::GST_MIKEY_TYPE_ERROR,
MIKEYType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstMIKEYType> for MIKEYType {
fn from_glib(value: ffi::GstMIKEYType) -> Self {
skip_assert_initialized!();
match value {
-1 => MIKEYType::Invalid,
0 => MIKEYType::PskInit,
1 => MIKEYType::PskVerify,
2 => MIKEYType::PkInit,
3 => MIKEYType::PkVerify,
4 => MIKEYType::DhInit,
5 => MIKEYType::DhResp,
6 => MIKEYType::Error,
value => MIKEYType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum SDPResult {
Ok,
Einval,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for SDPResult {
type GlibType = ffi::GstSDPResult;
fn to_glib(&self) -> ffi::GstSDPResult {
match *self {
SDPResult::Ok => ffi::GST_SDP_OK,
SDPResult::Einval => ffi::GST_SDP_EINVAL,
SDPResult::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstSDPResult> for SDPResult {
fn from_glib(value: ffi::GstSDPResult) -> Self {
skip_assert_initialized!();
match value {
0 => SDPResult::Ok,
-1 => SDPResult::Einval,
value => SDPResult::__Unknown(value),
}
}
}

View file

@ -0,0 +1,7 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::translate::*;

View file

@ -0,0 +1,22 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
mod enums;
pub use self::enums::MIKEYCacheType;
pub use self::enums::MIKEYEncAlg;
pub use self::enums::MIKEYKVType;
pub use self::enums::MIKEYKeyDataType;
pub use self::enums::MIKEYMacAlg;
pub use self::enums::MIKEYMapType;
pub use self::enums::MIKEYPRFFunc;
pub use self::enums::MIKEYPayloadType;
pub use self::enums::MIKEYSecProto;
pub use self::enums::MIKEYSecSRTP;
pub use self::enums::MIKEYTSType;
pub use self::enums::MIKEYType;
pub use self::enums::SDPResult;
#[doc(hidden)]
pub mod traits {
}

40
gstreamer-sdp/src/lib.rs Normal file
View file

@ -0,0 +1,40 @@
// Copyright (C) 2017 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.
extern crate bitflags;
extern crate libc;
extern crate glib;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer as gst;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_sdp_sys as ffi;
macro_rules! skip_assert_initialized {
() => (
)
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
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::*;
}