Event & Message: factorize common attributes in generic builders

Concrete events and messages share common attributes which can be factorized in generic builder `struct`s. This reduces noise in the concrete implementations.
This commit is contained in:
fengalin 2018-01-29 11:58:25 +01:00 committed by Sebastian Dröge
parent 2d1218e6d6
commit da924e5d4d
2 changed files with 229 additions and 417 deletions

View file

@ -873,23 +873,36 @@ declare_concrete_event!(CustomDownstreamSticky);
declare_concrete_event!(CustomBoth); declare_concrete_event!(CustomBoth);
declare_concrete_event!(CustomBothOob); declare_concrete_event!(CustomBothOob);
macro_rules! event_builder_generic_impl { struct EventBuilder<'a> {
($new_fn:expr) => { seqnum: Option<Seqnum>,
pub fn seqnum(self, seqnum: Seqnum) -> Self { running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> EventBuilder<'a> {
fn new() -> Self {
Self {
seqnum: None,
running_time_offset: None,
other_fields: Vec::new()
}
}
fn seqnum(self, seqnum: Seqnum) -> Self {
Self { Self {
seqnum: Some(seqnum), seqnum: Some(seqnum),
.. self .. self
} }
} }
pub fn running_time_offset(self, running_time_offset: i64) -> Self { fn running_time_offset(self, running_time_offset: i64) -> Self {
Self { Self {
running_time_offset: Some(running_time_offset), running_time_offset: Some(running_time_offset),
.. self .. self
} }
} }
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self { fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
Self { Self {
other_fields: self.other_fields.iter().cloned() other_fields: self.other_fields.iter().cloned()
.chain(other_fields.iter().cloned()) .chain(other_fields.iter().cloned())
@ -897,25 +910,49 @@ macro_rules! event_builder_generic_impl {
.. self .. self
} }
} }
}
macro_rules! event_builder_generic_impl {
($new_fn:expr) => {
pub fn seqnum(self, seqnum: Seqnum) -> Self {
Self {
builder: self.builder.seqnum(seqnum),
.. self
}
}
pub fn running_time_offset(self, running_time_offset: i64) -> Self {
Self {
builder: self.builder.running_time_offset(running_time_offset),
.. self
}
}
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
Self {
builder: self.builder.other_fields(other_fields),
.. self
}
}
pub fn build(mut self) -> Event { pub fn build(mut self) -> Event {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let event = $new_fn(&mut self); let event = $new_fn(&mut self);
if let Some(seqnum) = self.seqnum { if let Some(seqnum) = self.builder.seqnum {
ffi::gst_event_set_seqnum(event, seqnum.to_glib()); ffi::gst_event_set_seqnum(event, seqnum.to_glib());
} }
if let Some(running_time_offset) = self.running_time_offset { if let Some(running_time_offset) = self.builder.running_time_offset {
ffi::gst_event_set_running_time_offset(event, running_time_offset); ffi::gst_event_set_running_time_offset(event, running_time_offset);
} }
if !self.other_fields.is_empty() { if !self.builder.other_fields.is_empty() {
let s = StructureRef::from_glib_borrow_mut( let s = StructureRef::from_glib_borrow_mut(
ffi::gst_event_writable_structure(event) ffi::gst_event_writable_structure(event)
); );
for (k, v) in self.other_fields { for (k, v) in self.builder.other_fields {
s.set_value(k, v.to_send_value()); s.set_value(k, v.to_send_value());
} }
} }
@ -927,17 +964,13 @@ macro_rules! event_builder_generic_impl {
} }
pub struct FlushStartBuilder<'a> { pub struct FlushStartBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> FlushStartBuilder<'a> { impl<'a> FlushStartBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
} }
} }
@ -945,18 +978,14 @@ impl<'a> FlushStartBuilder<'a> {
} }
pub struct FlushStopBuilder<'a> { pub struct FlushStopBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
reset_time: bool, reset_time: bool,
} }
impl<'a> FlushStopBuilder<'a> { impl<'a> FlushStopBuilder<'a> {
fn new(reset_time: bool) -> Self { fn new(reset_time: bool) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
reset_time: reset_time, reset_time: reset_time,
} }
} }
@ -965,9 +994,7 @@ impl<'a> FlushStopBuilder<'a> {
} }
pub struct StreamStartBuilder<'a> { pub struct StreamStartBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
stream_id: &'a str, stream_id: &'a str,
flags: Option<::StreamFlags>, flags: Option<::StreamFlags>,
group_id: Option<GroupId>, group_id: Option<GroupId>,
@ -976,9 +1003,7 @@ impl<'a> StreamStartBuilder<'a> {
fn new(stream_id: &'a str) -> Self { fn new(stream_id: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
stream_id: stream_id, stream_id: stream_id,
flags: None, flags: None,
group_id: None, group_id: None,
@ -1012,18 +1037,14 @@ impl<'a> StreamStartBuilder<'a> {
} }
pub struct CapsBuilder<'a> { pub struct CapsBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
caps: &'a ::Caps, caps: &'a ::Caps,
} }
impl<'a> CapsBuilder<'a> { impl<'a> CapsBuilder<'a> {
fn new(caps: &'a ::Caps) -> Self { fn new(caps: &'a ::Caps) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
caps: caps, caps: caps,
} }
} }
@ -1032,18 +1053,14 @@ impl<'a> CapsBuilder<'a> {
} }
pub struct SegmentBuilder<'a> { pub struct SegmentBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
segment: &'a ::Segment, segment: &'a ::Segment,
} }
impl<'a> SegmentBuilder<'a> { impl<'a> SegmentBuilder<'a> {
fn new(segment: &'a ::Segment) -> Self { fn new(segment: &'a ::Segment) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
segment: segment, segment: segment,
} }
} }
@ -1053,9 +1070,7 @@ impl<'a> SegmentBuilder<'a> {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamCollectionBuilder<'a> { pub struct StreamCollectionBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
stream_collection: &'a ::StreamCollection, stream_collection: &'a ::StreamCollection,
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
@ -1063,9 +1078,7 @@ impl<'a> StreamCollectionBuilder<'a> {
fn new(stream_collection: &'a ::StreamCollection) -> Self { fn new(stream_collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
stream_collection: stream_collection, stream_collection: stream_collection,
} }
} }
@ -1076,18 +1089,14 @@ impl<'a> StreamCollectionBuilder<'a> {
} }
pub struct TagBuilder<'a> { pub struct TagBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
tags: Option<::TagList>, tags: Option<::TagList>,
} }
impl<'a> TagBuilder<'a> { impl<'a> TagBuilder<'a> {
fn new(tags: ::TagList) -> Self { fn new(tags: ::TagList) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
tags: Some(tags), tags: Some(tags),
} }
} }
@ -1099,9 +1108,7 @@ impl<'a> TagBuilder<'a> {
} }
pub struct BufferSizeBuilder<'a> { pub struct BufferSizeBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
minsize: GenericFormattedValue, minsize: GenericFormattedValue,
maxsize: GenericFormattedValue, maxsize: GenericFormattedValue,
async: bool, async: bool,
@ -1110,9 +1117,7 @@ impl<'a> BufferSizeBuilder<'a> {
fn new(minsize: GenericFormattedValue, maxsize: GenericFormattedValue, async: bool) -> Self { fn new(minsize: GenericFormattedValue, maxsize: GenericFormattedValue, async: bool) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
minsize: minsize, minsize: minsize,
maxsize: maxsize, maxsize: maxsize,
async: async, async: async,
@ -1128,9 +1133,7 @@ impl<'a> BufferSizeBuilder<'a> {
} }
pub struct SinkMessageBuilder<'a> { pub struct SinkMessageBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
name: &'a str, name: &'a str,
msg: &'a ::Message, msg: &'a ::Message,
} }
@ -1138,9 +1141,7 @@ impl<'a> SinkMessageBuilder<'a> {
fn new(name: &'a str, msg: &'a ::Message) -> Self { fn new(name: &'a str, msg: &'a ::Message) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
name: name, name: name,
msg: msg, msg: msg,
} }
@ -1154,9 +1155,7 @@ impl<'a> SinkMessageBuilder<'a> {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamGroupDoneBuilder<'a> { pub struct StreamGroupDoneBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
group_id: GroupId, group_id: GroupId,
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
@ -1164,9 +1163,7 @@ impl<'a> StreamGroupDoneBuilder<'a> {
fn new(group_id: GroupId) -> Self { fn new(group_id: GroupId) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
group_id: group_id, group_id: group_id,
} }
} }
@ -1177,17 +1174,13 @@ impl<'a> StreamGroupDoneBuilder<'a> {
} }
pub struct EosBuilder<'a> { pub struct EosBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> EosBuilder<'a> { impl<'a> EosBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
} }
} }
@ -1195,9 +1188,7 @@ impl<'a> EosBuilder<'a> {
} }
pub struct TocBuilder<'a> { pub struct TocBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
toc: &'a ::Toc, toc: &'a ::Toc,
updated: bool, updated: bool,
} }
@ -1205,9 +1196,7 @@ impl<'a> TocBuilder<'a> {
fn new(toc: &'a ::Toc, updated: bool) -> Self { fn new(toc: &'a ::Toc, updated: bool) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
toc: toc, toc: toc,
updated: updated, updated: updated,
} }
@ -1220,9 +1209,7 @@ impl<'a> TocBuilder<'a> {
} }
pub struct ProtectionBuilder<'a> { pub struct ProtectionBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
system_id: &'a str, system_id: &'a str,
data: &'a ::Buffer, data: &'a ::Buffer,
origin: Option<&'a str>, origin: Option<&'a str>,
@ -1231,9 +1218,7 @@ impl<'a> ProtectionBuilder<'a> {
fn new(system_id: &'a str, data: &'a ::Buffer) -> Self { fn new(system_id: &'a str, data: &'a ::Buffer) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
system_id: system_id, system_id: system_id,
data: data, data: data,
origin: None, origin: None,
@ -1255,18 +1240,14 @@ impl<'a> ProtectionBuilder<'a> {
} }
pub struct SegmentDoneBuilder<'a> { pub struct SegmentDoneBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
position: GenericFormattedValue, position: GenericFormattedValue,
} }
impl<'a> SegmentDoneBuilder<'a> { impl<'a> SegmentDoneBuilder<'a> {
fn new(position: GenericFormattedValue) -> Self { fn new(position: GenericFormattedValue) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
position: position, position: position,
} }
} }
@ -1278,9 +1259,7 @@ impl<'a> SegmentDoneBuilder<'a> {
} }
pub struct GapBuilder<'a> { pub struct GapBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
timestamp: ::ClockTime, timestamp: ::ClockTime,
duration: ::ClockTime, duration: ::ClockTime,
} }
@ -1288,9 +1267,7 @@ impl<'a> GapBuilder<'a> {
fn new(timestamp: ::ClockTime, duration: ::ClockTime) -> Self { fn new(timestamp: ::ClockTime, duration: ::ClockTime) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
timestamp: timestamp, timestamp: timestamp,
duration: duration, duration: duration,
} }
@ -1303,9 +1280,7 @@ impl<'a> GapBuilder<'a> {
} }
pub struct QosBuilder<'a> { pub struct QosBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::QOSType, type_: ::QOSType,
proportion: f64, proportion: f64,
diff: i64, diff: i64,
@ -1315,9 +1290,7 @@ impl<'a> QosBuilder<'a> {
fn new(type_: ::QOSType, proportion: f64, diff: i64, timestamp: ::ClockTime) -> Self { fn new(type_: ::QOSType, proportion: f64, diff: i64, timestamp: ::ClockTime) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
type_: type_, type_: type_,
proportion: proportion, proportion: proportion,
diff: diff, diff: diff,
@ -1334,9 +1307,7 @@ impl<'a> QosBuilder<'a> {
} }
pub struct SeekBuilder<'a> { pub struct SeekBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
rate: f64, rate: f64,
flags: ::SeekFlags, flags: ::SeekFlags,
start_type: ::SeekType, start_type: ::SeekType,
@ -1355,9 +1326,7 @@ impl<'a> SeekBuilder<'a> {
) -> Self { ) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
rate: rate, rate: rate,
flags: flags, flags: flags,
start_type, start_type,
@ -1379,18 +1348,14 @@ impl<'a> SeekBuilder<'a> {
} }
pub struct NavigationBuilder<'a> { pub struct NavigationBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>, structure: Option<Structure>,
} }
impl<'a> NavigationBuilder<'a> { impl<'a> NavigationBuilder<'a> {
fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1405,18 +1370,14 @@ impl<'a> NavigationBuilder<'a> {
} }
pub struct LatencyBuilder<'a> { pub struct LatencyBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
latency: ::ClockTime, latency: ::ClockTime,
} }
impl<'a> LatencyBuilder<'a> { impl<'a> LatencyBuilder<'a> {
fn new(latency: ::ClockTime) -> Self { fn new(latency: ::ClockTime) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
latency: latency, latency: latency,
} }
} }
@ -1425,9 +1386,7 @@ impl<'a> LatencyBuilder<'a> {
} }
pub struct StepBuilder<'a> { pub struct StepBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
amount: GenericFormattedValue, amount: GenericFormattedValue,
rate: f64, rate: f64,
flush: bool, flush: bool,
@ -1437,9 +1396,7 @@ impl<'a> StepBuilder<'a> {
fn new(amount: GenericFormattedValue, rate: f64, flush: bool, intermediate: bool) -> Self { fn new(amount: GenericFormattedValue, rate: f64, flush: bool, intermediate: bool) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
amount: amount, amount: amount,
rate: rate, rate: rate,
flush: flush, flush: flush,
@ -1457,17 +1414,13 @@ impl<'a> StepBuilder<'a> {
} }
pub struct ReconfigureBuilder<'a> { pub struct ReconfigureBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> ReconfigureBuilder<'a> { impl<'a> ReconfigureBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
} }
} }
@ -1475,18 +1428,14 @@ impl<'a> ReconfigureBuilder<'a> {
} }
pub struct TocSelectBuilder<'a> { pub struct TocSelectBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
uid: &'a str, uid: &'a str,
} }
impl<'a> TocSelectBuilder<'a> { impl<'a> TocSelectBuilder<'a> {
fn new(uid: &'a str) -> Self { fn new(uid: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
uid: uid, uid: uid,
} }
} }
@ -1496,9 +1445,7 @@ impl<'a> TocSelectBuilder<'a> {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct SelectStreamsBuilder<'a> { pub struct SelectStreamsBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
streams: &'a [&'a str], streams: &'a [&'a str],
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
@ -1506,9 +1453,7 @@ impl<'a> SelectStreamsBuilder<'a> {
fn new(streams: &'a [&'a str]) -> Self { fn new(streams: &'a [&'a str]) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
streams: streams, streams: streams,
} }
} }
@ -1519,18 +1464,14 @@ impl<'a> SelectStreamsBuilder<'a> {
} }
pub struct CustomUpstreamBuilder<'a> { pub struct CustomUpstreamBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>, structure: Option<Structure>,
} }
impl<'a> CustomUpstreamBuilder<'a> { impl<'a> CustomUpstreamBuilder<'a> {
fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1546,18 +1487,14 @@ impl<'a> CustomUpstreamBuilder<'a> {
} }
pub struct CustomDownstreamBuilder<'a> { pub struct CustomDownstreamBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>, structure: Option<Structure>,
} }
impl<'a> CustomDownstreamBuilder<'a> { impl<'a> CustomDownstreamBuilder<'a> {
fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1573,18 +1510,14 @@ impl<'a> CustomDownstreamBuilder<'a> {
} }
pub struct CustomDownstreamOobBuilder<'a> { pub struct CustomDownstreamOobBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>, structure: Option<Structure>,
} }
impl<'a> CustomDownstreamOobBuilder<'a> { impl<'a> CustomDownstreamOobBuilder<'a> {
fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1602,18 +1535,14 @@ impl<'a> CustomDownstreamOobBuilder<'a> {
} }
pub struct CustomDownstreamStickyBuilder<'a> { pub struct CustomDownstreamStickyBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>, structure: Option<Structure>,
} }
impl<'a> CustomDownstreamStickyBuilder<'a> { impl<'a> CustomDownstreamStickyBuilder<'a> {
fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1631,18 +1560,14 @@ impl<'a> CustomDownstreamStickyBuilder<'a> {
} }
pub struct CustomBothBuilder<'a> { pub struct CustomBothBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>, structure: Option<Structure>,
} }
impl<'a> CustomBothBuilder<'a> { impl<'a> CustomBothBuilder<'a> {
fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1657,18 +1582,14 @@ impl<'a> CustomBothBuilder<'a> {
} }
pub struct CustomBothOobBuilder<'a> { pub struct CustomBothOobBuilder<'a> {
seqnum: Option<Seqnum>, builder: EventBuilder<'a>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>, structure: Option<Structure>,
} }
impl<'a> CustomBothOobBuilder<'a> { impl<'a> CustomBothOobBuilder<'a> {
fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
seqnum: None, builder: EventBuilder::new(),
running_time_offset: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1682,6 +1603,7 @@ impl<'a> CustomBothOobBuilder<'a> {
ev ev
}); });
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -1160,8 +1160,21 @@ impl<'a> Redirect<'a> {
} }
} }
macro_rules! message_builder_generic_impl { struct MessageBuilder<'a> {
($new_fn:expr) => { src: Option<Object>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> MessageBuilder<'a> {
fn new() -> Self {
Self {
src: None,
seqnum: None,
other_fields: Vec::new()
}
}
pub fn src<O: IsA<Object> + Cast + Clone>(self, src: Option<&O>) -> Self { pub fn src<O: IsA<Object> + Cast + Clone>(self, src: Option<&O>) -> Self {
Self { Self {
src: src.map(|o| { src: src.map(|o| {
@ -1172,15 +1185,15 @@ macro_rules! message_builder_generic_impl {
} }
} }
pub fn seqnum(self, seqnum: Seqnum) -> Self { fn seqnum(self, seqnum: Seqnum) -> Self {
Self { Self {
seqnum: Some(seqnum), seqnum: Some(seqnum),
.. self .. self
} }
} }
// TODO: restore other_fields method and condition it to the "v1_14" feature // TODO: restore clone_and_chain_other_fields method and condition it to the "v1_14" feature
/*pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self { /*fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
Self { Self {
other_fields: self.other_fields.iter().cloned() other_fields: self.other_fields.iter().cloned()
.chain(other_fields.iter().cloned()) .chain(other_fields.iter().cloned())
@ -1188,17 +1201,42 @@ macro_rules! message_builder_generic_impl {
.. self .. self
} }
}*/ }*/
}
macro_rules! message_builder_generic_impl {
($new_fn:expr) => {
pub fn src<O: IsA<Object> + Cast + Clone>(self, src: Option<&O>) -> Self {
Self {
builder: self.builder.src(src),
.. self
}
}
pub fn seqnum(self, seqnum: Seqnum) -> Self {
Self {
builder: self.builder.seqnum(seqnum),
.. self
}
}
// TODO: restore other_fields method and condition it to the "v1_14" feature
/*pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
Self {
builder: self.builder.other_fields(other_fields),
.. self
}
}*/
pub fn build(mut self) -> Message { pub fn build(mut self) -> Message {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let src = self.src.to_glib_none().0; let src = self.builder.src.to_glib_none().0;
let msg = $new_fn(&mut self, src); let msg = $new_fn(&mut self, src);
if let Some(seqnum) = self.seqnum { if let Some(seqnum) = self.builder.seqnum {
ffi::gst_message_set_seqnum(msg, seqnum.to_glib()); ffi::gst_message_set_seqnum(msg, seqnum.to_glib());
} }
if !self.other_fields.is_empty() { if !self.builder.other_fields.is_empty() {
// issue with argument-less messages. We need the function // issue with argument-less messages. We need the function
// ffi::gst_message_writable_structure to sort this out // ffi::gst_message_writable_structure to sort this out
// and this function will be available in GStreamer 1.14 // and this function will be available in GStreamer 1.14
@ -1208,7 +1246,7 @@ macro_rules! message_builder_generic_impl {
if !structure.is_null() { if !structure.is_null() {
let structure = StructureRef::from_glib_borrow_mut(structure as *mut _); let structure = StructureRef::from_glib_borrow_mut(structure as *mut _);
for (k, v) in self.other_fields { for (k, v) in self.builder.other_fields {
structure.set_value(k, v.to_send_value()); structure.set_value(k, v.to_send_value());
} }
} }
@ -1221,17 +1259,13 @@ macro_rules! message_builder_generic_impl {
} }
pub struct EosBuilder<'a> { pub struct EosBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> EosBuilder<'a> { impl<'a> EosBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
} }
} }
@ -1246,9 +1280,7 @@ impl MessageErrorDomain for ::StreamError {}
impl MessageErrorDomain for ::LibraryError {} impl MessageErrorDomain for ::LibraryError {}
pub struct ErrorBuilder<'a, T> { pub struct ErrorBuilder<'a, T> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
error: T, error: T,
message: &'a str, message: &'a str,
debug: Option<&'a str>, debug: Option<&'a str>,
@ -1258,9 +1290,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
fn new(error: T, message: &'a str) -> Self { fn new(error: T, message: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
error: error, error: error,
message: message, message: message,
debug: None, debug: None,
@ -1314,9 +1344,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
} }
pub struct WarningBuilder<'a, T> { pub struct WarningBuilder<'a, T> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
error: T, error: T,
message: &'a str, message: &'a str,
debug: Option<&'a str>, debug: Option<&'a str>,
@ -1326,9 +1354,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
fn new(error: T, message: &'a str) -> Self { fn new(error: T, message: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
error: error, error: error,
message: message, message: message,
debug: None, debug: None,
@ -1382,9 +1408,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
} }
pub struct InfoBuilder<'a, T> { pub struct InfoBuilder<'a, T> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
error: T, error: T,
message: &'a str, message: &'a str,
debug: Option<&'a str>, debug: Option<&'a str>,
@ -1394,9 +1418,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
fn new(error: T, message: &'a str) -> Self { fn new(error: T, message: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
error: error, error: error,
message: message, message: message,
debug: None, debug: None,
@ -1450,18 +1472,14 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
} }
pub struct TagBuilder<'a> { pub struct TagBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
tags: &'a TagList, tags: &'a TagList,
} }
impl<'a> TagBuilder<'a> { impl<'a> TagBuilder<'a> {
fn new(tags: &'a TagList) -> Self { fn new(tags: &'a TagList) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
tags: tags, tags: tags,
} }
} }
@ -1473,9 +1491,7 @@ impl<'a> TagBuilder<'a> {
} }
pub struct BufferingBuilder<'a> { pub struct BufferingBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
percent: i32, percent: i32,
stats: Option<(::BufferingMode, i32, i32, i64)>, stats: Option<(::BufferingMode, i32, i32, i64)>,
} }
@ -1483,9 +1499,7 @@ impl<'a> BufferingBuilder<'a> {
fn new(percent: i32) -> Self { fn new(percent: i32) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
percent: percent, percent: percent,
stats: None, stats: None,
} }
@ -1523,9 +1537,7 @@ impl<'a> BufferingBuilder<'a> {
} }
pub struct StateChangedBuilder<'a> { pub struct StateChangedBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
old: ::State, old: ::State,
new: ::State, new: ::State,
pending: ::State, pending: ::State,
@ -1534,9 +1546,7 @@ impl<'a> StateChangedBuilder<'a> {
fn new(old: ::State, new: ::State, pending: ::State) -> Self { fn new(old: ::State, new: ::State, pending: ::State) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
old: old, old: old,
new: new, new: new,
pending: pending, pending: pending,
@ -1552,17 +1562,13 @@ impl<'a> StateChangedBuilder<'a> {
} }
pub struct StateDirtyBuilder<'a> { pub struct StateDirtyBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> StateDirtyBuilder<'a> { impl<'a> StateDirtyBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
} }
} }
@ -1570,9 +1576,7 @@ impl<'a> StateDirtyBuilder<'a> {
} }
pub struct StepDoneBuilder<'a> { pub struct StepDoneBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
amount: GenericFormattedValue, amount: GenericFormattedValue,
rate: f64, rate: f64,
flush: bool, flush: bool,
@ -1592,9 +1596,7 @@ impl<'a> StepDoneBuilder<'a> {
skip_assert_initialized!(); skip_assert_initialized!();
assert_eq!(amount.get_format(), duration.get_format()); assert_eq!(amount.get_format(), duration.get_format());
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
amount: amount, amount: amount,
rate: rate, rate: rate,
flush: flush, flush: flush,
@ -1617,9 +1619,7 @@ impl<'a> StepDoneBuilder<'a> {
} }
pub struct ClockProvideBuilder<'a> { pub struct ClockProvideBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
clock: &'a ::Clock, clock: &'a ::Clock,
ready: bool, ready: bool,
} }
@ -1627,9 +1627,7 @@ impl<'a> ClockProvideBuilder<'a> {
fn new(clock: &'a ::Clock, ready: bool) -> Self { fn new(clock: &'a ::Clock, ready: bool) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
clock: clock, clock: clock,
ready: ready, ready: ready,
} }
@ -1643,18 +1641,14 @@ impl<'a> ClockProvideBuilder<'a> {
} }
pub struct ClockLostBuilder<'a> { pub struct ClockLostBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
clock: &'a ::Clock, clock: &'a ::Clock,
} }
impl<'a> ClockLostBuilder<'a> { impl<'a> ClockLostBuilder<'a> {
fn new(clock: &'a ::Clock) -> Self { fn new(clock: &'a ::Clock) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
clock: clock, clock: clock,
} }
} }
@ -1666,18 +1660,14 @@ impl<'a> ClockLostBuilder<'a> {
} }
pub struct NewClockBuilder<'a> { pub struct NewClockBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
clock: &'a ::Clock, clock: &'a ::Clock,
} }
impl<'a> NewClockBuilder<'a> { impl<'a> NewClockBuilder<'a> {
fn new(clock: &'a ::Clock) -> Self { fn new(clock: &'a ::Clock) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
clock: clock, clock: clock,
} }
} }
@ -1689,9 +1679,7 @@ impl<'a> NewClockBuilder<'a> {
} }
pub struct StructureChangeBuilder<'a> { pub struct StructureChangeBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::StructureChangeType, type_: ::StructureChangeType,
owner: &'a ::Element, owner: &'a ::Element,
busy: bool, busy: bool,
@ -1700,9 +1688,7 @@ impl<'a> StructureChangeBuilder<'a> {
fn new(type_: ::StructureChangeType, owner: &'a ::Element, busy: bool) -> Self { fn new(type_: ::StructureChangeType, owner: &'a ::Element, busy: bool) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
type_: type_, type_: type_,
owner: owner, owner: owner,
busy: busy, busy: busy,
@ -1718,9 +1704,7 @@ impl<'a> StructureChangeBuilder<'a> {
} }
pub struct StreamStatusBuilder<'a> { pub struct StreamStatusBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::StreamStatusType, type_: ::StreamStatusType,
owner: &'a ::Element, owner: &'a ::Element,
status_object: Option<&'a glib::ToSendValue>, status_object: Option<&'a glib::ToSendValue>,
@ -1729,9 +1713,7 @@ impl<'a> StreamStatusBuilder<'a> {
fn new(type_: ::StreamStatusType, owner: &'a ::Element) -> Self { fn new(type_: ::StreamStatusType, owner: &'a ::Element) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
type_: type_, type_: type_,
owner: owner, owner: owner,
status_object: None, status_object: None,
@ -1759,18 +1741,14 @@ impl<'a> StreamStatusBuilder<'a> {
} }
pub struct ApplicationBuilder<'a> { pub struct ApplicationBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<::Structure>, structure: Option<::Structure>,
} }
impl<'a> ApplicationBuilder<'a> { impl<'a> ApplicationBuilder<'a> {
fn new(structure: ::Structure) -> Self { fn new(structure: ::Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1782,18 +1760,14 @@ impl<'a> ApplicationBuilder<'a> {
} }
pub struct ElementBuilder<'a> { pub struct ElementBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<::Structure>, structure: Option<::Structure>,
} }
impl<'a> ElementBuilder<'a> { impl<'a> ElementBuilder<'a> {
fn new(structure: ::Structure) -> Self { fn new(structure: ::Structure) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
structure: Some(structure), structure: Some(structure),
} }
} }
@ -1805,18 +1779,14 @@ impl<'a> ElementBuilder<'a> {
} }
pub struct SegmentStartBuilder<'a> { pub struct SegmentStartBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
position: GenericFormattedValue, position: GenericFormattedValue,
} }
impl<'a> SegmentStartBuilder<'a> { impl<'a> SegmentStartBuilder<'a> {
fn new(position: GenericFormattedValue) -> Self { fn new(position: GenericFormattedValue) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
position: position, position: position,
} }
} }
@ -1829,18 +1799,14 @@ impl<'a> SegmentStartBuilder<'a> {
} }
pub struct SegmentDoneBuilder<'a> { pub struct SegmentDoneBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
position: GenericFormattedValue, position: GenericFormattedValue,
} }
impl<'a> SegmentDoneBuilder<'a> { impl<'a> SegmentDoneBuilder<'a> {
fn new(position: GenericFormattedValue) -> Self { fn new(position: GenericFormattedValue) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
position: position, position: position,
} }
} }
@ -1853,17 +1819,13 @@ impl<'a> SegmentDoneBuilder<'a> {
} }
pub struct DurationChangedBuilder<'a> { pub struct DurationChangedBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> DurationChangedBuilder<'a> { impl<'a> DurationChangedBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
} }
} }
@ -1871,17 +1833,13 @@ impl<'a> DurationChangedBuilder<'a> {
} }
pub struct LatencyBuilder<'a> { pub struct LatencyBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> LatencyBuilder<'a> { impl<'a> LatencyBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
} }
} }
@ -1889,17 +1847,13 @@ impl<'a> LatencyBuilder<'a> {
} }
pub struct AsyncStartBuilder<'a> { pub struct AsyncStartBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
} }
impl<'a> AsyncStartBuilder<'a> { impl<'a> AsyncStartBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
} }
} }
@ -1907,18 +1861,14 @@ impl<'a> AsyncStartBuilder<'a> {
} }
pub struct AsyncDoneBuilder<'a> { pub struct AsyncDoneBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
running_time: ::ClockTime, running_time: ::ClockTime,
} }
impl<'a> AsyncDoneBuilder<'a> { impl<'a> AsyncDoneBuilder<'a> {
fn new(running_time: ::ClockTime) -> Self { fn new(running_time: ::ClockTime) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
running_time: running_time, running_time: running_time,
} }
} }
@ -1930,18 +1880,14 @@ impl<'a> AsyncDoneBuilder<'a> {
} }
pub struct RequestStateBuilder<'a> { pub struct RequestStateBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
state: ::State, state: ::State,
} }
impl<'a> RequestStateBuilder<'a> { impl<'a> RequestStateBuilder<'a> {
fn new(state: ::State) -> Self { fn new(state: ::State) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
state: state, state: state,
} }
} }
@ -1953,9 +1899,7 @@ impl<'a> RequestStateBuilder<'a> {
} }
pub struct StepStartBuilder<'a> { pub struct StepStartBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
active: bool, active: bool,
amount: GenericFormattedValue, amount: GenericFormattedValue,
rate: f64, rate: f64,
@ -1972,9 +1916,7 @@ impl<'a> StepStartBuilder<'a> {
) -> Self { ) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
active: active, active: active,
amount: amount, amount: amount,
rate: rate, rate: rate,
@ -1995,9 +1937,7 @@ impl<'a> StepStartBuilder<'a> {
} }
pub struct QosBuilder<'a> { pub struct QosBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
live: bool, live: bool,
running_time: ::ClockTime, running_time: ::ClockTime,
stream_time: ::ClockTime, stream_time: ::ClockTime,
@ -2016,9 +1956,7 @@ impl<'a> QosBuilder<'a> {
) -> Self { ) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
live: live, live: live,
running_time: running_time, running_time: running_time,
stream_time: stream_time, stream_time: stream_time,
@ -2071,9 +2009,7 @@ impl<'a> QosBuilder<'a> {
} }
pub struct ProgressBuilder<'a> { pub struct ProgressBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::ProgressType, type_: ::ProgressType,
code: &'a str, code: &'a str,
text: &'a str, text: &'a str,
@ -2082,9 +2018,7 @@ impl<'a> ProgressBuilder<'a> {
fn new(type_: ::ProgressType, code: &'a str, text: &'a str) -> Self { fn new(type_: ::ProgressType, code: &'a str, text: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
type_: type_, type_: type_,
code: code, code: code,
text: text, text: text,
@ -2100,9 +2034,7 @@ impl<'a> ProgressBuilder<'a> {
} }
pub struct TocBuilder<'a> { pub struct TocBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
toc: &'a ::Toc, toc: &'a ::Toc,
updated: bool, updated: bool,
} }
@ -2110,9 +2042,7 @@ impl<'a> TocBuilder<'a> {
fn new(toc: &'a ::Toc, updated: bool) -> Self { fn new(toc: &'a ::Toc, updated: bool) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
toc: toc, toc: toc,
updated: updated, updated: updated,
} }
@ -2126,18 +2056,14 @@ impl<'a> TocBuilder<'a> {
} }
pub struct ResetTimeBuilder<'a> { pub struct ResetTimeBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
running_time: ::ClockTime, running_time: ::ClockTime,
} }
impl<'a> ResetTimeBuilder<'a> { impl<'a> ResetTimeBuilder<'a> {
fn new(running_time: ::ClockTime) -> Self { fn new(running_time: ::ClockTime) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
running_time: running_time, running_time: running_time,
} }
} }
@ -2149,18 +2075,14 @@ impl<'a> ResetTimeBuilder<'a> {
} }
pub struct StreamStartBuilder<'a> { pub struct StreamStartBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
group_id: Option<GroupId>, group_id: Option<GroupId>,
} }
impl<'a> StreamStartBuilder<'a> { impl<'a> StreamStartBuilder<'a> {
fn new() -> Self { fn new() -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
group_id: None, group_id: None,
} }
} }
@ -2182,18 +2104,14 @@ impl<'a> StreamStartBuilder<'a> {
} }
pub struct NeedContextBuilder<'a> { pub struct NeedContextBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
context_type: &'a str, context_type: &'a str,
} }
impl<'a> NeedContextBuilder<'a> { impl<'a> NeedContextBuilder<'a> {
fn new(context_type: &'a str) -> Self { fn new(context_type: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
context_type: context_type, context_type: context_type,
} }
} }
@ -2205,18 +2123,14 @@ impl<'a> NeedContextBuilder<'a> {
} }
pub struct HaveContextBuilder<'a> { pub struct HaveContextBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
context: Option<::Context>, context: Option<::Context>,
} }
impl<'a> HaveContextBuilder<'a> { impl<'a> HaveContextBuilder<'a> {
fn new(context: ::Context) -> Self { fn new(context: ::Context) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
context: Some(context), context: Some(context),
} }
} }
@ -2228,18 +2142,14 @@ impl<'a> HaveContextBuilder<'a> {
} }
pub struct DeviceAddedBuilder<'a> { pub struct DeviceAddedBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
device: &'a ::Device, device: &'a ::Device,
} }
impl<'a> DeviceAddedBuilder<'a> { impl<'a> DeviceAddedBuilder<'a> {
fn new(device: &'a ::Device) -> Self { fn new(device: &'a ::Device) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
device: device, device: device,
} }
} }
@ -2251,18 +2161,14 @@ impl<'a> DeviceAddedBuilder<'a> {
} }
pub struct DeviceRemovedBuilder<'a> { pub struct DeviceRemovedBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
device: &'a ::Device, device: &'a ::Device,
} }
impl<'a> DeviceRemovedBuilder<'a> { impl<'a> DeviceRemovedBuilder<'a> {
fn new(device: &'a ::Device) -> Self { fn new(device: &'a ::Device) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
device: device, device: device,
} }
} }
@ -2275,9 +2181,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct PropertyNotifyBuilder<'a> { pub struct PropertyNotifyBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
property_name: &'a str, property_name: &'a str,
value: Option<&'a glib::ToSendValue>, value: Option<&'a glib::ToSendValue>,
} }
@ -2286,9 +2190,7 @@ impl<'a> PropertyNotifyBuilder<'a> {
fn new(property_name: &'a str) -> Self { fn new(property_name: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
property_name: property_name, property_name: property_name,
value: None, value: None,
} }
@ -2317,9 +2219,7 @@ impl<'a> PropertyNotifyBuilder<'a> {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamCollectionBuilder<'a> { pub struct StreamCollectionBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
collection: &'a ::StreamCollection, collection: &'a ::StreamCollection,
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
@ -2327,9 +2227,7 @@ impl<'a> StreamCollectionBuilder<'a> {
fn new(collection: &'a ::StreamCollection) -> Self { fn new(collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
collection: collection, collection: collection,
} }
} }
@ -2342,9 +2240,7 @@ impl<'a> StreamCollectionBuilder<'a> {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct StreamsSelectedBuilder<'a> { pub struct StreamsSelectedBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
#[cfg(any(feature = "v1_10", feature = "dox"))] collection: &'a ::StreamCollection, #[cfg(any(feature = "v1_10", feature = "dox"))] collection: &'a ::StreamCollection,
#[cfg(any(feature = "v1_10", feature = "dox"))] streams: Option<&'a [&'a ::Stream]>, #[cfg(any(feature = "v1_10", feature = "dox"))] streams: Option<&'a [&'a ::Stream]>,
} }
@ -2353,9 +2249,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
fn new(collection: &'a ::StreamCollection) -> Self { fn new(collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
collection: collection, collection: collection,
streams: None, streams: None,
} }
@ -2381,9 +2275,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub struct RedirectBuilder<'a> { pub struct RedirectBuilder<'a> {
src: Option<Object>, builder: MessageBuilder<'a>,
seqnum: Option<Seqnum>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
location: &'a str, location: &'a str,
tag_list: Option<&'a TagList>, tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>, entry_struct: Option<Structure>,
@ -2395,9 +2287,7 @@ impl<'a> RedirectBuilder<'a> {
fn new(location: &'a str) -> Self { fn new(location: &'a str) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, builder: MessageBuilder::new(),
seqnum: None,
other_fields: Vec::new(),
location: location, location: location,
tag_list: None, tag_list: None,
entry_struct: None, entry_struct: None,