diff options
author | Guillaume Desmottes <guillaume.desmottes@onestream.live> | 2022-12-19 19:13:01 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@onestream.live> | 2023-06-05 15:09:41 +0300 |
commit | 432de060ea24a8d7fc29394a56cd689980a0cb39 (patch) | |
tree | 60200c6935d9646004693f522834f9b2931710df /utils | |
parent | 97fa20237f2d71908831c53d777e7a3158249cb6 (diff) |
uriplaylistbin: example: display iterations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1232>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/uriplaylistbin/examples/playlist.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/uriplaylistbin/examples/playlist.rs b/utils/uriplaylistbin/examples/playlist.rs index 3c624ba1..707e0d92 100644 --- a/utils/uriplaylistbin/examples/playlist.rs +++ b/utils/uriplaylistbin/examples/playlist.rs @@ -78,6 +78,22 @@ fn create_pipeline(uris: Vec<String>, iterations: u32) -> anyhow::Result<gst::Pi let _ = sink.set_state(gst::State::Null); }); + fn display_current(uriplaylistbin: &gst::Element) { + let uris = uriplaylistbin.property::<Vec<String>>("uris"); + let uri_index = uriplaylistbin.property::<u64>("current-uri-index"); + let iteration = uriplaylistbin.property::<u32>("current-iteration"); + + println!("-> {} (iteration {})", uris[uri_index as usize], iteration); + } + + playlist.connect_notify(Some("current-iteration"), |uriplaylistbin, _param_spec| { + display_current(uriplaylistbin); + }); + + playlist.connect_notify(Some("current-uri-index"), |uriplaylistbin, _param_spec| { + display_current(uriplaylistbin); + }); + Ok(pipeline) } |