mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-21 09:36:28 +00:00
fix-getters-{def,calls} pass
This commit is contained in:
parent
c3fb55f235
commit
06accc8d98
107 changed files with 936 additions and 1003 deletions
|
@ -143,7 +143,7 @@ impl ObjectImpl for AudioEcho {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"max-delay" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
if self.state.lock().unwrap().is_none() {
|
||||
|
@ -167,7 +167,7 @@ impl ObjectImpl for AudioEcho {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"max-delay" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.max_delay.to_value()
|
||||
|
|
|
@ -252,7 +252,7 @@ impl State {
|
|||
let outbuf = outbuf.get_mut().unwrap();
|
||||
outbuf.set_pts(pts);
|
||||
outbuf.set_duration(
|
||||
(outbuf.get_size() as u64)
|
||||
(outbuf.size() as u64)
|
||||
.mul_div_floor(gst::SECOND_VAL, (self.info.bpf() * self.info.rate()) as u64)
|
||||
.into(),
|
||||
);
|
||||
|
@ -309,7 +309,7 @@ impl State {
|
|||
let outbuf = outbuf.get_mut().unwrap();
|
||||
outbuf.set_pts(pts);
|
||||
outbuf.set_duration(
|
||||
(outbuf.get_size() as u64)
|
||||
(outbuf.size() as u64)
|
||||
.mul_div_floor(gst::SECOND_VAL, (self.info.bpf() * self.info.rate()) as u64)
|
||||
.into(),
|
||||
);
|
||||
|
@ -1560,7 +1560,7 @@ impl AudioLoudNorm {
|
|||
};
|
||||
|
||||
let mut outbufs = vec![];
|
||||
if buffer.get_flags().contains(gst::BufferFlags::DISCONT) {
|
||||
if buffer.flags().contains(gst::BufferFlags::DISCONT) {
|
||||
gst_debug!(CAT, obj: element, "Draining on discontinuity");
|
||||
match state.drain(element) {
|
||||
Ok(outbuf) => {
|
||||
|
@ -1598,7 +1598,7 @@ impl AudioLoudNorm {
|
|||
|
||||
match event.view() {
|
||||
EventView::Caps(c) => {
|
||||
let caps = c.get_caps();
|
||||
let caps = c.caps();
|
||||
gst_info!(CAT, obj: pad, "Got caps {:?}", caps);
|
||||
|
||||
let info = match gst_audio::AudioInfo::from_caps(caps) {
|
||||
|
@ -1687,7 +1687,7 @@ impl AudioLoudNorm {
|
|||
QueryView::Latency(ref mut q) => {
|
||||
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();
|
||||
let (live, min_latency, max_latency) = peer_query.result();
|
||||
q.set(
|
||||
live,
|
||||
min_latency + 3 * gst::SECOND,
|
||||
|
@ -1810,7 +1810,7 @@ impl ObjectImpl for AudioLoudNorm {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"loudness-target" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.loudness_target = value.get_some().expect("type checked upstream");
|
||||
|
@ -1832,7 +1832,7 @@ impl ObjectImpl for AudioLoudNorm {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"loudness-target" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.loudness_target.to_value()
|
||||
|
|
|
@ -61,7 +61,7 @@ impl State {
|
|||
gst::ClockTime(samples.mul_div_round(gst::SECOND_VAL, self.in_info.rate() as u64))
|
||||
}
|
||||
|
||||
fn get_current_pts(&self) -> gst::ClockTime {
|
||||
fn current_pts(&self) -> gst::ClockTime {
|
||||
// get the last seen pts and the amount of bytes
|
||||
// since then
|
||||
let (prev_pts, distance) = self.adapter.prev_pts();
|
||||
|
@ -137,7 +137,7 @@ impl AudioRNNoise {
|
|||
})?;
|
||||
|
||||
let duration = state.buffer_duration(available as _);
|
||||
let pts = state.get_current_pts();
|
||||
let pts = state.current_pts();
|
||||
|
||||
{
|
||||
let ibuffer = state.adapter.take_buffer(available).unwrap();
|
||||
|
@ -167,7 +167,7 @@ impl AudioRNNoise {
|
|||
let bpf = state.in_info.bpf() as usize;
|
||||
let output_size = available - (available % (FRAME_SIZE * bpf));
|
||||
let duration = state.buffer_duration(output_size as _);
|
||||
let pts = state.get_current_pts();
|
||||
let pts = state.current_pts();
|
||||
|
||||
let mut buffer = gst::Buffer::with_size(output_size).map_err(|_| gst::FlowError::Error)?;
|
||||
|
||||
|
@ -307,7 +307,7 @@ impl BaseTransformImpl for AudioRNNoise {
|
|||
// if it is not the case, just notify the parent class to not generate
|
||||
// an output
|
||||
if let Some(buffer) = self.take_queued_buffer() {
|
||||
if buffer.get_flags() == gst::BufferFlags::DISCONT {
|
||||
if buffer.flags() == gst::BufferFlags::DISCONT {
|
||||
self.drain(element)?;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ impl BaseTransformImpl for AudioRNNoise {
|
|||
let sink_pad = element.get_static_pad("sink").expect("Sink pad not found");
|
||||
let mut upstream_query = gst::query::Latency::new();
|
||||
if sink_pad.peer_query(&mut upstream_query) {
|
||||
let (live, mut min, mut max) = upstream_query.get_result();
|
||||
let (live, mut min, mut max) = upstream_query.result();
|
||||
gst_debug!(
|
||||
CAT,
|
||||
obj: element,
|
||||
|
|
|
@ -185,7 +185,7 @@ impl ObjectImpl for EbuR128Level {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"mode" => {
|
||||
let mode = value.get_some().expect("type checked upstream");
|
||||
gst_info!(
|
||||
|
@ -225,7 +225,7 @@ impl ObjectImpl for EbuR128Level {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"mode" => settings.mode.to_value(),
|
||||
"post-messages" => settings.post_messages.to_value(),
|
||||
"interval" => settings.interval.to_value(),
|
||||
|
@ -432,8 +432,8 @@ impl BaseTransformImpl for EbuR128Level {
|
|||
gst::FlowError::NotNegotiated
|
||||
})?;
|
||||
|
||||
let mut timestamp = buf.get_pts();
|
||||
let segment = element.get_segment().downcast::<gst::ClockTime>().ok();
|
||||
let mut timestamp = buf.pts();
|
||||
let segment = element.segment().downcast::<gst::ClockTime>().ok();
|
||||
|
||||
let buf = gst_audio::AudioBufferRef::from_buffer_ref_readable(&buf, &state.info).map_err(
|
||||
|_| {
|
||||
|
|
|
@ -101,7 +101,7 @@ fn run_test(
|
|||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
let mut eos = false;
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
|
@ -131,9 +131,9 @@ fn run_test(
|
|||
for sample in samples.iter() {
|
||||
use std::cmp::Ordering;
|
||||
|
||||
let buf = sample.get_buffer().unwrap();
|
||||
let buf = sample.buffer().unwrap();
|
||||
|
||||
let ts = buf.get_pts();
|
||||
let ts = buf.pts();
|
||||
match ts.cmp(&expected_ts) {
|
||||
Ordering::Greater => {
|
||||
assert!(
|
||||
|
|
|
@ -104,7 +104,7 @@ fn run_test(layout: gst_audio::AudioLayout, format: gst_audio::AudioFormat) {
|
|||
format.to_str()
|
||||
));
|
||||
let bus = gst::Bus::new();
|
||||
h.get_element().unwrap().set_bus(Some(&bus));
|
||||
h.element().unwrap().set_bus(Some(&bus));
|
||||
h.play();
|
||||
|
||||
// Pull all buffers until EOS
|
||||
|
@ -118,8 +118,8 @@ fn run_test(layout: gst_audio::AudioLayout, format: gst_audio::AudioFormat) {
|
|||
while let Some(msg) = bus.pop() {
|
||||
match msg.view() {
|
||||
gst::MessageView::Element(msg) => {
|
||||
let s = msg.get_structure().unwrap();
|
||||
if s.get_name() == "ebur128-level" {
|
||||
let s = msg.structure().unwrap();
|
||||
if s.name() == "ebur128-level" {
|
||||
num_msgs += 1;
|
||||
let timestamp = s.get_some::<u64>("timestamp").unwrap();
|
||||
let running_time = s.get_some::<u64>("running-time").unwrap();
|
||||
|
|
|
@ -97,11 +97,11 @@ fn do_test(data: &'static [u8], packet_sizes: &[usize], decoded_samples: &[usize
|
|||
continue;
|
||||
}
|
||||
let buffer = h.pull().unwrap();
|
||||
assert_eq!(buffer.get_size(), 4 * samples);
|
||||
assert_eq!(buffer.size(), 4 * samples);
|
||||
}
|
||||
|
||||
h.get_sinkpad()
|
||||
h.sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.expect("pad has no caps")
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Box<dyn Error>> {
|
|||
pipeline.set_state(gst::State::Playing)?;
|
||||
|
||||
let bus = pipeline
|
||||
.get_bus()
|
||||
.bus()
|
||||
.expect("Pipeline without bus. Shouldn't happen!");
|
||||
|
||||
for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
|
||||
|
@ -115,9 +115,9 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Box<dyn Error>> {
|
|||
MessageView::Error(err) => {
|
||||
println!(
|
||||
"Error from {:?}: {} ({:?})",
|
||||
msg.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
msg.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ impl State {
|
|||
gst::ClockTime(samples.mul_div_round(gst::SECOND_VAL, self.in_info.rate() as u64))
|
||||
}
|
||||
|
||||
fn get_current_pts(&self) -> gst::ClockTime {
|
||||
fn current_pts(&self) -> gst::ClockTime {
|
||||
// get the last seen pts and the amount of bytes
|
||||
// since then
|
||||
let (prev_pts, distance) = self.adapter.prev_pts();
|
||||
|
@ -128,8 +128,8 @@ impl State {
|
|||
|
||||
impl CsoundFilter {
|
||||
fn process(&self, csound: &mut Csound, idata: &[f64], odata: &mut [f64]) -> bool {
|
||||
let spin = csound.get_spin().unwrap();
|
||||
let spout = csound.get_spout().unwrap();
|
||||
let spin = csound.spin().unwrap();
|
||||
let spout = csound.spout().unwrap();
|
||||
|
||||
let in_chunks = idata.chunks_exact(spin.len());
|
||||
let out_chuncks = odata.chunks_exact_mut(spout.len());
|
||||
|
@ -190,8 +190,8 @@ impl CsoundFilter {
|
|||
return Ok(gst::FlowSuccess::Ok);
|
||||
}
|
||||
|
||||
let mut spin = csound.get_spin().unwrap();
|
||||
let spout = csound.get_spout().unwrap();
|
||||
let mut spin = csound.spin().unwrap();
|
||||
let spout = csound.spout().unwrap();
|
||||
|
||||
let out_bytes =
|
||||
(avail / state.in_info.channels() as usize) * state.out_info.channels() as usize;
|
||||
|
@ -208,7 +208,7 @@ impl CsoundFilter {
|
|||
|
||||
let buffer_mut = buffer.get_mut().ok_or(gst::FlowError::NotSupported)?;
|
||||
|
||||
let pts = state.get_current_pts();
|
||||
let pts = state.current_pts();
|
||||
let duration = state.buffer_duration(out_bytes as _);
|
||||
|
||||
buffer_mut.set_pts(pts);
|
||||
|
@ -255,7 +255,7 @@ impl CsoundFilter {
|
|||
let mut output = gst::Buffer::with_size(output_size).map_err(|_| gst::FlowError::Error)?;
|
||||
let outbuf = output.get_mut().ok_or(gst::FlowError::Error)?;
|
||||
|
||||
let pts = state.get_current_pts();
|
||||
let pts = state.current_pts();
|
||||
let duration = state.buffer_duration(output_size as _);
|
||||
|
||||
outbuf.set_pts(pts);
|
||||
|
@ -387,7 +387,7 @@ impl ObjectImpl for CsoundFilter {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"loop" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.loop_ = value.get_some().expect("type checked upstream");
|
||||
|
@ -419,7 +419,7 @@ impl ObjectImpl for CsoundFilter {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"loop" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.loop_.to_value()
|
||||
|
@ -547,7 +547,7 @@ impl BaseTransformImpl for CsoundFilter {
|
|||
if compiled {
|
||||
let csound = self.csound.lock().unwrap();
|
||||
// Use the sample rate and channels configured in the csound score
|
||||
let sr = csound.get_sample_rate() as i32;
|
||||
let sr = csound.sample_rate() as i32;
|
||||
let ichannels = csound.input_channels() as i32;
|
||||
let ochannels = csound.output_channels() as i32;
|
||||
for s in new_caps.make_mut().iter_mut() {
|
||||
|
@ -608,7 +608,7 @@ impl BaseTransformImpl for CsoundFilter {
|
|||
let rate = in_info.rate();
|
||||
|
||||
// Check if the negotiated caps are the right ones
|
||||
if rate != out_info.rate() || rate != csound.get_sample_rate() as _ {
|
||||
if rate != out_info.rate() || rate != csound.sample_rate() as _ {
|
||||
return Err(loggable_error!(
|
||||
CAT,
|
||||
"Failed to negotiate caps: invalid sample rate {}",
|
||||
|
@ -628,7 +628,7 @@ impl BaseTransformImpl for CsoundFilter {
|
|||
));
|
||||
}
|
||||
|
||||
let ksmps = csound.get_ksmps();
|
||||
let ksmps = csound.ksmps();
|
||||
|
||||
let adapter = gst_base::UniqueAdapter::new();
|
||||
|
||||
|
@ -651,7 +651,7 @@ impl BaseTransformImpl for CsoundFilter {
|
|||
// if it is not the case, just notify the parent class to not generate
|
||||
// an output
|
||||
if let Some(buffer) = self.take_queued_buffer() {
|
||||
if buffer.get_flags() == gst::BufferFlags::DISCONT {
|
||||
if buffer.flags() == gst::BufferFlags::DISCONT {
|
||||
self.drain(element)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,10 +147,10 @@ fn csound_filter_eos() {
|
|||
|
||||
// Checks output buffer timestamp and duration
|
||||
assert_eq!(
|
||||
buffer.as_ref().get_duration(),
|
||||
buffer.as_ref().duration(),
|
||||
duration_from_samples(in_process_samples, sr as _)
|
||||
);
|
||||
assert_eq!(buffer.as_ref().get_pts(), expected_pts);
|
||||
assert_eq!(buffer.as_ref().pts(), expected_pts);
|
||||
|
||||
// Get the number of samples that were not processed
|
||||
samples_offset = in_samples % ksmps as u64;
|
||||
|
@ -177,7 +177,7 @@ fn csound_filter_eos() {
|
|||
|
||||
let samples_at_eos = (EOS_NUM_BUFFERS * EOS_NUM_SAMPLES) % ksmps;
|
||||
assert_eq!(
|
||||
buffer.as_ref().get_pts(),
|
||||
buffer.as_ref().pts(),
|
||||
in_pts - duration_from_samples(samples_at_eos as _, sr as _)
|
||||
);
|
||||
|
||||
|
@ -254,10 +254,10 @@ fn csound_filter_underflow() {
|
|||
|
||||
for _ in 0..expected_buffers {
|
||||
let buffer = h.pull().unwrap();
|
||||
let samples = buffer.get_size() / std::mem::size_of::<f64>();
|
||||
let samples = buffer.size() / std::mem::size_of::<f64>();
|
||||
|
||||
assert_eq!(buffer.as_ref().get_pts(), expected_pts);
|
||||
assert_eq!(buffer.as_ref().get_duration(), expected_duration);
|
||||
assert_eq!(buffer.as_ref().pts(), expected_pts);
|
||||
assert_eq!(buffer.as_ref().duration(), expected_duration);
|
||||
assert_eq!(samples, UNDERFLOW_NUM_SAMPLES * 2);
|
||||
// Output data is produced after 2 input buffers
|
||||
// so that, the next output buffer's PTS should be
|
||||
|
@ -329,18 +329,18 @@ fn csound_filter_caps_negotiation() {
|
|||
let buffer = h.pull().unwrap();
|
||||
|
||||
// Pushing a buffer without a timestamp should produce a no timestamp output
|
||||
assert!(buffer.as_ref().get_pts().is_none());
|
||||
assert!(buffer.as_ref().pts().is_none());
|
||||
// But It should have a duration
|
||||
assert_eq!(
|
||||
buffer.as_ref().get_duration(),
|
||||
buffer.as_ref().duration(),
|
||||
duration_from_samples(1024 / std::mem::size_of::<f64>() as u64, sr as u64)
|
||||
);
|
||||
|
||||
// get the negotiated harness sink caps
|
||||
let harness_sink_caps = h
|
||||
.get_sinkpad()
|
||||
.sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.expect("pad has no caps");
|
||||
|
||||
// our expected caps at the harness sinkpad
|
||||
|
@ -407,10 +407,7 @@ fn csound_filter_caps_negotiation_fail() {
|
|||
|
||||
// The harness sinkpad end up not having defined caps
|
||||
// so, the get_current_caps should be None
|
||||
let current_caps = h
|
||||
.get_sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps();
|
||||
let current_caps = h.sinkpad().expect("harness has no sinkpad").current_caps();
|
||||
|
||||
assert!(current_caps.is_none());
|
||||
}
|
||||
|
|
|
@ -81,13 +81,13 @@ fn run_test(inline_headers: bool) {
|
|||
continue;
|
||||
}
|
||||
let buffer = h.pull().unwrap();
|
||||
assert_eq!(buffer.get_size(), 4 * samples);
|
||||
assert_eq!(buffer.size(), 4 * samples);
|
||||
}
|
||||
|
||||
let caps = h
|
||||
.get_sinkpad()
|
||||
.sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.expect("pad has no caps");
|
||||
assert_eq!(
|
||||
caps,
|
||||
|
|
|
@ -136,7 +136,7 @@ impl ObjectImpl for FileSink {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"location" => {
|
||||
let res = match value.get::<String>() {
|
||||
Ok(Some(location)) => FileLocation::try_from_path_str(location)
|
||||
|
@ -154,7 +154,7 @@ impl ObjectImpl for FileSink {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"location" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
let location = settings
|
||||
|
|
|
@ -150,7 +150,7 @@ impl ObjectImpl for FileSrc {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"location" => {
|
||||
let res = match value.get::<String>() {
|
||||
Ok(Some(location)) => FileLocation::try_from_path_str(location)
|
||||
|
@ -168,7 +168,7 @@ impl ObjectImpl for FileSrc {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"location" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
let location = settings
|
||||
|
|
|
@ -68,7 +68,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
.required(true)
|
||||
.takes_value(true),
|
||||
)
|
||||
.get_matches();
|
||||
.matches();
|
||||
|
||||
gst::init()?;
|
||||
gstsodium::plugin_register_static().expect("Failed to register sodium plugin");
|
||||
|
@ -123,17 +123,17 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
.set_state(gst::State::Playing)
|
||||
.expect("Unable to set the pipeline to the `Playing` state");
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
MessageView::Error(err) => {
|
||||
eprintln!(
|
||||
"Error received from element {:?}: {}",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error()
|
||||
);
|
||||
eprintln!("Debugging information: {:?}", err.get_debug());
|
||||
eprintln!("Debugging information: {:?}", err.debug());
|
||||
break;
|
||||
}
|
||||
MessageView::Eos(..) => break,
|
||||
|
|
|
@ -68,7 +68,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
.required(true)
|
||||
.takes_value(true),
|
||||
)
|
||||
.get_matches();
|
||||
.matches();
|
||||
|
||||
gst::init()?;
|
||||
gstsodium::plugin_register_static().expect("Failed to register sodium plugin");
|
||||
|
@ -120,17 +120,17 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
|
||||
pipeline.set_state(gst::State::Playing)?;
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
MessageView::Error(err) => {
|
||||
eprintln!(
|
||||
"Error received from element {:?}: {}",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error()
|
||||
);
|
||||
eprintln!("Debugging information: {:?}", err.get_debug());
|
||||
eprintln!("Debugging information: {:?}", err.debug());
|
||||
break;
|
||||
}
|
||||
MessageView::Eos(..) => break,
|
||||
|
|
|
@ -92,7 +92,7 @@ fn main() {
|
|||
.short("j")
|
||||
.help("Write a JSON file instead of a key.prv/key.pub pair"),
|
||||
)
|
||||
.get_matches();
|
||||
.matches();
|
||||
|
||||
let keys = Keys::new();
|
||||
|
||||
|
|
|
@ -301,16 +301,16 @@ impl Decrypter {
|
|||
|
||||
gst_log!(CAT, obj: pad, "Upstream returned {:?}", peer_query);
|
||||
|
||||
let (flags, min, max, align) = peer_query.get_result();
|
||||
let (flags, min, max, align) = peer_query.result();
|
||||
q.set(flags, min, max, align);
|
||||
q.add_scheduling_modes(&[gst::PadMode::Pull]);
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.get_mut_query());
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.query_mut());
|
||||
true
|
||||
}
|
||||
QueryView::Duration(ref mut q) => {
|
||||
use std::convert::TryInto;
|
||||
|
||||
if q.get_format() != gst::Format::Bytes {
|
||||
if q.format() != gst::Format::Bytes {
|
||||
return pad.query_default(Some(element), query);
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ impl Decrypter {
|
|||
return false;
|
||||
}
|
||||
|
||||
let size = match peer_query.get_result().try_into().unwrap() {
|
||||
let size = match peer_query.result().try_into().unwrap() {
|
||||
gst::format::Bytes(Some(size)) => size,
|
||||
gst::format::Bytes(None) => {
|
||||
gst_error!(CAT, "Failed to query upstream duration");
|
||||
|
@ -381,7 +381,7 @@ impl Decrypter {
|
|||
err
|
||||
})?;
|
||||
|
||||
if buffer.get_size() != crate::HEADERS_SIZE {
|
||||
if buffer.size() != crate::HEADERS_SIZE {
|
||||
let err = gst::loggable_error!(CAT, "Headers buffer has wrong size");
|
||||
err.log_with_object(element);
|
||||
return Err(err);
|
||||
|
@ -636,7 +636,7 @@ impl ObjectImpl for Decrypter {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"sender-key" => {
|
||||
let mut props = self.props.lock().unwrap();
|
||||
props.sender_key = value.get().expect("type checked upstream");
|
||||
|
@ -652,7 +652,7 @@ impl ObjectImpl for Decrypter {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"receiver-key" => {
|
||||
let props = self.props.lock().unwrap();
|
||||
props.receiver_key.to_value()
|
||||
|
|
|
@ -275,19 +275,19 @@ impl Encrypter {
|
|||
|
||||
match query.view_mut() {
|
||||
QueryView::Seeking(mut q) => {
|
||||
let format = q.get_format();
|
||||
let format = q.format();
|
||||
q.set(
|
||||
false,
|
||||
gst::GenericFormattedValue::Other(format, -1),
|
||||
gst::GenericFormattedValue::Other(format, -1),
|
||||
);
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.get_mut_query());
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.query_mut());
|
||||
true
|
||||
}
|
||||
QueryView::Duration(ref mut q) => {
|
||||
use std::convert::TryInto;
|
||||
|
||||
if q.get_format() != gst::Format::Bytes {
|
||||
if q.format() != gst::Format::Bytes {
|
||||
return pad.query_default(Some(element), query);
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ impl Encrypter {
|
|||
return false;
|
||||
}
|
||||
|
||||
let size = match peer_query.get_result().try_into().unwrap() {
|
||||
let size = match peer_query.result().try_into().unwrap() {
|
||||
gst::format::Bytes(Some(size)) => size,
|
||||
gst::format::Bytes(None) => {
|
||||
gst_error!(CAT, "Failed to query upstream duration");
|
||||
|
@ -436,7 +436,7 @@ impl ObjectImpl for Encrypter {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"sender-key" => {
|
||||
let mut props = self.props.lock().unwrap();
|
||||
props.sender_key = value.get().expect("type checked upstream");
|
||||
|
@ -457,7 +457,7 @@ impl ObjectImpl for Encrypter {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"receiver-key" => {
|
||||
let props = self.props.lock().unwrap();
|
||||
props.receiver_key.to_value()
|
||||
|
|
|
@ -104,7 +104,7 @@ fn test_pipeline() {
|
|||
.new_sample(move |appsink| {
|
||||
// Pull the sample in question out of the appsink's buffer.
|
||||
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
|
||||
let buffer = sample.get_buffer().ok_or(gst::FlowError::Error)?;
|
||||
let buffer = sample.buffer().ok_or(gst::FlowError::Error)?;
|
||||
|
||||
let mut adapter = adapter_clone.lock().unwrap();
|
||||
adapter.push(buffer.to_owned());
|
||||
|
@ -118,17 +118,17 @@ fn test_pipeline() {
|
|||
.set_state(gst::State::Playing)
|
||||
.expect("Unable to set the pipeline to the `Playing` state");
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
MessageView::Error(err) => {
|
||||
eprintln!(
|
||||
"Error received from element {:?}: {}",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error()
|
||||
);
|
||||
eprintln!("Debugging information: {:?}", err.get_debug());
|
||||
eprintln!("Debugging information: {:?}", err.debug());
|
||||
unreachable!();
|
||||
}
|
||||
MessageView::Eos(..) => break,
|
||||
|
@ -196,7 +196,7 @@ fn test_pull_range() {
|
|||
srcpad.query(&mut q);
|
||||
|
||||
// get the seeking capabilities
|
||||
let (seekable, start, stop) = q.get_result();
|
||||
let (seekable, start, stop) = q.result();
|
||||
assert_eq!(seekable, true);
|
||||
assert_eq!(
|
||||
start,
|
||||
|
@ -214,7 +214,7 @@ fn test_pull_range() {
|
|||
61, 70, 175, 103, 127, 28, 0,
|
||||
];
|
||||
let buf1 = srcpad.get_range(0, 50).unwrap();
|
||||
assert_eq!(buf1.get_size(), 50);
|
||||
assert_eq!(buf1.size(), 50);
|
||||
let map1 = buf1.map_readable().unwrap();
|
||||
assert_eq!(&map1[..], &expected_array_1[..]);
|
||||
|
||||
|
@ -226,7 +226,7 @@ fn test_pull_range() {
|
|||
120, 121, 232, 0, 0, 12, 252, 195, 195, 199, 128, 0, 0, 0,
|
||||
];
|
||||
let buf2 = srcpad.get_range(0, 100).unwrap();
|
||||
assert_eq!(buf2.get_size(), 100);
|
||||
assert_eq!(buf2.size(), 100);
|
||||
let map2 = buf2.map_readable().unwrap();
|
||||
assert_eq!(&map2[..], &expected_array_2[..]);
|
||||
|
||||
|
@ -237,20 +237,20 @@ fn test_pull_range() {
|
|||
// request in the middle of a block
|
||||
let buf = srcpad.get_range(853, 100).unwrap();
|
||||
// result size doesn't include the block macs,
|
||||
assert_eq!(buf.get_size(), 100);
|
||||
assert_eq!(buf.size(), 100);
|
||||
|
||||
// read till eos, this also will pull multiple blocks
|
||||
let buf = srcpad.get_range(853, 42000).unwrap();
|
||||
// 6031 (size of file) - 883 (requersted offset) - headers size - (numbler of blcks * block mac)
|
||||
assert_eq!(buf.get_size(), 5054);
|
||||
assert_eq!(buf.size(), 5054);
|
||||
|
||||
// read 0 bytes from the start
|
||||
let buf = srcpad.get_range(0, 0).unwrap();
|
||||
assert_eq!(buf.get_size(), 0);
|
||||
assert_eq!(buf.size(), 0);
|
||||
|
||||
// read 0 bytes somewhere in the middle
|
||||
let buf = srcpad.get_range(4242, 0).unwrap();
|
||||
assert_eq!(buf.get_size(), 0);
|
||||
assert_eq!(buf.size(), 0);
|
||||
|
||||
// read 0 bytes to eos
|
||||
let res = srcpad.get_range(6003, 0);
|
||||
|
@ -266,7 +266,7 @@ fn test_pull_range() {
|
|||
|
||||
// read 10 bytes at eos -1, should return a single byte
|
||||
let buf = srcpad.get_range(5906, 10).unwrap();
|
||||
assert_eq!(buf.get_size(), 1);
|
||||
assert_eq!(buf.size(), 1);
|
||||
|
||||
pipeline
|
||||
.set_state(gst::State::Null)
|
||||
|
|
|
@ -167,7 +167,7 @@ fn main() {
|
|||
source.link(&sink).unwrap();
|
||||
}
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
let l_clone = l.clone();
|
||||
bus.add_watch(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
@ -177,9 +177,9 @@ fn main() {
|
|||
MessageView::Error(err) => {
|
||||
println!(
|
||||
"Error from {:?}: {} ({:?})",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
l_clone.quit();
|
||||
}
|
||||
|
|
|
@ -235,11 +235,11 @@ impl PadSrcHandler for AppSrcPadHandler {
|
|||
}
|
||||
QueryView::Caps(ref mut q) => {
|
||||
let caps = if let Some(caps) = self.0.configured_caps.lock().unwrap().as_ref() {
|
||||
q.get_filter()
|
||||
q.filter()
|
||||
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
|
||||
.unwrap_or_else(|| caps.clone())
|
||||
} else {
|
||||
q.get_filter()
|
||||
q.filter()
|
||||
.map(|f| f.to_owned())
|
||||
.unwrap_or_else(gst::Caps::new_any)
|
||||
};
|
||||
|
@ -386,9 +386,9 @@ impl AppSrc {
|
|||
|
||||
let do_timestamp = self.settings.lock().unwrap().do_timestamp;
|
||||
if do_timestamp {
|
||||
if let Some(clock) = element.get_clock() {
|
||||
let base_time = element.get_base_time();
|
||||
let now = clock.get_time();
|
||||
if let Some(clock) = element.clock() {
|
||||
let base_time = element.base_time();
|
||||
let now = clock.time();
|
||||
|
||||
let buffer = buffer.make_mut();
|
||||
buffer.set_dts(now - base_time);
|
||||
|
@ -623,7 +623,7 @@ impl ObjectImpl for AppSrc {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"context" => {
|
||||
settings.context = value
|
||||
.get()
|
||||
|
@ -648,7 +648,7 @@ impl ObjectImpl for AppSrc {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"context" => settings.context.to_value(),
|
||||
"context-wait" => settings.context_wait.to_value(),
|
||||
"caps" => settings.caps.to_value(),
|
||||
|
|
|
@ -45,10 +45,10 @@ pub enum DataQueueItem {
|
|||
impl DataQueueItem {
|
||||
fn size(&self) -> (u32, u32) {
|
||||
match *self {
|
||||
DataQueueItem::Buffer(ref buffer) => (1, buffer.get_size() as u32),
|
||||
DataQueueItem::Buffer(ref buffer) => (1, buffer.size() as u32),
|
||||
DataQueueItem::BufferList(ref list) => (
|
||||
list.len() as u32,
|
||||
list.iter().map(|b| b.get_size() as u32).sum::<u32>(),
|
||||
list.iter().map(|b| b.size() as u32).sum::<u32>(),
|
||||
),
|
||||
DataQueueItem::Event(_) => (0, 0),
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ impl DataQueueItem {
|
|||
|
||||
fn timestamp(&self) -> Option<u64> {
|
||||
match *self {
|
||||
DataQueueItem::Buffer(ref buffer) => buffer.get_dts_or_pts().0,
|
||||
DataQueueItem::Buffer(ref buffer) => buffer.dts_or_pts().0,
|
||||
DataQueueItem::BufferList(ref list) => {
|
||||
list.iter().filter_map(|b| b.get_dts_or_pts().0).next()
|
||||
list.iter().filter_map(|b| b.dts_or_pts().0).next()
|
||||
}
|
||||
DataQueueItem::Event(_) => None,
|
||||
}
|
||||
|
@ -156,8 +156,8 @@ impl DataQueue {
|
|||
for item in inner.queue.drain(..) {
|
||||
if let DataQueueItem::Event(event) = item {
|
||||
if event.is_sticky()
|
||||
&& event.get_type() != gst::EventType::Segment
|
||||
&& event.get_type() != gst::EventType::Eos
|
||||
&& event.type_() != gst::EventType::Segment
|
||||
&& event.type_() != gst::EventType::Eos
|
||||
{
|
||||
let _ = src_pad.store_sticky_event(&event);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ struct InputSelectorPadSinkHandler(Arc<Mutex<InputSelectorPadSinkHandlerInner>>)
|
|||
impl InputSelectorPadSinkHandler {
|
||||
/* Wait until specified time */
|
||||
async fn sync(&self, element: &super::InputSelector, running_time: gst::ClockTime) {
|
||||
let now = element.get_current_running_time();
|
||||
let now = element.current_running_time();
|
||||
|
||||
if let Some(delay) = running_time
|
||||
.saturating_sub(now)
|
||||
|
@ -104,7 +104,7 @@ impl InputSelectorPadSinkHandler {
|
|||
|
||||
if let Some(segment) = &inner.segment {
|
||||
if let Some(segment) = segment.downcast_ref::<gst::format::Time>() {
|
||||
let rtime = segment.to_running_time(buffer.get_pts());
|
||||
let rtime = segment.to_running_time(buffer.pts());
|
||||
let (sync_fut, abort_handle) = abortable(self.sync(&element, rtime));
|
||||
inner.abort_handle = Some(abort_handle);
|
||||
sync_future = Some(sync_fut.map_err(|_| gst::FlowError::Flushing));
|
||||
|
@ -142,7 +142,7 @@ impl InputSelectorPadSinkHandler {
|
|||
if is_active {
|
||||
gst_log!(CAT, obj: pad.gst_pad(), "Forwarding {:?}", buffer);
|
||||
|
||||
if switched_pad && !buffer.get_flags().contains(gst::BufferFlags::DISCONT) {
|
||||
if switched_pad && !buffer.flags().contains(gst::BufferFlags::DISCONT) {
|
||||
let buffer = buffer.make_mut();
|
||||
buffer.set_flags(gst::BufferFlags::DISCONT);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ impl PadSinkHandler for InputSelectorPadSinkHandler {
|
|||
|
||||
// Remember the segment for later use
|
||||
if let gst::EventView::Segment(e) = event.view() {
|
||||
inner.segment = Some(e.get_segment().clone());
|
||||
inner.segment = Some(e.segment().clone());
|
||||
}
|
||||
|
||||
// We sent sticky events together with the next buffer once it becomes
|
||||
|
@ -307,7 +307,7 @@ impl PadSrcHandler for InputSelectorPadSrcHandler {
|
|||
ret = pad.peer_query(&mut peer_query);
|
||||
|
||||
if ret {
|
||||
let (live, min, max) = peer_query.get_result();
|
||||
let (live, min, max) = peer_query.result();
|
||||
if live {
|
||||
min_latency = min.max(min_latency).unwrap_or(min_latency);
|
||||
max_latency = max.min(max_latency).unwrap_or(max);
|
||||
|
@ -449,7 +449,7 @@ impl ObjectImpl for InputSelector {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"context" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.context = value
|
||||
|
@ -494,7 +494,7 @@ impl ObjectImpl for InputSelector {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"context" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.context.to_value()
|
||||
|
|
|
@ -81,8 +81,8 @@ struct GapPacket {
|
|||
impl GapPacket {
|
||||
fn new(buffer: gst::Buffer) -> Self {
|
||||
let rtp_buffer = RTPBuffer::from_buffer_readable(&buffer).unwrap();
|
||||
let seq = rtp_buffer.get_seq();
|
||||
let pt = rtp_buffer.get_payload_type();
|
||||
let seq = rtp_buffer.seq();
|
||||
let pt = rtp_buffer.payload_type();
|
||||
drop(rtp_buffer);
|
||||
|
||||
Self { buffer, seq, pt }
|
||||
|
@ -318,14 +318,14 @@ impl SinkHandler {
|
|||
let rtp_buffer =
|
||||
RTPBuffer::from_buffer_readable(&buffer).map_err(|_| gst::FlowError::Error)?;
|
||||
(
|
||||
rtp_buffer.get_seq(),
|
||||
rtp_buffer.get_timestamp(),
|
||||
rtp_buffer.get_payload_type(),
|
||||
rtp_buffer.seq(),
|
||||
rtp_buffer.timestamp(),
|
||||
rtp_buffer.payload_type(),
|
||||
)
|
||||
};
|
||||
|
||||
let mut pts = buffer.get_pts();
|
||||
let mut dts = buffer.get_dts();
|
||||
let mut pts = buffer.pts();
|
||||
let mut dts = buffer.dts();
|
||||
let mut estimated_dts = false;
|
||||
|
||||
gst_log!(
|
||||
|
@ -344,7 +344,7 @@ impl SinkHandler {
|
|||
}
|
||||
|
||||
if dts.is_none() {
|
||||
dts = element.get_current_running_time();
|
||||
dts = element.current_running_time();
|
||||
pts = dts;
|
||||
|
||||
estimated_dts = state.clock_rate.is_some();
|
||||
|
@ -363,7 +363,7 @@ impl SinkHandler {
|
|||
|
||||
gst_debug!(CAT, obj: pad, "New payload type: {}", pt);
|
||||
|
||||
if let Some(caps) = pad.get_current_caps() {
|
||||
if let Some(caps) = pad.current_caps() {
|
||||
/* Ignore errors at this point, as we want to emit request-pt-map */
|
||||
let _ = self.parse_caps(inner, &mut state, element, &caps, pt);
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ impl SinkHandler {
|
|||
dts,
|
||||
estimated_dts,
|
||||
rtptime,
|
||||
element.get_base_time(),
|
||||
element.base_time(),
|
||||
0,
|
||||
false,
|
||||
);
|
||||
|
@ -626,11 +626,7 @@ impl PadSinkHandler for SinkHandler {
|
|||
match event.view() {
|
||||
EventView::Segment(e) => {
|
||||
let mut state = jb.state.lock().unwrap();
|
||||
state.segment = e
|
||||
.get_segment()
|
||||
.clone()
|
||||
.downcast::<gst::format::Time>()
|
||||
.unwrap();
|
||||
state.segment = e.segment().clone().downcast::<gst::format::Time>().unwrap();
|
||||
}
|
||||
EventView::FlushStop(..) => {
|
||||
if let Err(err) = jb.task.flush_stop() {
|
||||
|
@ -797,9 +793,9 @@ impl SrcHandler {
|
|||
Some(item) => item,
|
||||
};
|
||||
|
||||
let dts = jb_item.get_dts();
|
||||
let pts = jb_item.get_pts();
|
||||
let seq = jb_item.get_seqnum();
|
||||
let dts = jb_item.dts();
|
||||
let pts = jb_item.pts();
|
||||
let seq = jb_item.seqnum();
|
||||
let mut buffer = jb_item.into_buffer();
|
||||
|
||||
let lost_events = {
|
||||
|
@ -808,7 +804,7 @@ impl SrcHandler {
|
|||
buffer.set_dts(state.segment.to_running_time(dts));
|
||||
buffer.set_pts(state.segment.to_running_time(pts));
|
||||
|
||||
if state.last_popped_pts.is_some() && buffer.get_pts() < state.last_popped_pts {
|
||||
if state.last_popped_pts.is_some() && buffer.pts() < state.last_popped_pts {
|
||||
buffer.set_pts(state.last_popped_pts)
|
||||
}
|
||||
|
||||
|
@ -830,7 +826,7 @@ impl SrcHandler {
|
|||
lost_events
|
||||
};
|
||||
|
||||
state.last_popped_pts = buffer.get_pts();
|
||||
state.last_popped_pts = buffer.pts();
|
||||
if let Some(pts) = state.last_popped_pts.nseconds() {
|
||||
state.position = pts.into();
|
||||
}
|
||||
|
@ -858,7 +854,7 @@ impl SrcHandler {
|
|||
latency: gst::ClockTime,
|
||||
context_wait: gst::ClockTime,
|
||||
) -> (gst::ClockTime, Option<(gst::ClockTime, Duration)>) {
|
||||
let now = element.get_current_running_time();
|
||||
let now = element.current_running_time();
|
||||
|
||||
gst_debug!(
|
||||
CAT,
|
||||
|
@ -965,7 +961,7 @@ impl PadSrcHandler for SrcHandler {
|
|||
|
||||
if ret {
|
||||
let settings = jb.settings.lock().unwrap();
|
||||
let (_, mut min_latency, _) = peer_query.get_result();
|
||||
let (_, mut min_latency, _) = peer_query.result();
|
||||
min_latency += (settings.latency_ms as u64) * gst::SECOND;
|
||||
let max_latency = gst::CLOCK_TIME_NONE;
|
||||
|
||||
|
@ -975,7 +971,7 @@ impl PadSrcHandler for SrcHandler {
|
|||
ret
|
||||
}
|
||||
QueryView::Position(ref mut q) => {
|
||||
if q.get_format() != gst::Format::Time {
|
||||
if q.format() != gst::Format::Time {
|
||||
jb.sink_pad.gst_pad().peer_query(query)
|
||||
} else {
|
||||
let state = jb.state.lock().unwrap();
|
||||
|
@ -1459,7 +1455,7 @@ impl ObjectImpl for JitterBuffer {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"latency" => {
|
||||
let latency_ms = {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
|
@ -1500,7 +1496,7 @@ impl ObjectImpl for JitterBuffer {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"latency" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.latency_ms.to_value()
|
||||
|
|
|
@ -112,7 +112,7 @@ impl RTPJitterBufferItem {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_dts(&self) -> gst::ClockTime {
|
||||
pub fn dts(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
let item = self.0.as_ref().expect("Invalid wrapper");
|
||||
if item.as_ref().dts == gst::ffi::GST_CLOCK_TIME_NONE {
|
||||
|
@ -123,7 +123,7 @@ impl RTPJitterBufferItem {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_pts(&self) -> gst::ClockTime {
|
||||
pub fn pts(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
let item = self.0.as_ref().expect("Invalid wrapper");
|
||||
if item.as_ref().pts == gst::ffi::GST_CLOCK_TIME_NONE {
|
||||
|
@ -134,7 +134,7 @@ impl RTPJitterBufferItem {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_seqnum(&self) -> Option<u16> {
|
||||
pub fn seqnum(&self) -> Option<u16> {
|
||||
unsafe {
|
||||
let item = self.0.as_ref().expect("Invalid wrapper");
|
||||
if item.as_ref().seqnum == std::u32::MAX {
|
||||
|
@ -146,7 +146,7 @@ impl RTPJitterBufferItem {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_rtptime(&self) -> u32 {
|
||||
pub fn rtptime(&self) -> u32 {
|
||||
unsafe {
|
||||
let item = self.0.as_ref().expect("Invalid wrapper");
|
||||
item.as_ref().rtptime
|
||||
|
@ -223,7 +223,7 @@ impl RTPJitterBuffer {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_mode(&self) -> RTPJitterBufferMode {
|
||||
pub fn mode(&self) -> RTPJitterBufferMode {
|
||||
unsafe { from_glib(ffi::rtp_jitter_buffer_get_mode(self.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ impl RTPJitterBuffer {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_delay(&self) -> gst::ClockTime {
|
||||
pub fn delay(&self) -> gst::ClockTime {
|
||||
unsafe { from_glib(ffi::rtp_jitter_buffer_get_delay(self.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ impl RTPJitterBuffer {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_clock_rate(&self) -> u32 {
|
||||
pub fn clock_rate(&self) -> u32 {
|
||||
unsafe { ffi::rtp_jitter_buffer_get_clock_rate(self.to_glib_none().0) }
|
||||
}
|
||||
|
||||
|
|
|
@ -456,9 +456,7 @@ impl ProxySink {
|
|||
let pending_queue = shared_ctx.pending_queue.as_mut().unwrap();
|
||||
|
||||
let schedule_now = match item {
|
||||
DataQueueItem::Event(ref ev) if ev.get_type() != gst::EventType::Eos => {
|
||||
false
|
||||
}
|
||||
DataQueueItem::Event(ref ev) if ev.type_() != gst::EventType::Eos => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
|
@ -612,7 +610,7 @@ impl ObjectImpl for ProxySink {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"proxy-context" => {
|
||||
settings.proxy_context = value
|
||||
.get()
|
||||
|
@ -625,7 +623,7 @@ impl ObjectImpl for ProxySink {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"proxy-context" => settings.proxy_context.to_value(),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
|
@ -823,12 +821,12 @@ impl PadSrcHandler for ProxySrcPadHandler {
|
|||
true
|
||||
}
|
||||
QueryView::Caps(ref mut q) => {
|
||||
let caps = if let Some(ref caps) = pad.gst_pad().get_current_caps() {
|
||||
q.get_filter()
|
||||
let caps = if let Some(ref caps) = pad.gst_pad().current_caps() {
|
||||
q.filter()
|
||||
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
|
||||
.unwrap_or_else(|| caps.clone())
|
||||
} else {
|
||||
q.get_filter()
|
||||
q.filter()
|
||||
.map(|f| f.to_owned())
|
||||
.unwrap_or_else(gst::Caps::new_any)
|
||||
};
|
||||
|
@ -1196,7 +1194,7 @@ impl ObjectImpl for ProxySrc {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"max-size-buffers" => {
|
||||
settings.max_size_buffers = value.get_some().expect("type checked upstream");
|
||||
}
|
||||
|
@ -1227,7 +1225,7 @@ impl ObjectImpl for ProxySrc {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"max-size-buffers" => settings.max_size_buffers.to_value(),
|
||||
"max-size-bytes" => settings.max_size_bytes.to_value(),
|
||||
"max-size-time" => settings.max_size_time.to_value(),
|
||||
|
|
|
@ -300,17 +300,17 @@ impl PadSrcHandler for QueuePadSrcHandler {
|
|||
|
||||
gst_log!(CAT, obj: pad.gst_pad(), "Upstream returned {:?}", new_query);
|
||||
|
||||
let (flags, min, max, align) = new_query.get_result();
|
||||
let (flags, min, max, align) = new_query.result();
|
||||
q.set(flags, min, max, align);
|
||||
q.add_scheduling_modes(
|
||||
&new_query
|
||||
.get_scheduling_modes()
|
||||
.scheduling_modes()
|
||||
.iter()
|
||||
.cloned()
|
||||
.filter(|m| m != &gst::PadMode::Pull)
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
gst_log!(CAT, obj: pad.gst_pad(), "Returning {:?}", q.get_mut_query());
|
||||
gst_log!(CAT, obj: pad.gst_pad(), "Returning {:?}", q.query_mut());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -573,9 +573,7 @@ impl Queue {
|
|||
}
|
||||
|
||||
let schedule_now = match item {
|
||||
DataQueueItem::Event(ref ev) if ev.get_type() != gst::EventType::Eos => {
|
||||
false
|
||||
}
|
||||
DataQueueItem::Event(ref ev) if ev.type_() != gst::EventType::Eos => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
|
@ -777,7 +775,7 @@ impl ObjectImpl for Queue {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"max-size-buffers" => {
|
||||
settings.max_size_buffers = value.get_some().expect("type checked upstream");
|
||||
}
|
||||
|
@ -802,7 +800,7 @@ impl ObjectImpl for Queue {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"max-size-buffers" => settings.max_size_buffers.to_value(),
|
||||
"max-size-bytes" => settings.max_size_bytes.to_value(),
|
||||
"max-size-time" => settings.max_size_time.to_value(),
|
||||
|
|
|
@ -131,7 +131,7 @@ pub trait PadSrcHandler: Clone + Send + Sync + 'static {
|
|||
RUNTIME_CAT,
|
||||
obj: gst_pad,
|
||||
"Already activated in {:?} mode ",
|
||||
gst_pad.get_mode()
|
||||
gst_pad.mode()
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ pub trait PadSrcHandler: Clone + Send + Sync + 'static {
|
|||
) -> Result<FlowSuccess, FlowError> {
|
||||
// default is to dispatch to `src_event`
|
||||
// (as implemented in `gst_pad_send_event_unchecked`)
|
||||
let event_type = event.get_type();
|
||||
let event_type = event.type_();
|
||||
event_to_event_full(self.src_event(pad, imp, element, event), event_type)
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ pub struct PadSrcInner {
|
|||
|
||||
impl PadSrcInner {
|
||||
fn new(gst_pad: gst::Pad) -> Self {
|
||||
if gst_pad.get_direction() != gst::PadDirection::Src {
|
||||
if gst_pad.direction() != gst::PadDirection::Src {
|
||||
panic!("Wrong pad direction for PadSrc");
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static {
|
|||
RUNTIME_CAT,
|
||||
obj: gst_pad,
|
||||
"Already activated in {:?} mode ",
|
||||
gst_pad.get_mode()
|
||||
gst_pad.mode()
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static {
|
|||
assert!(!event.is_serialized());
|
||||
// default is to dispatch to `sink_event`
|
||||
// (as implemented in `gst_pad_send_event_unchecked`)
|
||||
let event_type = event.get_type();
|
||||
let event_type = event.type_();
|
||||
event_to_event_full(self.sink_event(pad, imp, element, event), event_type)
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static {
|
|||
assert!(event.is_serialized());
|
||||
// default is to dispatch to `sink_event`
|
||||
// (as implemented in `gst_pad_send_event_unchecked`)
|
||||
let event_type = event.get_type();
|
||||
let event_type = event.type_();
|
||||
event_to_event_full_serialized(
|
||||
self.sink_event_serialized(pad, imp, element, event),
|
||||
event_type,
|
||||
|
@ -680,7 +680,7 @@ pub struct PadSinkInner {
|
|||
|
||||
impl PadSinkInner {
|
||||
fn new(gst_pad: gst::Pad) -> Self {
|
||||
if gst_pad.get_direction() != gst::PadDirection::Sink {
|
||||
if gst_pad.direction() != gst::PadDirection::Sink {
|
||||
panic!("Wrong pad direction for PadSink");
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ impl<T: SocketRead> Socket<T> {
|
|||
{
|
||||
Ok((len, saddr)) => {
|
||||
let dts = if T::DO_TIMESTAMP {
|
||||
let time = self.clock.as_ref().unwrap().get_time();
|
||||
let time = self.clock.as_ref().unwrap().time();
|
||||
let running_time = time - self.base_time.unwrap();
|
||||
gst_debug!(
|
||||
SOCKET_CAT,
|
||||
|
@ -160,7 +160,7 @@ impl<T: SocketRead> Socket<T> {
|
|||
let mut buffer = self.mapped_buffer.take().unwrap().into_buffer();
|
||||
{
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
if len < buffer.get_size() {
|
||||
if len < buffer.size() {
|
||||
buffer.set_size(len);
|
||||
}
|
||||
buffer.set_dts(dts);
|
||||
|
@ -226,7 +226,7 @@ impl GioSocketWrapper {
|
|||
|
||||
socket.set_option(IPPROTO_IP, IP_TOS, tos)?;
|
||||
|
||||
if socket.get_family() == gio::SocketFamily::Ipv6 {
|
||||
if socket.family() == gio::SocketFamily::Ipv6 {
|
||||
socket.set_option(IPPROTO_IPV6, IPV6_TCLASS, tos)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ impl TcpClientSrcPadHandler {
|
|||
|
||||
self.push_prelude(pad, element).await;
|
||||
|
||||
if buffer.get_size() == 0 {
|
||||
if buffer.size() == 0 {
|
||||
pad.push_event(gst::event::Eos::new()).await;
|
||||
return Ok(gst::FlowSuccess::Ok);
|
||||
}
|
||||
|
@ -236,11 +236,11 @@ impl PadSrcHandler for TcpClientSrcPadHandler {
|
|||
}
|
||||
QueryView::Caps(ref mut q) => {
|
||||
let caps = if let Some(caps) = self.0.configured_caps.lock().unwrap().as_ref() {
|
||||
q.get_filter()
|
||||
q.filter()
|
||||
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
|
||||
.unwrap_or_else(|| caps.clone())
|
||||
} else {
|
||||
q.get_filter()
|
||||
q.filter()
|
||||
.map(|f| f.to_owned())
|
||||
.unwrap_or_else(gst::Caps::new_any)
|
||||
};
|
||||
|
@ -480,7 +480,7 @@ impl TcpClientSrc {
|
|||
let port = settings.port;
|
||||
|
||||
let buffer_pool = gst::BufferPool::new();
|
||||
let mut config = buffer_pool.get_config();
|
||||
let mut config = buffer_pool.config();
|
||||
config.set_params(None, settings.blocksize, 0, 0);
|
||||
buffer_pool.set_config(config).map_err(|_| {
|
||||
gst::error_msg!(
|
||||
|
@ -631,7 +631,7 @@ impl ObjectImpl for TcpClientSrc {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"host" => {
|
||||
settings.host = value.get().expect("type checked upstream");
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ impl ObjectImpl for TcpClientSrc {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"host" => settings.host.to_value(),
|
||||
"port" => settings.port.to_value(),
|
||||
"caps" => settings.caps.to_value(),
|
||||
|
|
|
@ -256,7 +256,7 @@ impl UdpSinkPadHandler {
|
|||
self.0.write().unwrap().add_client(gst_pad, addr);
|
||||
}
|
||||
|
||||
fn get_clients(&self) -> Vec<SocketAddr> {
|
||||
fn clients(&self) -> Vec<SocketAddr> {
|
||||
(*self.0.read().unwrap().clients).clone()
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ impl UdpSinkPadHandler {
|
|||
|
||||
if let Some(segment) = &inner.segment {
|
||||
if let Some(segment) = segment.downcast_ref::<gst::format::Time>() {
|
||||
rtime = segment.to_running_time(buffer.get_pts());
|
||||
rtime = segment.to_running_time(buffer.pts());
|
||||
if inner.latency.is_some() {
|
||||
rtime += inner.latency;
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ impl UdpSinkPadHandler {
|
|||
|
||||
/* Wait until specified time */
|
||||
async fn sync(&self, element: &super::UdpSink, running_time: gst::ClockTime) {
|
||||
let now = element.get_current_running_time();
|
||||
let now = element.current_running_time();
|
||||
|
||||
if let Some(delay) = running_time
|
||||
.saturating_sub(now)
|
||||
|
@ -538,10 +538,10 @@ impl UdpSinkPadHandler {
|
|||
let _ = element.post_message(gst::message::Eos::builder().src(element).build());
|
||||
}
|
||||
EventView::Segment(e) => {
|
||||
self.0.write().unwrap().segment = Some(e.get_segment().clone());
|
||||
self.0.write().unwrap().segment = Some(e.segment().clone());
|
||||
}
|
||||
EventView::SinkMessage(e) => {
|
||||
let _ = element.post_message(e.get_message());
|
||||
let _ = element.post_message(e.message());
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
@ -1193,7 +1193,7 @@ impl ObjectImpl for UdpSink {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"sync" => {
|
||||
settings.sync = value.get_some().expect("type checked upstream");
|
||||
}
|
||||
|
@ -1288,7 +1288,7 @@ impl ObjectImpl for UdpSink {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"sync" => settings.sync.to_value(),
|
||||
"bind-address" => settings.bind_address.to_value(),
|
||||
"bind-port" => settings.bind_port.to_value(),
|
||||
|
@ -1324,7 +1324,7 @@ impl ObjectImpl for UdpSink {
|
|||
|
||||
let clients: Vec<String> = self
|
||||
.sink_pad_handler
|
||||
.get_clients()
|
||||
.clients()
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect();
|
||||
|
@ -1410,7 +1410,7 @@ impl ElementImpl for UdpSink {
|
|||
fn send_event(&self, _element: &Self::Type, event: gst::Event) -> bool {
|
||||
match event.view() {
|
||||
EventView::Latency(ev) => {
|
||||
self.sink_pad_handler.set_latency(ev.get_latency());
|
||||
self.sink_pad_handler.set_latency(ev.latency());
|
||||
self.sink_pad.gst_pad().push_event(event)
|
||||
}
|
||||
EventView::Step(..) => false,
|
||||
|
|
|
@ -249,11 +249,11 @@ impl PadSrcHandler for UdpSrcPadHandler {
|
|||
}
|
||||
QueryView::Caps(ref mut q) => {
|
||||
let caps = if let Some(caps) = self.0.configured_caps.lock().unwrap().as_ref() {
|
||||
q.get_filter()
|
||||
q.filter()
|
||||
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
|
||||
.unwrap_or_else(|| caps.clone())
|
||||
} else {
|
||||
q.get_filter()
|
||||
q.filter()
|
||||
.map(|f| f.to_owned())
|
||||
.unwrap_or_else(gst::Caps::new_any)
|
||||
};
|
||||
|
@ -303,7 +303,7 @@ impl TaskImpl for UdpSrcTask {
|
|||
async move {
|
||||
gst_log!(CAT, obj: &self.element, "Starting task");
|
||||
self.socket
|
||||
.set_clock(self.element.get_clock(), Some(self.element.get_base_time()));
|
||||
.set_clock(self.element.clock(), Some(self.element.base_time()));
|
||||
gst_log!(CAT, obj: &self.element, "Task started");
|
||||
Ok(())
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ impl UdpSrc {
|
|||
};
|
||||
|
||||
let buffer_pool = gst::BufferPool::new();
|
||||
let mut config = buffer_pool.get_config();
|
||||
let mut config = buffer_pool.config();
|
||||
config.set_params(None, settings.mtu, 0, 0);
|
||||
buffer_pool.set_config(config).map_err(|err| {
|
||||
gst::error_msg!(
|
||||
|
@ -806,7 +806,7 @@ impl ObjectImpl for UdpSrc {
|
|||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"address" => {
|
||||
settings.address = value.get().expect("type checked upstream");
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ impl ObjectImpl for UdpSrc {
|
|||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"address" => settings.address.to_value(),
|
||||
"port" => settings.port.to_value(),
|
||||
"reuse" => settings.reuse.to_value(),
|
||||
|
|
|
@ -36,7 +36,7 @@ fn push() {
|
|||
|
||||
let caps = gst::Caps::new_simple("foo/bar", &[]);
|
||||
{
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", &true).unwrap();
|
||||
appsrc.set_property("context", &"appsrc-push").unwrap();
|
||||
|
@ -45,7 +45,7 @@ fn push() {
|
|||
h.play();
|
||||
|
||||
{
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
for _ in 0..3 {
|
||||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
|
||||
|
@ -78,7 +78,7 @@ fn push() {
|
|||
}
|
||||
EventView::Caps(ev) => {
|
||||
assert_eq!(n_events, 1);
|
||||
let event_caps = ev.get_caps();
|
||||
let event_caps = ev.caps();
|
||||
assert_eq!(caps.as_ref(), event_caps);
|
||||
}
|
||||
EventView::Segment(..) => {
|
||||
|
@ -102,7 +102,7 @@ fn pause_regular() {
|
|||
|
||||
let caps = gst::Caps::new_simple("foo/bar", &[]);
|
||||
{
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", &true).unwrap();
|
||||
appsrc.set_property("context", &"appsrc-pause").unwrap();
|
||||
|
@ -110,7 +110,7 @@ fn pause_regular() {
|
|||
|
||||
h.play();
|
||||
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
|
||||
// Initial buffer
|
||||
assert!(appsrc
|
||||
|
@ -172,7 +172,7 @@ fn flush_regular() {
|
|||
|
||||
let caps = gst::Caps::new_simple("foo/bar", &[]);
|
||||
{
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", &true).unwrap();
|
||||
appsrc.set_property("context", &"appsrc-flush").unwrap();
|
||||
|
@ -180,7 +180,7 @@ fn flush_regular() {
|
|||
|
||||
h.play();
|
||||
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
|
||||
// Initial buffer
|
||||
assert!(appsrc
|
||||
|
@ -231,7 +231,7 @@ fn pause_flush() {
|
|||
|
||||
let caps = gst::Caps::new_simple("foo/bar", &[]);
|
||||
{
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", &true).unwrap();
|
||||
appsrc
|
||||
|
@ -241,7 +241,7 @@ fn pause_flush() {
|
|||
|
||||
h.play();
|
||||
|
||||
let appsrc = h.get_element().unwrap();
|
||||
let appsrc = h.element().unwrap();
|
||||
|
||||
// Initial buffer
|
||||
assert!(appsrc
|
||||
|
|
|
@ -42,16 +42,16 @@ fn test_active_pad() {
|
|||
.unwrap()
|
||||
.get::<gst::Pad>()
|
||||
.unwrap();
|
||||
assert_eq!(active_pad, h1.get_srcpad().unwrap().get_peer());
|
||||
assert_eq!(active_pad, h1.srcpad().unwrap().peer());
|
||||
|
||||
is.set_property("active-pad", &h2.get_srcpad().unwrap().get_peer())
|
||||
is.set_property("active-pad", &h2.srcpad().unwrap().peer())
|
||||
.unwrap();
|
||||
let active_pad = is
|
||||
.get_property("active-pad")
|
||||
.unwrap()
|
||||
.get::<gst::Pad>()
|
||||
.unwrap();
|
||||
assert_eq!(active_pad, h2.get_srcpad().unwrap().get_peer());
|
||||
assert_eq!(active_pad, h2.srcpad().unwrap().peer());
|
||||
|
||||
h1.set_src_caps_str("foo/bar");
|
||||
h2.set_src_caps_str("foo/bar");
|
||||
|
@ -71,11 +71,11 @@ fn test_active_pad() {
|
|||
assert_eq!(h1.events_received(), 3);
|
||||
|
||||
let event = h1.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::StreamStart);
|
||||
assert_eq!(event.type_(), gst::EventType::StreamStart);
|
||||
let event = h1.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::Caps);
|
||||
assert_eq!(event.type_(), gst::EventType::Caps);
|
||||
let event = h1.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::Segment);
|
||||
assert_eq!(event.type_(), gst::EventType::Segment);
|
||||
|
||||
/* Push another buffer on the active pad, there should be no new events */
|
||||
let buf = gst::Buffer::new();
|
||||
|
@ -86,17 +86,17 @@ fn test_active_pad() {
|
|||
/* Switch the active pad and push a buffer, we should receive stream-start, segment and caps
|
||||
* again */
|
||||
let buf = gst::Buffer::new();
|
||||
is.set_property("active-pad", &h1.get_srcpad().unwrap().get_peer())
|
||||
is.set_property("active-pad", &h1.srcpad().unwrap().peer())
|
||||
.unwrap();
|
||||
assert_eq!(h1.push(buf), Ok(gst::FlowSuccess::Ok));
|
||||
assert_eq!(h1.buffers_received(), 3);
|
||||
assert_eq!(h1.events_received(), 6);
|
||||
let event = h1.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::StreamStart);
|
||||
assert_eq!(event.type_(), gst::EventType::StreamStart);
|
||||
let event = h1.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::Caps);
|
||||
assert_eq!(event.type_(), gst::EventType::Caps);
|
||||
let event = h1.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::Segment);
|
||||
assert_eq!(event.type_(), gst::EventType::Segment);
|
||||
|
||||
let _ = is.set_state(gst::State::Null);
|
||||
}
|
||||
|
|
|
@ -342,7 +342,7 @@ mod imp_src {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"context" => {
|
||||
let context = value
|
||||
.get()
|
||||
|
@ -672,7 +672,7 @@ mod imp_sink {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"sender" => {
|
||||
let ItemSender { sender } = value
|
||||
.get::<&ItemSender>()
|
||||
|
|
|
@ -131,17 +131,17 @@ fn multiple_contexts_queue() {
|
|||
l_clone.quit();
|
||||
});
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
let l_clone = l.clone();
|
||||
bus.add_watch(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
||||
match msg.view() {
|
||||
MessageView::StateChanged(state_changed) => {
|
||||
if let Some(source) = state_changed.get_src() {
|
||||
if source.get_type() == gst::Pipeline::static_type()
|
||||
&& state_changed.get_old() == gst::State::Paused
|
||||
&& state_changed.get_current() == gst::State::Playing
|
||||
if let Some(source) = state_changed.src() {
|
||||
if source.type_() == gst::Pipeline::static_type()
|
||||
&& state_changed.old() == gst::State::Paused
|
||||
&& state_changed.current() == gst::State::Playing
|
||||
{
|
||||
if let Some(test_scenario) = test_scenario.take() {
|
||||
std::thread::spawn(test_scenario);
|
||||
|
@ -153,9 +153,9 @@ fn multiple_contexts_queue() {
|
|||
gst_error!(
|
||||
CAT,
|
||||
"multiple_contexts_queue: Error from {:?}: {} ({:?})",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
l_clone.quit();
|
||||
}
|
||||
|
@ -290,17 +290,17 @@ fn multiple_contexts_proxy() {
|
|||
l_clone.quit();
|
||||
});
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
let l_clone = l.clone();
|
||||
bus.add_watch(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
||||
match msg.view() {
|
||||
MessageView::StateChanged(state_changed) => {
|
||||
if let Some(source) = state_changed.get_src() {
|
||||
if source.get_type() == gst::Pipeline::static_type()
|
||||
&& state_changed.get_old() == gst::State::Paused
|
||||
&& state_changed.get_current() == gst::State::Playing
|
||||
if let Some(source) = state_changed.src() {
|
||||
if source.type_() == gst::Pipeline::static_type()
|
||||
&& state_changed.old() == gst::State::Paused
|
||||
&& state_changed.current() == gst::State::Playing
|
||||
{
|
||||
if let Some(test_scenario) = test_scenario.take() {
|
||||
std::thread::spawn(test_scenario);
|
||||
|
@ -312,9 +312,9 @@ fn multiple_contexts_proxy() {
|
|||
gst_error!(
|
||||
CAT,
|
||||
"multiple_contexts_proxy: Error from {:?}: {} ({:?})",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
l_clone.quit();
|
||||
}
|
||||
|
@ -422,19 +422,19 @@ fn eos() {
|
|||
|
||||
let l_clone = l.clone();
|
||||
pipeline
|
||||
.get_bus()
|
||||
.bus()
|
||||
.unwrap()
|
||||
.add_watch(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
||||
match msg.view() {
|
||||
MessageView::StateChanged(state_changed) => {
|
||||
if let Some(source) = state_changed.get_src() {
|
||||
if source.get_type() != gst::Pipeline::static_type() {
|
||||
if let Some(source) = state_changed.src() {
|
||||
if source.type_() != gst::Pipeline::static_type() {
|
||||
return glib::Continue(true);
|
||||
}
|
||||
if state_changed.get_old() == gst::State::Paused
|
||||
&& state_changed.get_current() == gst::State::Playing
|
||||
if state_changed.old() == gst::State::Paused
|
||||
&& state_changed.current() == gst::State::Playing
|
||||
{
|
||||
if let Some(scenario) = scenario.take() {
|
||||
std::thread::spawn(scenario);
|
||||
|
@ -446,9 +446,9 @@ fn eos() {
|
|||
gst_error!(
|
||||
CAT,
|
||||
"eos: Error from {:?}: {} ({:?})",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
l_clone.quit();
|
||||
}
|
||||
|
@ -582,19 +582,19 @@ fn premature_shutdown() {
|
|||
|
||||
let l_clone = l.clone();
|
||||
pipeline
|
||||
.get_bus()
|
||||
.bus()
|
||||
.unwrap()
|
||||
.add_watch(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
||||
match msg.view() {
|
||||
MessageView::StateChanged(state_changed) => {
|
||||
if let Some(source) = state_changed.get_src() {
|
||||
if source.get_type() != gst::Pipeline::static_type() {
|
||||
if let Some(source) = state_changed.src() {
|
||||
if source.type_() != gst::Pipeline::static_type() {
|
||||
return glib::Continue(true);
|
||||
}
|
||||
if state_changed.get_old() == gst::State::Paused
|
||||
&& state_changed.get_current() == gst::State::Playing
|
||||
if state_changed.old() == gst::State::Paused
|
||||
&& state_changed.current() == gst::State::Playing
|
||||
{
|
||||
if let Some(scenario) = scenario.take() {
|
||||
std::thread::spawn(scenario);
|
||||
|
@ -606,9 +606,9 @@ fn premature_shutdown() {
|
|||
gst_error!(
|
||||
CAT,
|
||||
"premature_shutdown: Error from {:?}: {} ({:?})",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
l_clone.quit();
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ fn test_push() {
|
|||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
let mut eos = false;
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
while let Some(msg) = bus.timed_pop(5 * gst::SECOND) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
|
@ -91,7 +91,7 @@ fn test_push() {
|
|||
assert_eq!(samples.len(), 3);
|
||||
|
||||
for sample in samples.iter() {
|
||||
assert!(sample.get_buffer().is_some());
|
||||
assert!(sample.buffer().is_some());
|
||||
}
|
||||
|
||||
pipeline.set_state(gst::State::Null).unwrap();
|
||||
|
@ -121,8 +121,8 @@ fn test_from_pipeline_to_pipeline() {
|
|||
pipe_1.set_state(gst::State::Paused).unwrap();
|
||||
pipe_2.set_state(gst::State::Paused).unwrap();
|
||||
|
||||
let _ = pipe_1.get_state(gst::CLOCK_TIME_NONE);
|
||||
let _ = pipe_2.get_state(gst::CLOCK_TIME_NONE);
|
||||
let _ = pipe_1.state(gst::CLOCK_TIME_NONE);
|
||||
let _ = pipe_2.state(gst::CLOCK_TIME_NONE);
|
||||
|
||||
pipe_1.set_state(gst::State::Null).unwrap();
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ fn test_push() {
|
|||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
let mut eos = false;
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
while let Some(msg) = bus.timed_pop(5 * gst::SECOND) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
|
@ -86,7 +86,7 @@ fn test_push() {
|
|||
assert_eq!(samples.len(), 3);
|
||||
|
||||
for sample in samples.iter() {
|
||||
assert!(sample.get_buffer().is_some());
|
||||
assert!(sample.buffer().is_some());
|
||||
}
|
||||
|
||||
pipeline.set_state(gst::State::Null).unwrap();
|
||||
|
|
|
@ -92,7 +92,7 @@ fn test_push() {
|
|||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
let mut eos = false;
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
while let Some(msg) = bus.timed_pop(5 * gst::SECOND) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
|
@ -108,12 +108,12 @@ fn test_push() {
|
|||
assert!(eos);
|
||||
let samples = samples.lock().unwrap();
|
||||
for sample in samples.iter() {
|
||||
assert_eq!(Some(caps.as_ref()), sample.get_caps());
|
||||
assert_eq!(Some(caps.as_ref()), sample.caps());
|
||||
}
|
||||
|
||||
let total_received_size = samples.iter().fold(0, |acc, sample| {
|
||||
acc + sample.get_buffer().unwrap().get_size()
|
||||
});
|
||||
let total_received_size = samples
|
||||
.iter()
|
||||
.fold(0, |acc, sample| acc + sample.buffer().unwrap().size());
|
||||
assert_eq!(total_received_size, 3 * 160);
|
||||
|
||||
pipeline.set_state(gst::State::Null).unwrap();
|
||||
|
|
|
@ -34,7 +34,7 @@ fn test_client_management() {
|
|||
init();
|
||||
|
||||
let h = gst_check::Harness::new("ts-udpsink");
|
||||
let udpsink = h.get_element().unwrap();
|
||||
let udpsink = h.element().unwrap();
|
||||
|
||||
let clients = udpsink
|
||||
.get_property("clients")
|
||||
|
@ -132,7 +132,7 @@ fn test_chain() {
|
|||
let mut h = gst_check::Harness::new("ts-udpsink");
|
||||
h.set_src_caps_str(&"foo/bar");
|
||||
{
|
||||
let udpsink = h.get_element().unwrap();
|
||||
let udpsink = h.element().unwrap();
|
||||
udpsink.set_property("clients", &"127.0.0.1:5005").unwrap();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ fn test_push() {
|
|||
|
||||
let caps = gst::Caps::new_simple("foo/bar", &[]);
|
||||
{
|
||||
let udpsrc = h.get_element().unwrap();
|
||||
let udpsrc = h.element().unwrap();
|
||||
udpsrc.set_property("caps", &caps).unwrap();
|
||||
udpsrc.set_property("port", &5000i32).unwrap();
|
||||
udpsrc.set_property("context", &"test-push").unwrap();
|
||||
|
@ -66,7 +66,7 @@ fn test_push() {
|
|||
|
||||
for _ in 0..3 {
|
||||
let buffer = h.pull().unwrap();
|
||||
assert_eq!(buffer.get_size(), 160);
|
||||
assert_eq!(buffer.size(), 160);
|
||||
}
|
||||
|
||||
let mut n_events = 0;
|
||||
|
@ -80,7 +80,7 @@ fn test_push() {
|
|||
}
|
||||
EventView::Caps(ev) => {
|
||||
assert_eq!(n_events, 1);
|
||||
let event_caps = ev.get_caps();
|
||||
let event_caps = ev.caps();
|
||||
assert_eq!(caps.as_ref(), event_caps);
|
||||
}
|
||||
EventView::Segment(..) => {
|
||||
|
@ -104,7 +104,7 @@ fn test_socket_reuse() {
|
|||
let mut ts_src_h2 = gst_check::Harness::new("ts-udpsrc");
|
||||
|
||||
{
|
||||
let udpsrc = ts_src_h.get_element().unwrap();
|
||||
let udpsrc = ts_src_h.element().unwrap();
|
||||
udpsrc.set_property("port", &6000i32).unwrap();
|
||||
udpsrc
|
||||
.set_property("context", &"test-socket-reuse")
|
||||
|
@ -113,14 +113,14 @@ fn test_socket_reuse() {
|
|||
ts_src_h.play();
|
||||
|
||||
{
|
||||
let udpsrc = ts_src_h.get_element().unwrap();
|
||||
let udpsrc = ts_src_h.element().unwrap();
|
||||
let socket = udpsrc
|
||||
.get_property("used-socket")
|
||||
.unwrap()
|
||||
.get::<gio::Socket>()
|
||||
.unwrap();
|
||||
|
||||
let udpsink = sink_h.get_element().unwrap();
|
||||
let udpsink = sink_h.element().unwrap();
|
||||
udpsink.set_property("socket", &socket).unwrap();
|
||||
udpsink.set_property("host", &"127.0.0.1").unwrap();
|
||||
udpsink.set_property("port", &6001i32).unwrap();
|
||||
|
@ -129,7 +129,7 @@ fn test_socket_reuse() {
|
|||
sink_h.set_src_caps_str("application/test");
|
||||
|
||||
{
|
||||
let udpsrc = ts_src_h2.get_element().unwrap();
|
||||
let udpsrc = ts_src_h2.element().unwrap();
|
||||
udpsrc.set_property("port", &6001i32).unwrap();
|
||||
udpsrc
|
||||
.set_property("context", &"test-socket-reuse")
|
||||
|
@ -161,6 +161,6 @@ fn test_socket_reuse() {
|
|||
sink_h.push(buffer).unwrap();
|
||||
let buffer = ts_src_h2.pull().unwrap();
|
||||
|
||||
assert_eq!(buffer.get_size(), 160);
|
||||
assert_eq!(buffer.size(), 160);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ impl ReqwestHttpSrc {
|
|||
let srcpad = src.get_static_pad("src").unwrap();
|
||||
let mut q = gst::query::Context::new(REQWEST_CLIENT_CONTEXT);
|
||||
if srcpad.peer_query(&mut q) {
|
||||
if let Some(context) = q.get_context_owned() {
|
||||
if let Some(context) = q.context_owned() {
|
||||
src.set_context(&context);
|
||||
}
|
||||
} else {
|
||||
|
@ -224,7 +224,7 @@ impl ReqwestHttpSrc {
|
|||
let mut context = gst::Context::new(REQWEST_CLIENT_CONTEXT, true);
|
||||
{
|
||||
let context = context.get_mut().unwrap();
|
||||
let s = context.get_mut_structure();
|
||||
let s = context.structure_mut();
|
||||
s.set("client", &client);
|
||||
}
|
||||
src.set_context(&context);
|
||||
|
@ -671,7 +671,7 @@ impl ObjectImpl for ReqwestHttpSrc {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"location" => {
|
||||
let location = value.get::<&str>().expect("type checked upstream");
|
||||
if let Err(err) = self.set_location(obj, location) {
|
||||
|
@ -740,7 +740,7 @@ impl ObjectImpl for ReqwestHttpSrc {
|
|||
}
|
||||
|
||||
fn get_property(&self, obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"location" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
let location = settings.location.as_ref().map(Url::to_string);
|
||||
|
@ -827,9 +827,9 @@ impl ElementImpl for ReqwestHttpSrc {
|
|||
}
|
||||
|
||||
fn set_context(&self, element: &Self::Type, context: &gst::Context) {
|
||||
if context.get_context_type() == REQWEST_CLIENT_CONTEXT {
|
||||
if context.context_type() == REQWEST_CLIENT_CONTEXT {
|
||||
let mut external_client = self.external_client.lock().unwrap();
|
||||
let s = context.get_structure();
|
||||
let s = context.structure();
|
||||
*external_client = s
|
||||
.get_some::<&ClientContext>("client")
|
||||
.map(|c| Some(c.clone()))
|
||||
|
@ -946,8 +946,8 @@ impl BaseSrcImpl for ReqwestHttpSrc {
|
|||
}
|
||||
};
|
||||
|
||||
let start = segment.get_start().expect("No start position given");
|
||||
let stop = segment.get_stop();
|
||||
let start = segment.start().expect("No start position given");
|
||||
let stop = segment.stop();
|
||||
|
||||
gst_debug!(CAT, obj: src, "Seeking to {}-{:?}", start, stop);
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ impl Harness {
|
|||
|
||||
match msg.view() {
|
||||
MessageView::Error(err) => {
|
||||
return err.get_error();
|
||||
return err.error();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
@ -205,13 +205,13 @@ impl Harness {
|
|||
|
||||
match msg.view() {
|
||||
MessageView::StateChanged(state) => {
|
||||
return state.get_current();
|
||||
return state.current();
|
||||
}
|
||||
MessageView::Error(err) => {
|
||||
panic!(
|
||||
"Got error: {} ({})",
|
||||
err.get_error(),
|
||||
err.get_debug().unwrap_or_else(|| String::from("None"))
|
||||
err.error(),
|
||||
err.debug().unwrap_or_else(|| String::from("None"))
|
||||
);
|
||||
}
|
||||
_ => (),
|
||||
|
@ -239,7 +239,7 @@ impl Harness {
|
|||
match ev.view() {
|
||||
EventView::Segment(seg) => {
|
||||
return seg
|
||||
.get_segment()
|
||||
.segment()
|
||||
.clone()
|
||||
.downcast::<gst::format::Bytes>()
|
||||
.unwrap();
|
||||
|
@ -254,8 +254,8 @@ impl Harness {
|
|||
MessageView::Error(err) => {
|
||||
panic!(
|
||||
"Got error: {} ({})",
|
||||
err.get_error(),
|
||||
err.get_debug().unwrap_or_else(|| String::from("None"))
|
||||
err.error(),
|
||||
err.debug().unwrap_or_else(|| String::from("None"))
|
||||
);
|
||||
}
|
||||
_ => (),
|
||||
|
@ -294,8 +294,8 @@ impl Harness {
|
|||
MessageView::Error(err) => {
|
||||
panic!(
|
||||
"Got error: {} ({})",
|
||||
err.get_error(),
|
||||
err.get_debug().unwrap_or_else(|| String::from("None"))
|
||||
err.error(),
|
||||
err.debug().unwrap_or_else(|| String::from("None"))
|
||||
);
|
||||
}
|
||||
_ => (),
|
||||
|
@ -316,7 +316,7 @@ impl Drop for Harness {
|
|||
fn drop(&mut self) {
|
||||
// Shut down everything that was set up for this test harness
|
||||
// and wait until the tokio runtime exited
|
||||
let bus = self.src.get_bus().unwrap();
|
||||
let bus = self.src.bus().unwrap();
|
||||
bus.set_flushing(true);
|
||||
|
||||
// Drop the receiver first before setting the state so that
|
||||
|
@ -376,8 +376,8 @@ fn test_basic_request() {
|
|||
// Map the buffer readable and check if it contains exactly the data we would expect at
|
||||
// this point after reading everything else we read in previous runs
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
|
||||
|
@ -434,8 +434,8 @@ fn test_basic_request_inverted_defaults() {
|
|||
// Map the buffer readable and check if it contains exactly the data we would expect at
|
||||
// this point after reading everything else we read in previous runs
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
|
||||
|
@ -512,8 +512,8 @@ fn test_extra_headers() {
|
|||
// Map the buffer readable and check if it contains exactly the data we would expect at
|
||||
// this point after reading everything else we read in previous runs
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
|
||||
|
@ -572,8 +572,8 @@ fn test_cookies_property() {
|
|||
// Map the buffer readable and check if it contains exactly the data we would expect at
|
||||
// this point after reading everything else we read in previous runs
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
|
||||
|
@ -632,8 +632,8 @@ fn test_iradio_mode() {
|
|||
// Map the buffer readable and check if it contains exactly the data we would expect at
|
||||
// this point after reading everything else we read in previous runs
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
|
||||
|
@ -641,7 +641,7 @@ fn test_iradio_mode() {
|
|||
assert_eq!(cursor.position(), 11);
|
||||
|
||||
let srcpad = h.src.get_static_pad("src").unwrap();
|
||||
let caps = srcpad.get_current_caps().unwrap();
|
||||
let caps = srcpad.current_caps().unwrap();
|
||||
assert_eq!(
|
||||
caps,
|
||||
gst::Caps::builder("application/x-icy")
|
||||
|
@ -654,7 +654,7 @@ fn test_iradio_mode() {
|
|||
use gst::EventView;
|
||||
let tag_event = srcpad.get_sticky_event(gst::EventType::Tag, 0).unwrap();
|
||||
if let EventView::Tag(tags) = tag_event.view() {
|
||||
let tags = tags.get_tag();
|
||||
let tags = tags.tag();
|
||||
assert_eq!(
|
||||
tags.get::<gst::tags::Organization>().unwrap().get(),
|
||||
Some("Name")
|
||||
|
@ -713,8 +713,8 @@ fn test_audio_l16() {
|
|||
// Map the buffer readable and check if it contains exactly the data we would expect at
|
||||
// this point after reading everything else we read in previous runs
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
|
||||
|
@ -722,7 +722,7 @@ fn test_audio_l16() {
|
|||
assert_eq!(cursor.position(), 11);
|
||||
|
||||
let srcpad = h.src.get_static_pad("src").unwrap();
|
||||
let caps = srcpad.get_current_caps().unwrap();
|
||||
let caps = srcpad.current_caps().unwrap();
|
||||
assert_eq!(
|
||||
caps,
|
||||
gst::Caps::builder("audio/x-unaligned-raw")
|
||||
|
@ -787,8 +787,8 @@ fn test_authorization() {
|
|||
// Map the buffer readable and check if it contains exactly the data we would expect at
|
||||
// this point after reading everything else we read in previous runs
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
|
||||
|
@ -936,7 +936,7 @@ fn test_seek_after_ready() {
|
|||
});
|
||||
|
||||
let segment = h.wait_for_segment(false);
|
||||
assert_eq!(segment.get_start(), gst::format::Bytes::from(123));
|
||||
assert_eq!(segment.start(), gst::format::Bytes::from(123));
|
||||
|
||||
let mut expected_output = vec![0; 8192 - 123];
|
||||
for (i, d) in expected_output.iter_mut().enumerate() {
|
||||
|
@ -945,12 +945,12 @@ fn test_seek_after_ready() {
|
|||
let mut cursor = Cursor::new(expected_output);
|
||||
|
||||
while let Some(buffer) = h.wait_buffer_or_eos() {
|
||||
assert_eq!(buffer.get_offset(), 123 + cursor.position());
|
||||
assert_eq!(buffer.offset(), 123 + cursor.position());
|
||||
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
}
|
||||
|
@ -1005,7 +1005,7 @@ fn test_seek_after_buffer_received() {
|
|||
|
||||
//wait for a buffer
|
||||
let buffer = h.wait_buffer_or_eos().unwrap();
|
||||
assert_eq!(buffer.get_offset(), 0);
|
||||
assert_eq!(buffer.offset(), 0);
|
||||
|
||||
//seek to a position after a buffer is Received
|
||||
h.run(|src| {
|
||||
|
@ -1014,7 +1014,7 @@ fn test_seek_after_buffer_received() {
|
|||
});
|
||||
|
||||
let segment = h.wait_for_segment(true);
|
||||
assert_eq!(segment.get_start(), gst::format::Bytes::from(123));
|
||||
assert_eq!(segment.start(), gst::format::Bytes::from(123));
|
||||
|
||||
let mut expected_output = vec![0; 8192 - 123];
|
||||
for (i, d) in expected_output.iter_mut().enumerate() {
|
||||
|
@ -1023,12 +1023,12 @@ fn test_seek_after_buffer_received() {
|
|||
let mut cursor = Cursor::new(expected_output);
|
||||
|
||||
while let Some(buffer) = h.wait_buffer_or_eos() {
|
||||
assert_eq!(buffer.get_offset(), 123 + cursor.position());
|
||||
assert_eq!(buffer.offset(), 123 + cursor.position());
|
||||
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
}
|
||||
|
@ -1083,7 +1083,7 @@ fn test_seek_with_stop_position() {
|
|||
|
||||
//wait for a buffer
|
||||
let buffer = h.wait_buffer_or_eos().unwrap();
|
||||
assert_eq!(buffer.get_offset(), 0);
|
||||
assert_eq!(buffer.offset(), 0);
|
||||
|
||||
//seek to a position after a buffer is Received
|
||||
h.run(|src| {
|
||||
|
@ -1099,8 +1099,8 @@ fn test_seek_with_stop_position() {
|
|||
});
|
||||
|
||||
let segment = h.wait_for_segment(true);
|
||||
assert_eq!(segment.get_start(), gst::format::Bytes::from(123));
|
||||
assert_eq!(segment.get_stop(), gst::format::Bytes::from(131));
|
||||
assert_eq!(segment.start(), gst::format::Bytes::from(123));
|
||||
assert_eq!(segment.stop(), gst::format::Bytes::from(131));
|
||||
|
||||
let mut expected_output = vec![0; 8];
|
||||
for (i, d) in expected_output.iter_mut().enumerate() {
|
||||
|
@ -1109,12 +1109,12 @@ fn test_seek_with_stop_position() {
|
|||
let mut cursor = Cursor::new(expected_output);
|
||||
|
||||
while let Some(buffer) = h.wait_buffer_or_eos() {
|
||||
assert_eq!(buffer.get_offset(), 123 + cursor.position());
|
||||
assert_eq!(buffer.offset(), 123 + cursor.position());
|
||||
|
||||
let map = buffer.map_readable().unwrap();
|
||||
let mut read_buf = vec![0; map.get_size()];
|
||||
let mut read_buf = vec![0; map.size()];
|
||||
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size());
|
||||
assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size());
|
||||
assert_eq!(&*map, &*read_buf);
|
||||
}
|
||||
}
|
||||
|
@ -1146,7 +1146,7 @@ fn test_cookies() {
|
|||
|
||||
let mut num_bytes = 0;
|
||||
while let Some(buffer) = h.wait_buffer_or_eos() {
|
||||
num_bytes += buffer.get_size();
|
||||
num_bytes += buffer.size();
|
||||
}
|
||||
assert_eq!(num_bytes, 11);
|
||||
|
||||
|
@ -1182,7 +1182,7 @@ fn test_cookies() {
|
|||
|
||||
let mut num_bytes = 0;
|
||||
while let Some(buffer) = h2.wait_buffer_or_eos() {
|
||||
num_bytes += buffer.get_size();
|
||||
num_bytes += buffer.size();
|
||||
}
|
||||
assert_eq!(num_bytes, 12);
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ impl Transcriber {
|
|||
let latency: gst::ClockTime = (self.settings.lock().unwrap().latency_ms as u64
|
||||
- (2 * GRANULARITY_MS) as u64)
|
||||
* gst::MSECOND;
|
||||
let now = element.get_current_running_time();
|
||||
let now = element.current_running_time();
|
||||
|
||||
if let Some(alternative) = state.partial_alternative.take() {
|
||||
self.enqueue(element, &mut state, &alternative, true, latency, now);
|
||||
|
@ -221,7 +221,7 @@ impl Transcriber {
|
|||
let send_eos = state.send_eos && state.buffers.is_empty();
|
||||
|
||||
while let Some(buf) = state.buffers.front() {
|
||||
if now - buf.get_pts() > latency {
|
||||
if now - buf.pts() > latency {
|
||||
/* Safe unwrap, we know we have an item */
|
||||
let buf = state.buffers.pop_front().unwrap();
|
||||
items.push(buf);
|
||||
|
@ -233,7 +233,7 @@ impl Transcriber {
|
|||
(
|
||||
latency,
|
||||
now,
|
||||
state.out_segment.get_position(),
|
||||
state.out_segment.position(),
|
||||
send_eos,
|
||||
state.seqnum,
|
||||
)
|
||||
|
@ -249,31 +249,25 @@ impl Transcriber {
|
|||
}
|
||||
|
||||
for mut buf in items.drain(..) {
|
||||
if buf.get_pts() > last_position {
|
||||
let gap_event =
|
||||
gst::event::Gap::builder(last_position, buf.get_pts() - last_position)
|
||||
.seqnum(seqnum)
|
||||
.build();
|
||||
gst_debug!(
|
||||
CAT,
|
||||
"Pushing gap: {} -> {}",
|
||||
last_position,
|
||||
buf.get_pts()
|
||||
);
|
||||
if buf.pts() > last_position {
|
||||
let gap_event = gst::event::Gap::builder(last_position, buf.pts() - last_position)
|
||||
.seqnum(seqnum)
|
||||
.build();
|
||||
gst_debug!(CAT, "Pushing gap: {} -> {}", last_position, buf.pts());
|
||||
if !self.srcpad.push_event(gap_event) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
last_position = buf.get_pts() + buf.get_duration();
|
||||
last_position = buf.pts() + buf.duration();
|
||||
{
|
||||
let buf = buf.get_mut().unwrap();
|
||||
buf.set_pts(buf.get_pts());
|
||||
buf.set_pts(buf.pts());
|
||||
}
|
||||
gst_debug!(
|
||||
CAT,
|
||||
"Pushing buffer: {} -> {}",
|
||||
buf.get_pts(),
|
||||
buf.get_pts() + buf.get_duration()
|
||||
buf.pts(),
|
||||
buf.pts() + buf.duration()
|
||||
);
|
||||
if self.srcpad.push(buf).is_err() {
|
||||
return false;
|
||||
|
@ -341,15 +335,15 @@ impl Transcriber {
|
|||
state.discont = false;
|
||||
}
|
||||
|
||||
if start_time < state.out_segment.get_position() {
|
||||
if start_time < state.out_segment.position() {
|
||||
gst_debug!(
|
||||
CAT,
|
||||
obj: element,
|
||||
"Adjusting item timing({:?} < {:?})",
|
||||
start_time,
|
||||
state.out_segment.get_position()
|
||||
state.out_segment.position()
|
||||
);
|
||||
start_time = state.out_segment.get_position();
|
||||
start_time = state.out_segment.position();
|
||||
if end_time < start_time {
|
||||
end_time = start_time;
|
||||
}
|
||||
|
@ -449,7 +443,7 @@ impl Transcriber {
|
|||
((result.end_time as f64 * 1_000_000_000.0) as u64).into();
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
let position = state.out_segment.get_position();
|
||||
let position = state.out_segment.position();
|
||||
|
||||
if end_time < position {
|
||||
gst_warning!(CAT, obj: element,
|
||||
|
@ -617,7 +611,7 @@ impl Transcriber {
|
|||
let ret = self.sinkpad.peer_query(&mut peer_query);
|
||||
|
||||
if ret {
|
||||
let (_, min, _) = peer_query.get_result();
|
||||
let (_, min, _) = peer_query.result();
|
||||
let our_latency: gst::ClockTime =
|
||||
self.settings.lock().unwrap().latency_ms as u64 * gst::MSECOND;
|
||||
q.set(true, our_latency + min, gst::CLOCK_TIME_NONE);
|
||||
|
@ -625,12 +619,12 @@ impl Transcriber {
|
|||
ret
|
||||
}
|
||||
QueryView::Position(ref mut q) => {
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
let state = self.state.lock().unwrap();
|
||||
q.set(
|
||||
state
|
||||
.out_segment
|
||||
.to_stream_time(state.out_segment.get_position()),
|
||||
.to_stream_time(state.out_segment.position()),
|
||||
);
|
||||
true
|
||||
} else {
|
||||
|
@ -685,15 +679,12 @@ impl Transcriber {
|
|||
}
|
||||
}
|
||||
EventView::Segment(e) => {
|
||||
let segment = match e.get_segment().clone().downcast::<gst::ClockTime>() {
|
||||
let segment = match e.segment().clone().downcast::<gst::ClockTime>() {
|
||||
Err(segment) => {
|
||||
element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
[
|
||||
"Only Time segments supported, got {:?}",
|
||||
segment.get_format(),
|
||||
]
|
||||
["Only Time segments supported, got {:?}", segment.format(),]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -703,13 +694,13 @@ impl Transcriber {
|
|||
let event = {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
||||
state.out_segment.set_time(segment.get_time());
|
||||
state.out_segment.set_time(segment.time());
|
||||
state
|
||||
.out_segment
|
||||
.set_position(gst::ClockTime::from_nseconds(0));
|
||||
|
||||
state.in_segment = segment;
|
||||
state.seqnum = e.get_seqnum();
|
||||
state.seqnum = e.seqnum();
|
||||
gst::event::Segment::builder(&state.out_segment)
|
||||
.seqnum(state.seqnum)
|
||||
.build()
|
||||
|
@ -745,8 +736,8 @@ impl Transcriber {
|
|||
let state = self.state.lock().unwrap();
|
||||
|
||||
if let Some(buffer) = &buffer {
|
||||
let running_time = state.in_segment.to_running_time(buffer.get_pts());
|
||||
let now = element.get_current_running_time();
|
||||
let running_time = state.in_segment.to_running_time(buffer.pts());
|
||||
let now = element.current_running_time();
|
||||
|
||||
if now.is_some() && now < running_time {
|
||||
delay = Some(running_time - now);
|
||||
|
@ -829,7 +820,7 @@ impl Transcriber {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let in_caps = self.sinkpad.get_current_caps().unwrap();
|
||||
let in_caps = self.sinkpad.current_caps().unwrap();
|
||||
let s = in_caps.get_structure(0).unwrap();
|
||||
let sample_rate: i32 = s.get("rate").unwrap().unwrap();
|
||||
|
||||
|
@ -1079,7 +1070,7 @@ impl ObjectImpl for Transcriber {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"language_code" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.language_code = value.get().expect("type checked upstream");
|
||||
|
@ -1101,7 +1092,7 @@ impl ObjectImpl for Transcriber {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"language-code" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.language_code.to_value()
|
||||
|
|
|
@ -397,7 +397,7 @@ impl ObjectImpl for S3Sink {
|
|||
) {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"bucket" => {
|
||||
settings.bucket = value.get::<String>().expect("type checked upstream");
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ impl ObjectImpl for S3Sink {
|
|||
fn get_property(&self, _: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"key" => settings.key.to_value(),
|
||||
"bucket" => settings.bucket.to_value(),
|
||||
"region" => settings.region.name().to_value(),
|
||||
|
|
|
@ -232,7 +232,7 @@ impl ObjectImpl for S3Src {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"uri" => {
|
||||
let _ = self.set_uri(obj, value.get().expect("type checked upstream"));
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ impl ObjectImpl for S3Src {
|
|||
}
|
||||
|
||||
fn get_property(&self, _: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"uri" => {
|
||||
let url = match *self.url.lock().unwrap() {
|
||||
Some(ref url) => url.to_string(),
|
||||
|
|
|
@ -79,8 +79,8 @@ impl JsonGstEnc {
|
|||
element: &super::JsonGstEnc,
|
||||
buffer: gst::Buffer,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let pts = buffer.get_pts();
|
||||
let duration = buffer.get_duration();
|
||||
let pts = buffer.pts();
|
||||
let duration = buffer.duration();
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
||||
|
@ -182,7 +182,7 @@ impl JsonGstEnc {
|
|||
EventView::Caps(e) => {
|
||||
{
|
||||
let mut state = self.state.lock().unwrap();
|
||||
let caps = e.get_caps();
|
||||
let caps = e.caps();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
state.format = match s.get::<String>("format") {
|
||||
Err(_) => None,
|
||||
|
|
|
@ -275,8 +275,8 @@ impl JsonGstParse {
|
|||
|
||||
state.add_buffer_metadata(element, &mut buffer, pts, duration);
|
||||
|
||||
let send_eos = state.segment.get_stop().is_some()
|
||||
&& buffer.get_pts() + buffer.get_duration() >= state.segment.get_stop();
|
||||
let send_eos = state.segment.stop().is_some()
|
||||
&& buffer.pts() + buffer.duration() >= state.segment.stop();
|
||||
|
||||
// Drop our state mutex while we push out buffers or events
|
||||
drop(state);
|
||||
|
@ -343,7 +343,7 @@ impl JsonGstParse {
|
|||
pts: gst::ClockTime,
|
||||
mut state: MutexGuard<State>,
|
||||
) -> MutexGuard<State> {
|
||||
if pts >= state.segment.get_start() {
|
||||
if pts >= state.segment.start() {
|
||||
state.seeking = false;
|
||||
state.discont = true;
|
||||
state.replay_last_line = true;
|
||||
|
@ -446,7 +446,7 @@ impl JsonGstParse {
|
|||
));
|
||||
}
|
||||
|
||||
let size = match q.get_result().try_into().unwrap() {
|
||||
let size = match q.result().try_into().unwrap() {
|
||||
gst::format::Bytes(Some(size)) => size,
|
||||
gst::format::Bytes(None) => {
|
||||
return Err(gst::loggable_error!(
|
||||
|
@ -682,7 +682,7 @@ impl JsonGstParse {
|
|||
_ => {
|
||||
if event.is_sticky()
|
||||
&& !self.srcpad.has_current_caps()
|
||||
&& event.get_type() > gst::EventType::Caps
|
||||
&& event.type_() > gst::EventType::Caps
|
||||
{
|
||||
gst_log!(CAT, obj: pad, "Deferring sticky event until we have caps");
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
@ -729,7 +729,7 @@ impl JsonGstParse {
|
|||
return false;
|
||||
}
|
||||
|
||||
let seek_seqnum = event.get_seqnum();
|
||||
let seek_seqnum = event.seqnum();
|
||||
|
||||
let event = gst::event::FlushStart::builder()
|
||||
.seqnum(seek_seqnum)
|
||||
|
@ -812,7 +812,7 @@ impl JsonGstParse {
|
|||
QueryView::Seeking(mut q) => {
|
||||
let state = self.state.lock().unwrap();
|
||||
|
||||
let fmt = q.get_format();
|
||||
let fmt = q.format();
|
||||
|
||||
if fmt == gst::Format::Time {
|
||||
if let Some(pull) = state.pull.as_ref() {
|
||||
|
@ -831,7 +831,7 @@ impl JsonGstParse {
|
|||
}
|
||||
QueryView::Position(ref mut q) => {
|
||||
// For Time answer ourselfs, otherwise forward
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
let state = self.state.lock().unwrap();
|
||||
q.set(state.last_position);
|
||||
true
|
||||
|
@ -842,7 +842,7 @@ impl JsonGstParse {
|
|||
QueryView::Duration(ref mut q) => {
|
||||
// For Time answer ourselfs, otherwise forward
|
||||
let state = self.state.lock().unwrap();
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
if let Some(pull) = state.pull.as_ref() {
|
||||
if pull.duration.is_some() {
|
||||
q.set(state.pull.as_ref().unwrap().duration);
|
||||
|
|
|
@ -55,8 +55,8 @@ fn test_enc() {
|
|||
);
|
||||
|
||||
let buf = h.pull().expect("Couldn't pull buffer");
|
||||
assert_eq!(buf.get_pts(), 0.into());
|
||||
assert_eq!(buf.get_duration(), 2 * gst::SECOND);
|
||||
assert_eq!(buf.pts(), 0.into());
|
||||
assert_eq!(buf.duration(), 2 * gst::SECOND);
|
||||
let map = buf.map_readable().expect("Couldn't map buffer readable");
|
||||
assert_eq!(
|
||||
std::str::from_utf8(map.as_ref()),
|
||||
|
@ -87,7 +87,7 @@ fn test_parse() {
|
|||
|
||||
match ev.view() {
|
||||
EventView::Caps(ev) => {
|
||||
assert!(ev.get_caps().is_strictly_equal(&gst::Caps::new_simple(
|
||||
assert!(ev.caps().is_strictly_equal(&gst::Caps::new_simple(
|
||||
&"application/x-json",
|
||||
&[(&"format", &"test")]
|
||||
)));
|
||||
|
@ -98,7 +98,7 @@ fn test_parse() {
|
|||
|
||||
let buf = h.pull().expect("Couldn't pull buffer");
|
||||
let map = buf.map_readable().expect("Couldn't map buffer readable");
|
||||
assert_eq!(buf.get_pts(), 0.into());
|
||||
assert_eq!(buf.get_duration(), 2 * gst::SECOND);
|
||||
assert_eq!(buf.pts(), 0.into());
|
||||
assert_eq!(buf.duration(), 2 * gst::SECOND);
|
||||
assert_eq!(std::str::from_utf8(map.as_ref()), Ok("{\"foo\":42}"));
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ impl ObjectImpl for RegEx {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"commands" => {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.commands = vec![];
|
||||
|
@ -202,7 +202,7 @@ impl ObjectImpl for RegEx {
|
|||
continue;
|
||||
}
|
||||
};
|
||||
let operation = s.get_name();
|
||||
let operation = s.name();
|
||||
|
||||
let pattern = match s.get::<String>("pattern") {
|
||||
Ok(Some(pattern)) => pattern,
|
||||
|
@ -249,7 +249,7 @@ impl ObjectImpl for RegEx {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"commands" => {
|
||||
let state = self.state.lock().unwrap();
|
||||
let mut commands = vec![];
|
||||
|
|
|
@ -38,7 +38,7 @@ fn test_replace_all() {
|
|||
let mut h = gst_check::Harness::new("regex");
|
||||
|
||||
{
|
||||
let regex = h.get_element().expect("Could not create regex");
|
||||
let regex = h.element().expect("Could not create regex");
|
||||
|
||||
let command = gst::Structure::new(
|
||||
"replace-all",
|
||||
|
@ -64,8 +64,8 @@ fn test_replace_all() {
|
|||
|
||||
let buf = h.pull().expect("Couldn't pull buffer");
|
||||
|
||||
assert_eq!(buf.get_pts(), 0.into());
|
||||
assert_eq!(buf.get_duration(), 2 * gst::SECOND);
|
||||
assert_eq!(buf.pts(), 0.into());
|
||||
assert_eq!(buf.duration(), 2 * gst::SECOND);
|
||||
|
||||
let map = buf.map_readable().expect("Couldn't map buffer readable");
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ impl TextWrap {
|
|||
self.update_wrapper(element);
|
||||
|
||||
let mut pts: gst::ClockTime = buffer
|
||||
.get_pts()
|
||||
.pts()
|
||||
.ok_or_else(|| {
|
||||
gst_error!(CAT, obj: element, "Need timestamped buffers");
|
||||
gst::FlowError::Error
|
||||
|
@ -155,7 +155,7 @@ impl TextWrap {
|
|||
.into();
|
||||
|
||||
let duration: gst::ClockTime = buffer
|
||||
.get_duration()
|
||||
.duration()
|
||||
.ok_or_else(|| {
|
||||
gst_error!(CAT, obj: element, "Need buffers with duration");
|
||||
gst::FlowError::Error
|
||||
|
@ -181,7 +181,7 @@ impl TextWrap {
|
|||
let mut bufferlist = gst::BufferList::new();
|
||||
let n_lines = std::cmp::max(self.settings.lock().unwrap().lines, 1);
|
||||
|
||||
if state.start_ts.is_some() && state.start_ts + accumulate_time < buffer.get_pts() {
|
||||
if state.start_ts.is_some() && state.start_ts + accumulate_time < buffer.pts() {
|
||||
let mut buf = gst::Buffer::from_mut_slice(
|
||||
mem::replace(&mut state.current_text, String::new()).into_bytes(),
|
||||
);
|
||||
|
@ -200,10 +200,10 @@ impl TextWrap {
|
|||
duration / data.split_whitespace().count() as u64;
|
||||
|
||||
if state.start_ts.is_none() {
|
||||
state.start_ts = buffer.get_pts();
|
||||
state.start_ts = buffer.pts();
|
||||
}
|
||||
|
||||
state.end_ts = buffer.get_pts();
|
||||
state.end_ts = buffer.pts();
|
||||
|
||||
let words = data.split_whitespace();
|
||||
let mut current_text = state.current_text.to_string();
|
||||
|
@ -397,7 +397,7 @@ impl TextWrap {
|
|||
let ret = self.sinkpad.peer_query(&mut peer_query);
|
||||
|
||||
if ret {
|
||||
let (live, min, _) = peer_query.get_result();
|
||||
let (live, min, _) = peer_query.result();
|
||||
let our_latency: gst::ClockTime = self
|
||||
.settings
|
||||
.lock()
|
||||
|
@ -530,7 +530,7 @@ impl ObjectImpl for TextWrap {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"dictionary" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
@ -570,7 +570,7 @@ impl ObjectImpl for TextWrap {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"dictionary" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.dictionary.to_value()
|
||||
|
|
|
@ -38,7 +38,7 @@ fn test_columns() {
|
|||
let mut h = gst_check::Harness::new("textwrap");
|
||||
|
||||
{
|
||||
let wrap = h.get_element().expect("Could not create textwrap");
|
||||
let wrap = h.element().expect("Could not create textwrap");
|
||||
wrap.set_property("columns", &5u32).unwrap();
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ fn test_columns() {
|
|||
|
||||
let buf = h.pull().expect("Couldn't pull buffer");
|
||||
|
||||
assert_eq!(buf.get_pts(), 0.into());
|
||||
assert_eq!(buf.get_duration(), 2 * gst::SECOND);
|
||||
assert_eq!(buf.pts(), 0.into());
|
||||
assert_eq!(buf.duration(), 2 * gst::SECOND);
|
||||
|
||||
let map = buf.map_readable().expect("Couldn't map buffer readable");
|
||||
|
||||
|
@ -76,7 +76,7 @@ fn test_lines() {
|
|||
let mut h = gst_check::Harness::new("textwrap");
|
||||
|
||||
{
|
||||
let wrap = h.get_element().expect("Could not create textwrap");
|
||||
let wrap = h.element().expect("Could not create textwrap");
|
||||
wrap.set_property("columns", &5u32).unwrap();
|
||||
wrap.set_property("lines", &2u32).unwrap();
|
||||
}
|
||||
|
@ -95,8 +95,8 @@ fn test_lines() {
|
|||
|
||||
let buf = h.pull().expect("Couldn't pull buffer");
|
||||
|
||||
assert_eq!(buf.get_pts(), 0.into());
|
||||
assert_eq!(buf.get_duration(), gst::SECOND);
|
||||
assert_eq!(buf.pts(), 0.into());
|
||||
assert_eq!(buf.duration(), gst::SECOND);
|
||||
|
||||
let expected_output = "Split\nthis";
|
||||
|
||||
|
@ -109,8 +109,8 @@ fn test_lines() {
|
|||
|
||||
let buf = h.pull().expect("Couldn't pull buffer");
|
||||
|
||||
assert_eq!(buf.get_pts(), gst::SECOND);
|
||||
assert_eq!(buf.get_duration(), gst::SECOND);
|
||||
assert_eq!(buf.pts(), gst::SECOND);
|
||||
assert_eq!(buf.duration(), gst::SECOND);
|
||||
|
||||
let expected_output = "text\nup";
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ impl ObjectImpl for ProgressBin {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"output" => {
|
||||
let mut output_type = self.output_type.lock().unwrap();
|
||||
let new_output_type = value
|
||||
|
@ -126,7 +126,7 @@ impl ObjectImpl for ProgressBin {
|
|||
// Called whenever a value of a property is read. It can be called
|
||||
// at any time from any thread.
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"output" => {
|
||||
let output_type = self.output_type.lock().unwrap();
|
||||
output_type.to_value()
|
||||
|
@ -223,13 +223,13 @@ impl BinImpl for ProgressBin {
|
|||
// handling of the parent class, i.e. forwarding to the parent
|
||||
// bins and the application.
|
||||
MessageView::Element(ref msg)
|
||||
if msg.get_src().as_ref() == Some(self.progress.upcast_ref())
|
||||
if msg.src().as_ref() == Some(self.progress.upcast_ref())
|
||||
&& msg
|
||||
.get_structure()
|
||||
.map(|s| s.get_name() == "progress")
|
||||
.structure()
|
||||
.map(|s| s.name() == "progress")
|
||||
.unwrap_or(false) =>
|
||||
{
|
||||
let s = msg.get_structure().unwrap();
|
||||
let s = msg.structure().unwrap();
|
||||
if let Ok(percent) = s.get_some::<f64>("percent-double") {
|
||||
let output_type = *self.output_type.lock().unwrap();
|
||||
match output_type {
|
||||
|
|
|
@ -134,7 +134,7 @@ impl ObjectImpl for Rgb2Gray {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"invert" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let invert = value.get_some().expect("type checked upstream");
|
||||
|
@ -166,7 +166,7 @@ impl ObjectImpl for Rgb2Gray {
|
|||
// Called whenever a value of a property is read. It can be called
|
||||
// at any time from any thread.
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"invert" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.invert.to_value()
|
||||
|
|
|
@ -233,7 +233,7 @@ impl ObjectImpl for SineSrc {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"samples-per-buffer" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let samples_per_buffer = value.get_some().expect("type checked upstream");
|
||||
|
@ -304,7 +304,7 @@ impl ObjectImpl for SineSrc {
|
|||
// Called whenever a value of a property is read. It can be called
|
||||
// at any time from any thread.
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"samples-per-buffer" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.samples_per_buffer.to_value()
|
||||
|
@ -544,7 +544,7 @@ impl BaseSrcImpl for SineSrc {
|
|||
// reverse playback is requested. These values will all be used during buffer creation
|
||||
// and for calculating the timestamps, etc.
|
||||
|
||||
if segment.get_rate() < 0.0 {
|
||||
if segment.rate() < 0.0 {
|
||||
gst_error!(CAT, obj: element, "Reverse playback not supported");
|
||||
return false;
|
||||
}
|
||||
|
@ -564,13 +564,13 @@ impl BaseSrcImpl for SineSrc {
|
|||
use std::f64::consts::PI;
|
||||
|
||||
let sample_offset = segment
|
||||
.get_start()
|
||||
.start()
|
||||
.unwrap()
|
||||
.mul_div_floor(rate, gst::SECOND_VAL)
|
||||
.unwrap();
|
||||
|
||||
let sample_stop = segment
|
||||
.get_stop()
|
||||
.stop()
|
||||
.map(|v| v.mul_div_floor(rate, gst::SECOND_VAL).unwrap());
|
||||
|
||||
let accumulator =
|
||||
|
@ -606,8 +606,8 @@ impl BaseSrcImpl for SineSrc {
|
|||
return false;
|
||||
}
|
||||
|
||||
let sample_offset = segment.get_start().unwrap();
|
||||
let sample_stop = segment.get_stop().0;
|
||||
let sample_offset = segment.start().unwrap();
|
||||
let sample_stop = segment.stop().0;
|
||||
|
||||
let accumulator =
|
||||
(sample_offset as f64).rem(2.0 * PI * (settings.freq as f64) / (rate as f64));
|
||||
|
@ -635,7 +635,7 @@ impl BaseSrcImpl for SineSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Can't seek in format {:?}",
|
||||
segment.get_format()
|
||||
segment.format()
|
||||
);
|
||||
|
||||
false
|
||||
|
@ -757,17 +757,14 @@ impl PushSrcImpl for SineSrc {
|
|||
// with its own clock would require various translations between the two clocks.
|
||||
// This is out of scope for the tutorial though.
|
||||
if element.is_live() {
|
||||
let clock = match element.get_clock() {
|
||||
let clock = match element.clock() {
|
||||
None => return Ok(buffer),
|
||||
Some(clock) => clock,
|
||||
};
|
||||
|
||||
let segment = element
|
||||
.get_segment()
|
||||
.downcast::<gst::format::Time>()
|
||||
.unwrap();
|
||||
let base_time = element.get_base_time();
|
||||
let running_time = segment.to_running_time(buffer.get_pts() + buffer.get_duration());
|
||||
let segment = element.segment().downcast::<gst::format::Time>().unwrap();
|
||||
let base_time = element.base_time();
|
||||
let running_time = segment.to_running_time(buffer.pts() + buffer.duration());
|
||||
|
||||
// The last sample's clock time is the base time of the element plus the
|
||||
// running time of the last sample
|
||||
|
@ -794,7 +791,7 @@ impl PushSrcImpl for SineSrc {
|
|||
obj: element,
|
||||
"Waiting until {}, now {}",
|
||||
wait_until,
|
||||
clock.get_time()
|
||||
clock.time()
|
||||
);
|
||||
let (res, jitter) = id.wait();
|
||||
gst_log!(CAT, obj: element, "Waited res {:?} jitter {}", res, jitter);
|
||||
|
|
|
@ -49,12 +49,12 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
|
|||
|
||||
let videoconvert_clone = videoconvert.clone();
|
||||
decodebin.connect_pad_added(move |_, pad| {
|
||||
let caps = pad.get_current_caps().unwrap();
|
||||
let caps = pad.current_caps().unwrap();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
|
||||
let sinkpad = videoconvert_clone.get_static_pad("sink").unwrap();
|
||||
|
||||
if s.get_name() == "video/x-raw" && !sinkpad.is_linked() {
|
||||
if s.name() == "video/x-raw" && !sinkpad.is_linked() {
|
||||
pad.link(&sinkpad).unwrap();
|
||||
}
|
||||
});
|
||||
|
@ -147,7 +147,7 @@ fn create_ui(app: >k::Application) {
|
|||
None => return,
|
||||
};
|
||||
|
||||
let drop = drop_button.get_active();
|
||||
let drop = drop_button.active();
|
||||
if drop {
|
||||
let mut drop_id = drop_id.borrow_mut();
|
||||
if drop_id.is_none() {
|
||||
|
@ -170,7 +170,7 @@ fn create_ui(app: >k::Application) {
|
|||
Inhibit(false)
|
||||
});
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
let app_weak = app.downgrade();
|
||||
bus.add_watch_local(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
@ -185,9 +185,9 @@ fn create_ui(app: >k::Application) {
|
|||
MessageView::Error(err) => {
|
||||
println!(
|
||||
"Error from {:?}: {} ({:?})",
|
||||
msg.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
msg.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
app.quit();
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ use std::mem;
|
|||
use std::ptr;
|
||||
|
||||
pub trait AggregatorExtManual: 'static {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||
|
||||
fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
fn get_property_min_upstream_latency(&self) -> gst::ClockTime;
|
||||
fn property_min_upstream_latency(&self) -> gst::ClockTime;
|
||||
|
||||
fn set_property_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime);
|
||||
|
||||
|
@ -32,7 +32,7 @@ pub trait AggregatorExtManual: 'static {
|
|||
}
|
||||
|
||||
impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||
unsafe {
|
||||
let mut allocator = ptr::null_mut();
|
||||
let mut params = mem::zeroed();
|
||||
|
@ -55,7 +55,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
|||
ret.into_result()
|
||||
}
|
||||
|
||||
fn get_property_min_upstream_latency(&self) -> gst::ClockTime {
|
||||
fn property_min_upstream_latency(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
let mut value = Value::from_type(<gst::ClockTime as StaticType>::static_type());
|
||||
glib::gobject_ffi::g_object_get_property(
|
||||
|
|
|
@ -12,11 +12,11 @@ use glib::object::IsA;
|
|||
use glib::translate::*;
|
||||
|
||||
pub trait AggregatorPadExtManual: 'static {
|
||||
fn get_segment(&self) -> gst::Segment;
|
||||
fn segment(&self) -> gst::Segment;
|
||||
}
|
||||
|
||||
impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {
|
||||
fn get_segment(&self) -> gst::Segment {
|
||||
fn segment(&self) -> gst::Segment {
|
||||
unsafe {
|
||||
let ptr: &ffi::GstAggregatorPad = &*(self.as_ptr() as *const _);
|
||||
let _guard = super::utils::MutexGuard::lock(&ptr.parent.object.lock);
|
||||
|
|
|
@ -245,7 +245,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
(*parent_class)
|
||||
.flush
|
||||
.map(|f| {
|
||||
|
@ -267,7 +267,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Option<gst::Buffer> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
match (*parent_class).clip {
|
||||
None => Some(buffer),
|
||||
Some(ref func) => from_glib_full(func(
|
||||
|
@ -286,7 +286,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.finish_buffer
|
||||
.expect("Missing parent function `finish_buffer`");
|
||||
|
@ -306,7 +306,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> bool {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.sink_event
|
||||
.expect("Missing parent function `sink_event`");
|
||||
|
@ -326,7 +326,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.sink_event_pre_queue
|
||||
.expect("Missing parent function `sink_event_pre_queue`");
|
||||
|
@ -347,7 +347,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> bool {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.sink_query
|
||||
.expect("Missing parent function `sink_query`");
|
||||
|
@ -367,7 +367,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> bool {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.sink_query_pre_queue
|
||||
.expect("Missing parent function `sink_query`");
|
||||
|
@ -382,7 +382,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_src_event(&self, aggregator: &Self::Type, event: gst::Event) -> bool {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.src_event
|
||||
.expect("Missing parent function `src_event`");
|
||||
|
@ -396,7 +396,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_src_query(&self, aggregator: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.src_query
|
||||
.expect("Missing parent function `src_query`");
|
||||
|
@ -415,7 +415,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
match (*parent_class).src_activate {
|
||||
None => Ok(()),
|
||||
Some(f) => gst::result_from_gboolean!(
|
||||
|
@ -438,7 +438,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.aggregate
|
||||
.expect("Missing parent function `aggregate`");
|
||||
|
@ -453,7 +453,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_start(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
(*parent_class)
|
||||
.start
|
||||
.map(|f| {
|
||||
|
@ -477,7 +477,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
(*parent_class)
|
||||
.stop
|
||||
.map(|f| {
|
||||
|
@ -501,7 +501,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
(*parent_class)
|
||||
.get_next_time
|
||||
.map(|f| {
|
||||
|
@ -523,7 +523,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Option<AggregatorPad> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.create_new_pad
|
||||
.expect("Missing parent function `create_new_pad`");
|
||||
|
@ -543,7 +543,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Result<gst::Caps, gst::FlowError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let f = (*parent_class)
|
||||
.update_src_caps
|
||||
.expect("Missing parent function `update_src_caps`");
|
||||
|
@ -561,7 +561,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_fixate_src_caps(&self, aggregator: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
|
||||
let f = (*parent_class)
|
||||
.fixate_src_caps
|
||||
|
@ -580,7 +580,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
(*parent_class)
|
||||
.negotiated_src_caps
|
||||
.map(|f| {
|
||||
|
@ -600,7 +600,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_negotiate(&self, aggregator: &Self::Type) -> bool {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
|
||||
(*parent_class)
|
||||
.negotiate
|
||||
.map(|f| {
|
||||
|
@ -650,7 +650,7 @@ unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
|
|||
ptr: *mut ffi::GstAggregator,
|
||||
) -> gst::ffi::GstFlowReturn {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||
|
@ -665,7 +665,7 @@ unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>(
|
|||
buffer: *mut gst::ffi::GstBuffer,
|
||||
) -> *mut gst::ffi::GstBuffer {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
let ret = gst::panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||
|
@ -684,7 +684,7 @@ unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
|
|||
buffer: *mut gst::ffi::GstBuffer,
|
||||
) -> gst::ffi::GstFlowReturn {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||
|
@ -700,7 +700,7 @@ unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
|
|||
event: *mut gst::ffi::GstEvent,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(wrap, &imp.panicked(), false, {
|
||||
|
@ -719,7 +719,7 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
|
|||
event: *mut gst::ffi::GstEvent,
|
||||
) -> gst::ffi::GstFlowReturn {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||
|
@ -739,7 +739,7 @@ unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
|
|||
query: *mut gst::ffi::GstQuery,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -758,7 +758,7 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
|
|||
query: *mut gst::ffi::GstQuery,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -776,7 +776,7 @@ unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
|
|||
event: *mut gst::ffi::GstEvent,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -790,7 +790,7 @@ unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
|
|||
query: *mut gst::ffi::GstQuery,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -805,7 +805,7 @@ unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
|
|||
active: glib::ffi::gboolean,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -825,7 +825,7 @@ unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
|
|||
timeout: glib::ffi::gboolean,
|
||||
) -> gst::ffi::GstFlowReturn {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||
|
@ -839,7 +839,7 @@ unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
|
|||
ptr: *mut ffi::GstAggregator,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -858,7 +858,7 @@ unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
|
|||
ptr: *mut ffi::GstAggregator,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -877,7 +877,7 @@ unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
|
|||
ptr: *mut ffi::GstAggregator,
|
||||
) -> gst::ffi::GstClockTime {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, {
|
||||
|
@ -893,7 +893,7 @@ unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>(
|
|||
caps: *const gst::ffi::GstCaps,
|
||||
) -> *mut ffi::GstAggregatorPad {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||
|
@ -917,7 +917,7 @@ unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>(
|
|||
res: *mut *mut gst::ffi::GstCaps,
|
||||
) -> gst::ffi::GstFlowReturn {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
*res = ptr::null_mut();
|
||||
|
@ -939,7 +939,7 @@ unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
|
|||
caps: *mut gst::ffi::GstCaps,
|
||||
) -> *mut gst::ffi::GstCaps {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||
|
@ -953,7 +953,7 @@ unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
|
|||
caps: *mut gst::ffi::GstCaps,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
@ -972,7 +972,7 @@ unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>(
|
|||
ptr: *mut ffi::GstAggregator,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
|
|
|
@ -59,7 +59,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorPadClass;
|
||||
(*parent_class)
|
||||
.flush
|
||||
.map(|f| {
|
||||
|
@ -84,7 +84,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
|||
) -> bool {
|
||||
unsafe {
|
||||
let data = T::type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass;
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorPadClass;
|
||||
(*parent_class)
|
||||
.skip_buffer
|
||||
.map(|f| {
|
||||
|
@ -119,7 +119,7 @@ unsafe extern "C" fn aggregator_pad_flush<T: AggregatorPadImpl>(
|
|||
aggregator: *mut ffi::GstAggregator,
|
||||
) -> gst::ffi::GstFlowReturn {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);
|
||||
|
||||
let res: gst::FlowReturn = imp
|
||||
|
@ -134,7 +134,7 @@ unsafe extern "C" fn aggregator_pad_skip_buffer<T: AggregatorPadImpl>(
|
|||
buffer: *mut gst::ffi::GstBuffer,
|
||||
) -> glib::ffi::gboolean {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);
|
||||
|
||||
imp.skip_buffer(
|
||||
|
|
|
@ -83,7 +83,7 @@ impl ObjectImpl for CustomSource {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"source" => {
|
||||
let source = value.get::<gst::Element>().unwrap().unwrap();
|
||||
self.source.set(source.clone()).unwrap();
|
||||
|
@ -178,11 +178,11 @@ impl CustomSource {
|
|||
gst_debug!(CAT, obj: element, "Starting");
|
||||
let source = self.source.get().unwrap();
|
||||
|
||||
let templates = source.get_pad_template_list();
|
||||
let templates = source.pad_template_list();
|
||||
|
||||
if templates
|
||||
.iter()
|
||||
.any(|templ| templ.get_property_presence() == gst::PadPresence::Request)
|
||||
.any(|templ| templ.property_presence() == gst::PadPresence::Request)
|
||||
{
|
||||
gst_error!(CAT, obj: element, "Request pads not supported");
|
||||
gst::element_error!(
|
||||
|
@ -195,10 +195,10 @@ impl CustomSource {
|
|||
|
||||
let has_sometimes_pads = templates
|
||||
.iter()
|
||||
.any(|templ| templ.get_property_presence() == gst::PadPresence::Sometimes);
|
||||
.any(|templ| templ.property_presence() == gst::PadPresence::Sometimes);
|
||||
|
||||
// Handle all source pads that already exist
|
||||
for pad in source.get_src_pads() {
|
||||
for pad in source.src_pads() {
|
||||
if let Err(msg) = self.handle_source_pad_added(&element, &pad) {
|
||||
element.post_error_message(msg);
|
||||
return Err(gst::StateChangeError);
|
||||
|
@ -253,7 +253,7 @@ impl CustomSource {
|
|||
element: &super::CustomSource,
|
||||
pad: &gst::Pad,
|
||||
) -> Result<(), gst::ErrorMessage> {
|
||||
gst_debug!(CAT, obj: element, "Source added pad {}", pad.get_name());
|
||||
gst_debug!(CAT, obj: element, "Source added pad {}", pad.name());
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
||||
|
@ -262,19 +262,16 @@ impl CustomSource {
|
|||
// Take stream type from stream-start event if we can
|
||||
if let Some(event) = pad.get_sticky_event(gst::EventType::StreamStart, 0) {
|
||||
if let gst::EventView::StreamStart(ev) = event.view() {
|
||||
stream_type = ev.get_stream().map(|s| s.get_stream_type());
|
||||
stream_type = ev.stream().map(|s| s.stream_type());
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise from the caps
|
||||
if stream_type.is_none() {
|
||||
let caps = match pad
|
||||
.get_current_caps()
|
||||
.unwrap_or_else(|| pad.query_caps(None))
|
||||
{
|
||||
let caps = match pad.current_caps().unwrap_or_else(|| pad.query_caps(None)) {
|
||||
caps if !caps.is_any() && !caps.is_empty() => caps,
|
||||
_ => {
|
||||
gst_error!(CAT, obj: element, "Pad {} had no caps", pad.get_name());
|
||||
gst_error!(CAT, obj: element, "Pad {} had no caps", pad.name());
|
||||
return Err(gst::error_msg!(
|
||||
gst::CoreError::Negotiation,
|
||||
["Pad had no caps"]
|
||||
|
@ -284,9 +281,9 @@ impl CustomSource {
|
|||
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
|
||||
if s.get_name().starts_with("audio/") {
|
||||
if s.name().starts_with("audio/") {
|
||||
stream_type = Some(gst::StreamType::AUDIO);
|
||||
} else if s.get_name().starts_with("video/") {
|
||||
} else if s.name().starts_with("video/") {
|
||||
stream_type = Some(gst::StreamType::VIDEO);
|
||||
} else {
|
||||
return Ok(());
|
||||
|
@ -325,7 +322,7 @@ impl CustomSource {
|
|||
}
|
||||
|
||||
fn handle_source_pad_removed(&self, element: &super::CustomSource, pad: &gst::Pad) {
|
||||
gst_debug!(CAT, obj: element, "Source removed pad {}", pad.get_name());
|
||||
gst_debug!(CAT, obj: element, "Source removed pad {}", pad.name());
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
let (i, stream) = match state
|
||||
|
|
|
@ -299,7 +299,7 @@ impl ObjectImpl for FallbackSrc {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"enable-audio" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let new_value = value.get_some().expect("type checked upstream");
|
||||
|
@ -440,7 +440,7 @@ impl ObjectImpl for FallbackSrc {
|
|||
// at any time from any thread.
|
||||
#[allow(clippy::blocks_in_if_conditions)]
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"enable-audio" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.enable_audio.to_value()
|
||||
|
@ -501,9 +501,9 @@ impl ObjectImpl for FallbackSrc {
|
|||
if let Some(ref streams) = state.streams {
|
||||
for stream in streams.iter() {
|
||||
have_audio =
|
||||
have_audio || stream.get_stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_audio || stream.stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_video =
|
||||
have_video || stream.get_stream_type().contains(gst::StreamType::VIDEO);
|
||||
have_video || stream.stream_type().contains(gst::StreamType::VIDEO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ impl ObjectImpl for FallbackSrc {
|
|||
let settings = self.settings.lock().unwrap();
|
||||
settings.buffer_duration.to_value()
|
||||
}
|
||||
"statistics" => self.get_stats().to_value(),
|
||||
"statistics" => self.stats().to_value(),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ impl FallbackSrc {
|
|||
let templ = element
|
||||
.get_pad_template(if is_audio { "audio" } else { "video" })
|
||||
.unwrap();
|
||||
let ghostpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.get_name()))
|
||||
let ghostpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.name()))
|
||||
.proxy_pad_chain_function({
|
||||
let element_weak = element.downgrade();
|
||||
move |pad, _parent, buffer| {
|
||||
|
@ -1096,7 +1096,7 @@ impl FallbackSrc {
|
|||
element: &super::FallbackSrc,
|
||||
pad: &gst::Pad,
|
||||
) -> Result<(), gst::ErrorMessage> {
|
||||
gst_debug!(CAT, obj: element, "Pad {} added to source", pad.get_name(),);
|
||||
gst_debug!(CAT, obj: element, "Pad {} added to source", pad.name(),);
|
||||
|
||||
let mut state_guard = self.state.lock().unwrap();
|
||||
let state = match &mut *state_guard {
|
||||
|
@ -1106,23 +1106,20 @@ impl FallbackSrc {
|
|||
Some(state) => state,
|
||||
};
|
||||
|
||||
let (type_, stream) = match pad.get_name() {
|
||||
let (type_, stream) = match pad.name() {
|
||||
x if x.starts_with("audio_") => ("audio", &mut state.audio_stream),
|
||||
x if x.starts_with("video_") => ("video", &mut state.video_stream),
|
||||
_ => {
|
||||
let caps = match pad
|
||||
.get_current_caps()
|
||||
.unwrap_or_else(|| pad.query_caps(None))
|
||||
{
|
||||
let caps = match pad.current_caps().unwrap_or_else(|| pad.query_caps(None)) {
|
||||
caps if !caps.is_any() && !caps.is_empty() => caps,
|
||||
_ => return Ok(()),
|
||||
};
|
||||
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
|
||||
if s.get_name().starts_with("audio/") {
|
||||
if s.name().starts_with("audio/") {
|
||||
("audio", &mut state.audio_stream)
|
||||
} else if s.get_name().starts_with("video/") {
|
||||
} else if s.name().starts_with("video/") {
|
||||
("video", &mut state.video_stream)
|
||||
} else {
|
||||
// TODO: handle subtitles etc
|
||||
|
@ -1171,14 +1168,12 @@ impl FallbackSrc {
|
|||
let src = FallbackSrc::from_instance(&element);
|
||||
|
||||
match info.data {
|
||||
Some(gst::PadProbeData::Event(ref ev))
|
||||
if ev.get_type() == gst::EventType::Eos =>
|
||||
{
|
||||
Some(gst::PadProbeData::Event(ref ev)) if ev.type_() == gst::EventType::Eos => {
|
||||
gst_debug!(
|
||||
CAT,
|
||||
obj: &element,
|
||||
"Received EOS from source on pad {}, restarting",
|
||||
pad.get_name()
|
||||
pad.name()
|
||||
);
|
||||
|
||||
let mut state_guard = src.state.lock().unwrap();
|
||||
|
@ -1218,7 +1213,7 @@ impl FallbackSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Adding probe to pad {}",
|
||||
stream.source_srcpad.as_ref().unwrap().get_name()
|
||||
stream.source_srcpad.as_ref().unwrap().name()
|
||||
);
|
||||
|
||||
let element_weak = element.downgrade();
|
||||
|
@ -1234,7 +1229,7 @@ impl FallbackSrc {
|
|||
Some(element) => element,
|
||||
};
|
||||
let pts = match info.data {
|
||||
Some(gst::PadProbeData::Buffer(ref buffer)) => buffer.get_pts(),
|
||||
Some(gst::PadProbeData::Buffer(ref buffer)) => buffer.pts(),
|
||||
Some(gst::PadProbeData::Event(ref ev)) => match ev.view() {
|
||||
gst::EventView::Gap(ref ev) => ev.get().0,
|
||||
_ => return gst::PadProbeReturn::Pass,
|
||||
|
@ -1288,7 +1283,7 @@ impl FallbackSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Called probe on pad {}",
|
||||
stream.source_srcpad.as_ref().unwrap().get_name()
|
||||
stream.source_srcpad.as_ref().unwrap().name()
|
||||
);
|
||||
stream
|
||||
} else if let Some(stream) = state
|
||||
|
@ -1300,7 +1295,7 @@ impl FallbackSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Called probe on pad {}",
|
||||
stream.source_srcpad.as_ref().unwrap().get_name()
|
||||
stream.source_srcpad.as_ref().unwrap().name()
|
||||
);
|
||||
stream
|
||||
} else {
|
||||
|
@ -1324,7 +1319,7 @@ impl FallbackSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Removing pad probe for pad {}",
|
||||
source_srcpad.get_name()
|
||||
source_srcpad.name()
|
||||
);
|
||||
block.pad.remove_probe(block.probe_id);
|
||||
}
|
||||
|
@ -1352,7 +1347,7 @@ impl FallbackSrc {
|
|||
};
|
||||
|
||||
let segment = match ev.view() {
|
||||
gst::EventView::Segment(s) => s.get_segment(),
|
||||
gst::EventView::Segment(s) => s.segment(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let segment = segment.downcast_ref::<gst::ClockTime>().ok_or_else(|| {
|
||||
|
@ -1360,10 +1355,10 @@ impl FallbackSrc {
|
|||
gst::error_msg!(gst::CoreError::Clock, ["Have no time segment"])
|
||||
})?;
|
||||
|
||||
let running_time = if pts < segment.get_start() {
|
||||
segment.get_start()
|
||||
} else if segment.get_stop().is_some() && pts >= segment.get_stop() {
|
||||
segment.get_stop()
|
||||
let running_time = if pts < segment.start() {
|
||||
segment.start()
|
||||
} else if segment.stop().is_some() && pts >= segment.stop() {
|
||||
segment.stop()
|
||||
} else {
|
||||
segment.to_running_time(pts)
|
||||
};
|
||||
|
@ -1410,8 +1405,8 @@ impl FallbackSrc {
|
|||
let mut have_audio = false;
|
||||
let mut have_video = false;
|
||||
for stream in streams.iter() {
|
||||
have_audio = have_audio || stream.get_stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_video = have_video || stream.get_stream_type().contains(gst::StreamType::VIDEO);
|
||||
have_audio = have_audio || stream.stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_video = have_video || stream.stream_type().contains(gst::StreamType::VIDEO);
|
||||
}
|
||||
|
||||
let want_audio = state.settings.enable_audio;
|
||||
|
@ -1439,18 +1434,18 @@ impl FallbackSrc {
|
|||
|
||||
let audio_is_eos = audio_srcpad
|
||||
.as_ref()
|
||||
.map(|p| p.get_pad_flags().contains(gst::PadFlags::EOS))
|
||||
.map(|p| p.pad_flags().contains(gst::PadFlags::EOS))
|
||||
.unwrap_or(false);
|
||||
let video_is_eos = video_srcpad
|
||||
.as_ref()
|
||||
.map(|p| p.get_pad_flags().contains(gst::PadFlags::EOS))
|
||||
.map(|p| p.pad_flags().contains(gst::PadFlags::EOS))
|
||||
.unwrap_or(false);
|
||||
|
||||
// If we need both, wait for both and take the minimum, otherwise take the one we need.
|
||||
// Also consider EOS, we'd never get a new running time after EOS so don't need to wait.
|
||||
// FIXME: All this surely can be simplified somehow
|
||||
|
||||
let current_running_time = element.get_current_running_time();
|
||||
let current_running_time = element.current_running_time();
|
||||
|
||||
if have_audio && want_audio && have_video && want_video {
|
||||
if audio_running_time.is_none()
|
||||
|
@ -1587,12 +1582,7 @@ impl FallbackSrc {
|
|||
}
|
||||
|
||||
fn handle_source_pad_removed(&self, element: &super::FallbackSrc, pad: &gst::Pad) {
|
||||
gst_debug!(
|
||||
CAT,
|
||||
obj: element,
|
||||
"Pad {} removed from source",
|
||||
pad.get_name()
|
||||
);
|
||||
gst_debug!(CAT, obj: element, "Pad {} removed from source", pad.name());
|
||||
|
||||
let mut state_guard = self.state.lock().unwrap();
|
||||
let state = match &mut *state_guard {
|
||||
|
@ -1643,9 +1633,9 @@ impl FallbackSrc {
|
|||
return;
|
||||
}
|
||||
|
||||
gst_debug!(CAT, obj: element, "Got buffering {}%", m.get_percent());
|
||||
gst_debug!(CAT, obj: element, "Got buffering {}%", m.percent());
|
||||
|
||||
state.stats.buffering_percent = m.get_percent();
|
||||
state.stats.buffering_percent = m.percent();
|
||||
if state.stats.buffering_percent < 100 {
|
||||
state.last_buffering_update = Some(Instant::now());
|
||||
// Block source pads if needed to pause
|
||||
|
@ -1682,7 +1672,7 @@ impl FallbackSrc {
|
|||
Some(state) => state,
|
||||
};
|
||||
|
||||
let streams = m.get_stream_collection();
|
||||
let streams = m.stream_collection();
|
||||
|
||||
gst_debug!(
|
||||
CAT,
|
||||
|
@ -1694,8 +1684,8 @@ impl FallbackSrc {
|
|||
let mut have_audio = false;
|
||||
let mut have_video = false;
|
||||
for stream in streams.iter() {
|
||||
have_audio = have_audio || stream.get_stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_video = have_video || stream.get_stream_type().contains(gst::StreamType::VIDEO);
|
||||
have_audio = have_audio || stream.stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_video = have_video || stream.stream_type().contains(gst::StreamType::VIDEO);
|
||||
}
|
||||
|
||||
if !have_audio && state.settings.enable_audio {
|
||||
|
@ -1742,7 +1732,7 @@ impl FallbackSrc {
|
|||
Some(state) => state,
|
||||
};
|
||||
|
||||
let src = match m.get_src().and_then(|s| s.downcast::<gst::Element>().ok()) {
|
||||
let src = match m.src().and_then(|s| s.downcast::<gst::Element>().ok()) {
|
||||
None => return false,
|
||||
Some(src) => src,
|
||||
};
|
||||
|
@ -1751,7 +1741,7 @@ impl FallbackSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Got error message from {}",
|
||||
src.get_path_string()
|
||||
src.path_string()
|
||||
);
|
||||
|
||||
if src == state.source || src.has_as_ancestor(&state.source) {
|
||||
|
@ -1799,7 +1789,7 @@ impl FallbackSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Give up for error message from {}",
|
||||
src.get_path_string()
|
||||
src.path_string()
|
||||
);
|
||||
|
||||
false
|
||||
|
@ -1833,12 +1823,12 @@ impl FallbackSrc {
|
|||
// Drop any EOS events from any source pads of the source that might happen because of the
|
||||
// error. We don't need to remove these pad probes because restarting the source will also
|
||||
// remove/add the pads again.
|
||||
for pad in state.source.get_src_pads() {
|
||||
for pad in state.source.src_pads() {
|
||||
pad.add_probe(
|
||||
gst::PadProbeType::EVENT_DOWNSTREAM,
|
||||
|_pad, info| match info.data {
|
||||
Some(gst::PadProbeData::Event(ref event)) => {
|
||||
if event.get_type() == gst::EventType::Eos {
|
||||
if event.type_() == gst::EventType::Eos {
|
||||
gst::PadProbeReturn::Drop
|
||||
} else {
|
||||
gst::PadProbeReturn::Ok
|
||||
|
@ -1888,7 +1878,7 @@ impl FallbackSrc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Removing pad probe for pad {}",
|
||||
source_srcpad.get_name()
|
||||
source_srcpad.name()
|
||||
);
|
||||
block.pad.remove_probe(block.probe_id);
|
||||
}
|
||||
|
@ -1922,7 +1912,7 @@ impl FallbackSrc {
|
|||
|
||||
gst_debug!(CAT, obj: element, "Waiting for 1s before retrying");
|
||||
let clock = gst::SystemClock::obtain();
|
||||
let wait_time = clock.get_time() + gst::SECOND;
|
||||
let wait_time = clock.time() + gst::SECOND;
|
||||
assert!(wait_time.is_some());
|
||||
assert!(state.source_pending_restart_timeout.is_none());
|
||||
|
||||
|
@ -2035,9 +2025,8 @@ impl FallbackSrc {
|
|||
}
|
||||
|
||||
let clock = gst::SystemClock::obtain();
|
||||
let wait_time = clock.get_time()
|
||||
+ gst::ClockTime::from_nseconds(state.settings.restart_timeout)
|
||||
- elapsed;
|
||||
let wait_time =
|
||||
clock.time() + gst::ClockTime::from_nseconds(state.settings.restart_timeout) - elapsed;
|
||||
assert!(wait_time.is_some());
|
||||
gst_debug!(
|
||||
CAT,
|
||||
|
@ -2110,10 +2099,8 @@ impl FallbackSrc {
|
|||
let mut have_video = false;
|
||||
if let Some(ref streams) = state.streams {
|
||||
for stream in streams.iter() {
|
||||
have_audio =
|
||||
have_audio || stream.get_stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_video =
|
||||
have_video || stream.get_stream_type().contains(gst::StreamType::VIDEO);
|
||||
have_audio = have_audio || stream.stream_type().contains(gst::StreamType::AUDIO);
|
||||
have_video = have_video || stream.stream_type().contains(gst::StreamType::VIDEO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2132,7 +2119,7 @@ impl FallbackSrc {
|
|||
.get::<gst::Pad>()
|
||||
.unwrap()
|
||||
})
|
||||
.map(|p| p.get_name() == "fallback_sink")
|
||||
.map(|p| p.name() == "fallback_sink")
|
||||
.unwrap_or(true))
|
||||
|| (have_video
|
||||
&& state.video_stream.is_some()
|
||||
|
@ -2146,7 +2133,7 @@ impl FallbackSrc {
|
|||
.get::<gst::Pad>()
|
||||
.unwrap()
|
||||
})
|
||||
.map(|p| p.get_name() == "fallback_sink")
|
||||
.map(|p| p.name() == "fallback_sink")
|
||||
.unwrap_or(true))
|
||||
}
|
||||
|
||||
|
@ -2186,7 +2173,7 @@ impl FallbackSrc {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_stats(&self) -> gst::Structure {
|
||||
fn stats(&self) -> gst::Structure {
|
||||
let state_guard = self.state.lock().unwrap();
|
||||
|
||||
let state = match &*state_guard {
|
||||
|
|
|
@ -69,7 +69,7 @@ impl ObjectSubclass for VideoFallbackSource {
|
|||
|
||||
fn with_class(klass: &Self::Class) -> Self {
|
||||
let templ = klass.get_pad_template("src").unwrap();
|
||||
let srcpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.get_name())).build();
|
||||
let srcpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.name())).build();
|
||||
|
||||
Self {
|
||||
srcpad,
|
||||
|
@ -113,7 +113,7 @@ impl ObjectImpl for VideoFallbackSource {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"uri" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let new_value = value.get().expect("type checked upstream");
|
||||
|
@ -143,7 +143,7 @@ impl ObjectImpl for VideoFallbackSource {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"uri" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.uri.to_value()
|
||||
|
@ -379,10 +379,10 @@ impl VideoFallbackSource {
|
|||
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
let decoder;
|
||||
if s.get_name() == "image/jpeg" {
|
||||
if s.name() == "image/jpeg" {
|
||||
decoder = gst::ElementFactory::make("jpegdec", Some("decoder"))
|
||||
.expect("jpegdec not found");
|
||||
} else if s.get_name() == "image/png" {
|
||||
} else if s.name() == "image/png" {
|
||||
decoder = gst::ElementFactory::make("pngdec", Some("decoder"))
|
||||
.expect("pngdec not found");
|
||||
} else {
|
||||
|
|
|
@ -187,10 +187,10 @@ impl FallbackSwitch {
|
|||
pad: &gst_base::AggregatorPad,
|
||||
target_running_time: gst::ClockTime,
|
||||
) -> Result<(), gst::FlowError> {
|
||||
let segment = pad.get_segment();
|
||||
let segment = pad.segment();
|
||||
|
||||
/* No segment yet - no data */
|
||||
if segment.get_format() == gst::Format::Undefined {
|
||||
if segment.format() == gst::Format::Undefined {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ impl FallbackSwitch {
|
|||
let mut running_time = gst::ClockTime::none();
|
||||
|
||||
while let Some(buffer) = pad.peek_buffer() {
|
||||
let pts = buffer.get_dts_or_pts();
|
||||
let pts = buffer.dts_or_pts();
|
||||
let new_running_time = segment.to_running_time(pts);
|
||||
|
||||
if pts.is_none() || new_running_time <= target_running_time {
|
||||
|
@ -239,30 +239,30 @@ impl FallbackSwitch {
|
|||
CAT,
|
||||
obj: preferred_pad,
|
||||
"Got buffer on pad {} - {:?}",
|
||||
preferred_pad.get_name(),
|
||||
preferred_pad.name(),
|
||||
buffer
|
||||
);
|
||||
|
||||
if buffer.get_pts().is_none() {
|
||||
if buffer.pts().is_none() {
|
||||
gst_error!(CAT, obj: preferred_pad, "Only buffers with PTS supported");
|
||||
return Err(gst::FlowError::Error);
|
||||
}
|
||||
|
||||
let segment = preferred_pad
|
||||
.get_segment()
|
||||
.segment()
|
||||
.downcast::<gst::ClockTime>()
|
||||
.map_err(|_| {
|
||||
gst_error!(CAT, obj: preferred_pad, "Only TIME segments supported");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
let running_time = segment.to_running_time(buffer.get_dts_or_pts());
|
||||
let running_time = segment.to_running_time(buffer.dts_or_pts());
|
||||
|
||||
{
|
||||
// FIXME: This will not work correctly for negative DTS
|
||||
let buffer = buffer.make_mut();
|
||||
buffer.set_pts(segment.to_running_time(buffer.get_pts()));
|
||||
buffer.set_dts(segment.to_running_time(buffer.get_dts()));
|
||||
buffer.set_pts(segment.to_running_time(buffer.pts()));
|
||||
buffer.set_dts(segment.to_running_time(buffer.dts()));
|
||||
}
|
||||
|
||||
if preferred_pad == &self.primary_sinkpad {
|
||||
|
@ -273,7 +273,7 @@ impl FallbackSwitch {
|
|||
|
||||
let is_late = {
|
||||
if cur_running_time != gst::ClockTime::none() {
|
||||
let latency = agg.get_latency();
|
||||
let latency = agg.latency();
|
||||
if latency.is_some() {
|
||||
let deadline = running_time + latency + 40 * gst::MSECOND;
|
||||
|
||||
|
@ -320,12 +320,12 @@ impl FallbackSwitch {
|
|||
&& active_sinkpad.as_ref() != Some(preferred_pad.upcast_ref::<gst::Pad>());
|
||||
|
||||
if pad_change {
|
||||
if buffer.get_flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
||||
if buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
||||
gst_info!(
|
||||
CAT,
|
||||
obj: preferred_pad,
|
||||
"Can't change back to sinkpad {}, waiting for keyframe",
|
||||
preferred_pad.get_name()
|
||||
preferred_pad.name()
|
||||
);
|
||||
preferred_pad.push_event(
|
||||
gst_video::UpstreamForceKeyUnitEvent::builder()
|
||||
|
@ -380,25 +380,26 @@ impl FallbackSwitch {
|
|||
buffer
|
||||
);
|
||||
|
||||
if buffer.get_pts().is_none() {
|
||||
if buffer.pts().is_none() {
|
||||
gst_error!(CAT, obj: backup_pad, "Only buffers with PTS supported");
|
||||
return Err(gst::FlowError::Error);
|
||||
}
|
||||
|
||||
let backup_segment = backup_pad
|
||||
.get_segment()
|
||||
.downcast::<gst::ClockTime>()
|
||||
.map_err(|_| {
|
||||
gst_error!(CAT, obj: backup_pad, "Only TIME segments supported");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
let running_time = backup_segment.to_running_time(buffer.get_dts_or_pts());
|
||||
let backup_segment =
|
||||
backup_pad
|
||||
.segment()
|
||||
.downcast::<gst::ClockTime>()
|
||||
.map_err(|_| {
|
||||
gst_error!(CAT, obj: backup_pad, "Only TIME segments supported");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
let running_time = backup_segment.to_running_time(buffer.dts_or_pts());
|
||||
|
||||
{
|
||||
// FIXME: This will not work correctly for negative DTS
|
||||
let buffer = buffer.make_mut();
|
||||
buffer.set_pts(backup_segment.to_running_time(buffer.get_pts()));
|
||||
buffer.set_dts(backup_segment.to_running_time(buffer.get_dts()));
|
||||
buffer.set_pts(backup_segment.to_running_time(buffer.pts()));
|
||||
buffer.set_dts(backup_segment.to_running_time(buffer.dts()));
|
||||
}
|
||||
|
||||
// If we never had a real buffer, initialize with the running time of the fallback
|
||||
|
@ -439,12 +440,12 @@ impl FallbackSwitch {
|
|||
let pad_change = settings.auto_switch
|
||||
&& active_sinkpad.as_ref() != Some(backup_pad.upcast_ref::<gst::Pad>());
|
||||
if pad_change {
|
||||
if buffer.get_flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
||||
if buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
||||
gst_info!(
|
||||
CAT,
|
||||
obj: backup_pad,
|
||||
"Can't change to sinkpad {} yet, waiting for keyframe",
|
||||
backup_pad.get_name()
|
||||
backup_pad.name()
|
||||
);
|
||||
backup_pad.push_event(
|
||||
gst_video::UpstreamForceKeyUnitEvent::builder()
|
||||
|
@ -522,11 +523,11 @@ impl FallbackSwitch {
|
|||
)
|
||||
};
|
||||
|
||||
let clock = agg.get_clock();
|
||||
let base_time = agg.get_base_time();
|
||||
let clock = agg.clock();
|
||||
let base_time = agg.base_time();
|
||||
|
||||
let cur_running_time = if let Some(clock) = clock {
|
||||
clock.get_time() - base_time
|
||||
clock.time() - base_time
|
||||
} else {
|
||||
gst::ClockTime::none()
|
||||
};
|
||||
|
@ -727,7 +728,7 @@ impl ObjectImpl for FallbackSwitch {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"timeout" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let timeout = value.get_some().expect("type checked upstream");
|
||||
|
@ -769,7 +770,7 @@ impl ObjectImpl for FallbackSwitch {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"timeout" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.timeout.to_value()
|
||||
|
@ -945,15 +946,15 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
|
||||
match event.view() {
|
||||
EventView::Caps(caps) => {
|
||||
let caps = caps.get_caps_owned();
|
||||
let caps = caps.caps_owned();
|
||||
gst_debug!(CAT, obj: agg_pad, "Received caps {}", caps);
|
||||
|
||||
let audio_info;
|
||||
let video_info;
|
||||
if caps.get_structure(0).unwrap().get_name() == "audio/x-raw" {
|
||||
if caps.get_structure(0).unwrap().name() == "audio/x-raw" {
|
||||
audio_info = gst_audio::AudioInfo::from_caps(&caps).ok();
|
||||
video_info = None;
|
||||
} else if caps.get_structure(0).unwrap().get_name() == "video/x-raw" {
|
||||
} else if caps.get_structure(0).unwrap().name() == "video/x-raw" {
|
||||
audio_info = None;
|
||||
video_info = gst_video::VideoInfo::from_caps(&caps).ok();
|
||||
} else {
|
||||
|
@ -1013,7 +1014,7 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
CAT,
|
||||
obj: agg,
|
||||
"Have buffer on sinkpad {}, immediate timeout",
|
||||
preferred_pad.get_name()
|
||||
preferred_pad.name()
|
||||
);
|
||||
0.into()
|
||||
} else if self.primary_sinkpad.is_eos() {
|
||||
|
@ -1023,13 +1024,13 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
.as_ref()
|
||||
.and_then(|p| p.peek_buffer().map(|buffer| (buffer, p)))
|
||||
{
|
||||
if buffer.get_pts().is_none() {
|
||||
if buffer.pts().is_none() {
|
||||
gst_error!(CAT, obj: agg, "Only buffers with PTS supported");
|
||||
// Trigger aggregate immediately to error out immediately
|
||||
return 0.into();
|
||||
}
|
||||
|
||||
let segment = match backup_sinkpad.get_segment().downcast::<gst::ClockTime>() {
|
||||
let segment = match backup_sinkpad.segment().downcast::<gst::ClockTime>() {
|
||||
Ok(segment) => segment,
|
||||
Err(_) => {
|
||||
gst_error!(CAT, obj: agg, "Only TIME segments supported");
|
||||
|
@ -1038,12 +1039,12 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
}
|
||||
};
|
||||
|
||||
let running_time = segment.to_running_time(buffer.get_dts_or_pts());
|
||||
let running_time = segment.to_running_time(buffer.dts_or_pts());
|
||||
gst_debug!(
|
||||
CAT,
|
||||
obj: agg,
|
||||
"Have buffer on {} pad, timeout at {}",
|
||||
backup_sinkpad.get_name(),
|
||||
backup_sinkpad.name(),
|
||||
running_time
|
||||
);
|
||||
running_time
|
||||
|
@ -1061,7 +1062,7 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
agg_pad: &gst_base::AggregatorPad,
|
||||
mut buffer: gst::Buffer,
|
||||
) -> Option<gst::Buffer> {
|
||||
let segment = match agg_pad.get_segment().downcast::<gst::ClockTime>() {
|
||||
let segment = match agg_pad.segment().downcast::<gst::ClockTime>() {
|
||||
Ok(segment) => segment,
|
||||
Err(_) => {
|
||||
gst_error!(CAT, obj: agg, "Only TIME segments supported");
|
||||
|
@ -1069,7 +1070,7 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
}
|
||||
};
|
||||
|
||||
let pts = buffer.get_pts();
|
||||
let pts = buffer.pts();
|
||||
if pts.is_none() {
|
||||
gst_error!(CAT, obj: agg, "Only buffers with PTS supported");
|
||||
return Some(buffer);
|
||||
|
@ -1091,12 +1092,12 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
return Some(buffer);
|
||||
}
|
||||
|
||||
let duration = if buffer.get_duration().is_some() {
|
||||
buffer.get_duration()
|
||||
let duration = if buffer.duration().is_some() {
|
||||
buffer.duration()
|
||||
} else if let Some(ref audio_info) = pad_state.audio_info {
|
||||
gst::SECOND
|
||||
.mul_div_floor(
|
||||
buffer.get_size() as u64,
|
||||
buffer.size() as u64,
|
||||
audio_info.rate() as u64 * audio_info.bpf() as u64,
|
||||
)
|
||||
.unwrap()
|
||||
|
@ -1178,7 +1179,7 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
|
||||
let (mut buffer, active_caps, pad_change) = res?;
|
||||
|
||||
let current_src_caps = agg.get_static_pad("src").unwrap().get_current_caps();
|
||||
let current_src_caps = agg.get_static_pad("src").unwrap().current_caps();
|
||||
if Some(&active_caps) != current_src_caps.as_ref() {
|
||||
gst_info!(
|
||||
CAT,
|
||||
|
|
|
@ -41,15 +41,15 @@ fn init() {
|
|||
|
||||
macro_rules! assert_fallback_buffer {
|
||||
($buffer:expr, $ts:expr) => {
|
||||
assert_eq!($buffer.get_pts(), $ts);
|
||||
assert_eq!($buffer.get_size(), 160 * 120 * 4);
|
||||
assert_eq!($buffer.pts(), $ts);
|
||||
assert_eq!($buffer.size(), 160 * 120 * 4);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! assert_buffer {
|
||||
($buffer:expr, $ts:expr) => {
|
||||
assert_eq!($buffer.get_pts(), $ts);
|
||||
assert_eq!($buffer.get_size(), 320 * 240 * 4);
|
||||
assert_eq!($buffer.pts(), $ts);
|
||||
assert_eq!($buffer.size(), 320 * 240 * 4);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -412,16 +412,16 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
|||
loop {
|
||||
while let Some(clock_id) = clock.peek_next_pending_id().and_then(|clock_id| {
|
||||
// Process if the clock ID is in the past or now
|
||||
if clock.get_time() >= clock_id.get_time() {
|
||||
if clock.time() >= clock_id.time() {
|
||||
Some(clock_id)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}) {
|
||||
gst_debug!(TEST_CAT, "Processing clock ID at {}", clock_id.get_time());
|
||||
gst_debug!(TEST_CAT, "Processing clock ID at {}", clock_id.time());
|
||||
if let Some(clock_id) = clock.process_next_clock_id() {
|
||||
gst_debug!(TEST_CAT, "Processed clock ID at {}", clock_id.get_time());
|
||||
if clock_id.get_time() == 0.into() {
|
||||
gst_debug!(TEST_CAT, "Processed clock ID at {}", clock_id.time());
|
||||
if clock_id.time() == 0.into() {
|
||||
gst_debug!(TEST_CAT, "Stopping clock thread");
|
||||
return;
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
|||
// at the top of the queue. We don't want to do a busy loop here.
|
||||
while clock.peek_next_pending_id().iter().any(|clock_id| {
|
||||
// Sleep if the clock ID is in the future
|
||||
clock.get_time() < clock_id.get_time()
|
||||
clock.time() < clock_id.time()
|
||||
}) {
|
||||
use std::{thread, time};
|
||||
|
||||
|
@ -504,12 +504,12 @@ fn pull_buffer(pipeline: &Pipeline) -> gst::Buffer {
|
|||
.downcast::<gst_app::AppSink>()
|
||||
.unwrap();
|
||||
let sample = sink.pull_sample().unwrap();
|
||||
sample.get_buffer_owned().unwrap()
|
||||
sample.buffer_owned().unwrap()
|
||||
}
|
||||
|
||||
fn set_time(pipeline: &Pipeline, time: gst::ClockTime) {
|
||||
let clock = pipeline
|
||||
.get_clock()
|
||||
.clock()
|
||||
.unwrap()
|
||||
.downcast::<gst_check::TestClock>()
|
||||
.unwrap();
|
||||
|
@ -540,7 +540,7 @@ fn stop_pipeline(mut pipeline: Pipeline) {
|
|||
pipeline.set_state(gst::State::Null).unwrap();
|
||||
|
||||
let clock = pipeline
|
||||
.get_clock()
|
||||
.clock()
|
||||
.unwrap()
|
||||
.downcast::<gst_check::TestClock>()
|
||||
.unwrap();
|
||||
|
|
|
@ -291,7 +291,7 @@ fn create_ui(app: >k::Application) {
|
|||
Inhibit(false)
|
||||
});
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
let app_weak = app.downgrade();
|
||||
bus.add_watch_local(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
@ -306,9 +306,9 @@ fn create_ui(app: >k::Application) {
|
|||
MessageView::Error(err) => {
|
||||
println!(
|
||||
"Error from {:?}: {} ({:?})",
|
||||
msg.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
msg.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
app.quit();
|
||||
}
|
||||
|
|
|
@ -158,14 +158,14 @@ enum HandleResult<T> {
|
|||
}
|
||||
|
||||
trait HandleData: Sized {
|
||||
fn get_pts(&self) -> gst::ClockTime;
|
||||
fn get_dts(&self) -> gst::ClockTime;
|
||||
fn get_dts_or_pts(&self) -> gst::ClockTime {
|
||||
let dts = self.get_dts();
|
||||
fn pts(&self) -> gst::ClockTime;
|
||||
fn dts(&self) -> gst::ClockTime;
|
||||
fn dts_or_pts(&self) -> gst::ClockTime {
|
||||
let dts = self.dts();
|
||||
if dts.is_some() {
|
||||
dts
|
||||
} else {
|
||||
self.get_pts()
|
||||
self.pts()
|
||||
}
|
||||
}
|
||||
fn get_duration(&self, state: &StreamState) -> gst::ClockTime;
|
||||
|
@ -179,11 +179,11 @@ trait HandleData: Sized {
|
|||
}
|
||||
|
||||
impl HandleData for (gst::ClockTime, gst::ClockTime) {
|
||||
fn get_pts(&self) -> gst::ClockTime {
|
||||
fn pts(&self) -> gst::ClockTime {
|
||||
self.0
|
||||
}
|
||||
|
||||
fn get_dts(&self) -> gst::ClockTime {
|
||||
fn dts(&self) -> gst::ClockTime {
|
||||
self.0
|
||||
}
|
||||
|
||||
|
@ -217,11 +217,11 @@ impl HandleData for (gst::ClockTime, gst::ClockTime) {
|
|||
}
|
||||
|
||||
impl HandleData for gst::Buffer {
|
||||
fn get_pts(&self) -> gst::ClockTime {
|
||||
fn pts(&self) -> gst::ClockTime {
|
||||
gst::BufferRef::get_pts(self)
|
||||
}
|
||||
|
||||
fn get_dts(&self) -> gst::ClockTime {
|
||||
fn dts(&self) -> gst::ClockTime {
|
||||
gst::BufferRef::get_dts(self)
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ impl HandleData for gst::Buffer {
|
|||
return gst::CLOCK_TIME_NONE;
|
||||
}
|
||||
|
||||
let size = self.get_size() as u64;
|
||||
let size = self.size() as u64;
|
||||
let num_samples = size / audio_info.bpf() as u64;
|
||||
gst::SECOND
|
||||
.mul_div_floor(num_samples, audio_info.rate() as u64)
|
||||
|
@ -273,7 +273,7 @@ impl HandleData for gst::Buffer {
|
|||
} else if let Some(ref video_info) = state.video_info {
|
||||
if video_info.format() == gst_video::VideoFormat::Unknown
|
||||
|| video_info.format() == gst_video::VideoFormat::Encoded
|
||||
|| self.get_dts_or_pts() != self.get_pts()
|
||||
|| self.dts_or_pts() != self.pts()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ impl ToggleRecord {
|
|||
) -> Result<HandleResult<T>, gst::FlowError> {
|
||||
let mut state = stream.state.lock();
|
||||
|
||||
let mut dts_or_pts = data.get_dts_or_pts();
|
||||
let mut dts_or_pts = data.dts_or_pts();
|
||||
let duration = data.get_duration(&state);
|
||||
|
||||
if !dts_or_pts.is_some() {
|
||||
|
@ -382,11 +382,11 @@ impl ToggleRecord {
|
|||
};
|
||||
|
||||
// This will only do anything for non-raw data
|
||||
dts_or_pts = state.in_segment.get_start().max(dts_or_pts).unwrap();
|
||||
dts_or_pts_end = state.in_segment.get_start().max(dts_or_pts_end).unwrap();
|
||||
if state.in_segment.get_stop().is_some() {
|
||||
dts_or_pts = state.in_segment.get_stop().min(dts_or_pts).unwrap();
|
||||
dts_or_pts_end = state.in_segment.get_stop().min(dts_or_pts_end).unwrap();
|
||||
dts_or_pts = state.in_segment.start().max(dts_or_pts).unwrap();
|
||||
dts_or_pts_end = state.in_segment.start().max(dts_or_pts_end).unwrap();
|
||||
if state.in_segment.stop().is_some() {
|
||||
dts_or_pts = state.in_segment.stop().min(dts_or_pts).unwrap();
|
||||
dts_or_pts_end = state.in_segment.stop().min(dts_or_pts_end).unwrap();
|
||||
}
|
||||
|
||||
let current_running_time = state.in_segment.to_running_time(dts_or_pts);
|
||||
|
@ -609,7 +609,7 @@ impl ToggleRecord {
|
|||
// Calculate end pts & current running time and make sure we stay in the segment
|
||||
let mut state = stream.state.lock();
|
||||
|
||||
let mut pts = data.get_pts();
|
||||
let mut pts = data.pts();
|
||||
let duration = data.get_duration(&state);
|
||||
|
||||
if pts.is_none() {
|
||||
|
@ -617,7 +617,7 @@ impl ToggleRecord {
|
|||
return Err(gst::FlowError::Error);
|
||||
}
|
||||
|
||||
let dts = data.get_dts();
|
||||
let dts = data.dts();
|
||||
if dts.is_some() && pts.is_some() && dts != pts {
|
||||
gst::element_error!(
|
||||
element,
|
||||
|
@ -651,11 +651,11 @@ impl ToggleRecord {
|
|||
};
|
||||
|
||||
// This will only do anything for non-raw data
|
||||
pts = state.in_segment.get_start().max(pts).unwrap();
|
||||
pts_end = state.in_segment.get_start().max(pts_end).unwrap();
|
||||
if state.in_segment.get_stop().is_some() {
|
||||
pts = state.in_segment.get_stop().min(pts).unwrap();
|
||||
pts_end = state.in_segment.get_stop().min(pts_end).unwrap();
|
||||
pts = state.in_segment.start().max(pts).unwrap();
|
||||
pts_end = state.in_segment.start().max(pts_end).unwrap();
|
||||
if state.in_segment.stop().is_some() {
|
||||
pts = state.in_segment.stop().min(pts).unwrap();
|
||||
pts_end = state.in_segment.stop().min(pts_end).unwrap();
|
||||
}
|
||||
|
||||
let current_running_time = state.in_segment.to_running_time(pts);
|
||||
|
@ -762,13 +762,13 @@ impl ToggleRecord {
|
|||
.in_segment
|
||||
.position_from_running_time(rec_state.last_recording_start);
|
||||
if clip_start.is_none() {
|
||||
clip_start = state.in_segment.get_start();
|
||||
clip_start = state.in_segment.start();
|
||||
}
|
||||
let mut clip_stop = state
|
||||
.in_segment
|
||||
.position_from_running_time(rec_state.last_recording_stop);
|
||||
if clip_stop.is_none() {
|
||||
clip_stop = state.in_segment.get_stop();
|
||||
clip_stop = state.in_segment.stop();
|
||||
}
|
||||
let mut segment = state.in_segment.clone();
|
||||
segment.set_start(clip_start);
|
||||
|
@ -813,13 +813,13 @@ impl ToggleRecord {
|
|||
.in_segment
|
||||
.position_from_running_time(rec_state.last_recording_start);
|
||||
if clip_start.is_none() {
|
||||
clip_start = state.in_segment.get_start();
|
||||
clip_start = state.in_segment.start();
|
||||
}
|
||||
let mut clip_stop = state
|
||||
.in_segment
|
||||
.position_from_running_time(rec_state.last_recording_stop);
|
||||
if clip_stop.is_none() {
|
||||
clip_stop = state.in_segment.get_stop();
|
||||
clip_stop = state.in_segment.stop();
|
||||
}
|
||||
let mut segment = state.in_segment.clone();
|
||||
segment.set_start(clip_start);
|
||||
|
@ -928,7 +928,7 @@ impl ToggleRecord {
|
|||
.in_segment
|
||||
.position_from_running_time(rec_state.last_recording_stop);
|
||||
if clip_stop.is_none() {
|
||||
clip_stop = state.in_segment.get_stop();
|
||||
clip_stop = state.in_segment.stop();
|
||||
}
|
||||
let mut segment = state.in_segment.clone();
|
||||
segment.set_stop(clip_stop);
|
||||
|
@ -1004,7 +1004,7 @@ impl ToggleRecord {
|
|||
.in_segment
|
||||
.position_from_running_time(rec_state.last_recording_start);
|
||||
if clip_start.is_none() {
|
||||
clip_start = state.in_segment.get_start();
|
||||
clip_start = state.in_segment.start();
|
||||
}
|
||||
let mut segment = state.in_segment.clone();
|
||||
segment.set_start(clip_start);
|
||||
|
@ -1084,7 +1084,7 @@ impl ToggleRecord {
|
|||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Pad,
|
||||
["Unknown pad {:?}", pad.get_name()]
|
||||
["Unknown pad {:?}", pad.name()]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
@ -1172,7 +1172,7 @@ impl ToggleRecord {
|
|||
|
||||
events.append(&mut state.pending_events);
|
||||
|
||||
let out_running_time = state.out_segment.to_running_time(buffer.get_pts());
|
||||
let out_running_time = state.out_segment.to_running_time(buffer.pts());
|
||||
|
||||
// Unlock before pushing
|
||||
drop(state);
|
||||
|
@ -1207,7 +1207,7 @@ impl ToggleRecord {
|
|||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Pad,
|
||||
["Unknown pad {:?}", pad.get_name()]
|
||||
["Unknown pad {:?}", pad.name()]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -1244,13 +1244,13 @@ impl ToggleRecord {
|
|||
}
|
||||
EventView::Caps(c) => {
|
||||
let mut state = stream.state.lock();
|
||||
let caps = c.get_caps();
|
||||
let caps = c.caps();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
if s.get_name().starts_with("audio/") {
|
||||
if s.name().starts_with("audio/") {
|
||||
state.audio_info = gst_audio::AudioInfo::from_caps(caps).ok();
|
||||
gst_log!(CAT, obj: pad, "Got audio caps {:?}", state.audio_info);
|
||||
state.video_info = None;
|
||||
} else if s.get_name().starts_with("video/") {
|
||||
} else if s.name().starts_with("video/") {
|
||||
state.audio_info = None;
|
||||
state.video_info = gst_video::VideoInfo::from_caps(caps).ok();
|
||||
gst_log!(CAT, obj: pad, "Got video caps {:?}", state.video_info);
|
||||
|
@ -1262,35 +1262,32 @@ impl ToggleRecord {
|
|||
EventView::Segment(e) => {
|
||||
let mut state = stream.state.lock();
|
||||
|
||||
let segment = match e.get_segment().clone().downcast::<gst::ClockTime>() {
|
||||
let segment = match e.segment().clone().downcast::<gst::ClockTime>() {
|
||||
Err(segment) => {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
[
|
||||
"Only Time segments supported, got {:?}",
|
||||
segment.get_format(),
|
||||
]
|
||||
["Only Time segments supported, got {:?}", segment.format(),]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
Ok(segment) => segment,
|
||||
};
|
||||
|
||||
if (segment.get_rate() - 1.0).abs() > f64::EPSILON {
|
||||
if (segment.rate() - 1.0).abs() > f64::EPSILON {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
[
|
||||
"Only rate==1.0 segments supported, got {:?}",
|
||||
segment.get_rate(),
|
||||
segment.rate(),
|
||||
]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
state.in_segment = segment;
|
||||
state.segment_seqnum = event.get_seqnum();
|
||||
state.segment_seqnum = event.seqnum();
|
||||
state.segment_pending = true;
|
||||
state.current_running_time = gst::CLOCK_TIME_NONE;
|
||||
state.current_running_time_end = gst::CLOCK_TIME_NONE;
|
||||
|
@ -1358,7 +1355,7 @@ impl ToggleRecord {
|
|||
|
||||
// If a serialized event and coming after Segment and a new Segment is pending,
|
||||
// queue up and send at a later time (buffer/gap) after we sent the Segment
|
||||
let type_ = event.get_type();
|
||||
let type_ = event.type_();
|
||||
if forward
|
||||
&& type_ != gst::EventType::Eos
|
||||
&& type_.is_serialized()
|
||||
|
@ -1413,7 +1410,7 @@ impl ToggleRecord {
|
|||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Pad,
|
||||
["Unknown pad {:?}", pad.get_name()]
|
||||
["Unknown pad {:?}", pad.name()]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -1441,7 +1438,7 @@ impl ToggleRecord {
|
|||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Pad,
|
||||
["Unknown pad {:?}", pad.get_name()]
|
||||
["Unknown pad {:?}", pad.name()]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -1454,7 +1451,7 @@ impl ToggleRecord {
|
|||
|
||||
let rec_state = self.state.lock();
|
||||
let running_time_offset = rec_state.running_time_offset.unwrap_or(0) as i64;
|
||||
let offset = event.get_running_time_offset();
|
||||
let offset = event.running_time_offset();
|
||||
event
|
||||
.make_mut()
|
||||
.set_running_time_offset(offset + running_time_offset);
|
||||
|
@ -1482,7 +1479,7 @@ impl ToggleRecord {
|
|||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Pad,
|
||||
["Unknown pad {:?}", pad.get_name()]
|
||||
["Unknown pad {:?}", pad.name()]
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -1500,34 +1497,34 @@ impl ToggleRecord {
|
|||
|
||||
gst_log!(CAT, obj: pad, "Downstream returned {:?}", new_query);
|
||||
|
||||
let (flags, min, max, align) = new_query.get_result();
|
||||
let (flags, min, max, align) = new_query.result();
|
||||
q.set(flags, min, max, align);
|
||||
q.add_scheduling_modes(
|
||||
&new_query
|
||||
.get_scheduling_modes()
|
||||
.scheduling_modes()
|
||||
.iter()
|
||||
.cloned()
|
||||
.filter(|m| m != &gst::PadMode::Pull)
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.get_mut_query());
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.query_mut());
|
||||
true
|
||||
}
|
||||
QueryView::Seeking(ref mut q) => {
|
||||
// Seeking is not possible here
|
||||
let format = q.get_format();
|
||||
let format = q.format();
|
||||
q.set(
|
||||
false,
|
||||
gst::GenericFormattedValue::new(format, -1),
|
||||
gst::GenericFormattedValue::new(format, -1),
|
||||
);
|
||||
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.get_mut_query());
|
||||
gst_log!(CAT, obj: pad, "Returning {:?}", q.query_mut());
|
||||
true
|
||||
}
|
||||
// Position and duration is always the current recording position
|
||||
QueryView::Position(ref mut q) => {
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
let state = stream.state.lock();
|
||||
let rec_state = self.state.lock();
|
||||
let mut recording_duration = rec_state.recording_duration;
|
||||
|
@ -1556,7 +1553,7 @@ impl ToggleRecord {
|
|||
}
|
||||
}
|
||||
QueryView::Duration(ref mut q) => {
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
let state = stream.state.lock();
|
||||
let rec_state = self.state.lock();
|
||||
let mut recording_duration = rec_state.recording_duration;
|
||||
|
@ -1601,7 +1598,7 @@ impl ToggleRecord {
|
|||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Pad,
|
||||
["Unknown pad {:?}", pad.get_name()]
|
||||
["Unknown pad {:?}", pad.name()]
|
||||
);
|
||||
return gst::Iterator::from_vec(vec![]);
|
||||
}
|
||||
|
@ -1728,7 +1725,7 @@ impl ObjectImpl for ToggleRecord {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"record" => {
|
||||
let mut settings = self.settings.lock();
|
||||
let record = value.get_some().expect("type checked upstream");
|
||||
|
@ -1747,7 +1744,7 @@ impl ObjectImpl for ToggleRecord {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"record" => {
|
||||
let settings = self.settings.lock();
|
||||
settings.record.to_value()
|
||||
|
|
|
@ -214,9 +214,9 @@ fn recv_buffers(
|
|||
match val {
|
||||
Left(buffer) => {
|
||||
res.push((
|
||||
segment.to_running_time(buffer.get_pts()),
|
||||
buffer.get_pts(),
|
||||
buffer.get_duration(),
|
||||
segment.to_running_time(buffer.pts()),
|
||||
buffer.pts(),
|
||||
buffer.duration(),
|
||||
));
|
||||
n_buffers += 1;
|
||||
if wait_buffers > 0 && n_buffers == wait_buffers {
|
||||
|
@ -241,7 +241,7 @@ fn recv_buffers(
|
|||
return (res, saw_eos);
|
||||
}
|
||||
EventView::Segment(ref e) => {
|
||||
*segment = e.get_segment().clone().downcast().unwrap();
|
||||
*segment = e.segment().clone().downcast().unwrap();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
@ -266,12 +266,12 @@ fn test_create_pads() {
|
|||
let sinkpad = togglerecord.get_request_pad("sink_%u").unwrap();
|
||||
let srcpad = sinkpad.iterate_internal_links().next().unwrap().unwrap();
|
||||
|
||||
assert_eq!(sinkpad.get_name(), "sink_0");
|
||||
assert_eq!(srcpad.get_name(), "src_0");
|
||||
assert_eq!(sinkpad.name(), "sink_0");
|
||||
assert_eq!(srcpad.name(), "src_0");
|
||||
|
||||
togglerecord.release_request_pad(&sinkpad);
|
||||
assert!(sinkpad.get_parent().is_none());
|
||||
assert!(srcpad.get_parent().is_none());
|
||||
assert!(sinkpad.parent().is_none());
|
||||
assert!(srcpad.parent().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -119,13 +119,13 @@ impl VideoDecoderImpl for CdgDec {
|
|||
|
||||
element.negotiate(output_state)?;
|
||||
|
||||
let out_state = element.get_output_state().unwrap();
|
||||
*out_info = Some(out_state.get_info());
|
||||
let out_state = element.output_state().unwrap();
|
||||
*out_info = Some(out_state.info());
|
||||
}
|
||||
}
|
||||
|
||||
let cmd = {
|
||||
let input = frame.get_input_buffer().unwrap();
|
||||
let input = frame.input_buffer().unwrap();
|
||||
let map = input.map_readable().map_err(|_| {
|
||||
gst::element_error!(
|
||||
element,
|
||||
|
@ -153,7 +153,7 @@ impl VideoDecoderImpl for CdgDec {
|
|||
|
||||
element.allocate_output_frame(&mut frame, None)?;
|
||||
{
|
||||
let output = frame.get_output_buffer_mut().unwrap();
|
||||
let output = frame.output_buffer_mut().unwrap();
|
||||
let info = self.output_info.lock().unwrap();
|
||||
|
||||
let mut out_frame =
|
||||
|
@ -187,7 +187,7 @@ impl VideoDecoderImpl for CdgDec {
|
|||
}
|
||||
}
|
||||
|
||||
gst_debug!(CAT, obj: element, "Finish frame pts={}", frame.get_pts());
|
||||
gst_debug!(CAT, obj: element, "Finish frame pts={}", frame.pts());
|
||||
|
||||
element.finish_frame(frame)
|
||||
}
|
||||
|
@ -202,9 +202,9 @@ impl VideoDecoderImpl for CdgDec {
|
|||
.find_allocation_meta::<gst_video::VideoMeta>()
|
||||
.is_some()
|
||||
{
|
||||
let pools = allocation.get_allocation_pools();
|
||||
let pools = allocation.allocation_pools();
|
||||
if let Some((Some(ref pool), _, _, _)) = pools.first() {
|
||||
let mut config = pool.get_config();
|
||||
let mut config = pool.config();
|
||||
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
|
||||
pool.set_config(config)
|
||||
.map_err(|e| gst::error_msg!(gst::CoreError::Negotiation, [&e.message]))?;
|
||||
|
|
|
@ -119,9 +119,9 @@ impl BaseParseImpl for CdgParse {
|
|||
|
||||
/* Set duration */
|
||||
let mut query = gst::query::Duration::new(gst::Format::Bytes);
|
||||
let pad = element.get_src_pad();
|
||||
let pad = element.src_pad();
|
||||
if pad.query(&mut query) {
|
||||
let size = query.get_result();
|
||||
let size = query.result();
|
||||
let duration = bytes_to_time(size.try_into().unwrap());
|
||||
element.set_duration(duration, 0);
|
||||
}
|
||||
|
@ -134,8 +134,8 @@ impl BaseParseImpl for CdgParse {
|
|||
element: &Self::Type,
|
||||
mut frame: gst_base::BaseParseFrame,
|
||||
) -> Result<(gst::FlowSuccess, u32), gst::FlowError> {
|
||||
let pad = element.get_src_pad();
|
||||
if pad.get_current_caps().is_none() {
|
||||
let pad = element.src_pad();
|
||||
if pad.current_caps().is_none() {
|
||||
// Set src pad caps
|
||||
let src_caps = gst::Caps::new_simple(
|
||||
"video/x-cdg",
|
||||
|
@ -151,7 +151,7 @@ impl BaseParseImpl for CdgParse {
|
|||
}
|
||||
|
||||
// Scan for CDG instruction
|
||||
let input = frame.get_buffer().unwrap();
|
||||
let input = frame.buffer().unwrap();
|
||||
let skip = {
|
||||
let map = input.map_readable().map_err(|_| {
|
||||
gst::element_error!(
|
||||
|
@ -167,7 +167,7 @@ impl BaseParseImpl for CdgParse {
|
|||
.enumerate()
|
||||
.find(|(_, byte)| (*byte & CDG_MASK == CDG_COMMAND))
|
||||
.map(|(i, _)| i)
|
||||
.unwrap_or_else(|| input.get_size()) // skip the whole buffer
|
||||
.unwrap_or_else(|| input.size()) // skip the whole buffer
|
||||
as u32
|
||||
};
|
||||
|
||||
|
@ -198,8 +198,8 @@ impl BaseParseImpl for CdgParse {
|
|||
}
|
||||
};
|
||||
|
||||
let pts = bytes_to_time(Bytes(Some(frame.get_offset())));
|
||||
let buffer = frame.get_buffer_mut().unwrap();
|
||||
let pts = bytes_to_time(Bytes(Some(frame.offset())));
|
||||
let buffer = frame.buffer_mut().unwrap();
|
||||
buffer.set_pts(pts);
|
||||
|
||||
if !keyframe {
|
||||
|
|
|
@ -43,7 +43,7 @@ fn compute_probability(typefind: &mut TypeFind) -> TypeFindProbability {
|
|||
let mut best = TypeFindProbability::None;
|
||||
// Try looking at the start of the file if its length isn't available
|
||||
let len = typefind
|
||||
.get_length()
|
||||
.length()
|
||||
.unwrap_or(TYPEFIND_SEARCH_WINDOW as u64 * NB_WINDOWS);
|
||||
let step = len / NB_WINDOWS;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ fn test_cdgdec() {
|
|||
.new_sample(move |appsink| {
|
||||
// Pull the sample in question out of the appsink's buffer.
|
||||
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
|
||||
let buffer = sample.get_buffer().ok_or(gst::FlowError::Error)?;
|
||||
let buffer = sample.buffer().ok_or(gst::FlowError::Error)?;
|
||||
let map = buffer.map_readable().map_err(|_| gst::FlowError::Error)?;
|
||||
|
||||
// First frame fully blue
|
||||
|
@ -83,17 +83,17 @@ fn test_cdgdec() {
|
|||
.set_state(gst::State::Playing)
|
||||
.expect("Unable to set the pipeline to the `Playing` state");
|
||||
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
|
||||
use gst::MessageView;
|
||||
match msg.view() {
|
||||
MessageView::Error(err) => {
|
||||
eprintln!(
|
||||
"Error received from element {:?}: {}",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error()
|
||||
);
|
||||
eprintln!("Debugging information: {:?}", err.get_debug());
|
||||
eprintln!("Debugging information: {:?}", err.debug());
|
||||
unreachable!();
|
||||
}
|
||||
MessageView::Eos(..) => break,
|
||||
|
|
|
@ -261,7 +261,7 @@ impl ObjectImpl for CCDetect {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"window" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.window = value.get_some().expect("type checked upstream");
|
||||
|
@ -271,7 +271,7 @@ impl ObjectImpl for CCDetect {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"window" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.window.to_value()
|
||||
|
@ -350,7 +350,7 @@ impl BaseTransformImpl for CCDetect {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let map = buf.map_readable().map_err(|_| gst::FlowError::Error)?;
|
||||
|
||||
if buf.get_pts().is_none() {
|
||||
if buf.pts().is_none() {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::ResourceError::Read,
|
||||
|
@ -377,7 +377,7 @@ impl BaseTransformImpl for CCDetect {
|
|||
}
|
||||
};
|
||||
|
||||
self.maybe_update_properties(element, buf.get_pts(), cc_packet)
|
||||
self.maybe_update_properties(element, buf.pts(), cc_packet)
|
||||
.map_err(|_| gst::FlowError::Error)?;
|
||||
|
||||
Ok(gst::FlowSuccess::Ok)
|
||||
|
|
|
@ -138,7 +138,7 @@ impl Cea608Overlay {
|
|||
layout.set_text(
|
||||
&"12345678901234567890123456789012\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5",
|
||||
);
|
||||
let (_ink_rect, logical_rect) = layout.get_extents();
|
||||
let (_ink_rect, logical_rect) = layout.extents();
|
||||
if logical_rect.width > video_info.width() as i32 * pango::SCALE
|
||||
|| logical_rect.height > video_info.height() as i32 * pango::SCALE
|
||||
{
|
||||
|
@ -160,7 +160,7 @@ impl Cea608Overlay {
|
|||
let video_info = state.video_info.as_ref().unwrap();
|
||||
let layout = state.layout.as_ref().unwrap();
|
||||
layout.set_text(text);
|
||||
let (_ink_rect, logical_rect) = layout.get_extents();
|
||||
let (_ink_rect, logical_rect) = layout.extents();
|
||||
let height = logical_rect.height / pango::SCALE;
|
||||
let width = logical_rect.width / pango::SCALE;
|
||||
|
||||
|
@ -189,7 +189,7 @@ impl Cea608Overlay {
|
|||
// Pass ownership of the buffer to the cairo surface but keep around
|
||||
// a raw pointer so we can later retrieve it again when the surface
|
||||
// is done
|
||||
let buffer_ptr = unsafe { buffer.get_buffer().as_ptr() };
|
||||
let buffer_ptr = unsafe { buffer.buffer().as_ptr() };
|
||||
let surface = cairo::ImageSurface::create_for_data(
|
||||
buffer,
|
||||
cairo::Format::ARgb32,
|
||||
|
@ -436,8 +436,8 @@ impl Cea608Overlay {
|
|||
}
|
||||
|
||||
for meta in buffer.iter_meta::<gst_video::VideoCaptionMeta>() {
|
||||
if meta.get_caption_type() == gst_video::VideoCaptionType::Cea708Cdp {
|
||||
match extract_cdp(meta.get_data()) {
|
||||
if meta.caption_type() == gst_video::VideoCaptionType::Cea708Cdp {
|
||||
match extract_cdp(meta.data()) {
|
||||
Ok(data) => {
|
||||
self.decode_cc_data(pad, element, &mut state, data);
|
||||
}
|
||||
|
@ -446,12 +446,12 @@ impl Cea608Overlay {
|
|||
gst::element_warning!(element, gst::StreamError::Decode, [&e.to_string()]);
|
||||
}
|
||||
}
|
||||
} else if meta.get_caption_type() == gst_video::VideoCaptionType::Cea708Raw {
|
||||
self.decode_cc_data(pad, element, &mut state, meta.get_data());
|
||||
} else if meta.get_caption_type() == gst_video::VideoCaptionType::Cea608S3341a {
|
||||
self.decode_s334_1a(pad, element, &mut state, meta.get_data());
|
||||
} else if meta.get_caption_type() == gst_video::VideoCaptionType::Cea608Raw {
|
||||
let data = meta.get_data();
|
||||
} else if meta.caption_type() == gst_video::VideoCaptionType::Cea708Raw {
|
||||
self.decode_cc_data(pad, element, &mut state, meta.data());
|
||||
} else if meta.caption_type() == gst_video::VideoCaptionType::Cea608S3341a {
|
||||
self.decode_s334_1a(pad, element, &mut state, meta.data());
|
||||
} else if meta.caption_type() == gst_video::VideoCaptionType::Cea608Raw {
|
||||
let data = meta.data();
|
||||
assert!(data.len() % 2 == 0);
|
||||
for i in 0..data.len() / 2 {
|
||||
match state
|
||||
|
@ -514,7 +514,7 @@ impl Cea608Overlay {
|
|||
match event.view() {
|
||||
EventView::Caps(c) => {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.video_info = gst_video::VideoInfo::from_caps(c.get_caps()).ok();
|
||||
state.video_info = gst_video::VideoInfo::from_caps(c.caps()).ok();
|
||||
self.srcpad.check_reconfigure();
|
||||
match self.negotiate(element, &mut state) {
|
||||
Ok(_) => true,
|
||||
|
@ -599,7 +599,7 @@ impl ObjectImpl for Cea608Overlay {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"field" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
@ -615,7 +615,7 @@ impl ObjectImpl for Cea608Overlay {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"field" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.field.to_value()
|
||||
|
|
|
@ -748,13 +748,13 @@ impl Cea608ToJson {
|
|||
|
||||
let mut state = self.state.borrow_mut();
|
||||
|
||||
let pts = buffer.get_pts();
|
||||
let pts = buffer.pts();
|
||||
if pts.is_none() {
|
||||
gst_error!(CAT, obj: pad, "Require timestamped buffers");
|
||||
return Err(gst::FlowError::Error);
|
||||
}
|
||||
|
||||
let duration = buffer.get_duration();
|
||||
let duration = buffer.duration();
|
||||
if duration.is_none() {
|
||||
gst_error!(CAT, obj: pad, "Require buffers with duration");
|
||||
return Err(gst::FlowError::Error);
|
||||
|
|
|
@ -76,7 +76,7 @@ impl Cea608ToTt {
|
|||
}
|
||||
};
|
||||
|
||||
let buffer_pts = buffer.get_pts();
|
||||
let buffer_pts = buffer.pts();
|
||||
if buffer_pts.is_none() {
|
||||
gst_error!(CAT, obj: pad, "Require timestamped buffers");
|
||||
return Err(gst::FlowError::Error);
|
||||
|
@ -284,8 +284,8 @@ impl Cea608ToTt {
|
|||
return true;
|
||||
}
|
||||
|
||||
let mut downstream_caps = match self.srcpad.get_allowed_caps() {
|
||||
None => self.srcpad.get_pad_template_caps(),
|
||||
let mut downstream_caps = match self.srcpad.allowed_caps() {
|
||||
None => self.srcpad.pad_template_caps(),
|
||||
Some(caps) => caps,
|
||||
};
|
||||
|
||||
|
@ -304,13 +304,13 @@ impl Cea608ToTt {
|
|||
);
|
||||
|
||||
let s = downstream_caps.get_structure(0).unwrap();
|
||||
let new_caps = if s.get_name() == "application/x-subtitle-vtt" {
|
||||
let new_caps = if s.name() == "application/x-subtitle-vtt" {
|
||||
state.format = Some(Format::Vtt);
|
||||
gst::Caps::builder("application/x-subtitle-vtt").build()
|
||||
} else if s.get_name() == "application/x-subtitle" {
|
||||
} else if s.name() == "application/x-subtitle" {
|
||||
state.format = Some(Format::Srt);
|
||||
gst::Caps::builder("application/x-subtitle").build()
|
||||
} else if s.get_name() == "text/x-raw" {
|
||||
} else if s.name() == "text/x-raw" {
|
||||
state.format = Some(Format::Raw);
|
||||
gst::Caps::builder("text/x-raw")
|
||||
.field("format", &"utf8")
|
||||
|
|
|
@ -61,12 +61,12 @@ impl<T: AsRef<[u8]>> LineReader<T> {
|
|||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn get_line_or_drain(&mut self) -> Option<&[u8]> {
|
||||
pub fn line_or_drain(&mut self) -> Option<&[u8]> {
|
||||
self.get_line_with_drain(true)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn get_line(&mut self) -> Option<&[u8]> {
|
||||
pub fn line(&mut self) -> Option<&[u8]> {
|
||||
self.get_line_with_drain(false)
|
||||
}
|
||||
|
||||
|
@ -247,10 +247,10 @@ mod tests {
|
|||
let mut r = LineReader::new();
|
||||
r.push(Vec::from(b"abcd\nefgh\nijkl\n".as_ref()));
|
||||
|
||||
assert_eq!(r.get_line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.get_line(), None);
|
||||
assert_eq!(r.line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.line(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -258,11 +258,11 @@ mod tests {
|
|||
let mut r = LineReader::new();
|
||||
r.push(Vec::from(b"abcd\nefgh\n\nijkl\n".as_ref()));
|
||||
|
||||
assert_eq!(r.get_line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.get_line(), None);
|
||||
assert_eq!(r.line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.line(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -271,10 +271,10 @@ mod tests {
|
|||
r.push(Vec::from(b"abcd\nef".as_ref()));
|
||||
r.push(Vec::from(b"gh\nijkl\n".as_ref()));
|
||||
|
||||
assert_eq!(r.get_line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.get_line(), None);
|
||||
assert_eq!(r.line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.line(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -285,10 +285,10 @@ mod tests {
|
|||
r.push(Vec::from(b"g".as_ref()));
|
||||
r.push(Vec::from(b"h\nijkl\n".as_ref()));
|
||||
|
||||
assert_eq!(r.get_line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.get_line(), None);
|
||||
assert_eq!(r.line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"ijkl\n".as_ref()));
|
||||
assert_eq!(r.line(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -296,11 +296,11 @@ mod tests {
|
|||
let mut r = LineReader::new();
|
||||
r.push(Vec::from(b"abcd\nefgh\nijkl".as_ref()));
|
||||
|
||||
assert_eq!(r.get_line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.get_line(), None);
|
||||
assert_eq!(r.get_line_or_drain(), Some(b"ijkl".as_ref()));
|
||||
assert_eq!(r.get_line_or_drain(), None);
|
||||
assert_eq!(r.line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.line(), None);
|
||||
assert_eq!(r.line_or_drain(), Some(b"ijkl".as_ref()));
|
||||
assert_eq!(r.line_or_drain(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -309,11 +309,11 @@ mod tests {
|
|||
r.push(Vec::from(b"abcd\nefgh\n".as_ref()));
|
||||
r.push(Vec::from(b"ijkl".as_ref()));
|
||||
|
||||
assert_eq!(r.get_line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.get_line(), None);
|
||||
assert_eq!(r.get_line_or_drain(), Some(b"ijkl".as_ref()));
|
||||
assert_eq!(r.get_line_or_drain(), None);
|
||||
assert_eq!(r.line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.line(), None);
|
||||
assert_eq!(r.line_or_drain(), Some(b"ijkl".as_ref()));
|
||||
assert_eq!(r.line_or_drain(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -324,10 +324,10 @@ mod tests {
|
|||
r.push(Vec::from(b"k".as_ref()));
|
||||
r.push(Vec::from(b"l".as_ref()));
|
||||
|
||||
assert_eq!(r.get_line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.get_line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.get_line(), None);
|
||||
assert_eq!(r.get_line_or_drain(), Some(b"ijkl".as_ref()));
|
||||
assert_eq!(r.get_line_or_drain(), None);
|
||||
assert_eq!(r.line(), Some(b"abcd\n".as_ref()));
|
||||
assert_eq!(r.line(), Some(b"efgh\n".as_ref()));
|
||||
assert_eq!(r.line(), None);
|
||||
assert_eq!(r.line_or_drain(), Some(b"ijkl".as_ref()));
|
||||
assert_eq!(r.line_or_drain(), None);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ impl MccEnc {
|
|||
|
||||
let caps = self
|
||||
.sinkpad
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.ok_or(gst::FlowError::NotNegotiated)?;
|
||||
let framerate = match caps
|
||||
.get_structure(0)
|
||||
|
@ -125,17 +125,17 @@ impl MccEnc {
|
|||
if let Some(ref creation_date) = settings.creation_date {
|
||||
let creation_date = Utc
|
||||
.ymd(
|
||||
creation_date.get_year() as i32,
|
||||
creation_date.get_month() as u32,
|
||||
creation_date.get_day_of_month() as u32,
|
||||
creation_date.year() as i32,
|
||||
creation_date.month() as u32,
|
||||
creation_date.day_of_month() as u32,
|
||||
)
|
||||
.and_hms(
|
||||
creation_date.get_hour() as u32,
|
||||
creation_date.get_minute() as u32,
|
||||
creation_date.get_seconds() as u32,
|
||||
creation_date.hour() as u32,
|
||||
creation_date.minute() as u32,
|
||||
creation_date.seconds() as u32,
|
||||
)
|
||||
.with_timezone(&FixedOffset::east(
|
||||
(creation_date.get_utc_offset() / 1_000_000) as i32,
|
||||
(creation_date.utc_offset() / 1_000_000) as i32,
|
||||
));
|
||||
|
||||
let _ = write!(
|
||||
|
@ -287,7 +287,7 @@ impl MccEnc {
|
|||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
let _ = write!(outbuf, "{}\t", meta.get_tc());
|
||||
let _ = write!(outbuf, "{}\t", meta.tc());
|
||||
|
||||
let map = buffer.map_readable().map_err(|_| {
|
||||
gst::element_error!(
|
||||
|
@ -369,7 +369,7 @@ impl MccEnc {
|
|||
|
||||
match event.view() {
|
||||
EventView::Caps(ev) => {
|
||||
let caps = ev.get_caps();
|
||||
let caps = ev.caps();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
let framerate = match s.get_some::<gst::Fraction>("framerate") {
|
||||
Ok(framerate) => framerate,
|
||||
|
@ -381,7 +381,7 @@ impl MccEnc {
|
|||
};
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
if s.get_name() == "closedcaption/x-cea-608" {
|
||||
if s.name() == "closedcaption/x-cea-608" {
|
||||
state.format = Some(Format::Cea608);
|
||||
} else {
|
||||
state.format = Some(Format::Cea708Cdp);
|
||||
|
@ -431,7 +431,7 @@ impl MccEnc {
|
|||
match query.view_mut() {
|
||||
QueryView::Seeking(mut q) => {
|
||||
// We don't support any seeking at all
|
||||
let fmt = q.get_format();
|
||||
let fmt = q.format();
|
||||
q.set(
|
||||
false,
|
||||
gst::GenericFormattedValue::Other(fmt, -1),
|
||||
|
@ -527,7 +527,7 @@ impl ObjectImpl for MccEnc {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"uuid" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.uuid = value.get().expect("type checked upstream");
|
||||
|
@ -541,7 +541,7 @@ impl ObjectImpl for MccEnc {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"uuid" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.uuid.to_value()
|
||||
|
|
|
@ -526,7 +526,7 @@ impl MccParse {
|
|||
|
||||
state.last_timecode = Some(timecode);
|
||||
|
||||
if nsecs >= state.segment.get_start() {
|
||||
if nsecs >= state.segment.start() {
|
||||
state.seeking = false;
|
||||
state.discont = true;
|
||||
state.replay_last_line = true;
|
||||
|
@ -562,8 +562,8 @@ impl MccParse {
|
|||
// Update the last_timecode to the current one
|
||||
state.last_timecode = Some(timecode);
|
||||
|
||||
let send_eos = state.segment.get_stop().is_some()
|
||||
&& buffer.get_pts() + buffer.get_duration() >= state.segment.get_stop();
|
||||
let send_eos = state.segment.stop().is_some()
|
||||
&& buffer.pts() + buffer.duration() >= state.segment.stop();
|
||||
|
||||
// Drop our state mutex while we push out buffers or events
|
||||
drop(state);
|
||||
|
@ -673,7 +673,7 @@ impl MccParse {
|
|||
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
|
||||
}
|
||||
|
||||
let size = match q.get_result().try_into().unwrap() {
|
||||
let size = match q.result().try_into().unwrap() {
|
||||
gst::format::Bytes(Some(size)) => size,
|
||||
gst::format::Bytes(None) => {
|
||||
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
|
||||
|
@ -937,7 +937,7 @@ impl MccParse {
|
|||
_ => {
|
||||
if event.is_sticky()
|
||||
&& !self.srcpad.has_current_caps()
|
||||
&& event.get_type() > gst::EventType::Caps
|
||||
&& event.type_() > gst::EventType::Caps
|
||||
{
|
||||
gst_log!(CAT, obj: pad, "Deferring sticky event until we have caps");
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
@ -984,7 +984,7 @@ impl MccParse {
|
|||
return false;
|
||||
}
|
||||
|
||||
let seek_seqnum = event.get_seqnum();
|
||||
let seek_seqnum = event.seqnum();
|
||||
|
||||
let event = gst::event::FlushStart::builder()
|
||||
.seqnum(seek_seqnum)
|
||||
|
@ -1067,7 +1067,7 @@ impl MccParse {
|
|||
QueryView::Seeking(mut q) => {
|
||||
let state = self.state.lock().unwrap();
|
||||
|
||||
let fmt = q.get_format();
|
||||
let fmt = q.format();
|
||||
|
||||
if fmt == gst::Format::Time {
|
||||
if let Some(pull) = state.pull.as_ref() {
|
||||
|
@ -1086,7 +1086,7 @@ impl MccParse {
|
|||
}
|
||||
QueryView::Position(ref mut q) => {
|
||||
// For Time answer ourselfs, otherwise forward
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
let state = self.state.lock().unwrap();
|
||||
q.set(state.last_position);
|
||||
true
|
||||
|
@ -1097,7 +1097,7 @@ impl MccParse {
|
|||
QueryView::Duration(ref mut q) => {
|
||||
// For Time answer ourselfs, otherwise forward
|
||||
let state = self.state.lock().unwrap();
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
if let Some(pull) = state.pull.as_ref() {
|
||||
if pull.duration.is_some() {
|
||||
q.set(state.pull.as_ref().unwrap().duration);
|
||||
|
|
|
@ -688,7 +688,7 @@ mod tests {
|
|||
|
||||
reader.push(Vec::from(mcc_file.as_ref()));
|
||||
|
||||
while let Some(line) = reader.get_line() {
|
||||
while let Some(line) = reader.line() {
|
||||
let res = match parser.parse_line(line, true) {
|
||||
Ok(res) => res,
|
||||
Err(err) => panic!("Couldn't parse line {}: {:?}", line_cnt, err),
|
||||
|
|
|
@ -78,11 +78,11 @@ impl State {
|
|||
|
||||
assert!(self.internal_buffer.len() < MAXIMUM_PACKETES_PER_LINE);
|
||||
|
||||
if buffer.get_size() != 2 {
|
||||
if buffer.size() != 2 {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
["Wrongly sized CEA608 packet: {}", buffer.get_size()]
|
||||
["Wrongly sized CEA608 packet: {}", buffer.size()]
|
||||
);
|
||||
|
||||
return Err(gst::FlowError::Error);
|
||||
|
@ -105,7 +105,7 @@ impl State {
|
|||
|
||||
gst::FlowError::Error
|
||||
})?
|
||||
.get_tc();
|
||||
.tc();
|
||||
|
||||
if self.expected_timecode.is_none() {
|
||||
self.expected_timecode = Some(timecode.clone());
|
||||
|
@ -173,7 +173,7 @@ impl State {
|
|||
// Checked already before the buffer has been pushed to the
|
||||
// internal_buffer
|
||||
.expect("Buffer without timecode")
|
||||
.get_tc();
|
||||
.tc();
|
||||
|
||||
let _ = write!(outbuf, "{}\t", timecode);
|
||||
line_start = false;
|
||||
|
@ -206,7 +206,7 @@ impl State {
|
|||
first_buf
|
||||
.copy_into(buf_mut, gst::BUFFER_COPY_METADATA, 0, None)
|
||||
.expect("Failed to copy buffer metadata");
|
||||
buf_mut.set_pts(first_buf.get_pts());
|
||||
buf_mut.set_pts(first_buf.pts());
|
||||
buffer
|
||||
};
|
||||
|
||||
|
@ -252,7 +252,7 @@ impl SccEnc {
|
|||
|
||||
match event.view() {
|
||||
EventView::Caps(ev) => {
|
||||
let caps = ev.get_caps();
|
||||
let caps = ev.caps();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
let framerate = match s.get_some::<gst::Fraction>("framerate") {
|
||||
Ok(framerate) => Some(framerate),
|
||||
|
@ -319,7 +319,7 @@ impl SccEnc {
|
|||
match query.view_mut() {
|
||||
QueryView::Seeking(mut q) => {
|
||||
// We don't support any seeking at all
|
||||
let fmt = q.get_format();
|
||||
let fmt = q.format();
|
||||
q.set(
|
||||
false,
|
||||
gst::GenericFormattedValue::Other(fmt, -1),
|
||||
|
|
|
@ -375,7 +375,7 @@ impl SccParse {
|
|||
|
||||
let mut timecode = state.handle_timecode(&tc, framerate, element)?;
|
||||
let start_time = gst::ClockTime::from(timecode.nsec_since_daily_jam());
|
||||
let segment_start = state.segment.get_start();
|
||||
let segment_start = state.segment.start();
|
||||
let clip_buffers = if state.seeking {
|
||||
// If we are in the middle of seeking, check whether this line
|
||||
// contains start frame, and if so, unset seeking flag
|
||||
|
@ -430,7 +430,7 @@ impl SccParse {
|
|||
timecode.increment_frame();
|
||||
|
||||
if clip_buffers {
|
||||
let end_time = buffer.get_pts() + buffer.get_duration();
|
||||
let end_time = buffer.pts() + buffer.duration();
|
||||
if end_time < segment_start {
|
||||
gst_trace!(
|
||||
CAT,
|
||||
|
@ -443,8 +443,8 @@ impl SccParse {
|
|||
}
|
||||
}
|
||||
|
||||
send_eos = state.segment.get_stop().is_some()
|
||||
&& buffer.get_pts() + buffer.get_duration() >= state.segment.get_stop();
|
||||
send_eos = state.segment.stop().is_some()
|
||||
&& buffer.pts() + buffer.duration() >= state.segment.stop();
|
||||
|
||||
let buffers = buffers.get_mut().unwrap();
|
||||
buffers.add(buffer);
|
||||
|
@ -566,7 +566,7 @@ impl SccParse {
|
|||
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
|
||||
}
|
||||
|
||||
let size = match q.get_result().try_into().unwrap() {
|
||||
let size = match q.result().try_into().unwrap() {
|
||||
gst::format::Bytes(Some(size)) => size,
|
||||
gst::format::Bytes(None) => {
|
||||
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
|
||||
|
@ -817,7 +817,7 @@ impl SccParse {
|
|||
_ => {
|
||||
if event.is_sticky()
|
||||
&& !self.srcpad.has_current_caps()
|
||||
&& event.get_type() > gst::EventType::Caps
|
||||
&& event.type_() > gst::EventType::Caps
|
||||
{
|
||||
gst_log!(CAT, obj: pad, "Deferring sticky event until we have caps");
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
@ -864,7 +864,7 @@ impl SccParse {
|
|||
return false;
|
||||
}
|
||||
|
||||
let seek_seqnum = event.get_seqnum();
|
||||
let seek_seqnum = event.seqnum();
|
||||
|
||||
let event = gst::event::FlushStart::builder()
|
||||
.seqnum(seek_seqnum)
|
||||
|
@ -947,7 +947,7 @@ impl SccParse {
|
|||
QueryView::Seeking(mut q) => {
|
||||
let state = self.state.lock().unwrap();
|
||||
|
||||
let fmt = q.get_format();
|
||||
let fmt = q.format();
|
||||
|
||||
if fmt == gst::Format::Time {
|
||||
if let Some(pull) = state.pull.as_ref() {
|
||||
|
@ -966,7 +966,7 @@ impl SccParse {
|
|||
}
|
||||
QueryView::Position(ref mut q) => {
|
||||
// For Time answer ourselfs, otherwise forward
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
let state = self.state.lock().unwrap();
|
||||
q.set(state.last_position);
|
||||
true
|
||||
|
@ -977,7 +977,7 @@ impl SccParse {
|
|||
QueryView::Duration(ref mut q) => {
|
||||
// For Time answer ourselfs, otherwise forward
|
||||
let state = self.state.lock().unwrap();
|
||||
if q.get_format() == gst::Format::Time {
|
||||
if q.format() == gst::Format::Time {
|
||||
if let Some(pull) = state.pull.as_ref() {
|
||||
if pull.duration.is_some() {
|
||||
q.set(state.pull.as_ref().unwrap().duration);
|
||||
|
|
|
@ -346,7 +346,7 @@ mod tests {
|
|||
|
||||
reader.push(Vec::from(scc_file.as_ref()));
|
||||
|
||||
while let Some(line) = reader.get_line() {
|
||||
while let Some(line) = reader.line() {
|
||||
let res = match parser.parse_line(line) {
|
||||
Ok(res) => res,
|
||||
Err(err) => panic!("Couldn't parse line {}: {:?}", line_cnt, err),
|
||||
|
|
|
@ -789,7 +789,7 @@ impl TtToCea608 {
|
|||
element: &super::TtToCea608,
|
||||
buffer: gst::Buffer,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let pts = match buffer.get_pts() {
|
||||
let pts = match buffer.pts() {
|
||||
gst::CLOCK_TIME_NONE => {
|
||||
gst::element_error!(
|
||||
element,
|
||||
|
@ -801,7 +801,7 @@ impl TtToCea608 {
|
|||
pts => Ok(pts),
|
||||
}?;
|
||||
|
||||
let duration = match buffer.get_duration() {
|
||||
let duration = match buffer.duration() {
|
||||
gst::CLOCK_TIME_NONE => {
|
||||
gst::element_error!(
|
||||
element,
|
||||
|
@ -884,8 +884,8 @@ impl TtToCea608 {
|
|||
|
||||
match event.view() {
|
||||
EventView::Caps(e) => {
|
||||
let mut downstream_caps = match self.srcpad.get_allowed_caps() {
|
||||
None => self.srcpad.get_pad_template_caps(),
|
||||
let mut downstream_caps = match self.srcpad.allowed_caps() {
|
||||
None => self.srcpad.pad_template_caps(),
|
||||
Some(caps) => caps,
|
||||
};
|
||||
|
||||
|
@ -906,9 +906,9 @@ impl TtToCea608 {
|
|||
let mut state = self.state.lock().unwrap();
|
||||
state.framerate = s.get_some::<gst::Fraction>("framerate").unwrap();
|
||||
|
||||
let upstream_caps = e.get_caps();
|
||||
let upstream_caps = e.caps();
|
||||
let s = upstream_caps.get_structure(0).unwrap();
|
||||
state.json_input = s.get_name() == "application/x-json";
|
||||
state.json_input = s.name() == "application/x-json";
|
||||
|
||||
gst_debug!(CAT, obj: pad, "Pushing caps {}", caps);
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ impl ObjectImpl for TtToCea608 {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"mode" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.mode = value
|
||||
|
@ -1091,7 +1091,7 @@ impl ObjectImpl for TtToCea608 {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"mode" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.mode.to_value()
|
||||
|
|
|
@ -60,8 +60,8 @@ impl TtToJson {
|
|||
element: &super::TtToJson,
|
||||
buffer: gst::Buffer,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let pts = buffer.get_pts();
|
||||
let duration = buffer.get_duration();
|
||||
let pts = buffer.pts();
|
||||
let duration = buffer.duration();
|
||||
|
||||
let buffer = buffer.into_mapped_buffer_readable().map_err(|_| {
|
||||
gst::element_error!(
|
||||
|
@ -253,7 +253,7 @@ impl ObjectImpl for TtToJson {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"mode" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.mode = value
|
||||
|
@ -265,7 +265,7 @@ impl ObjectImpl for TtToJson {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"mode" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.mode.to_value()
|
||||
|
|
|
@ -70,14 +70,14 @@ fn test_have_cc_data_notify() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", &(500_000_000u64))
|
||||
.unwrap();
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc608"), move |o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
|
@ -85,7 +85,7 @@ fn test_have_cc_data_notify() {
|
|||
o.get_property("cc608").unwrap();
|
||||
});
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc708"), move |o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
|
@ -115,21 +115,21 @@ fn test_cc_data_window() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", &500_000_000u64)
|
||||
.unwrap();
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc608"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
state_guard.cc608_count += 1;
|
||||
});
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc708"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
|
@ -193,21 +193,21 @@ fn test_have_cdp_notify() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", &500_000_000u64)
|
||||
.unwrap();
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc608"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
state_guard.cc608_count += 1;
|
||||
});
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc708"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
|
@ -257,21 +257,18 @@ fn test_malformed_cdp_notify() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.get_element()
|
||||
.unwrap()
|
||||
.set_property("window", &0u64)
|
||||
.unwrap();
|
||||
h.element().unwrap().set_property("window", &0u64).unwrap();
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc608"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
state_guard.cc608_count += 1;
|
||||
});
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc708"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
|
@ -297,21 +294,21 @@ fn test_gap_events() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", &500_000_000u64)
|
||||
.unwrap();
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc608"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
state_guard.cc608_count += 1;
|
||||
});
|
||||
let state_c = state.clone();
|
||||
h.get_element()
|
||||
h.element()
|
||||
.unwrap()
|
||||
.connect_notify(Some("cc708"), move |_o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
|
|
|
@ -68,10 +68,10 @@ fn test_parse() {
|
|||
for (i, e) in expected.iter().enumerate() {
|
||||
let buf = h.try_pull().unwrap();
|
||||
|
||||
assert_eq!(e.0, buf.get_pts(), "Unexpected PTS for {}th buffer", i + 1);
|
||||
assert_eq!(e.0, buf.pts(), "Unexpected PTS for {}th buffer", i + 1);
|
||||
assert_eq!(
|
||||
e.1,
|
||||
buf.get_duration(),
|
||||
buf.duration(),
|
||||
"Unexpected duration for {}th buffer",
|
||||
i + 1
|
||||
);
|
||||
|
@ -83,9 +83,9 @@ fn test_parse() {
|
|||
}
|
||||
|
||||
let caps = h
|
||||
.get_sinkpad()
|
||||
.sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.expect("pad has no caps");
|
||||
assert_eq!(
|
||||
caps,
|
||||
|
|
|
@ -91,7 +91,7 @@ Time Code Rate=30DF\r\n\
|
|||
|
||||
let mut h = gst_check::Harness::new("mccenc");
|
||||
{
|
||||
let enc = h.get_element().expect("could not create encoder");
|
||||
let enc = h.element().expect("could not create encoder");
|
||||
enc.set_property("uuid", &"14720C04-857D-40E2-86FC-F080DE44CE74")
|
||||
.unwrap();
|
||||
enc.set_property(
|
||||
|
@ -132,10 +132,10 @@ Time Code Rate=30DF\r\n\
|
|||
let timecode = buf
|
||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode for buffer")
|
||||
.get_tc();
|
||||
.tc();
|
||||
assert_eq!(timecode, tc);
|
||||
|
||||
let pts = buf.get_pts();
|
||||
let pts = buf.pts();
|
||||
assert_eq!(pts, gst::ClockTime::from_seconds(0));
|
||||
|
||||
let map = buf.map_readable().expect("Couldn't map buffer readable");
|
||||
|
|
|
@ -64,10 +64,10 @@ fn test_parse() {
|
|||
rnd.gen_range(1..=data.len())
|
||||
};
|
||||
let buf = gst::Buffer::from_mut_slice(Vec::from(&data[0..l]));
|
||||
input_len += buf.get_size();
|
||||
input_len += buf.size();
|
||||
assert_eq!(h.push(buf), Ok(gst::FlowSuccess::Ok));
|
||||
while let Some(buf) = h.try_pull() {
|
||||
output_len += buf.get_size();
|
||||
output_len += buf.size();
|
||||
checksum = checksum.wrapping_add(
|
||||
buf.map_readable()
|
||||
.unwrap()
|
||||
|
@ -79,9 +79,9 @@ fn test_parse() {
|
|||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode meta");
|
||||
if let Some(ref timecode) = expected_timecode {
|
||||
assert_eq!(&tc_meta.get_tc(), timecode);
|
||||
assert_eq!(&tc_meta.tc(), timecode);
|
||||
} else {
|
||||
expected_timecode = Some(tc_meta.get_tc());
|
||||
expected_timecode = Some(tc_meta.tc());
|
||||
}
|
||||
if let Some(ref mut tc) = expected_timecode {
|
||||
tc.increment_frame();
|
||||
|
@ -92,7 +92,7 @@ fn test_parse() {
|
|||
|
||||
h.push_event(gst::event::Eos::new());
|
||||
while let Some(buf) = h.try_pull() {
|
||||
output_len += buf.get_size();
|
||||
output_len += buf.size();
|
||||
checksum = checksum.wrapping_add(
|
||||
buf.map_readable()
|
||||
.unwrap()
|
||||
|
@ -104,9 +104,9 @@ fn test_parse() {
|
|||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode meta");
|
||||
if let Some(ref timecode) = expected_timecode {
|
||||
assert_eq!(&tc_meta.get_tc(), timecode);
|
||||
assert_eq!(&tc_meta.tc(), timecode);
|
||||
} else {
|
||||
expected_timecode = Some(tc_meta.get_tc());
|
||||
expected_timecode = Some(tc_meta.tc());
|
||||
}
|
||||
if let Some(ref mut tc) = expected_timecode {
|
||||
tc.increment_frame();
|
||||
|
@ -119,9 +119,9 @@ fn test_parse() {
|
|||
assert_eq!(checksum, 3_988_480);
|
||||
|
||||
let caps = h
|
||||
.get_sinkpad()
|
||||
.sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.expect("pad has no caps");
|
||||
assert_eq!(
|
||||
caps,
|
||||
|
@ -185,7 +185,7 @@ fn test_pull() {
|
|||
|
||||
while h.buffers_in_queue() != 0 {
|
||||
if let Ok(buffer) = h.pull() {
|
||||
let pts = buffer.get_pts();
|
||||
let pts = buffer.pts();
|
||||
assert!(pts > gst::SECOND && pts < 2 * gst::SECOND);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,10 +66,10 @@ fn test_encode_single_packet() {
|
|||
let timecode = buf
|
||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode for buffer")
|
||||
.get_tc();
|
||||
.tc();
|
||||
assert_eq!(timecode, tc);
|
||||
|
||||
let pts = buf.get_pts();
|
||||
let pts = buf.pts();
|
||||
assert_eq!(pts, gst::ClockTime::from_seconds(0));
|
||||
|
||||
let map = buf.map_readable().expect("Couldn't map buffer readable");
|
||||
|
@ -165,10 +165,10 @@ fn test_encode_multiple_packets() {
|
|||
let timecode = buf
|
||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode for buffer")
|
||||
.get_tc();
|
||||
.tc();
|
||||
assert_eq!(timecode, tc1);
|
||||
|
||||
let pts = buf.get_pts();
|
||||
let pts = buf.pts();
|
||||
assert_eq!(pts, gst::ClockTime::from_seconds(0));
|
||||
|
||||
let map = buf.map_readable().expect("Couldn't map buffer readable");
|
||||
|
@ -183,7 +183,7 @@ fn test_encode_multiple_packets() {
|
|||
let timecode = buf
|
||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode for buffer")
|
||||
.get_tc();
|
||||
.tc();
|
||||
assert_eq!(timecode, tc2);
|
||||
|
||||
// let pts = buf.get_pts();
|
||||
|
@ -212,7 +212,7 @@ fn test_encode_multiple_packets() {
|
|||
let timecode = buf
|
||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode for buffer")
|
||||
.get_tc();
|
||||
.tc();
|
||||
assert_eq!(timecode, tc3);
|
||||
|
||||
// let pts = buf.get_pts();
|
||||
|
|
|
@ -65,10 +65,10 @@ fn test_parse() {
|
|||
rnd.gen_range(1..=data.len())
|
||||
};
|
||||
let buf = gst::Buffer::from_mut_slice(Vec::from(&data[0..l]));
|
||||
input_len += buf.get_size();
|
||||
input_len += buf.size();
|
||||
assert_eq!(h.push(buf), Ok(gst::FlowSuccess::Ok));
|
||||
while let Some(buf) = h.try_pull() {
|
||||
output_len += buf.get_size();
|
||||
output_len += buf.size();
|
||||
checksum = checksum.wrapping_add(
|
||||
buf.map_readable()
|
||||
.unwrap()
|
||||
|
@ -81,7 +81,7 @@ fn test_parse() {
|
|||
|
||||
h.push_event(gst::event::Eos::new());
|
||||
while let Some(buf) = h.try_pull() {
|
||||
output_len += buf.get_size();
|
||||
output_len += buf.size();
|
||||
checksum = checksum.wrapping_add(
|
||||
buf.map_readable()
|
||||
.unwrap()
|
||||
|
@ -95,9 +95,9 @@ fn test_parse() {
|
|||
assert_eq!(checksum, 12_554_799);
|
||||
|
||||
let caps = h
|
||||
.get_sinkpad()
|
||||
.sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.expect("pad has no caps");
|
||||
assert_eq!(
|
||||
caps,
|
||||
|
@ -160,7 +160,7 @@ fn test_timecodes() {
|
|||
let buf = gst::Buffer::from_mut_slice(Vec::from(data));
|
||||
assert_eq!(h.push(buf), Ok(gst::FlowSuccess::Ok));
|
||||
while let Some(buf) = h.try_pull() {
|
||||
output_len += buf.get_size();
|
||||
output_len += buf.size();
|
||||
checksum = checksum.wrapping_add(
|
||||
buf.map_readable()
|
||||
.unwrap()
|
||||
|
@ -172,7 +172,7 @@ fn test_timecodes() {
|
|||
let tc = buf
|
||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
||||
.expect("No timecode meta")
|
||||
.get_tc();
|
||||
.tc();
|
||||
|
||||
// if the timecode matches one of expected codes,
|
||||
// pop the valid_timecodes deque and set expected_timecode,
|
||||
|
@ -189,9 +189,9 @@ fn test_timecodes() {
|
|||
assert_eq!(checksum, 174_295);
|
||||
|
||||
let caps = h
|
||||
.get_sinkpad()
|
||||
.sinkpad()
|
||||
.expect("harness has no sinkpad")
|
||||
.get_current_caps()
|
||||
.current_caps()
|
||||
.expect("pad has no caps");
|
||||
assert_eq!(
|
||||
caps,
|
||||
|
@ -255,8 +255,8 @@ fn test_pull() {
|
|||
|
||||
while h.buffers_in_queue() != 0 {
|
||||
if let Ok(buffer) = h.pull() {
|
||||
let pts = buffer.get_pts();
|
||||
let end_time = pts + buffer.get_duration();
|
||||
let pts = buffer.pts();
|
||||
let end_time = pts + buffer.duration();
|
||||
|
||||
assert!(end_time >= 18 * gst::SECOND && pts < 19 * gst::SECOND);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ fn test_one_timed_buffer_and_eos() {
|
|||
|
||||
loop {
|
||||
let outbuf = h.pull().unwrap();
|
||||
if outbuf.get_pts() + outbuf.get_duration() >= gst::SECOND {
|
||||
if outbuf.pts() + outbuf.duration() >= gst::SECOND {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -90,15 +90,10 @@ fn test_one_timed_buffer_and_eos() {
|
|||
for (i, e) in expected.iter().enumerate() {
|
||||
let outbuf = h.try_pull().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
e.0,
|
||||
outbuf.get_pts(),
|
||||
"Unexpected PTS for {}th buffer",
|
||||
i + 1
|
||||
);
|
||||
assert_eq!(e.0, outbuf.pts(), "Unexpected PTS for {}th buffer", i + 1);
|
||||
assert_eq!(
|
||||
e.1,
|
||||
outbuf.get_duration(),
|
||||
outbuf.duration(),
|
||||
"Unexpected duration for {}th buffer",
|
||||
i + 1
|
||||
);
|
||||
|
@ -115,7 +110,7 @@ fn test_one_timed_buffer_and_eos() {
|
|||
loop {
|
||||
let outbuf = h.try_pull().unwrap();
|
||||
let data = outbuf.map_readable().unwrap();
|
||||
if outbuf.get_pts() == 2_200_000_000.into() {
|
||||
if outbuf.pts() == 2_200_000_000.into() {
|
||||
assert_eq!(&*data, &[0x94, 0x2c]);
|
||||
break;
|
||||
} else {
|
||||
|
@ -126,7 +121,7 @@ fn test_one_timed_buffer_and_eos() {
|
|||
assert_eq!(h.events_in_queue() == 1, true);
|
||||
|
||||
let event = h.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::Eos);
|
||||
assert_eq!(event.type_(), gst::EventType::Eos);
|
||||
}
|
||||
|
||||
/* Here we test that the erase_display_memory control code
|
||||
|
@ -155,7 +150,7 @@ fn test_erase_display_memory_non_spliced() {
|
|||
while h.buffers_in_queue() > 0 {
|
||||
let outbuf = h.pull().unwrap();
|
||||
|
||||
if outbuf.get_pts() == 2_200_000_000.into() {
|
||||
if outbuf.pts() == 2_200_000_000.into() {
|
||||
let data = outbuf.map_readable().unwrap();
|
||||
assert_eq!(&*data, &[0x94, 0x2c]);
|
||||
erase_display_buffers += 1;
|
||||
|
@ -193,15 +188,15 @@ fn test_erase_display_memory_spliced() {
|
|||
let outbuf = h.pull().unwrap();
|
||||
|
||||
/* Check that our timestamps are strictly ascending */
|
||||
assert!(outbuf.get_pts() >= prev_pts);
|
||||
assert!(outbuf.pts() >= prev_pts);
|
||||
|
||||
if outbuf.get_pts() == 2_000_000_000.into() {
|
||||
if outbuf.pts() == 2_000_000_000.into() {
|
||||
let data = outbuf.map_readable().unwrap();
|
||||
assert_eq!(&*data, &[0x94, 0x2c]);
|
||||
erase_display_buffers += 1;
|
||||
}
|
||||
|
||||
prev_pts = outbuf.get_pts();
|
||||
prev_pts = outbuf.pts();
|
||||
}
|
||||
|
||||
assert_eq!(erase_display_buffers, 1);
|
||||
|
@ -232,7 +227,7 @@ fn test_output_gaps() {
|
|||
/* Padding */
|
||||
loop {
|
||||
let outbuf = h.pull().unwrap();
|
||||
if outbuf.get_pts() + outbuf.get_duration() >= gst::SECOND {
|
||||
if outbuf.pts() + outbuf.duration() >= gst::SECOND {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -243,7 +238,7 @@ fn test_output_gaps() {
|
|||
/* Hello */
|
||||
loop {
|
||||
let outbuf = h.pull().unwrap();
|
||||
if outbuf.get_pts() + outbuf.get_duration() >= 1_233_333_333.into() {
|
||||
if outbuf.pts() + outbuf.duration() >= 1_233_333_333.into() {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -254,12 +249,12 @@ fn test_output_gaps() {
|
|||
/* Padding */
|
||||
loop {
|
||||
let outbuf = h.pull().unwrap();
|
||||
if outbuf.get_pts() + outbuf.get_duration() >= 3_000_000_000.into() {
|
||||
if outbuf.pts() + outbuf.duration() >= 3_000_000_000.into() {
|
||||
break;
|
||||
}
|
||||
|
||||
let data = outbuf.map_readable().unwrap();
|
||||
if outbuf.get_pts() == 2_200_000_000.into() {
|
||||
if outbuf.pts() == 2_200_000_000.into() {
|
||||
/* Erase display one second after Hello */
|
||||
assert_eq!(&*data, &[0x94, 0x2C]);
|
||||
} else {
|
||||
|
@ -270,7 +265,7 @@ fn test_output_gaps() {
|
|||
/* World */
|
||||
loop {
|
||||
let outbuf = h.pull().unwrap();
|
||||
if outbuf.get_pts() + outbuf.get_duration() >= 3_233_333_333.into() {
|
||||
if outbuf.pts() + outbuf.duration() >= 3_233_333_333.into() {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -281,7 +276,7 @@ fn test_output_gaps() {
|
|||
assert_eq!(h.events_in_queue(), 1);
|
||||
|
||||
let event = h.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::Eos);
|
||||
assert_eq!(event.type_(), gst::EventType::Eos);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -304,7 +299,7 @@ fn test_one_timed_buffer_and_eos_roll_up2() {
|
|||
/* Padding */
|
||||
loop {
|
||||
let outbuf = h.pull().unwrap();
|
||||
if outbuf.get_pts() + outbuf.get_duration() >= gst::SECOND {
|
||||
if outbuf.pts() + outbuf.duration() >= gst::SECOND {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -323,15 +318,10 @@ fn test_one_timed_buffer_and_eos_roll_up2() {
|
|||
for (i, e) in expected.iter().enumerate() {
|
||||
let outbuf = h.try_pull().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
e.0,
|
||||
outbuf.get_pts(),
|
||||
"Unexpected PTS for {}th buffer",
|
||||
i + 1
|
||||
);
|
||||
assert_eq!(e.0, outbuf.pts(), "Unexpected PTS for {}th buffer", i + 1);
|
||||
assert_eq!(
|
||||
e.1,
|
||||
outbuf.get_duration(),
|
||||
outbuf.duration(),
|
||||
"Unexpected duration for {}th buffer",
|
||||
i + 1
|
||||
);
|
||||
|
@ -343,7 +333,7 @@ fn test_one_timed_buffer_and_eos_roll_up2() {
|
|||
/* Padding */
|
||||
loop {
|
||||
let outbuf = h.pull().unwrap();
|
||||
if outbuf.get_pts() + outbuf.get_duration() >= 2 * gst::SECOND {
|
||||
if outbuf.pts() + outbuf.duration() >= 2 * gst::SECOND {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -360,15 +350,10 @@ fn test_one_timed_buffer_and_eos_roll_up2() {
|
|||
for (i, e) in expected.iter().enumerate() {
|
||||
let outbuf = h.try_pull().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
e.0,
|
||||
outbuf.get_pts(),
|
||||
"Unexpected PTS for {}th buffer",
|
||||
i + 1
|
||||
);
|
||||
assert_eq!(e.0, outbuf.pts(), "Unexpected PTS for {}th buffer", i + 1);
|
||||
assert_eq!(
|
||||
e.1,
|
||||
outbuf.get_duration(),
|
||||
outbuf.duration(),
|
||||
"Unexpected duration for {}th buffer",
|
||||
i + 1
|
||||
);
|
||||
|
@ -384,5 +369,5 @@ fn test_one_timed_buffer_and_eos_roll_up2() {
|
|||
assert_eq!(h.events_in_queue(), 1);
|
||||
|
||||
let event = h.pull_event().unwrap();
|
||||
assert_eq!(event.get_type(), gst::EventType::Eos);
|
||||
assert_eq!(event.type_(), gst::EventType::Eos);
|
||||
}
|
||||
|
|
|
@ -118,10 +118,10 @@ impl Dav1dDec {
|
|||
element.set_output_state(format, pic.width(), pic.height(), input_state)
|
||||
}?;
|
||||
element.negotiate(output_state)?;
|
||||
let out_state = element.get_output_state().unwrap();
|
||||
let out_state = element.output_state().unwrap();
|
||||
{
|
||||
let mut negotiation_infos = self.negotiation_infos.lock().unwrap();
|
||||
negotiation_infos.output_info = Some(out_state.get_info());
|
||||
negotiation_infos.output_info = Some(out_state.info());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -138,16 +138,16 @@ impl Dav1dDec {
|
|||
frame: &gst_video::VideoCodecFrame,
|
||||
) -> Result<Vec<(dav1d::Picture, gst_video::VideoFormat)>, gst::FlowError> {
|
||||
let mut decoder = self.decoder.lock().unwrap();
|
||||
let timestamp = match frame.get_dts().0 {
|
||||
let timestamp = match frame.dts().0 {
|
||||
Some(ts) => Some(ts as i64),
|
||||
None => None,
|
||||
};
|
||||
let duration = match frame.get_duration().0 {
|
||||
let duration = match frame.duration().0 {
|
||||
Some(d) => Some(d as i64),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let frame_number = Some(frame.get_system_frame_number() as i64);
|
||||
let frame_number = Some(frame.system_frame_number() as i64);
|
||||
let input_data = input_buffer
|
||||
.map_readable()
|
||||
.map_err(|_| gst::FlowError::Error)?;
|
||||
|
@ -181,7 +181,7 @@ impl Dav1dDec {
|
|||
|
||||
let video_meta_supported = self.negotiation_infos.lock().unwrap().video_meta_supported;
|
||||
|
||||
let info = output_state.get_info();
|
||||
let info = output_state.info();
|
||||
let mut out_buffer = gst::Buffer::new();
|
||||
let mut_buffer = out_buffer.get_mut().unwrap();
|
||||
|
||||
|
@ -222,7 +222,7 @@ impl Dav1dDec {
|
|||
}
|
||||
writable_mem.into_memory()
|
||||
};
|
||||
let mem_size = mem.get_size();
|
||||
let mem_size = mem.size();
|
||||
mut_buffer.append_memory(mem);
|
||||
|
||||
strides.push(src_stride as i32);
|
||||
|
@ -262,7 +262,7 @@ impl Dav1dDec {
|
|||
self.handle_resolution_change(element, &pic, format)?;
|
||||
|
||||
let output_state = element
|
||||
.get_output_state()
|
||||
.output_state()
|
||||
.expect("Output state not set. Shouldn't happen!");
|
||||
let offset = pic.offset() as i32;
|
||||
if let Some(mut frame) = element.get_frame(offset) {
|
||||
|
@ -278,18 +278,18 @@ impl Dav1dDec {
|
|||
|
||||
fn drop_decoded_pictures(&self) {
|
||||
let mut decoder = self.decoder.lock().unwrap();
|
||||
while let Ok(pic) = decoder.get_picture() {
|
||||
while let Ok(pic) = decoder.picture() {
|
||||
gst_debug!(CAT, "Dropping picture");
|
||||
drop(pic);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_pending_pictures(
|
||||
fn pending_pictures(
|
||||
&self,
|
||||
) -> Result<Vec<(dav1d::Picture, gst_video::VideoFormat)>, gst::FlowError> {
|
||||
let mut decoder = self.decoder.lock().unwrap();
|
||||
let mut pictures = vec![];
|
||||
while let Ok(pic) = decoder.get_picture() {
|
||||
while let Ok(pic) = decoder.picture() {
|
||||
let format = self.gst_video_format_from_dav1d_picture(&pic);
|
||||
if format == gst_video::VideoFormat::Unknown {
|
||||
return Err(gst::FlowError::NotNegotiated);
|
||||
|
@ -303,7 +303,7 @@ impl Dav1dDec {
|
|||
&self,
|
||||
element: &super::Dav1dDec,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
for (pic, format) in self.get_pending_pictures()? {
|
||||
for (pic, format) in self.pending_pictures()? {
|
||||
self.handle_picture(element, &pic, format)?;
|
||||
}
|
||||
Ok(gst::FlowSuccess::Ok)
|
||||
|
@ -438,9 +438,7 @@ impl VideoDecoderImpl for Dav1dDec {
|
|||
element: &Self::Type,
|
||||
frame: gst_video::VideoCodecFrame,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let input_buffer = frame
|
||||
.get_input_buffer()
|
||||
.expect("frame without input buffer");
|
||||
let input_buffer = frame.input_buffer().expect("frame without input buffer");
|
||||
for (pic, format) in self.decode(input_buffer, &frame)? {
|
||||
self.handle_picture(element, &pic, format)?;
|
||||
}
|
||||
|
@ -479,9 +477,9 @@ impl VideoDecoderImpl for Dav1dDec {
|
|||
.find_allocation_meta::<gst_video::VideoMeta>()
|
||||
.is_some()
|
||||
{
|
||||
let pools = allocation.get_allocation_pools();
|
||||
let pools = allocation.allocation_pools();
|
||||
if let Some((Some(ref pool), _, _, _)) = pools.first() {
|
||||
let mut config = pool.get_config();
|
||||
let mut config = pool.config();
|
||||
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
|
||||
pool.set_config(config)
|
||||
.map_err(|e| gst::error_msg!(gst::CoreError::Negotiation, [&e.message]))?;
|
||||
|
|
|
@ -405,9 +405,9 @@ impl FlvDemux {
|
|||
|
||||
match query.view_mut() {
|
||||
QueryView::Position(ref mut q) => {
|
||||
let fmt = q.get_format();
|
||||
let fmt = q.format();
|
||||
if fmt == gst::Format::Time {
|
||||
if self.sinkpad.peer_query(q.get_mut_query()) {
|
||||
if self.sinkpad.peer_query(q.query_mut()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -424,9 +424,9 @@ impl FlvDemux {
|
|||
}
|
||||
}
|
||||
QueryView::Duration(ref mut q) => {
|
||||
let fmt = q.get_format();
|
||||
let fmt = q.format();
|
||||
if fmt == gst::Format::Time {
|
||||
if self.sinkpad.peer_query(q.get_mut_query()) {
|
||||
if self.sinkpad.peer_query(q.query_mut()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,7 @@ impl FlvDemux {
|
|||
}
|
||||
|
||||
fn create_srcpad(&self, element: &super::FlvDemux, name: &str, caps: &gst::Caps) -> gst::Pad {
|
||||
let templ = element.get_element_class().get_pad_template(name).unwrap();
|
||||
let templ = element.element_class().get_pad_template(name).unwrap();
|
||||
let srcpad = gst::Pad::builder_with_template(&templ, Some(name))
|
||||
.event_function(|pad, parent, event| {
|
||||
FlvDemux::catch_panic_pad_function(
|
||||
|
@ -1196,11 +1196,11 @@ impl StreamingState {
|
|||
}
|
||||
|
||||
fn update_position(&mut self, buffer: &gst::Buffer) {
|
||||
if buffer.get_pts().is_some() {
|
||||
let pts = buffer.get_pts();
|
||||
if buffer.pts().is_some() {
|
||||
let pts = buffer.pts();
|
||||
self.last_position = self.last_position.max(pts).unwrap_or(pts);
|
||||
} else if buffer.get_dts().is_some() {
|
||||
let dts = buffer.get_dts();
|
||||
} else if buffer.dts().is_some() {
|
||||
let dts = buffer.dts();
|
||||
self.last_position = self.last_position.max(dts).unwrap_or(dts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ fn main() {
|
|||
gstgif::plugin_register_static().expect("Failed to register gif plugin");
|
||||
|
||||
let pipeline = gst::parse_launch(ENCODE_PIPELINE).unwrap();
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
let bus = pipeline.bus().unwrap();
|
||||
|
||||
pipeline
|
||||
.set_state(gst::State::Playing)
|
||||
|
@ -38,9 +38,9 @@ fn main() {
|
|||
MessageView::Error(err) => {
|
||||
println!(
|
||||
"Error from {:?}: {} ({:?})",
|
||||
err.get_src().map(|s| s.get_path_string()),
|
||||
err.get_error(),
|
||||
err.get_debug()
|
||||
err.src().map(|s| s.path_string()),
|
||||
err.error(),
|
||||
err.debug()
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ impl ObjectImpl for GifEnc {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"repeat" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.repeat = value.get_some().expect("type checked upstream");
|
||||
|
@ -171,7 +171,7 @@ impl ObjectImpl for GifEnc {
|
|||
}
|
||||
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"repeat" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.repeat.to_value()
|
||||
|
@ -260,7 +260,7 @@ impl VideoEncoderImpl for GifEnc {
|
|||
self.flush_encoder(element)
|
||||
.map_err(|_| gst::loggable_error!(CAT, "Failed to drain"))?;
|
||||
|
||||
let video_info = state.get_info();
|
||||
let video_info = state.info();
|
||||
gst_debug!(CAT, obj: element, "Setting format {:?}", video_info);
|
||||
|
||||
{
|
||||
|
@ -296,12 +296,10 @@ impl VideoEncoderImpl for GifEnc {
|
|||
CAT,
|
||||
obj: element,
|
||||
"Sending frame {}",
|
||||
frame.get_system_frame_number()
|
||||
frame.system_frame_number()
|
||||
);
|
||||
|
||||
let input_buffer = frame
|
||||
.get_input_buffer()
|
||||
.expect("frame without input buffer");
|
||||
let input_buffer = frame.input_buffer().expect("frame without input buffer");
|
||||
|
||||
{
|
||||
let in_frame = gst_video::VideoFrameRef::from_buffer_ref_readable(
|
||||
|
@ -323,12 +321,12 @@ impl VideoEncoderImpl for GifEnc {
|
|||
// Calculate delay to new frame by calculating the difference between the current actual
|
||||
// presentation timestamp of the last frame within the gif, and the pts of the new frame.
|
||||
// This results in variable frame delays in the gif - but an overall constant fps.
|
||||
state.last_actual_pts = in_frame.buffer().get_pts();
|
||||
state.last_actual_pts = in_frame.buffer().pts();
|
||||
if state.gif_pts.is_none() {
|
||||
// First frame: use pts of first input frame as origin
|
||||
state.gif_pts = Some(in_frame.buffer().get_pts());
|
||||
state.gif_pts = Some(in_frame.buffer().pts());
|
||||
}
|
||||
let frame_delay = in_frame.buffer().get_pts() - state.gif_pts.unwrap();
|
||||
let frame_delay = in_frame.buffer().pts() - state.gif_pts.unwrap();
|
||||
if frame_delay.is_none() {
|
||||
gst::element_error!(
|
||||
element,
|
||||
|
|
|
@ -63,6 +63,6 @@ fn test_encode(video_info: &gst_video::VideoInfo) {
|
|||
// last frame is the GIF trailer
|
||||
let buffer = h.pull().unwrap();
|
||||
// Currently, every frame should be a full frame
|
||||
assert!(!buffer.get_flags().contains(gst::BufferFlags::DELTA_UNIT))
|
||||
assert!(!buffer.flags().contains(gst::BufferFlags::DELTA_UNIT))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ impl ObjectImpl for HsvDetector {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"hue-ref" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let hue_ref = value.get_some().expect("type checked upstream");
|
||||
|
@ -233,7 +233,7 @@ impl ObjectImpl for HsvDetector {
|
|||
// Called whenever a value of a property is read. It can be called
|
||||
// at any time from any thread.
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"hue-ref" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.hue_ref.to_value()
|
||||
|
|
|
@ -139,7 +139,7 @@ impl ObjectImpl for HsvFilter {
|
|||
value: &glib::Value,
|
||||
pspec: &glib::ParamSpec,
|
||||
) {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"hue-shift" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
let hue_shift = value.get_some().expect("type checked upstream");
|
||||
|
@ -207,7 +207,7 @@ impl ObjectImpl for HsvFilter {
|
|||
// Called whenever a value of a property is read. It can be called
|
||||
// at any time from any thread.
|
||||
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.get_name() {
|
||||
match pspec.name() {
|
||||
"hue-shift" => {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
settings.hue_shift.to_value()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue