Commit e40267e9 authored by François Laignel's avatar François Laignel
Browse files

event,message,query: update instantiation

See gstreamer-rs!532
parent fe274ac6
Pipeline #167236 passed with stages
in 19 minutes and 7 seconds
......@@ -1718,7 +1718,7 @@ impl AudioLoudNorm {
gst_log!(CAT, obj: pad, "Handling query {:?}", query);
match query.view_mut() {
QueryView::Latency(ref mut q) => {
let mut peer_query = gst::Query::new_latency();
let mut peer_query = gst::query::Latency::new();
if self.sinkpad.peer_query(&mut peer_query) {
let (live, min_latency, max_latency) = peer_query.get_result();
q.set(
......
......@@ -96,7 +96,7 @@ fn do_test(data: &'static [u8], packet_sizes: &[usize], decoded_samples: &[usize
h.push(buffer).unwrap();
}
h.push_event(gst::Event::new_eos().build());
h.push_event(gst::event::Eos::new());
for samples in decoded_samples {
if *samples == 0 {
......
......@@ -170,7 +170,7 @@ fn csound_filter_eos() {
num_buffers += 1;
}
h.push_event(gst::Event::new_eos().build());
h.push_event(gst::event::Eos::new());
// pull the buffer produced after the EOS event
let buffer = h.pull().unwrap();
......@@ -242,7 +242,7 @@ fn csound_filter_underflow() {
assert!(h.push(buffer).is_ok());
}
h.push_event(gst::Event::new_eos().build());
h.push_event(gst::event::Eos::new());
// From here we check our output data
let mut num_buffers = 0;
......@@ -324,7 +324,7 @@ fn csound_filter_caps_negotiation() {
h.play();
assert!(h.push(gst::Buffer::with_size(2048).unwrap()).is_ok());
h.push_event(gst::Event::new_eos().build());
h.push_event(gst::event::Eos::new());
let buffer = h.pull().unwrap();
......@@ -403,7 +403,7 @@ fn csound_filter_caps_negotiation_fail() {
let buffer = gst::Buffer::with_size(2048).unwrap();
assert!(h.push(buffer).is_err());
h.push_event(gst::Event::new_eos().build());
h.push_event(gst::event::Eos::new());
// The harness sinkpad end up not having defined caps
// so, the get_current_caps should be None
......
......@@ -80,7 +80,7 @@ fn run_test(inline_headers: bool) {
h.push(buffer).unwrap();
}
h.push_event(gst::Event::new_eos().build());
h.push_event(gst::event::Eos::new());
for samples in &decoded_samples {
if *samples == 0 {
......
......@@ -302,7 +302,7 @@ impl Decrypter {
match query.view_mut() {
QueryView::Scheduling(mut q) => {
let mut peer_query = gst::Query::new_scheduling();
let mut peer_query = gst::query::Scheduling::new();
let res = self.sinkpad.peer_query(&mut peer_query);
if !res {
return res;
......@@ -324,7 +324,7 @@ impl Decrypter {
}
/* First let's query the bytes duration upstream */
let mut peer_query = gst::query::Query::new_duration(gst::Format::Bytes);
let mut peer_query = gst::query::Duration::new(gst::Format::Bytes);
if !self.sinkpad.peer_query(&mut peer_query) {
gst_error!(CAT, "Failed to query upstream duration");
......
......@@ -260,7 +260,7 @@ impl Encrypter {
EventView::Caps(_) => {
// We send our own caps downstream
let caps = gst::Caps::builder("application/x-sodium-encrypted").build();
self.srcpad.push_event(gst::Event::new_caps(&caps).build())
self.srcpad.push_event(gst::event::Caps::new(&caps))
}
EventView::Eos(_) => {
let mut state_mutex = self.state.lock().unwrap();
......@@ -341,7 +341,7 @@ impl Encrypter {
}
/* First let's query the bytes duration upstream */
let mut peer_query = gst::query::Query::new_duration(gst::Format::Bytes);
let mut peer_query = gst::query::Duration::new(gst::Format::Bytes);
if !self.sinkpad.peer_query(&mut peer_query) {
gst_error!(CAT, "Failed to query upstream duration");
......
......@@ -198,7 +198,7 @@ fn test_pull_range() {
.expect("Unable to set the pipeline to the `Playing` state");
// Test that the decryptor is seekable
let mut q = gst::query::Query::new_seeking(gst::Format::Bytes);
let mut q = gst::query::Seeking::new(gst::Format::Bytes);
srcpad.query(&mut q);
// get the seeking capabilities
......
......@@ -91,7 +91,7 @@ fn encrypt_file() {
let buf = gst::Buffer::from_mut_slice(Vec::from(&input[..]));
assert_eq!(h.push(buf), Ok(gst::FlowSuccess::Ok));
h.push_event(gst::Event::new_eos().build());
h.push_event(gst::event::Eos::new());
println!("Pulling buffer...");
while let Ok(buf) = h.pull() {
......
......@@ -182,14 +182,13 @@ impl AppSrcPadHandler {
gst_debug!(CAT, obj: pad.gst_pad(), "Pushing initial events");
let stream_id = format!("{:08x}{:08x}", rand::random::<u32>(), rand::random::<u32>());
let stream_start_evt = gst::Event::new_stream_start(&stream_id)
let stream_start_evt = gst::event::StreamStart::builder(&stream_id)
.group_id(gst::GroupId::next())
.build();
pad.push_event(stream_start_evt).await;
if let Some(ref caps) = state.caps {
let caps_evt = gst::Event::new_caps(&caps).build();
pad.push_event(caps_evt).await;
pad.push_event(gst::event::Caps::new(&caps)).await;
*self.0.configured_caps.lock().unwrap() = Some(caps.clone());
}
......@@ -198,7 +197,7 @@ impl AppSrcPadHandler {
if state.need_segment {
let segment_evt =
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build();
gst::event::Segment::new(&gst::FormattedSegment::<gst::format::Time>::new());
pad.push_event(segment_evt).await;
state.need_segment = false;
......@@ -374,8 +373,7 @@ impl TaskImpl for AppSrcTask {
}
Err(gst::FlowError::Eos) => {
gst_debug!(CAT, obj: &self.element, "EOS");
let eos = gst::Event::new_eos().build();
pad.push_event(eos).await;
pad.push_event(gst::event::Eos::new()).await;
}
Err(gst::FlowError::Flushing) => {
gst_debug!(CAT, obj: &self.element, "Flushing");
......@@ -478,8 +476,7 @@ impl AppSrc {
None => return false,
};
let eos = StreamItem::Event(gst::Event::new_eos().build());
match sender.try_send(eos) {
match sender.try_send(StreamItem::Event(gst::event::Eos::new())) {
Ok(_) => true,
Err(err) => {
gst_error!(CAT, obj: element, "Failed to queue EOS: {}", err);
......
......@@ -334,7 +334,7 @@ impl PadSrcHandler for InputSelectorPadSrcHandler {
};
for pad in pads {
let mut peer_query = gst::query::Query::new_latency();
let mut peer_query = gst::query::Latency::new();
ret = pad.peer_query(&mut peer_query);
......@@ -518,12 +518,12 @@ impl ObjectImpl for InputSelector {
if let Some(old_pad) = old_pad {
if Some(&old_pad) != pad.as_ref() {
let _ = old_pad.push_event(gst::Event::new_reconfigure().build());
let _ = old_pad.push_event(gst::event::Reconfigure::new());
}
}
if let Some(pad) = pad {
let _ = pad.push_event(gst::Event::new_reconfigure().build());
let _ = pad.push_event(gst::event::Reconfigure::new());
}
}
_ => unimplemented!(),
......@@ -614,7 +614,7 @@ impl ElementImpl for InputSelector {
drop(pads);
drop(state);
let _ = element.post_message(&gst::Message::new_latency().src(Some(element)).build());
let _ = element.post_message(&gst::message::Latency::builder().src(element).build());
Some(ret)
}
......@@ -626,7 +626,7 @@ impl ElementImpl for InputSelector {
element.remove_pad(pad).unwrap();
drop(pads);
let _ = element.post_message(&gst::Message::new_latency().src(Some(element)).build());
let _ = element.post_message(&gst::message::Latency::builder().src(element).build());
}
fn provide_clock(&self, _element: &gst::Element) -> Option<gst::Clock> {
......
......@@ -812,7 +812,7 @@ impl SrcHandler {
],
);
events.push(gst::Event::new_custom_downstream(s).build());
events.push(gst::event::CustomDownstream::new(s));
}
lost_seqnum = lost_seqnum.wrapping_add(n_packets as u16);
......@@ -837,7 +837,7 @@ impl SrcHandler {
],
);
events.push(gst::Event::new_custom_downstream(s).build());
events.push(gst::event::CustomDownstream::new(s));
}
state.stats.num_lost += 1;
......@@ -1036,7 +1036,7 @@ impl PadSrcHandler for SrcHandler {
match query.view_mut() {
QueryView::Latency(ref mut q) => {
let mut peer_query = gst::query::Query::new_latency();
let mut peer_query = gst::query::Latency::new();
let ret = jb.sink_pad.gst_pad().peer_query(&mut peer_query);
......@@ -1302,8 +1302,7 @@ impl TaskImpl for JitterBufferTask {
match err {
gst::FlowError::Eos => {
gst_debug!(CAT, obj: &self.element, "Pushing EOS event");
let event = gst::Event::new_eos().build();
let _ = jb.src_pad.push_event(event).await;
let _ = jb.src_pad.push_event(gst::event::Eos::new()).await;
}
gst::FlowError::Flushing => gst_debug!(CAT, obj: &self.element, "Flushing"),
err => gst_error!(CAT, obj: &self.element, "Error {}", err),
......@@ -1513,7 +1512,7 @@ impl ObjectImpl for JitterBuffer {
let element = obj.downcast_ref::<gst::Element>().unwrap();
let _ =
element.post_message(&gst::Message::new_latency().src(Some(element)).build());
element.post_message(&gst::message::Latency::builder().src(element).build());
}
subclass::Property("do-lost", ..) => {
let mut settings = self.settings.lock().unwrap();
......
......@@ -389,7 +389,7 @@ impl PadSinkHandler for ProxySinkPadHandler {
match event.view() {
EventView::Eos(..) => {
let _ =
element.post_message(&gst::Message::new_eos().src(Some(&element)).build());
element.post_message(&gst::message::Eos::builder().src(&element).build());
}
EventView::FlushStop(..) => proxysink.start(&element),
_ => (),
......
......@@ -350,7 +350,7 @@ impl PadSrcHandler for QueuePadSrcHandler {
gst_log!(CAT, obj: pad.gst_pad(), "Handling {:?}", query);
if let QueryView::Scheduling(ref mut q) = query.view_mut() {
let mut new_query = gst::Query::new_scheduling();
let mut new_query = gst::query::Scheduling::new();
let res = queue.sink_pad.gst_pad().peer_query(&mut new_query);
if !res {
return res;
......@@ -439,8 +439,7 @@ impl TaskImpl for QueueTask {
Err(gst::FlowError::Eos) => {
gst_debug!(CAT, obj: &self.element, "EOS");
*queue.last_res.lock().unwrap() = Err(gst::FlowError::Eos);
let eos = gst::Event::new_eos().build();
pad.push_event(eos).await;
pad.push_event(gst::event::Eos::new()).await;
}
Err(err) => {
gst_error!(CAT, obj: &self.element, "Got error {}", err);
......
......@@ -207,14 +207,13 @@ impl TcpClientSrcPadHandler {
gst_debug!(CAT, obj: pad.gst_pad(), "Pushing initial events");
let stream_id = format!("{:08x}{:08x}", rand::random::<u32>(), rand::random::<u32>());
let stream_start_evt = gst::Event::new_stream_start(&stream_id)
let stream_start_evt = gst::event::StreamStart::builder(&stream_id)
.group_id(gst::GroupId::next())
.build();
pad.push_event(stream_start_evt).await;
if let Some(ref caps) = state.caps {
let caps_evt = gst::Event::new_caps(&caps).build();
pad.push_event(caps_evt).await;
pad.push_event(gst::event::Caps::new(&caps)).await;
*self.0.configured_caps.lock().unwrap() = Some(caps.clone());
}
......@@ -223,7 +222,7 @@ impl TcpClientSrcPadHandler {
if state.need_segment {
let segment_evt =
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build();
gst::event::Segment::new(&gst::FormattedSegment::<gst::format::Time>::new());
pad.push_event(segment_evt).await;
state.need_segment = false;
......@@ -241,8 +240,7 @@ impl TcpClientSrcPadHandler {
self.push_prelude(pad, element).await;
if buffer.get_size() == 0 {
let event = gst::Event::new_eos().build();
pad.push_event(event).await;
pad.push_event(gst::event::Eos::new()).await;
return Ok(gst::FlowSuccess::Ok);
}
......@@ -459,8 +457,7 @@ impl TaskImpl for TcpClientSrcTask {
}
Err(gst::FlowError::Eos) => {
gst_debug!(CAT, obj: &self.element, "EOS");
let eos = gst::Event::new_eos().build();
pad.push_event(eos).await;
pad.push_event(gst::event::Eos::new()).await;
}
Err(err) => {
gst_error!(CAT, obj: &self.element, "Got error {}", err);
......
......@@ -754,7 +754,7 @@ impl UdpSinkPadHandler {
async fn handle_event(&self, element: &gst::Element, event: gst::Event) {
match event.view() {
EventView::Eos(_) => {
let _ = element.post_message(&gst::Message::new_eos().src(Some(element)).build());
let _ = element.post_message(&gst::message::Eos::builder().src(element).build());
}
EventView::Segment(e) => {
self.0.write().unwrap().segment = Some(e.get_segment().clone());
......
......@@ -260,14 +260,13 @@ impl UdpSrcPadHandler {
gst_debug!(CAT, obj: pad.gst_pad(), "Pushing initial events");
let stream_id = format!("{:08x}{:08x}", rand::random::<u32>(), rand::random::<u32>());
let stream_start_evt = gst::Event::new_stream_start(&stream_id)
let stream_start_evt = gst::event::StreamStart::builder(&stream_id)
.group_id(gst::GroupId::next())
.build();
pad.push_event(stream_start_evt).await;
if let Some(ref caps) = state.caps {
let caps_evt = gst::Event::new_caps(&caps).build();
pad.push_event(caps_evt).await;
pad.push_event(gst::event::Caps::new(&caps)).await;
*self.0.configured_caps.lock().unwrap() = Some(caps.clone());
}
......@@ -276,7 +275,7 @@ impl UdpSrcPadHandler {
if state.need_segment {
let segment_evt =
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build();
gst::event::Segment::new(&gst::FormattedSegment::<gst::format::Time>::new());
pad.push_event(segment_evt).await;
state.need_segment = false;
......@@ -478,8 +477,7 @@ impl TaskImpl for UdpSrcTask {
Err(gst::FlowError::Flushing) => gst_debug!(CAT, obj: &self.element, "Flushing"),
Err(gst::FlowError::Eos) => {
gst_debug!(CAT, obj: &self.element, "EOS");
let eos = gst::Event::new_eos().build();
pad.push_event(eos).await;
pad.push_event(gst::event::Eos::new()).await;
}
Err(err) => {
gst_error!(CAT, obj: &self.element, "Got error {}", err);
......
......@@ -193,7 +193,7 @@ fn flush_regular() {
let _ = h.pull().unwrap();
// FlushStart
assert!(h.push_upstream_event(gst::Event::new_flush_start().build()));
assert!(h.push_upstream_event(gst::event::FlushStart::new()));
// Can't push buffer while flushing
assert!(!appsrc
......@@ -206,7 +206,7 @@ fn flush_regular() {
assert!(h.try_pull().is_none());
// FlushStop
assert!(h.push_upstream_event(gst::Event::new_flush_stop(true).build()));
assert!(h.push_upstream_event(gst::event::FlushStop::new(true)));
// No buffer available due to flush
assert!(h.try_pull().is_none());
......@@ -258,7 +258,7 @@ fn pause_flush() {
.unwrap();
// FlushStart
assert!(h.push_upstream_event(gst::Event::new_flush_start().build()));
assert!(h.push_upstream_event(gst::event::FlushStart::new()));
// Can't push buffers while flushing
assert!(!appsrc
......@@ -271,7 +271,7 @@ fn pause_flush() {
assert!(h.try_pull().is_none());
// FlushStop
assert!(h.push_upstream_event(gst::Event::new_flush_stop(true).build()));
assert!(h.push_upstream_event(gst::event::FlushStop::new(true)));
appsrc
.change_state(gst::StateChange::PausedToPlaying)
......
......@@ -586,7 +586,7 @@ impl ElementSinkTest {
gst_debug!(SINK_CAT, obj: element, "Pushing FlushStart");
self.sink_pad
.gst_pad()
.push_event(gst::Event::new_flush_start().build());
.push_event(gst::event::FlushStart::new());
gst_debug!(SINK_CAT, obj: element, "FlushStart pushed");
}
......@@ -594,7 +594,7 @@ impl ElementSinkTest {
gst_debug!(SINK_CAT, obj: element, "Pushing FlushStop");
self.sink_pad
.gst_pad()
.push_event(gst::Event::new_flush_stop(true).build());
.push_event(gst::event::FlushStop::new(true));
gst_debug!(SINK_CAT, obj: element, "FlushStop pushed");
}
}
......@@ -762,7 +762,7 @@ fn nominal_scenario(
// Initial events
elem_src_test
.try_push(Item::Event(
gst::Event::new_stream_start(scenario_name)
gst::event::StreamStart::builder(scenario_name)
.group_id(gst::GroupId::next())
.build(),
))
......@@ -777,9 +777,9 @@ fn nominal_scenario(
}
elem_src_test
.try_push(Item::Event(
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build(),
))
.try_push(Item::Event(gst::event::Segment::new(
&gst::FormattedSegment::<gst::format::Time>::new(),
)))
.unwrap();
match futures::executor::block_on(receiver.next()).unwrap() {
......@@ -838,8 +838,8 @@ fn nominal_scenario(
}
// Flush
src_element.send_event(gst::Event::new_flush_start().build());
src_element.send_event(gst::Event::new_flush_stop(true).build());
src_element.send_event(gst::event::FlushStart::new());
src_element.send_event(gst::event::FlushStop::new(true));
match futures::executor::block_on(receiver.next()).unwrap() {
Item::Event(event) => match event.view() {
......@@ -850,9 +850,9 @@ fn nominal_scenario(
}
elem_src_test
.try_push(Item::Event(
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build(),
))
.try_push(Item::Event(gst::event::Segment::new(
&gst::FormattedSegment::<gst::format::Time>::new(),
)))
.unwrap();
match futures::executor::block_on(receiver.next()).unwrap() {
......@@ -878,7 +878,7 @@ fn nominal_scenario(
// EOS
elem_src_test
.try_push(Item::Event(gst::Event::new_eos().build()))
.try_push(Item::Event(gst::event::Eos::new()))
.unwrap();
match futures::executor::block_on(receiver.next()).unwrap() {
......@@ -894,7 +894,7 @@ fn nominal_scenario(
// Receiver was dropped when stopping => can't send anymore
elem_src_test
.try_push(Item::Event(
gst::Event::new_stream_start(&format!("{}_past_stop", scenario_name))
gst::event::StreamStart::builder(&format!("{}_past_stop", scenario_name))
.group_id(gst::GroupId::next())
.build(),
))
......@@ -986,7 +986,7 @@ fn start_pause_start() {
// Initial events
elem_src_test
.try_push(Item::Event(
gst::Event::new_stream_start(scenario_name)
gst::event::StreamStart::builder(scenario_name)
.group_id(gst::GroupId::next())
.build(),
))
......@@ -1001,9 +1001,9 @@ fn start_pause_start() {
}
elem_src_test
.try_push(Item::Event(
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build(),
))
.try_push(Item::Event(gst::event::Segment::new(
&gst::FormattedSegment::<gst::format::Time>::new(),
)))
.unwrap();
match futures::executor::block_on(receiver.next()).unwrap() {
......@@ -1064,7 +1064,7 @@ fn start_stop_start() {
// Initial events
elem_src_test
.try_push(Item::Event(
gst::Event::new_stream_start(&format!("{}-after_stop", scenario_name))
gst::event::StreamStart::builder(&format!("{}-after_stop", scenario_name))
.group_id(gst::GroupId::next())
.build(),
))
......@@ -1079,9 +1079,9 @@ fn start_stop_start() {
}
elem_src_test
.try_push(Item::Event(
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build(),
))
.try_push(Item::Event(gst::event::Segment::new(
&gst::FormattedSegment::<gst::format::Time>::new(),
)))
.unwrap();
match futures::executor::block_on(receiver.next()).unwrap() {
......@@ -1104,7 +1104,7 @@ fn start_stop_start() {
// Initial events again
elem_src_test
.try_push(Item::Event(
gst::Event::new_stream_start(scenario_name)
gst::event::StreamStart::builder(scenario_name)
.group_id(gst::GroupId::next())
.build(),
))
......@@ -1134,9 +1134,9 @@ fn start_stop_start() {
}
elem_src_test
.try_push(Item::Event(
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build(),
))
.try_push(Item::Event(gst::event::Segment::new(
&gst::FormattedSegment::<gst::format::Time>::new(),
)))
.unwrap();
match futures::executor::block_on(receiver.next()).unwrap() {
......@@ -1177,7 +1177,7 @@ fn start_flush() {
// Initial events
elem_src_test
.try_push(Item::Event(
gst::Event::new_stream_start(&format!("{}-after_stop", scenario_name))
gst::event::StreamStart::builder(&format!("{}-after_stop", scenario_name))
.group_id(gst::GroupId::next())
.build(),
))
......@@ -1192,9 +1192,9 @@ fn start_flush() {
}
elem_src_test
.try_push(Item::Event(
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build(),
))
.try_push(Item::Event(gst::event::Segment::new(
&gst::FormattedSegment::<gst::format::Time>::new(),
)))
.unwrap();
match futures::executor::block_on(receiver.next()).unwrap() {
......@@ -1221,9 +1221,9 @@ fn start_flush() {
elem_sink_test.push_flush_stop(&sink_element);
elem_src_test
.try_push(Item::Event(
gst::Event::new_segment(&gst::FormattedSegment::<gst::format::Time>::new()).build(),
))