mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
New RTSP source plugin with live streaming support
GST_PLUGIN_FEATURE_RANK=rtspsrc2:1 gst-play-1.0 [URI] Features: * Live streaming N audio and N video - With RTCP-based A/V sync * Lower transports: TCP, UDP, UDP-Multicast * RTP, RTCP SR, RTCP RR * OPTIONS DESCRIBE SETUP PLAY TEARDOWN * Custom UDP socket management, does not use udpsrc/udpsink * Supports both rtpbin and the rtpbin2 rust rewrite - Set USE_RTPBIN2=1 to use rtpbin2 (needs other MRs) * Properties: - protocols selection and priority (NEW!) - location supports rtsp[ut]:// - port-start instead of port-range Co-Authored-by: Tim-Philipp Müller <tim@centricular.com> Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1425>
This commit is contained in:
parent
612ef91af9
commit
086ffd7aff
17 changed files with 3232 additions and 67 deletions
197
Cargo.lock
generated
197
Cargo.lock
generated
|
@ -854,6 +854,17 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"regex-automata 0.4.5",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "build_const"
|
||||
version = "0.2.2"
|
||||
|
@ -909,7 +920,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"cairo-sys-rs",
|
||||
|
@ -921,7 +932,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cairo-sys-rs"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -1105,6 +1116,12 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cookie-factory"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b"
|
||||
|
||||
[[package]]
|
||||
name = "cookie_store"
|
||||
version = "0.20.0"
|
||||
|
@ -1583,6 +1600,12 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fallible-iterator"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.0.1"
|
||||
|
@ -1801,7 +1824,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk-pixbuf"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"gdk-pixbuf-sys",
|
||||
"gio",
|
||||
|
@ -1812,7 +1835,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk-pixbuf-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
|
@ -1971,7 +1994,7 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
|||
[[package]]
|
||||
name = "gio"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1988,7 +2011,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gio-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -2000,7 +2023,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"futures-channel",
|
||||
|
@ -2021,7 +2044,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib-macros"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-crate",
|
||||
|
@ -2033,7 +2056,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps",
|
||||
|
@ -2048,7 +2071,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
|||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -2058,7 +2081,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "graphene-rs"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"graphene-sys",
|
||||
|
@ -2068,7 +2091,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "graphene-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -2599,6 +2622,28 @@ dependencies = [
|
|||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gst-plugin-rtsp"
|
||||
version = "0.12.0-alpha.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"atomic_refcell",
|
||||
"data-encoding",
|
||||
"futures",
|
||||
"gst-plugin-version-helper",
|
||||
"gstreamer",
|
||||
"gstreamer-app",
|
||||
"gstreamer-pbutils",
|
||||
"once_cell",
|
||||
"rtsp-types",
|
||||
"sdp-types",
|
||||
"socket2 0.5.5",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gst-plugin-sodium"
|
||||
version = "0.12.0-alpha.1"
|
||||
|
@ -2890,7 +2935,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-channel",
|
||||
|
@ -2916,7 +2961,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-app"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
|
@ -2930,7 +2975,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-app-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-base-sys",
|
||||
|
@ -2942,7 +2987,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-audio"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"glib",
|
||||
|
@ -2957,7 +3002,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-audio-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -2970,7 +3015,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-base"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"atomic_refcell",
|
||||
"cfg-if",
|
||||
|
@ -2983,7 +3028,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-base-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -2995,7 +3040,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-check"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3005,7 +3050,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-check-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -3017,7 +3062,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3031,7 +3076,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl-egl"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3043,7 +3088,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl-egl-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-gl-sys",
|
||||
|
@ -3054,7 +3099,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -3068,7 +3113,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl-wayland"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3080,7 +3125,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl-wayland-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-gl-sys",
|
||||
|
@ -3091,7 +3136,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl-x11"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3103,7 +3148,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-gl-x11-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-gl-sys",
|
||||
|
@ -3114,7 +3159,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-net"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"gio",
|
||||
"glib",
|
||||
|
@ -3125,7 +3170,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-net-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
|
@ -3137,7 +3182,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-pbutils"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3151,7 +3196,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-pbutils-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -3165,7 +3210,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-rtp"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3176,7 +3221,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-rtp-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-base-sys",
|
||||
|
@ -3188,7 +3233,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-sdp"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3198,7 +3243,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-sdp-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-sys",
|
||||
|
@ -3209,7 +3254,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -3220,7 +3265,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-utils"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"gstreamer",
|
||||
"gstreamer-app",
|
||||
|
@ -3232,7 +3277,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-video"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-channel",
|
||||
|
@ -3249,7 +3294,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-video-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -3262,7 +3307,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-webrtc"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gstreamer",
|
||||
|
@ -3274,7 +3319,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gstreamer-webrtc-sys"
|
||||
version = "0.22.0"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#230c9066269b74a82cc8b2389d07984d78d97f71"
|
||||
source = "git+https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#36792404a98de996e2cf6a7485e667fe6f1cee19"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-sdp-sys",
|
||||
|
@ -3798,9 +3843,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.67"
|
||||
version = "0.3.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1"
|
||||
checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
@ -4591,7 +4636,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pango"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"gio",
|
||||
"glib",
|
||||
|
@ -4602,7 +4647,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pango-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -4613,7 +4658,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pangocairo"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"cairo-rs",
|
||||
"glib",
|
||||
|
@ -4625,7 +4670,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pangocairo-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#4fd5ecf98d4e9f1ec0c42cf0e9bec3db4c39f8d1"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#8e574d3a8e445ff9184b00bd490e6f403cd5aa9c"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"glib-sys",
|
||||
|
@ -5314,6 +5359,18 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rtsp-types"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "991c14333b8f4fb7459bfaa9e029d0b4b7b1d5a83f56c0d017541e9e1ece21b9"
|
||||
dependencies = [
|
||||
"cookie-factory",
|
||||
"nom",
|
||||
"tinyvec",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rubato"
|
||||
version = "0.14.1"
|
||||
|
@ -5467,6 +5524,16 @@ dependencies = [
|
|||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sdp-types"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8db497829e222d081f7b50ac81aec4f69750071a0f76b97b950b0b62204da6e"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"fallible-iterator",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sec1"
|
||||
version = "0.3.0"
|
||||
|
@ -6538,9 +6605,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.90"
|
||||
version = "0.2.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406"
|
||||
checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
|
@ -6548,9 +6615,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.90"
|
||||
version = "0.2.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd"
|
||||
checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
|
@ -6563,9 +6630,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.40"
|
||||
version = "0.4.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461"
|
||||
checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
|
@ -6575,9 +6642,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.90"
|
||||
version = "0.2.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999"
|
||||
checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
@ -6585,9 +6652,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.90"
|
||||
version = "0.2.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7"
|
||||
checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -6598,15 +6665,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.90"
|
||||
version = "0.2.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
|
||||
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.67"
|
||||
version = "0.3.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed"
|
||||
checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -6804,9 +6871,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
|||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.37"
|
||||
version = "0.5.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5"
|
||||
checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
|
@ -27,6 +27,7 @@ members = [
|
|||
"net/raptorq",
|
||||
"net/reqwest",
|
||||
"net/rtp",
|
||||
"net/rtsp",
|
||||
"net/webrtchttp",
|
||||
"net/webrtc",
|
||||
"net/webrtc/protocol",
|
||||
|
@ -76,6 +77,7 @@ default-members = [
|
|||
"net/raptorq",
|
||||
"net/reqwest",
|
||||
"net/rtp",
|
||||
"net/rtsp",
|
||||
"net/webrtchttp",
|
||||
"net/webrtc",
|
||||
"net/webrtc/protocol",
|
||||
|
|
|
@ -22,6 +22,7 @@ RS_PREFIXED = [
|
|||
'png',
|
||||
'tracers',
|
||||
'rtp',
|
||||
'rtsp',
|
||||
'inter',
|
||||
]
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ RENAMES = {
|
|||
'rsfile': 'file',
|
||||
'rsflv': 'flavors',
|
||||
'rsrtp': 'rtp',
|
||||
'rsrtsp': 'rtsp',
|
||||
'rswebp': 'webp',
|
||||
'rsonvif': 'onvif',
|
||||
'rstracers': 'tracers',
|
||||
|
|
|
@ -6321,6 +6321,97 @@
|
|||
"tracers": {},
|
||||
"url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
|
||||
},
|
||||
"rsrtsp": {
|
||||
"description": "GStreamer RTSP Client Plugin",
|
||||
"elements": {
|
||||
"rtspsrc2": {
|
||||
"author": "Nirbheek Chauhan <nirbheek centricular com>",
|
||||
"description": "Receive audio or video from a network device via the Real Time Streaming Protocol (RTSP) (RFC 2326, 7826)",
|
||||
"hierarchy": [
|
||||
"GstRtspSrc2",
|
||||
"GstBin",
|
||||
"GstElement",
|
||||
"GstObject",
|
||||
"GInitiallyUnowned",
|
||||
"GObject"
|
||||
],
|
||||
"interfaces": [
|
||||
"GstChildProxy",
|
||||
"GstURIHandler"
|
||||
],
|
||||
"klass": "Source/Network",
|
||||
"pad-templates": {
|
||||
"stream_%%u": {
|
||||
"caps": "application/x-rtp:\n",
|
||||
"direction": "src",
|
||||
"presence": "sometimes"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"location": {
|
||||
"blurb": "RTSP server, credentials and media path, e.g. rtsp://user:p4ssw0rd@camera-5.local:8554/h264_1080p30",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "NULL",
|
||||
"mutable": "ready",
|
||||
"readable": true,
|
||||
"type": "gchararray",
|
||||
"writable": true
|
||||
},
|
||||
"port-start": {
|
||||
"blurb": "Port number to start allocating client ports for receiving RTP and RTCP data, eg. 3000 (0 = automatic selection)",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "0",
|
||||
"max": "-1",
|
||||
"min": "0",
|
||||
"mutable": "ready",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"protocols": {
|
||||
"blurb": "Allowed lower transport protocols, in order of preference",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "udp-mcast,udp,tcp",
|
||||
"mutable": "ready",
|
||||
"readable": true,
|
||||
"type": "gchararray",
|
||||
"writable": true
|
||||
},
|
||||
"timeout": {
|
||||
"blurb": "Timeout for network activity, in nanoseconds",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "2000000000",
|
||||
"max": "18446744073709551614",
|
||||
"min": "0",
|
||||
"mutable": "ready",
|
||||
"readable": true,
|
||||
"type": "guint64",
|
||||
"writable": true
|
||||
}
|
||||
},
|
||||
"rank": "none"
|
||||
}
|
||||
},
|
||||
"filename": "gstrsrtsp",
|
||||
"license": "MPL",
|
||||
"other-types": {},
|
||||
"package": "gst-plugin-rtsp",
|
||||
"source": "gst-plugin-rtsp",
|
||||
"tracers": {},
|
||||
"url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
|
||||
},
|
||||
"rstracers": {
|
||||
"description": "GStreamer Rust tracers plugin",
|
||||
"elements": {},
|
||||
|
|
|
@ -66,7 +66,9 @@ deps = [
|
|||
]
|
||||
|
||||
webrtc_option = get_option('webrtc')
|
||||
rtp_option = get_option('rtp').enable_if(webrtc_option.enabled(), error_message: 'webrtc option is enabled')
|
||||
rtp_option = get_option('rtp').enable_if(webrtc_option.enabled(), error_message: 'webrtc option needs rtp')
|
||||
|
||||
rtsp_option = get_option('rtsp')
|
||||
|
||||
if get_option('threadshare').allowed() \
|
||||
or get_option('onvif').allowed() \
|
||||
|
@ -86,7 +88,7 @@ endif
|
|||
if get_option('gtk4').allowed()
|
||||
deps += [['gstreamer-gl-1.0', 'gst-plugins-base', 'gst_gl_dep', 'gstgl']]
|
||||
endif
|
||||
if get_option('threadshare').allowed()
|
||||
if get_option('threadshare').allowed() or get_option('rtsp').allowed()
|
||||
deps += [['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net']]
|
||||
endif
|
||||
|
||||
|
@ -150,6 +152,7 @@ plugins = {
|
|||
},
|
||||
'raptorq': {'library': 'libgstraptorq'},
|
||||
'reqwest': {'library': 'libgstreqwest'},
|
||||
'rtsp': {'library': 'libgstrsrtsp'},
|
||||
'rtp': {'library': 'libgstrsrtp'},
|
||||
'webrtchttp': {'library': 'libgstwebrtchttp'},
|
||||
'webrtc': {
|
||||
|
|
|
@ -28,6 +28,7 @@ option('ndi', type: 'feature', value: 'auto', description: 'Build ndi plugin')
|
|||
option('onvif', type: 'feature', value: 'auto', description: 'Build onvif plugin')
|
||||
option('raptorq', type: 'feature', value: 'auto', description: 'Build raptorq plugin')
|
||||
option('reqwest', type: 'feature', value: 'auto', description: 'Build reqwest plugin')
|
||||
option('rtsp', type: 'feature', value: 'auto', description: 'Build rtsp plugin')
|
||||
option('rtp', type: 'feature', value: 'auto', description: 'Build rtp plugin')
|
||||
option('webrtc', type: 'feature', value: 'auto', yield: true, description: 'Build webrtc plugin')
|
||||
option('webrtchttp', type: 'feature', value: 'auto', description: 'Build webrtchttp plugin')
|
||||
|
|
53
net/rtsp/Cargo.toml
Normal file
53
net/rtsp/Cargo.toml
Normal file
|
@ -0,0 +1,53 @@
|
|||
[package]
|
||||
name = "gst-plugin-rtsp"
|
||||
version.workspace = true
|
||||
authors = ["Nirbheek Chauhan <nirbheek centricular com>"]
|
||||
repository.workspace = true
|
||||
license = "MPL-2.0"
|
||||
description = "GStreamer RTSP Client Plugin"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
atomic_refcell = "0.1"
|
||||
data-encoding = "2.4"
|
||||
futures = "0.3"
|
||||
gst = { workspace = true, features = ["v1_20"] }
|
||||
gst-app = { workspace = true, features = ["v1_20"] }
|
||||
gst-pbutils = { workspace = true, features = ["v1_20"] }
|
||||
once_cell.workspace = true
|
||||
rtsp-types = "0.1"
|
||||
sdp-types = "0.1"
|
||||
socket2 = "0.5"
|
||||
thiserror = "1"
|
||||
tokio = { version = "1.0", default-features = false, features = ["io-util", "macros", "net", "time", "rt-multi-thread", "sync"] }
|
||||
tokio-stream = "0.1"
|
||||
url = "2"
|
||||
|
||||
[lib]
|
||||
name = "gstrsrtsp"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[build-dependencies]
|
||||
gst-plugin-version-helper.workspace = true
|
||||
|
||||
[features]
|
||||
static = []
|
||||
capi = []
|
||||
doc = ["gst/v1_18"]
|
||||
|
||||
[package.metadata.capi]
|
||||
min_version = "0.9.21"
|
||||
|
||||
[package.metadata.capi.header]
|
||||
enabled = false
|
||||
|
||||
[package.metadata.capi.library]
|
||||
install_subdir = "gstreamer-1.0"
|
||||
versioning = false
|
||||
import_library = false
|
||||
|
||||
[package.metadata.capi.pkg_config]
|
||||
requires_private = "gstreamer-1.0, gobject-2.0, glib-2.0, gmodule-2.0"
|
373
net/rtsp/LICENSE-MPL-2.0
Normal file
373
net/rtsp/LICENSE-MPL-2.0
Normal file
|
@ -0,0 +1,373 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
68
net/rtsp/README.md
Normal file
68
net/rtsp/README.md
Normal file
|
@ -0,0 +1,68 @@
|
|||
# rtspsrc2
|
||||
|
||||
Rust rewrite of rtspsrc, with the purpose of fixing the fundamentally broken
|
||||
architecture of rtspsrc. There are some major problems with rtspsrc:
|
||||
|
||||
1. Element states are linked to RTSP states, which causes unfixable glitching
|
||||
and issues, especially in shared RTSP media
|
||||
2. The command loop is fundamentally broken and buggy, which can cause RTSP
|
||||
commands such as `SET_PARAMETER` and `GET_PARAMETER` to be lost
|
||||
3. The combination of the above two causes unfixable deadlocks when doing state
|
||||
changes due to external factors such as server state, or when seeking
|
||||
4. Parsing of untrusted RTSP messages from the network was done in C with the
|
||||
`GstRTSPMessage` API.
|
||||
5. Parsing of untrusted SDP from the network was done in C with the
|
||||
`GstSDPMessage` API
|
||||
|
||||
## Implemented features
|
||||
|
||||
* RTSP 1.0 support
|
||||
* Lower transports: TCP, UDP, UDP-Multicast
|
||||
* RTCP SR and RTCP RR
|
||||
* RTCP-based A/V sync
|
||||
* Lower transport selection and priority (NEW!)
|
||||
- Also supports different lower transports for each SETUP
|
||||
|
||||
## Missing features
|
||||
|
||||
Roughly in order of priority:
|
||||
|
||||
* Credentials support
|
||||
* TLS/TCP support
|
||||
* NAT hole punching
|
||||
* Allocate a buffer pool for receiving + pushing UDP packets
|
||||
* Allow ignoring specific streams (SDP medias)
|
||||
- Currently all available source pads must be linked
|
||||
* SRTP support
|
||||
* HTTP tunnelling
|
||||
* Proxy support
|
||||
* `GET_PARAMETER` / `SET_PARAMETER`
|
||||
* Make TCP connection optional when using UDP transport
|
||||
- Or TCP reconnection if UDP has not timed out
|
||||
* Parse SDP rtcp-fb attributes
|
||||
* Parse SDP ssrc attributes
|
||||
* Don't require Transport header in SETUP response, it is optional
|
||||
* Clock sync support, such as RFC7273
|
||||
* PAUSE support with VOD
|
||||
* Seeking support with VOD
|
||||
* ONVIF backchannel support
|
||||
* ONVIF trick mode support
|
||||
* RTSP 2 support (no servers exist at present)
|
||||
|
||||
## Missing configuration properties
|
||||
|
||||
These are some misc rtspsrc props that haven't been implemented in rtspsrc2
|
||||
yet:
|
||||
|
||||
* latency
|
||||
* do-rtx
|
||||
* do-rtcp
|
||||
* iface
|
||||
* user-agent
|
||||
|
||||
## Maintenance and future cleanup
|
||||
|
||||
* Refactor SDP → Caps parsing into a module
|
||||
* Test with market RTSP cameras
|
||||
- Currently, only live555 and gst-rtsp-server have been tested
|
||||
* Add tokio-console and tokio tracing support
|
3
net/rtsp/build.rs
Normal file
3
net/rtsp/build.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
gst_plugin_version_helper::info()
|
||||
}
|
36
net/rtsp/src/lib.rs
Normal file
36
net/rtsp/src/lib.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// GStreamer RTSP plugin (in Rust)
|
||||
//
|
||||
// Copyright (C) 2023 Tim-Philipp Müller <tim centricular com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at
|
||||
// <https://mozilla.org/MPL/2.0/>.
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
/**
|
||||
* plugin-rsrtsp:
|
||||
*
|
||||
* Since: plugins-rs-0.12.0
|
||||
*/
|
||||
use gst::glib;
|
||||
|
||||
mod rtspsrc;
|
||||
|
||||
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
rtspsrc::register(plugin)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
gst::plugin_define!(
|
||||
rsrtsp,
|
||||
env!("CARGO_PKG_DESCRIPTION"),
|
||||
plugin_init,
|
||||
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
|
||||
// FIXME: MPL-2.0 is only allowed since 1.18.3 (as unknown) and 1.20 (as known)
|
||||
"MPL",
|
||||
env!("CARGO_PKG_NAME"),
|
||||
env!("CARGO_PKG_NAME"),
|
||||
env!("CARGO_PKG_REPOSITORY"),
|
||||
env!("BUILD_REL_DATE")
|
||||
);
|
103
net/rtsp/src/rtspsrc/body.rs
Normal file
103
net/rtsp/src/rtspsrc/body.rs
Normal file
|
@ -0,0 +1,103 @@
|
|||
// Rust RTSP Server
|
||||
//
|
||||
// Copyright (C) 2020-2021 Sebastian Dröge <sebastian@centricular.com>
|
||||
// Copyright (C) 2024 Nirbheek Chauhan <nirbheek@centricular.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at
|
||||
// <https://mozilla.org/MPL/2.0/>.
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::cmp;
|
||||
use std::fmt;
|
||||
use std::ops;
|
||||
|
||||
use gst::buffer::{MappedBuffer, Readable};
|
||||
|
||||
/// Body used for RTSP messages in the server.
|
||||
#[derive(Debug)]
|
||||
pub struct Body(Inner);
|
||||
|
||||
enum Inner {
|
||||
Vec(Vec<u8>),
|
||||
Custom(Box<dyn Custom>),
|
||||
Buffer(MappedBuffer<Readable>),
|
||||
}
|
||||
|
||||
trait Custom: AsRef<[u8]> + Send + Sync + 'static {}
|
||||
impl<T: AsRef<[u8]> + Send + Sync + 'static> Custom for T {}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Body(Inner::Vec(Vec::new()))
|
||||
}
|
||||
}
|
||||
|
||||
impl Body {
|
||||
/// Create a body from custom memory without copying.
|
||||
#[allow(dead_code)]
|
||||
pub fn custom<T: AsRef<[u8]> + Send + Sync + 'static>(custom: T) -> Self {
|
||||
Body(Inner::Custom(Box::new(custom)))
|
||||
}
|
||||
|
||||
pub fn mapped(mapped: MappedBuffer<Readable>) -> Self {
|
||||
Body(Inner::Buffer(mapped))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec<u8>> for Body {
|
||||
fn from(v: Vec<u8>) -> Self {
|
||||
Body(Inner::Vec(v))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a [u8]> for Body {
|
||||
fn from(s: &'a [u8]) -> Self {
|
||||
Body::from(Vec::from(s))
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::Deref for Body {
|
||||
type Target = [u8];
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<[u8]> for Body {
|
||||
fn as_ref(&self) -> &[u8] {
|
||||
match self.0 {
|
||||
Inner::Vec(ref vec) => vec.as_slice(),
|
||||
Inner::Custom(ref custom) => (**custom).as_ref(),
|
||||
Inner::Buffer(ref mapped) => mapped.as_ref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl cmp::PartialEq for Body {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.as_ref().eq(other.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl cmp::Eq for Body {}
|
||||
|
||||
impl Clone for Body {
|
||||
fn clone(&self) -> Self {
|
||||
Body::from(Vec::from(self.as_ref()))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Inner {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Inner::Vec(ref vec) => f.debug_tuple("Vec").field(&vec).finish(),
|
||||
Inner::Custom(ref custom) => {
|
||||
f.debug_tuple("Custom").field(&(**custom).as_ref()).finish()
|
||||
}
|
||||
Inner::Buffer(ref mapped) => mapped.fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
2026
net/rtsp/src/rtspsrc/imp.rs
Normal file
2026
net/rtsp/src/rtspsrc/imp.rs
Normal file
File diff suppressed because it is too large
Load diff
30
net/rtsp/src/rtspsrc/mod.rs
Normal file
30
net/rtsp/src/rtspsrc/mod.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
// GStreamer RTSP Source v2
|
||||
//
|
||||
// Copyright (C) 2023 Tim-Philipp Müller <tim centricular com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at
|
||||
// <https://mozilla.org/MPL/2.0/>.
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use gst::glib;
|
||||
use gst::prelude::*;
|
||||
|
||||
mod body;
|
||||
mod imp;
|
||||
mod tcp_message;
|
||||
mod transport;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct RtspSrc(ObjectSubclass<imp::RtspSrc>) @extends gst::Bin, gst::Element, gst::Object;
|
||||
}
|
||||
|
||||
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
gst::Element::register(
|
||||
Some(plugin),
|
||||
"rtspsrc2",
|
||||
gst::Rank::NONE,
|
||||
RtspSrc::static_type(),
|
||||
)
|
||||
}
|
202
net/rtsp/src/rtspsrc/tcp_message.rs
Normal file
202
net/rtsp/src/rtspsrc/tcp_message.rs
Normal file
|
@ -0,0 +1,202 @@
|
|||
// GStreamer RTSP Source 2
|
||||
//
|
||||
// Copyright (C) 2023 Sebastian Dröge <sebastian@centricular.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at
|
||||
// <https://mozilla.org/MPL/2.0/>.
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::fmt;
|
||||
use std::marker::Unpin;
|
||||
|
||||
use futures::{Sink, Stream};
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
|
||||
use super::body::Body;
|
||||
use rtsp_types::Message;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ReadError {
|
||||
Io(std::io::Error),
|
||||
TooBig,
|
||||
ParseError,
|
||||
}
|
||||
|
||||
impl std::error::Error for ReadError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
ReadError::Io(ref io) => Some(io),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for ReadError {
|
||||
fn from(err: std::io::Error) -> Self {
|
||||
ReadError::Io(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ReadError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
ReadError::Io(ref io) => fmt::Display::fmt(io, fmt),
|
||||
ReadError::TooBig => write!(fmt, "Too big message"),
|
||||
ReadError::ParseError => write!(fmt, "Parse error"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn async_read<R: AsyncRead + Unpin + Send>(
|
||||
read: R,
|
||||
max_size: usize,
|
||||
) -> impl Stream<Item = Result<Message<Body>, ReadError>> + Send {
|
||||
const INITIAL_BUF_SIZE: usize = 8192;
|
||||
const MAX_EMPTY_BUF_SIZE: usize = 8 * INITIAL_BUF_SIZE;
|
||||
|
||||
struct State<R> {
|
||||
read: R,
|
||||
buf: Vec<u8>,
|
||||
write_pos: usize,
|
||||
// If > 0 then we first need to try parsing as there might be more messages
|
||||
read_pos: usize,
|
||||
}
|
||||
|
||||
let state = State {
|
||||
read,
|
||||
buf: vec![0; INITIAL_BUF_SIZE],
|
||||
write_pos: 0,
|
||||
read_pos: 0,
|
||||
};
|
||||
|
||||
futures::stream::unfold(Some(state), move |mut state| async move {
|
||||
let State {
|
||||
mut read,
|
||||
mut buf,
|
||||
mut write_pos,
|
||||
mut read_pos,
|
||||
} = state.take()?;
|
||||
|
||||
let read_one = async {
|
||||
loop {
|
||||
assert!(read_pos <= write_pos);
|
||||
|
||||
// First check if there are more messages left in the buffer
|
||||
if read_pos != write_pos {
|
||||
assert_ne!(read_pos, write_pos);
|
||||
match Message::<Body>::parse(&buf[read_pos..write_pos]) {
|
||||
Ok((msg, consumed)) => {
|
||||
read_pos += consumed;
|
||||
|
||||
// Need to first read more data on the next call
|
||||
if read_pos == write_pos {
|
||||
read_pos = 0;
|
||||
write_pos = 0;
|
||||
}
|
||||
|
||||
gst::trace!(super::imp::CAT, "Read message {:?}", msg);
|
||||
|
||||
return Ok((Some(msg), write_pos, read_pos));
|
||||
}
|
||||
Err(rtsp_types::ParseError::Error) => return Err(ReadError::ParseError),
|
||||
Err(rtsp_types::ParseError::Incomplete(_)) => {
|
||||
if read_pos > 0 {
|
||||
// Not a complete message left, copy to the beginning and read more
|
||||
// data
|
||||
buf.copy_within(read_pos..write_pos, 0);
|
||||
write_pos -= read_pos;
|
||||
read_pos = 0;
|
||||
|
||||
// Shrink the buffer again if possible and needed
|
||||
if buf.len() > MAX_EMPTY_BUF_SIZE && write_pos < MAX_EMPTY_BUF_SIZE
|
||||
{
|
||||
buf.resize(MAX_EMPTY_BUF_SIZE, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(read_pos, 0);
|
||||
|
||||
if write_pos == max_size {
|
||||
gst::error!(super::imp::CAT, "Message bigger than maximum {}", max_size);
|
||||
return Err(ReadError::TooBig);
|
||||
}
|
||||
|
||||
// Grow the buffer if needed up to the maximum
|
||||
let new_size = std::cmp::min(
|
||||
max_size,
|
||||
buf.len().checked_next_power_of_two().unwrap_or(usize::MAX),
|
||||
);
|
||||
if buf.len() < new_size {
|
||||
buf.resize(new_size, 0);
|
||||
}
|
||||
|
||||
let b = read.read(&mut buf[write_pos..]).await?;
|
||||
|
||||
if b == 0 {
|
||||
gst::debug!(super::imp::CAT, "Connection closed");
|
||||
return Ok((None, write_pos, read_pos));
|
||||
}
|
||||
write_pos += b;
|
||||
|
||||
// Try parsing on the next iteration
|
||||
}
|
||||
};
|
||||
|
||||
match read_one.await {
|
||||
Ok((Some(msg), write_pos, read_pos)) => Some((
|
||||
Ok(msg),
|
||||
Some(State {
|
||||
read,
|
||||
buf,
|
||||
write_pos,
|
||||
read_pos,
|
||||
}),
|
||||
)),
|
||||
Ok((None, _, _)) => None,
|
||||
Err(err) => {
|
||||
gst::error!(super::imp::CAT, "Read error {}", err);
|
||||
Some((Err(err), None))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn async_write<W: AsyncWrite + Unpin + Send>(
|
||||
write: W,
|
||||
) -> impl Sink<Message<Body>, Error = std::io::Error> + Send {
|
||||
struct State<W> {
|
||||
write: W,
|
||||
buffer: Vec<u8>,
|
||||
}
|
||||
|
||||
let state = State {
|
||||
write,
|
||||
buffer: Vec::with_capacity(8192),
|
||||
};
|
||||
|
||||
futures::sink::unfold(state, |mut state, item: Message<Body>| {
|
||||
async move {
|
||||
gst::trace!(super::imp::CAT, "Writing message {:?}", item);
|
||||
|
||||
// TODO: Write data messages more efficiently by writing header / body separately
|
||||
state.buffer.clear();
|
||||
item.write(&mut state.buffer).expect("can't fail");
|
||||
|
||||
match state.write.write_all(&state.buffer).await {
|
||||
Ok(_) => {
|
||||
gst::trace!(super::imp::CAT, "Finished writing queued message");
|
||||
Ok(state)
|
||||
}
|
||||
Err(err) => {
|
||||
gst::error!(super::imp::CAT, "Write error {}", err);
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
105
net/rtsp/src/rtspsrc/transport.rs
Normal file
105
net/rtsp/src/rtspsrc/transport.rs
Normal file
|
@ -0,0 +1,105 @@
|
|||
// GStreamer RTSP Source 2
|
||||
//
|
||||
// Copyright (C) 2023-2024 Nirbheek Chauhan <nirbheek centricular com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at
|
||||
// <https://mozilla.org/MPL/2.0/>.
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
//
|
||||
// https://www.rfc-editor.org/rfc/rfc2326.html
|
||||
|
||||
use super::imp::{RtspError, RtspProtocol};
|
||||
use rtsp_types::headers::{transport::RtpTransport, RtpLowerTransport};
|
||||
use std::{convert::TryFrom, net::IpAddr};
|
||||
use tokio::net::UdpSocket;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum RtspTransportInfo {
|
||||
Tcp {
|
||||
channels: (u8, Option<u8>),
|
||||
},
|
||||
Udp {
|
||||
source: Option<String>,
|
||||
server_port: (u16, Option<u16>),
|
||||
client_port: Option<(u16, Option<u16>)>,
|
||||
sockets: Option<(UdpSocket, Option<UdpSocket>)>,
|
||||
},
|
||||
UdpMulticast {
|
||||
dest: IpAddr,
|
||||
port: (u16, Option<u16>),
|
||||
ttl: Option<u8>,
|
||||
},
|
||||
}
|
||||
|
||||
impl TryFrom<&RtpTransport> for RtspTransportInfo {
|
||||
type Error = RtspError;
|
||||
|
||||
fn try_from(t: &RtpTransport) -> Result<Self, Self::Error> {
|
||||
match &t.lower_transport {
|
||||
Some(RtpLowerTransport::Tcp) => match t.params.interleaved {
|
||||
Some(v) => Ok(RtspTransportInfo::Tcp { channels: v }),
|
||||
None => Err(RtspError::Fatal(format!(
|
||||
"Expected interleaved channels: {t:#?}",
|
||||
))),
|
||||
},
|
||||
Some(RtpLowerTransport::Udp) | None => {
|
||||
if t.params.multicast {
|
||||
let dest = if let Some(d) = t.params.destination.as_ref() {
|
||||
match d.parse::<IpAddr>() {
|
||||
Ok(d) => d,
|
||||
Err(err) => {
|
||||
return Err(RtspError::Fatal(format!(
|
||||
"Failed to parse multicast dest addr: {err:?}"
|
||||
)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return Err(RtspError::Fatal(format!(
|
||||
"Need multicast dest addr: {:#?}",
|
||||
t.params,
|
||||
)));
|
||||
};
|
||||
let Some(port) = t.params.port else {
|
||||
return Err(RtspError::Fatal(format!(
|
||||
"Need multicast UDP port(s): {:#?}",
|
||||
t.params,
|
||||
)));
|
||||
};
|
||||
Ok(RtspTransportInfo::UdpMulticast {
|
||||
dest,
|
||||
port,
|
||||
ttl: t.params.ttl,
|
||||
})
|
||||
} else {
|
||||
let Some(server_port) = t.params.server_port else {
|
||||
return Err(RtspError::Fatal(format!(
|
||||
"Need server unicast UDP port(s): {:#?}",
|
||||
t.params,
|
||||
)));
|
||||
};
|
||||
Ok(RtspTransportInfo::Udp {
|
||||
source: t.params.source.clone(),
|
||||
server_port,
|
||||
client_port: t.params.client_port,
|
||||
sockets: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
Some(RtpLowerTransport::Other(token)) => Err(RtspError::Fatal(format!(
|
||||
"Unsupported RTP lower transport {token:?}"
|
||||
))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RtspTransportInfo {
|
||||
pub fn to_protocol(&self) -> RtspProtocol {
|
||||
match &self {
|
||||
Self::Tcp { .. } => RtspProtocol::Tcp,
|
||||
Self::Udp { .. } => RtspProtocol::Udp,
|
||||
Self::UdpMulticast { .. } => RtspProtocol::UdpMulticast,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue