webrtcsink
webrtcsink copied to clipboard
readme: add gst-launch with meta example
please, and thank you. I'm new to gstreamer and can't really figure out how meta works with gst-launch, nor has Google turned up anything helpful yet.
meta="a-structure, display-name=${dname}" is what I came up with, is that the simplest way?
So, an example would be helpful indeed. Yesterday I was updating my application to work with the meta instead of display-name, and it follows the Gst Structure syntax. To construct it in Rust you can do as follows:
let metadata = gstreamer::Structure::new("meta",
&[
(&"display-name", &"potato")
]
).to_string();
let pipeline_string = format!(
" ! webrtcsink stun-server={stun_endpoint} \
turn-server={turn_endpoint} \
signaller::address={signalling_endpoint} \
video-caps={capability} \
meta={metadata:?}"
);
Hope it helps!
Since it is a metadata, I wonder how to serialize a gstreamer::Structure from a Rust struct, it would be very helpful.
thanks @joaoantoniocardoso :) @thiblahute care to comment on this?
meta="a-structure, display-name=${dname}" is what I came up with, is that the simplest way?
Yes this is the right way to do it.
So, an example would be helpful indeed. Yesterday I was updating my application to work with the meta instead of display name, and it follows the Gst Structure syntax. To construct it in Rust you can do as follows:
let metadata = gstreamer::Structure::new("meta", &[ (&"display-name", &"potato") ] ).to_string(); let pipeline_string = format!( " ! webrtcsink stun-server={stun_endpoint} \ turn-server={turn_endpoint} \ signaller::address={signalling_endpoint} \ video-caps={capability} \ meta={metadata:?}" );
This is correct but I would find it cleaner to use metadata.to_string() (instead of abusing the Debug implementation ) or retrieve the element and set the structure as a prop fwiw :-)
Since it is a metadata, I wonder how to serialize a gstreamer::Structure from a Rust struct, it would be very helpful.
We should implement that with Serde at some point I think, but it is not done. I implemented a json_to_gst_structure function in my webrtcsrc branch which is fairly simple if it can help meanwhile.
@colemickens btw PR is welcome to add the example in the readme as suggested here :-)
This is correct but I would find it cleaner to use
metadata.to_string()(instead of abusing the Debug implementation ) or retrieve the element and set the structure as a prop fwiw :-)
metadata is already a String (you might just misread it?), and the debug :? is just there to get \" around the (String) metadata, as meta=\"{metadata}\". I agree that it is better to use \" instead of :?, especially in an example.
We should implement that with Serde at some point I think, but it is not done. I implemented a
json_to_gst_structurefunction in mywebrtcsrcbranch which is fairly simple if it can help meanwhile.
Nice! That's very helpful, thanks!
metadata is already a String (you might just misread it?), and the debug :? is just there to get " around the (String) metadata, as meta="{metadata}". I agree that it is better to use " instead of :?, especially in an example.
Indeed I read too fast. No problem in any case.
Closing, @colemickens if you decide to update the README it now lives at https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs :)