mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-10-31 22:59:14 +00:00
examples: Use safe RTSPMediaFactory
role API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1430>
This commit is contained in:
parent
e5f87cd415
commit
d756520231
1 changed files with 7 additions and 18 deletions
|
@ -4,11 +4,10 @@
|
||||||
// send to the server. For this, the launch syntax pipeline, that is passed
|
// send to the server. For this, the launch syntax pipeline, that is passed
|
||||||
// to this example's cli is spawned and the client's media is streamed into it.
|
// to this example's cli is spawned and the client's media is streamed into it.
|
||||||
|
|
||||||
use std::{env, ptr};
|
use std::env;
|
||||||
|
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use derive_more::{Display, Error};
|
use derive_more::{Display, Error};
|
||||||
use glib::translate::*;
|
|
||||||
use gst_rtsp_server::prelude::*;
|
use gst_rtsp_server::prelude::*;
|
||||||
|
|
||||||
#[path = "../examples-common.rs"]
|
#[path = "../examples-common.rs"]
|
||||||
|
@ -78,24 +77,14 @@ fn main_loop() -> Result<(), Error> {
|
||||||
W535W8UBbEg=-----END PRIVATE KEY-----",
|
W535W8UBbEg=-----END PRIVATE KEY-----",
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Bindable versions were added in b1f515178a363df0322d7adbd5754e1f6e2083c9
|
|
||||||
// This declares that the user "user" (once authenticated) has a role that
|
// This declares that the user "user" (once authenticated) has a role that
|
||||||
// allows them to access and construct media factories.
|
// allows them to access and construct media factories.
|
||||||
unsafe {
|
factory.add_role_from_structure(
|
||||||
gst_rtsp_server::ffi::gst_rtsp_media_factory_add_role(
|
&gst::Structure::builder("user")
|
||||||
factory.to_glib_none().0,
|
.field(gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS, true)
|
||||||
"user".to_glib_none().0,
|
.field(gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT, true)
|
||||||
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS
|
.build(),
|
||||||
.to_glib_none()
|
);
|
||||||
.0,
|
|
||||||
<bool as StaticType>::static_type().into_glib() as *const u8,
|
|
||||||
true.into_glib() as *const u8,
|
|
||||||
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT.as_ptr() as *const u8,
|
|
||||||
<bool as StaticType>::static_type().into_glib() as *const u8,
|
|
||||||
true.into_glib() as *const u8,
|
|
||||||
ptr::null_mut::<u8>(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
auth.set_tls_certificate(Some(&cert));
|
auth.set_tls_certificate(Some(&cert));
|
||||||
auth.add_basic(basic.as_str(), &token);
|
auth.add_basic(basic.as_str(), &token);
|
||||||
|
|
Loading…
Reference in a new issue