mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-09 00:35:41 +00:00
gstreamer/event: Add setter/getter for the gst::Stream in the stream-start event
This commit is contained in:
parent
4097c15c96
commit
1b7e99938f
1 changed files with 29 additions and 0 deletions
|
@ -541,6 +541,15 @@ impl<'a> StreamStart<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn get_stream(&self) -> Option<::Stream> {
|
||||
unsafe {
|
||||
let mut stream = ptr::null_mut();
|
||||
gst_sys::gst_event_parse_stream(self.as_mut_ptr(), &mut stream);
|
||||
from_glib_full(stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_event!(Caps);
|
||||
|
@ -1050,6 +1059,8 @@ pub struct StreamStartBuilder<'a> {
|
|||
stream_id: &'a str,
|
||||
flags: Option<::StreamFlags>,
|
||||
group_id: Option<GroupId>,
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
stream: Option<::Stream>,
|
||||
}
|
||||
impl<'a> StreamStartBuilder<'a> {
|
||||
fn new(stream_id: &'a str) -> Self {
|
||||
|
@ -1059,6 +1070,8 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
stream_id,
|
||||
flags: None,
|
||||
group_id: None,
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
stream: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1076,6 +1089,14 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn stream(self, stream: ::Stream) -> Self {
|
||||
Self {
|
||||
stream: Some(stream),
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
event_builder_generic_impl!(|s: &Self| {
|
||||
let ev = gst_sys::gst_event_new_stream_start(s.stream_id.to_glib_none().0);
|
||||
if let Some(flags) = s.flags {
|
||||
|
@ -1084,6 +1105,14 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
if let Some(group_id) = s.group_id {
|
||||
gst_sys::gst_event_set_group_id(ev, group_id.0.get());
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
{
|
||||
if let Some(ref stream) = s.stream {
|
||||
gst_sys::gst_event_set_stream(ev, stream.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
ev
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue