Add support for setting custom fields in message/events during construction

This commit is contained in:
Sebastian Dröge 2017-09-13 22:38:19 +03:00
parent f1025170d9
commit 17cce1a3d7
2 changed files with 340 additions and 149 deletions

View file

@ -15,6 +15,7 @@ use std::mem;
use std::ffi::CStr;
use glib;
use glib::value::ToValue;
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
#[cfg(feature = "v1_10")]
@ -109,50 +110,50 @@ impl EventRef {
}
impl GstRc<EventRef> {
pub fn new_flush_start() -> FlushStartBuilder {
pub fn new_flush_start<'a>() -> FlushStartBuilder<'a> {
assert_initialized_main_thread!();
FlushStartBuilder::new()
}
pub fn new_flush_stop(reset_time: bool) -> FlushStopBuilder {
pub fn new_flush_stop<'a>(reset_time: bool) -> FlushStopBuilder<'a> {
assert_initialized_main_thread!();
FlushStopBuilder::new(reset_time)
}
pub fn new_stream_start(stream_id: &str) -> StreamStartBuilder {
pub fn new_stream_start<'a>(stream_id: &'a str) -> StreamStartBuilder<'a> {
assert_initialized_main_thread!();
StreamStartBuilder::new(stream_id)
}
pub fn new_caps(caps: &::Caps) -> CapsBuilder {
pub fn new_caps<'a>(caps: &'a ::Caps) -> CapsBuilder<'a> {
assert_initialized_main_thread!();
CapsBuilder::new(caps)
}
pub fn new_segment(segment: &::Segment) -> SegmentBuilder {
pub fn new_segment<'a>(segment: &'a ::Segment) -> SegmentBuilder<'a> {
assert_initialized_main_thread!();
SegmentBuilder::new(segment)
}
#[cfg(feature = "v1_10")]
pub fn new_stream_collection(
stream_collection: &::StreamCollection,
) -> StreamCollectionBuilder {
pub fn new_stream_collection<'a>(
stream_collection: &'a ::StreamCollection,
) -> StreamCollectionBuilder<'a> {
assert_initialized_main_thread!();
StreamCollectionBuilder::new(stream_collection)
}
pub fn new_tag(tags: ::TagList) -> TagBuilder {
pub fn new_tag<'a>(tags: ::TagList) -> TagBuilder<'a> {
assert_initialized_main_thread!();
TagBuilder::new(tags)
}
pub fn new_buffer_size(
pub fn new_buffer_size<'a>(
format: ::Format,
minsize: i64,
maxsize: i64,
async: bool,
) -> BufferSizeBuilder {
) -> BufferSizeBuilder<'a> {
assert_initialized_main_thread!();
BufferSizeBuilder::new(format, minsize, maxsize, async)
}
@ -163,17 +164,17 @@ impl GstRc<EventRef> {
}
#[cfg(feature = "v1_10")]
pub fn new_stream_group_done(group_id: u32) -> StreamGroupDoneBuilder {
pub fn new_stream_group_done<'a>(group_id: u32) -> StreamGroupDoneBuilder<'a> {
assert_initialized_main_thread!();
StreamGroupDoneBuilder::new(group_id)
}
pub fn new_eos() -> EosBuilder {
pub fn new_eos<'a>() -> EosBuilder<'a> {
assert_initialized_main_thread!();
EosBuilder::new()
}
pub fn new_toc(toc: &::Toc, updated: bool) -> TocBuilder {
pub fn new_toc<'a>(toc: &'a ::Toc, updated: bool) -> TocBuilder<'a> {
assert_initialized_main_thread!();
TocBuilder::new(toc, updated)
}
@ -187,22 +188,27 @@ impl GstRc<EventRef> {
ProtectionBuilder::new(system_id, data, origin)
}
pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder {
pub fn new_segment_done<'a>(format: ::Format, position: i64) -> SegmentDoneBuilder<'a> {
assert_initialized_main_thread!();
SegmentDoneBuilder::new(format, position)
}
pub fn new_gap(timestamp: u64, duration: u64) -> GapBuilder {
pub fn new_gap<'a>(timestamp: u64, duration: u64) -> GapBuilder<'a> {
assert_initialized_main_thread!();
GapBuilder::new(timestamp, duration)
}
pub fn new_qos(type_: ::QOSType, proportion: f64, diff: i64, timestamp: u64) -> QosBuilder {
pub fn new_qos<'a>(
type_: ::QOSType,
proportion: f64,
diff: i64,
timestamp: u64,
) -> QosBuilder<'a> {
assert_initialized_main_thread!();
QosBuilder::new(type_, proportion, diff, timestamp)
}
pub fn new_seek(
pub fn new_seek<'a>(
rate: f64,
format: ::Format,
flags: ::SeekFlags,
@ -210,38 +216,38 @@ impl GstRc<EventRef> {
start: i64,
stop_type: ::SeekType,
stop: i64,
) -> SeekBuilder {
) -> SeekBuilder<'a> {
assert_initialized_main_thread!();
SeekBuilder::new(rate, format, flags, start_type, start, stop_type, stop)
}
pub fn new_navigation(structure: ::Structure) -> NavigationBuilder {
pub fn new_navigation<'a>(structure: ::Structure) -> NavigationBuilder<'a> {
assert_initialized_main_thread!();
NavigationBuilder::new(structure)
}
pub fn new_latency(latency: u64) -> LatencyBuilder {
pub fn new_latency<'a>(latency: u64) -> LatencyBuilder<'a> {
assert_initialized_main_thread!();
LatencyBuilder::new(latency)
}
pub fn new_step(
pub fn new_step<'a>(
format: ::Format,
amount: u64,
rate: f64,
flush: bool,
intermediate: bool,
) -> StepBuilder {
) -> StepBuilder<'a> {
assert_initialized_main_thread!();
StepBuilder::new(format, amount, rate, flush, intermediate)
}
pub fn new_reconfigure() -> ReconfigureBuilder {
pub fn new_reconfigure<'a>() -> ReconfigureBuilder<'a> {
assert_initialized_main_thread!();
ReconfigureBuilder::new()
}
pub fn new_toc_select(uid: &str) -> TocSelectBuilder {
pub fn new_toc_select<'a>(uid: &'a str) -> TocSelectBuilder<'a> {
assert_initialized_main_thread!();
TocSelectBuilder::new(uid)
}
@ -252,32 +258,34 @@ impl GstRc<EventRef> {
SelectStreamsBuilder::new(streams)
}
pub fn new_custom_upstream(structure: ::Structure) -> CustomUpstreamBuilder {
pub fn new_custom_upstream<'a>(structure: ::Structure) -> CustomUpstreamBuilder<'a> {
assert_initialized_main_thread!();
CustomUpstreamBuilder::new(structure)
}
pub fn new_custom_downstream(structure: ::Structure) -> CustomDownstreamBuilder {
pub fn new_custom_downstream<'a>(structure: ::Structure) -> CustomDownstreamBuilder<'a> {
assert_initialized_main_thread!();
CustomDownstreamBuilder::new(structure)
}
pub fn new_custom_downstream_oob(structure: ::Structure) -> CustomDownstreamOobBuilder {
pub fn new_custom_downstream_oob<'a>(structure: ::Structure) -> CustomDownstreamOobBuilder<'a> {
assert_initialized_main_thread!();
CustomDownstreamOobBuilder::new(structure)
}
pub fn new_custom_downstream_sticky(structure: ::Structure) -> CustomDownstreamStickyBuilder {
pub fn new_custom_downstream_sticky<'a>(
structure: ::Structure,
) -> CustomDownstreamStickyBuilder<'a> {
assert_initialized_main_thread!();
CustomDownstreamStickyBuilder::new(structure)
}
pub fn new_custom_both(structure: ::Structure) -> CustomBothBuilder {
pub fn new_custom_both<'a>(structure: ::Structure) -> CustomBothBuilder<'a> {
assert_initialized_main_thread!();
CustomBothBuilder::new(structure)
}
pub fn new_custom_both_oob(structure: ::Structure) -> CustomBothOobBuilder {
pub fn new_custom_both_oob<'a>(structure: ::Structure) -> CustomBothOobBuilder<'a> {
assert_initialized_main_thread!();
CustomBothOobBuilder::new(structure)
}
@ -693,6 +701,15 @@ macro_rules! event_builder_generic_impl {
}
}
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToValue)]) -> Self {
Self {
other_fields: self.other_fields.iter().cloned()
.chain(other_fields.iter().cloned())
.collect(),
.. self
}
}
pub fn build(mut self) -> Event {
assert_initialized_main_thread!();
unsafe {
@ -705,39 +722,53 @@ macro_rules! event_builder_generic_impl {
ffi::gst_event_set_running_time_offset(event, running_time_offset);
}
{
let s = StructureRef::from_glib_borrow_mut(
ffi::gst_event_writable_structure(event)
);
for (k, v) in self.other_fields {
s.set_value(k, v.to_value());
}
}
from_glib_full(event)
}
}
}
}
pub struct FlushStartBuilder {
pub struct FlushStartBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl FlushStartBuilder {
impl<'a> FlushStartBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
}
}
event_builder_generic_impl!(|_| ffi::gst_event_new_flush_start());
}
pub struct FlushStopBuilder {
pub struct FlushStopBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
reset_time: bool,
}
impl FlushStopBuilder {
impl<'a> FlushStopBuilder<'a> {
fn new(reset_time: bool) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
reset_time: reset_time,
}
}
@ -750,6 +781,7 @@ impl FlushStopBuilder {
pub struct StreamStartBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
stream_id: &'a str,
flags: Option<::StreamFlags>,
group_id: Option<u32>,
@ -760,6 +792,7 @@ impl<'a> StreamStartBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
stream_id: stream_id,
flags: None,
group_id: None,
@ -795,6 +828,7 @@ impl<'a> StreamStartBuilder<'a> {
pub struct CapsBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
caps: &'a ::Caps,
}
impl<'a> CapsBuilder<'a> {
@ -803,6 +837,7 @@ impl<'a> CapsBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
caps: caps,
}
}
@ -813,6 +848,7 @@ impl<'a> CapsBuilder<'a> {
pub struct SegmentBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
segment: &'a ::Segment,
}
impl<'a> SegmentBuilder<'a> {
@ -821,6 +857,7 @@ impl<'a> SegmentBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
segment: segment,
}
}
@ -834,6 +871,7 @@ impl<'a> SegmentBuilder<'a> {
pub struct StreamCollectionBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
stream_collection: &'a ::StreamCollection,
}
#[cfg(feature = "v1_10")]
@ -843,6 +881,7 @@ impl<'a> StreamCollectionBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
stream_collection: stream_collection,
}
}
@ -852,17 +891,19 @@ impl<'a> StreamCollectionBuilder<'a> {
});
}
pub struct TagBuilder {
pub struct TagBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
tags: Option<::TagList>,
}
impl TagBuilder {
impl<'a> TagBuilder<'a> {
fn new(tags: ::TagList) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
tags: Some(tags),
}
}
@ -873,20 +914,22 @@ impl TagBuilder {
});
}
pub struct BufferSizeBuilder {
pub struct BufferSizeBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
fmt: ::Format,
minsize: i64,
maxsize: i64,
async: bool,
}
impl BufferSizeBuilder {
impl<'a> BufferSizeBuilder<'a> {
fn new(fmt: ::Format, minsize: i64, maxsize: i64, async: bool) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
fmt: fmt,
minsize: minsize,
maxsize: maxsize,
@ -902,6 +945,7 @@ impl BufferSizeBuilder {
pub struct SinkMessageBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
name: &'a str,
msg: &'a ::Message,
}
@ -911,6 +955,7 @@ impl<'a> SinkMessageBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
name: name,
msg: msg,
}
@ -922,18 +967,20 @@ impl<'a> SinkMessageBuilder<'a> {
}
#[cfg(feature = "v1_10")]
pub struct StreamGroupDoneBuilder {
pub struct StreamGroupDoneBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
uid: u32,
}
#[cfg(feature = "v1_10")]
impl StreamGroupDoneBuilder {
impl<'a> StreamGroupDoneBuilder<'a> {
fn new(uid: u32) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
uid: uid,
}
}
@ -941,16 +988,18 @@ impl StreamGroupDoneBuilder {
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_stream_group_done(s.uid));
}
pub struct EosBuilder {
pub struct EosBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl EosBuilder {
impl<'a> EosBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
}
}
@ -960,6 +1009,7 @@ impl EosBuilder {
pub struct TocBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
toc: &'a ::Toc,
updated: bool,
}
@ -969,6 +1019,7 @@ impl<'a> TocBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
toc: toc,
updated: updated,
}
@ -982,6 +1033,7 @@ impl<'a> TocBuilder<'a> {
pub struct ProtectionBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
system_id: &'a str,
data: &'a ::Buffer,
origin: &'a str,
@ -992,6 +1044,7 @@ impl<'a> ProtectionBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
system_id: system_id,
data: data,
origin: origin,
@ -1007,18 +1060,20 @@ impl<'a> ProtectionBuilder<'a> {
});
}
pub struct SegmentDoneBuilder {
pub struct SegmentDoneBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
fmt: ::Format,
position: i64,
}
impl SegmentDoneBuilder {
impl<'a> SegmentDoneBuilder<'a> {
fn new(fmt: ::Format, position: i64) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
fmt: fmt,
position: position,
}
@ -1029,18 +1084,20 @@ impl SegmentDoneBuilder {
});
}
pub struct GapBuilder {
pub struct GapBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
timestamp: u64,
duration: u64,
}
impl GapBuilder {
impl<'a> GapBuilder<'a> {
fn new(timestamp: u64, duration: u64) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
timestamp: timestamp,
duration: duration,
}
@ -1049,20 +1106,22 @@ impl GapBuilder {
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_gap(s.timestamp, s.duration));
}
pub struct QosBuilder {
pub struct QosBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
type_: ::QOSType,
proportion: f64,
diff: i64,
timestamp: u64,
}
impl QosBuilder {
impl<'a> QosBuilder<'a> {
fn new(type_: ::QOSType, proportion: f64, diff: i64, timestamp: u64) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
type_: type_,
proportion: proportion,
diff: diff,
@ -1075,9 +1134,10 @@ impl QosBuilder {
});
}
pub struct SeekBuilder {
pub struct SeekBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
rate: f64,
fmt: ::Format,
flags: ::SeekFlags,
@ -1086,7 +1146,7 @@ pub struct SeekBuilder {
stop_type: ::SeekType,
stop: i64,
}
impl SeekBuilder {
impl<'a> SeekBuilder<'a> {
fn new(
rate: f64,
fmt: ::Format,
@ -1100,6 +1160,7 @@ impl SeekBuilder {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
rate: rate,
fmt: fmt,
flags: flags,
@ -1123,17 +1184,19 @@ impl SeekBuilder {
});
}
pub struct NavigationBuilder {
pub struct NavigationBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<Structure>,
}
impl NavigationBuilder {
impl<'a> NavigationBuilder<'a> {
fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1147,17 +1210,19 @@ impl NavigationBuilder {
});
}
pub struct LatencyBuilder {
pub struct LatencyBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
latency: u64,
}
impl LatencyBuilder {
impl<'a> LatencyBuilder<'a> {
fn new(latency: u64) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
latency: latency,
}
}
@ -1165,21 +1230,23 @@ impl LatencyBuilder {
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_latency(s.latency));
}
pub struct StepBuilder {
pub struct StepBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
fmt: ::Format,
amount: u64,
rate: f64,
flush: bool,
intermediate: bool,
}
impl StepBuilder {
impl<'a> StepBuilder<'a> {
fn new(fmt: ::Format, amount: u64, rate: f64, flush: bool, intermediate: bool) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
fmt: fmt,
amount: amount,
rate: rate,
@ -1199,16 +1266,18 @@ impl StepBuilder {
});
}
pub struct ReconfigureBuilder {
pub struct ReconfigureBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl ReconfigureBuilder {
impl<'a> ReconfigureBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
}
}
@ -1218,6 +1287,7 @@ impl ReconfigureBuilder {
pub struct TocSelectBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
uid: &'a str,
}
impl<'a> TocSelectBuilder<'a> {
@ -1226,6 +1296,7 @@ impl<'a> TocSelectBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
uid: uid,
}
}
@ -1239,6 +1310,7 @@ impl<'a> TocSelectBuilder<'a> {
pub struct SelectStreamsBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
streams: &'a [&'a str],
}
#[cfg(feature = "v1_10")]
@ -1248,6 +1320,7 @@ impl<'a> SelectStreamsBuilder<'a> {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
streams: streams,
}
}
@ -1257,17 +1330,19 @@ impl<'a> SelectStreamsBuilder<'a> {
});
}
pub struct CustomUpstreamBuilder {
pub struct CustomUpstreamBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<Structure>,
}
impl CustomUpstreamBuilder {
impl<'a> CustomUpstreamBuilder<'a> {
fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1282,17 +1357,19 @@ impl CustomUpstreamBuilder {
});
}
pub struct CustomDownstreamBuilder {
pub struct CustomDownstreamBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<Structure>,
}
impl CustomDownstreamBuilder {
impl<'a> CustomDownstreamBuilder<'a> {
fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1307,17 +1384,19 @@ impl CustomDownstreamBuilder {
});
}
pub struct CustomDownstreamOobBuilder {
pub struct CustomDownstreamOobBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<Structure>,
}
impl CustomDownstreamOobBuilder {
impl<'a> CustomDownstreamOobBuilder<'a> {
fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1334,17 +1413,19 @@ impl CustomDownstreamOobBuilder {
});
}
pub struct CustomDownstreamStickyBuilder {
pub struct CustomDownstreamStickyBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<Structure>,
}
impl CustomDownstreamStickyBuilder {
impl<'a> CustomDownstreamStickyBuilder<'a> {
fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1361,17 +1442,19 @@ impl CustomDownstreamStickyBuilder {
});
}
pub struct CustomBothBuilder {
pub struct CustomBothBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<Structure>,
}
impl CustomBothBuilder {
impl<'a> CustomBothBuilder<'a> {
fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1385,17 +1468,19 @@ impl CustomBothBuilder {
});
}
pub struct CustomBothOobBuilder {
pub struct CustomBothOobBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<Structure>,
}
impl CustomBothOobBuilder {
impl<'a> CustomBothOobBuilder<'a> {
fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}

View file

@ -19,6 +19,7 @@ use std::ffi::CStr;
use glib;
use glib::Cast;
use glib::IsA;
use glib::value::ToValue;
use glib::translate::{from_glib, from_glib_full, from_glib_none, mut_override, ToGlib, ToGlibPtr};
#[repr(C)]
@ -100,47 +101,51 @@ impl MessageRef {
}
impl GstRc<MessageRef> {
pub fn new_eos() -> EosBuilder {
pub fn new_eos<'a>() -> EosBuilder<'a> {
assert_initialized_main_thread!();
EosBuilder::new()
}
pub fn new_error(error: &glib::Error) -> ErrorBuilder {
pub fn new_error<'a>(error: &'a glib::Error) -> ErrorBuilder<'a> {
assert_initialized_main_thread!();
ErrorBuilder::new(error)
}
pub fn new_warning(error: &glib::Error) -> WarningBuilder {
pub fn new_warning<'a>(error: &'a glib::Error) -> WarningBuilder<'a> {
assert_initialized_main_thread!();
WarningBuilder::new(error)
}
pub fn new_info(error: &glib::Error) -> InfoBuilder {
pub fn new_info<'a>(error: &'a glib::Error) -> InfoBuilder<'a> {
assert_initialized_main_thread!();
InfoBuilder::new(error)
}
pub fn new_tag(tags: &TagList) -> TagBuilder {
pub fn new_tag<'a>(tags: &'a TagList) -> TagBuilder<'a> {
assert_initialized_main_thread!();
TagBuilder::new(tags)
}
pub fn new_buffering(percent: i32) -> BufferingBuilder {
pub fn new_buffering<'a>(percent: i32) -> BufferingBuilder<'a> {
assert_initialized_main_thread!();
BufferingBuilder::new(percent)
}
pub fn new_state_changed(old: ::State, new: ::State, pending: ::State) -> StateChangedBuilder {
pub fn new_state_changed<'a>(
old: ::State,
new: ::State,
pending: ::State,
) -> StateChangedBuilder<'a> {
assert_initialized_main_thread!();
StateChangedBuilder::new(old, new, pending)
}
pub fn new_state_dirty() -> StateDirtyBuilder {
pub fn new_state_dirty<'a>() -> StateDirtyBuilder<'a> {
assert_initialized_main_thread!();
StateDirtyBuilder::new()
}
pub fn new_step_done(
pub fn new_step_done<'a>(
format: ::Format,
amount: u64,
rate: f64,
@ -148,104 +153,107 @@ impl GstRc<MessageRef> {
intermediate: bool,
duration: u64,
eos: bool,
) -> StepDoneBuilder {
) -> StepDoneBuilder<'a> {
assert_initialized_main_thread!();
StepDoneBuilder::new(format, amount, rate, flush, intermediate, duration, eos)
}
pub fn new_clock_provide(clock: &::Clock, ready: bool) -> ClockProvideBuilder {
pub fn new_clock_provide<'a>(clock: &'a ::Clock, ready: bool) -> ClockProvideBuilder<'a> {
assert_initialized_main_thread!();
ClockProvideBuilder::new(clock, ready)
}
pub fn new_clock_lost(clock: &::Clock) -> ClockLostBuilder {
pub fn new_clock_lost<'a>(clock: &'a ::Clock) -> ClockLostBuilder<'a> {
assert_initialized_main_thread!();
ClockLostBuilder::new(clock)
}
pub fn new_new_clock(clock: &::Clock) -> NewClockBuilder {
pub fn new_new_clock<'a>(clock: &'a ::Clock) -> NewClockBuilder<'a> {
assert_initialized_main_thread!();
NewClockBuilder::new(clock)
}
pub fn new_structure_change(
pub fn new_structure_change<'a>(
type_: ::StructureChangeType,
owner: &::Element,
owner: &'a ::Element,
busy: bool,
) -> StructureChangeBuilder {
) -> StructureChangeBuilder<'a> {
assert_initialized_main_thread!();
StructureChangeBuilder::new(type_, owner, busy)
}
pub fn new_stream_status(type_: ::StreamStatusType, owner: &::Element) -> StreamStatusBuilder {
pub fn new_stream_status<'a>(
type_: ::StreamStatusType,
owner: &'a ::Element,
) -> StreamStatusBuilder<'a> {
assert_initialized_main_thread!();
StreamStatusBuilder::new(type_, owner)
}
pub fn new_application(structure: ::Structure) -> ApplicationBuilder {
pub fn new_application<'a>(structure: ::Structure) -> ApplicationBuilder<'a> {
assert_initialized_main_thread!();
ApplicationBuilder::new(structure)
}
pub fn new_element(structure: ::Structure) -> ElementBuilder {
pub fn new_element<'a>(structure: ::Structure) -> ElementBuilder<'a> {
assert_initialized_main_thread!();
ElementBuilder::new(structure)
}
pub fn new_segment_start(format: ::Format, position: i64) -> SegmentStartBuilder {
pub fn new_segment_start<'a>(format: ::Format, position: i64) -> SegmentStartBuilder<'a> {
assert_initialized_main_thread!();
SegmentStartBuilder::new(format, position)
}
pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder {
pub fn new_segment_done<'a>(format: ::Format, position: i64) -> SegmentDoneBuilder<'a> {
assert_initialized_main_thread!();
SegmentDoneBuilder::new(format, position)
}
pub fn new_duration_changed() -> DurationChangedBuilder {
pub fn new_duration_changed<'a>() -> DurationChangedBuilder<'a> {
assert_initialized_main_thread!();
DurationChangedBuilder::new()
}
pub fn new_latency() -> LatencyBuilder {
pub fn new_latency<'a>() -> LatencyBuilder<'a> {
assert_initialized_main_thread!();
LatencyBuilder::new()
}
pub fn new_async_start() -> AsyncStartBuilder {
pub fn new_async_start<'a>() -> AsyncStartBuilder<'a> {
assert_initialized_main_thread!();
AsyncStartBuilder::new()
}
pub fn new_async_done(running_time: u64) -> AsyncDoneBuilder {
pub fn new_async_done<'a>(running_time: u64) -> AsyncDoneBuilder<'a> {
assert_initialized_main_thread!();
AsyncDoneBuilder::new(running_time)
}
pub fn new_request_state(state: ::State) -> RequestStateBuilder {
pub fn new_request_state<'a>(state: ::State) -> RequestStateBuilder<'a> {
assert_initialized_main_thread!();
RequestStateBuilder::new(state)
}
pub fn new_step_start(
pub fn new_step_start<'a>(
active: bool,
format: ::Format,
amount: u64,
rate: f64,
flush: bool,
intermediate: bool,
) -> StepStartBuilder {
) -> StepStartBuilder<'a> {
assert_initialized_main_thread!();
StepStartBuilder::new(active, format, amount, rate, flush, intermediate)
}
pub fn new_qos_builder(
pub fn new_qos_builder<'a>(
live: bool,
running_time: u64,
stream_time: u64,
timestamp: u64,
duration: u64,
) -> QosBuilder {
) -> QosBuilder<'a> {
assert_initialized_main_thread!();
QosBuilder::new(live, running_time, stream_time, timestamp, duration)
}
@ -255,37 +263,37 @@ impl GstRc<MessageRef> {
ProgressBuilder::new(type_)
}
pub fn new_toc(toc: &::Toc, updated: bool) -> TocBuilder {
pub fn new_toc<'a>(toc: &'a ::Toc, updated: bool) -> TocBuilder<'a> {
assert_initialized_main_thread!();
TocBuilder::new(toc, updated)
}
pub fn new_reset_time(running_time: u64) -> ResetTimeBuilder {
pub fn new_reset_time<'a>(running_time: u64) -> ResetTimeBuilder<'a> {
assert_initialized_main_thread!();
ResetTimeBuilder::new(running_time)
}
pub fn new_stream_start() -> StreamStartBuilder {
pub fn new_stream_start<'a>() -> StreamStartBuilder<'a> {
assert_initialized_main_thread!();
StreamStartBuilder::new()
}
pub fn new_need_context(context_type: &str) -> NeedContextBuilder {
pub fn new_need_context<'a>(context_type: &'a str) -> NeedContextBuilder<'a> {
assert_initialized_main_thread!();
NeedContextBuilder::new(context_type)
}
pub fn new_have_context(context: ::Context) -> HaveContextBuilder {
pub fn new_have_context<'a>(context: ::Context) -> HaveContextBuilder<'a> {
assert_initialized_main_thread!();
HaveContextBuilder::new(context)
}
pub fn new_device_added(device: &::Device) -> DeviceAddedBuilder {
pub fn new_device_added<'a>(device: &'a ::Device) -> DeviceAddedBuilder<'a> {
assert_initialized_main_thread!();
DeviceAddedBuilder::new(device)
}
pub fn new_device_removed(device: &::Device) -> DeviceRemovedBuilder {
pub fn new_device_removed<'a>(device: &'a ::Device) -> DeviceRemovedBuilder<'a> {
assert_initialized_main_thread!();
DeviceRemovedBuilder::new(device)
}
@ -300,13 +308,17 @@ impl GstRc<MessageRef> {
}
#[cfg(feature = "v1_10")]
pub fn new_stream_collection(collection: &::StreamCollection) -> StreamCollectionBuilder {
pub fn new_stream_collection<'a>(
collection: &'a ::StreamCollection,
) -> StreamCollectionBuilder<'a> {
assert_initialized_main_thread!();
StreamCollectionBuilder::new(collection)
}
#[cfg(feature = "v1_10")]
pub fn new_streams_selected(collection: &::StreamCollection) -> StreamsSelectedBuilder {
pub fn new_streams_selected<'a>(
collection: &'a ::StreamCollection,
) -> StreamsSelectedBuilder<'a> {
assert_initialized_main_thread!();
StreamsSelectedBuilder::new(collection)
}
@ -1117,6 +1129,15 @@ macro_rules! message_builder_generic_impl {
}
}
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToValue)]) -> Self {
Self {
other_fields: self.other_fields.iter().cloned()
.chain(other_fields.iter().cloned())
.collect(),
.. self
}
}
pub fn build(mut self) -> Message {
assert_initialized_main_thread!();
unsafe {
@ -1126,22 +1147,34 @@ macro_rules! message_builder_generic_impl {
ffi::gst_message_set_seqnum(msg, seqnum);
}
{
let s = StructureRef::from_glib_borrow_mut(
ffi::gst_message_get_structure(msg) as *mut _
);
for (k, v) in self.other_fields {
s.set_value(k, v.to_value());
}
}
from_glib_full(msg)
}
}
}
}
pub struct EosBuilder {
pub struct EosBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl EosBuilder {
impl<'a> EosBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
}
}
@ -1151,6 +1184,7 @@ impl EosBuilder {
pub struct ErrorBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)] details: Option<Structure>,
@ -1161,6 +1195,7 @@ impl<'a> ErrorBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
error: error,
debug: None,
details: None,
@ -1211,6 +1246,7 @@ impl<'a> ErrorBuilder<'a> {
pub struct WarningBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)] details: Option<Structure>,
@ -1221,6 +1257,7 @@ impl<'a> WarningBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
error: error,
debug: None,
details: None,
@ -1271,6 +1308,7 @@ impl<'a> WarningBuilder<'a> {
pub struct InfoBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
error: &'a glib::Error,
debug: Option<&'a str>,
#[allow(unused)] details: Option<Structure>,
@ -1281,6 +1319,7 @@ impl<'a> InfoBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
error: error,
debug: None,
details: None,
@ -1331,6 +1370,7 @@ impl<'a> InfoBuilder<'a> {
pub struct TagBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
tags: &'a TagList,
}
impl<'a> TagBuilder<'a> {
@ -1339,6 +1379,7 @@ impl<'a> TagBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
tags: tags,
}
}
@ -1348,18 +1389,20 @@ impl<'a> TagBuilder<'a> {
});
}
pub struct BufferingBuilder {
pub struct BufferingBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
percent: i32,
stats: Option<(::BufferingMode, i32, i32, i64)>,
}
impl BufferingBuilder {
impl<'a> BufferingBuilder<'a> {
fn new(percent: i32) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
percent: percent,
stats: None,
}
@ -1396,19 +1439,21 @@ impl BufferingBuilder {
});
}
pub struct StateChangedBuilder {
pub struct StateChangedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
old: ::State,
new: ::State,
pending: ::State,
}
impl StateChangedBuilder {
impl<'a> StateChangedBuilder<'a> {
fn new(old: ::State, new: ::State, pending: ::State) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
old: old,
new: new,
pending: pending,
@ -1425,25 +1470,28 @@ impl StateChangedBuilder {
});
}
pub struct StateDirtyBuilder {
pub struct StateDirtyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl StateDirtyBuilder {
impl<'a> StateDirtyBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
}
}
message_builder_generic_impl!(|_, src| ffi::gst_message_new_state_dirty(src));
}
pub struct StepDoneBuilder {
pub struct StepDoneBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
format: ::Format,
amount: u64,
rate: f64,
@ -1452,7 +1500,7 @@ pub struct StepDoneBuilder {
duration: u64,
eos: bool,
}
impl StepDoneBuilder {
impl<'a> StepDoneBuilder<'a> {
fn new(
format: ::Format,
amount: u64,
@ -1466,6 +1514,7 @@ impl StepDoneBuilder {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
format: format,
amount: amount,
rate: rate,
@ -1493,6 +1542,7 @@ impl StepDoneBuilder {
pub struct ClockProvideBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
clock: &'a ::Clock,
ready: bool,
}
@ -1502,6 +1552,7 @@ impl<'a> ClockProvideBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
clock: clock,
ready: ready,
}
@ -1515,6 +1566,7 @@ impl<'a> ClockProvideBuilder<'a> {
pub struct ClockLostBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
clock: &'a ::Clock,
}
impl<'a> ClockLostBuilder<'a> {
@ -1523,6 +1575,7 @@ impl<'a> ClockLostBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
clock: clock,
}
}
@ -1535,6 +1588,7 @@ impl<'a> ClockLostBuilder<'a> {
pub struct NewClockBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
clock: &'a ::Clock,
}
impl<'a> NewClockBuilder<'a> {
@ -1543,6 +1597,7 @@ impl<'a> NewClockBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
clock: clock,
}
}
@ -1555,6 +1610,7 @@ impl<'a> NewClockBuilder<'a> {
pub struct StructureChangeBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
type_: ::StructureChangeType,
owner: &'a ::Element,
busy: bool,
@ -1565,6 +1621,7 @@ impl<'a> StructureChangeBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
type_: type_,
owner: owner,
busy: busy,
@ -1584,6 +1641,7 @@ impl<'a> StructureChangeBuilder<'a> {
pub struct StreamStatusBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
type_: ::StreamStatusType,
owner: &'a ::Element,
status_object: Option<&'a glib::Value>,
@ -1594,6 +1652,7 @@ impl<'a> StreamStatusBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
type_: type_,
owner: owner,
status_object: None,
@ -1617,17 +1676,19 @@ impl<'a> StreamStatusBuilder<'a> {
});
}
pub struct ApplicationBuilder {
pub struct ApplicationBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<::Structure>,
}
impl ApplicationBuilder {
impl<'a> ApplicationBuilder<'a> {
fn new(structure: ::Structure) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1637,17 +1698,19 @@ impl ApplicationBuilder {
});
}
pub struct ElementBuilder {
pub struct ElementBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
structure: Option<::Structure>,
}
impl ElementBuilder {
impl<'a> ElementBuilder<'a> {
fn new(structure: ::Structure) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
structure: Some(structure),
}
}
@ -1657,18 +1720,20 @@ impl ElementBuilder {
});
}
pub struct SegmentStartBuilder {
pub struct SegmentStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
format: ::Format,
position: i64,
}
impl SegmentStartBuilder {
impl<'a> SegmentStartBuilder<'a> {
fn new(format: ::Format, position: i64) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
format: format,
position: position,
}
@ -1679,18 +1744,20 @@ impl SegmentStartBuilder {
});
}
pub struct SegmentDoneBuilder {
pub struct SegmentDoneBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
format: ::Format,
position: i64,
}
impl SegmentDoneBuilder {
impl<'a> SegmentDoneBuilder<'a> {
fn new(format: ::Format, position: i64) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
format: format,
position: position,
}
@ -1701,65 +1768,73 @@ impl SegmentDoneBuilder {
});
}
pub struct DurationChangedBuilder {
pub struct DurationChangedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl DurationChangedBuilder {
impl<'a> DurationChangedBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
}
}
message_builder_generic_impl!(|_, src| ffi::gst_message_new_duration_changed(src));
}
pub struct LatencyBuilder {
pub struct LatencyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl LatencyBuilder {
impl<'a> LatencyBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
}
}
message_builder_generic_impl!(|_, src| ffi::gst_message_new_latency(src));
}
pub struct AsyncStartBuilder {
pub struct AsyncStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
}
impl AsyncStartBuilder {
impl<'a> AsyncStartBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
}
}
message_builder_generic_impl!(|_, src| ffi::gst_message_new_async_start(src));
}
pub struct AsyncDoneBuilder {
pub struct AsyncDoneBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
running_time: u64,
}
impl AsyncDoneBuilder {
impl<'a> AsyncDoneBuilder<'a> {
fn new(running_time: u64) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
running_time: running_time,
}
}
@ -1769,17 +1844,19 @@ impl AsyncDoneBuilder {
});
}
pub struct RequestStateBuilder {
pub struct RequestStateBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
state: ::State,
}
impl RequestStateBuilder {
impl<'a> RequestStateBuilder<'a> {
fn new(state: ::State) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
state: state,
}
}
@ -1789,9 +1866,10 @@ impl RequestStateBuilder {
});
}
pub struct StepStartBuilder {
pub struct StepStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
active: bool,
format: ::Format,
amount: u64,
@ -1799,7 +1877,7 @@ pub struct StepStartBuilder {
flush: bool,
intermediate: bool,
}
impl StepStartBuilder {
impl<'a> StepStartBuilder<'a> {
fn new(
active: bool,
format: ::Format,
@ -1812,6 +1890,7 @@ impl StepStartBuilder {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
active: active,
format: format,
amount: amount,
@ -1834,9 +1913,10 @@ impl StepStartBuilder {
});
}
pub struct QosBuilder {
pub struct QosBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
live: bool,
running_time: u64,
stream_time: u64,
@ -1845,12 +1925,13 @@ pub struct QosBuilder {
values: Option<(i64, f64, i32)>,
stats: Option<(::Format, u64, u64)>,
}
impl QosBuilder {
impl<'a> QosBuilder<'a> {
fn new(live: bool, running_time: u64, stream_time: u64, timestamp: u64, duration: u64) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
live: live,
running_time: running_time,
stream_time: stream_time,
@ -1897,6 +1978,7 @@ impl QosBuilder {
pub struct ProgressBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
type_: ::ProgressType,
code: Option<&'a str>,
text: Option<&'a str>,
@ -1907,6 +1989,7 @@ impl<'a> ProgressBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
type_: type_,
code: None,
text: None,
@ -1940,6 +2023,7 @@ impl<'a> ProgressBuilder<'a> {
pub struct TocBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
toc: &'a ::Toc,
updated: bool,
}
@ -1949,6 +2033,7 @@ impl<'a> TocBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
toc: toc,
updated: updated,
}
@ -1959,17 +2044,19 @@ impl<'a> TocBuilder<'a> {
});
}
pub struct ResetTimeBuilder {
pub struct ResetTimeBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
running_time: u64,
}
impl ResetTimeBuilder {
impl<'a> ResetTimeBuilder<'a> {
fn new(running_time: u64) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
running_time: running_time,
}
}
@ -1979,17 +2066,19 @@ impl ResetTimeBuilder {
});
}
pub struct StreamStartBuilder {
pub struct StreamStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
group_id: Option<u32>,
}
impl StreamStartBuilder {
impl<'a> StreamStartBuilder<'a> {
fn new() -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
group_id: None,
}
}
@ -2013,6 +2102,7 @@ impl StreamStartBuilder {
pub struct NeedContextBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
context_type: &'a str,
}
impl<'a> NeedContextBuilder<'a> {
@ -2021,6 +2111,7 @@ impl<'a> NeedContextBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
context_type: context_type,
}
}
@ -2030,17 +2121,19 @@ impl<'a> NeedContextBuilder<'a> {
});
}
pub struct HaveContextBuilder {
pub struct HaveContextBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
context: Option<::Context>,
}
impl HaveContextBuilder {
impl<'a> HaveContextBuilder<'a> {
fn new(context: ::Context) -> Self {
skip_assert_initialized!();
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
context: Some(context),
}
}
@ -2054,6 +2147,7 @@ impl HaveContextBuilder {
pub struct DeviceAddedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
device: &'a ::Device,
}
impl<'a> DeviceAddedBuilder<'a> {
@ -2062,6 +2156,7 @@ impl<'a> DeviceAddedBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
device: device,
}
}
@ -2074,6 +2169,7 @@ impl<'a> DeviceAddedBuilder<'a> {
pub struct DeviceRemovedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
device: &'a ::Device,
}
impl<'a> DeviceRemovedBuilder<'a> {
@ -2082,6 +2178,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
device: device,
}
}
@ -2095,6 +2192,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
pub struct PropertyNotifyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
property_name: &'a str,
value: &'a glib::Value,
}
@ -2105,6 +2203,7 @@ impl<'a> PropertyNotifyBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
property_name: property_name,
value: value,
}
@ -2123,6 +2222,7 @@ impl<'a> PropertyNotifyBuilder<'a> {
pub struct StreamCollectionBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
collection: &'a ::StreamCollection,
}
#[cfg(feature = "v1_10")]
@ -2132,6 +2232,7 @@ impl<'a> StreamCollectionBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
collection: collection,
}
}
@ -2145,6 +2246,7 @@ impl<'a> StreamCollectionBuilder<'a> {
pub struct StreamsSelectedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
#[cfg(feature = "v1_10")] collection: &'a ::StreamCollection,
#[cfg(feature = "v1_10")] streams: Option<&'a [&'a ::Stream]>,
}
@ -2155,6 +2257,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
collection: collection,
streams: None,
}
@ -2182,11 +2285,13 @@ impl<'a> StreamsSelectedBuilder<'a> {
pub struct RedirectBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
location: &'a str,
tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>,
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
entries: Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
entries:
Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
}
#[cfg(feature = "v1_10")]
impl<'a> RedirectBuilder<'a> {
@ -2199,6 +2304,7 @@ impl<'a> RedirectBuilder<'a> {
Self {
src: None,
seqnum: None,
other_fields: Vec::new(),
location: location,
tag_list: tag_list,
entry_struct: entry_struct,