mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-21 07:06:19 +00:00
fix-getters-calls 0.3.0 pass
This commit is contained in:
parent
27bc5c89ca
commit
67c5871957
94 changed files with 269 additions and 276 deletions
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1710,7 +1710,7 @@ impl ObjectSubclass for AudioLoudNorm {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
Self::catch_panic_pad_function(
|
Self::catch_panic_pad_function(
|
||||||
|
@ -1729,7 +1729,7 @@ impl ObjectSubclass for AudioLoudNorm {
|
||||||
.flags(gst::PadFlags::PROXY_CAPS)
|
.flags(gst::PadFlags::PROXY_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.query_function(|pad, parent, query| {
|
.query_function(|pad, parent, query| {
|
||||||
Self::catch_panic_pad_function(
|
Self::catch_panic_pad_function(
|
||||||
|
|
|
@ -154,7 +154,7 @@ impl AudioRNNoise {
|
||||||
state.process(in_data, &mut out_data);
|
state.process(in_data, &mut out_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
let srcpad = element.get_static_pad("src").unwrap();
|
let srcpad = element.static_pad("src").unwrap();
|
||||||
srcpad.push(buffer)
|
srcpad.push(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ impl BaseTransformImpl for AudioRNNoise {
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if direction == gst::PadDirection::Src {
|
if direction == gst::PadDirection::Src {
|
||||||
if let gst::QueryView::Latency(ref mut q) = query.view_mut() {
|
if let gst::QueryView::Latency(ref mut q) = query.view_mut() {
|
||||||
let sink_pad = element.get_static_pad("sink").expect("Sink pad not found");
|
let sink_pad = element.static_pad("sink").expect("Sink pad not found");
|
||||||
let mut upstream_query = gst::query::Latency::new();
|
let mut upstream_query = gst::query::Latency::new();
|
||||||
if sink_pad.peer_query(&mut upstream_query) {
|
if sink_pad.peer_query(&mut upstream_query) {
|
||||||
let (live, mut min, mut max) = upstream_query.result();
|
let (live, mut min, mut max) = upstream_query.result();
|
||||||
|
|
|
@ -70,7 +70,7 @@ fn run_test(
|
||||||
.downcast::<gst::Pipeline>()
|
.downcast::<gst::Pipeline>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let sink = pipeline
|
let sink = pipeline
|
||||||
.get_by_name("sink")
|
.by_name("sink")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<gst_app::AppSink>()
|
.downcast::<gst_app::AppSink>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl AudioDecoderImpl for ClaxonDec {
|
||||||
let mut streaminfo: Option<claxon::metadata::StreamInfo> = None;
|
let mut streaminfo: Option<claxon::metadata::StreamInfo> = None;
|
||||||
let mut audio_info: Option<gst_audio::AudioInfo> = None;
|
let mut audio_info: Option<gst_audio::AudioInfo> = None;
|
||||||
|
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
if let Ok(Some(streamheaders)) = s.get_optional::<gst::Array>("streamheader") {
|
if let Ok(Some(streamheaders)) = s.get_optional::<gst::Array>("streamheader") {
|
||||||
let streamheaders = streamheaders.as_slice();
|
let streamheaders = streamheaders.as_slice();
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ impl AudioDecoderImpl for ClaxonDec {
|
||||||
|
|
||||||
if inmap[0..7] != [0x7f, b'F', b'L', b'A', b'C', 0x01, 0x00] {
|
if inmap[0..7] != [0x7f, b'F', b'L', b'A', b'C', 0x01, 0x00] {
|
||||||
gst_debug!(CAT, obj: element, "Unknown streamheader format");
|
gst_debug!(CAT, obj: element, "Unknown streamheader format");
|
||||||
} else if let Ok(tstreaminfo) = get_claxon_streaminfo(&inmap[13..]) {
|
} else if let Ok(tstreaminfo) = claxon_streaminfo(&inmap[13..]) {
|
||||||
if let Ok(taudio_info) = get_gstaudioinfo(tstreaminfo) {
|
if let Ok(taudio_info) = gstaudioinfo(tstreaminfo) {
|
||||||
// To speed up negotiation
|
// To speed up negotiation
|
||||||
if element.set_output_format(&taudio_info).is_err()
|
if element.set_output_format(&taudio_info).is_err()
|
||||||
|| element.negotiate().is_err()
|
|| element.negotiate().is_err()
|
||||||
|
@ -224,12 +224,12 @@ impl ClaxonDec {
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
indata: &[u8],
|
indata: &[u8],
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let streaminfo = get_claxon_streaminfo(indata).map_err(|e| {
|
let streaminfo = claxon_streaminfo(indata).map_err(|e| {
|
||||||
gst::element_error!(element, gst::StreamError::Decode, [e]);
|
gst::element_error!(element, gst::StreamError::Decode, [e]);
|
||||||
gst::FlowError::Error
|
gst::FlowError::Error
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let audio_info = get_gstaudioinfo(streaminfo).map_err(|e| {
|
let audio_info = gstaudioinfo(streaminfo).map_err(|e| {
|
||||||
gst::element_error!(element, gst::StreamError::Decode, [&e]);
|
gst::element_error!(element, gst::StreamError::Decode, [&e]);
|
||||||
gst::FlowError::Error
|
gst::FlowError::Error
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,8 +128,8 @@ impl State {
|
||||||
|
|
||||||
impl CsoundFilter {
|
impl CsoundFilter {
|
||||||
fn process(&self, csound: &mut Csound, idata: &[f64], odata: &mut [f64]) -> bool {
|
fn process(&self, csound: &mut Csound, idata: &[f64], odata: &mut [f64]) -> bool {
|
||||||
let spin = csound.get_spin().unwrap();
|
let spin = csound.spin().unwrap();
|
||||||
let spout = csound.get_spout().unwrap();
|
let spout = csound.spout().unwrap();
|
||||||
|
|
||||||
let in_chunks = idata.chunks_exact(spin.len());
|
let in_chunks = idata.chunks_exact(spin.len());
|
||||||
let out_chuncks = odata.chunks_exact_mut(spout.len());
|
let out_chuncks = odata.chunks_exact_mut(spout.len());
|
||||||
|
@ -190,8 +190,8 @@ impl CsoundFilter {
|
||||||
return Ok(gst::FlowSuccess::Ok);
|
return Ok(gst::FlowSuccess::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut spin = csound.get_spin().unwrap();
|
let mut spin = csound.spin().unwrap();
|
||||||
let spout = csound.get_spout().unwrap();
|
let spout = csound.spout().unwrap();
|
||||||
|
|
||||||
let out_bytes =
|
let out_bytes =
|
||||||
(avail / state.in_info.channels() as usize) * state.out_info.channels() as usize;
|
(avail / state.in_info.channels() as usize) * state.out_info.channels() as usize;
|
||||||
|
@ -214,7 +214,7 @@ impl CsoundFilter {
|
||||||
buffer_mut.set_pts(pts);
|
buffer_mut.set_pts(pts);
|
||||||
buffer_mut.set_duration(duration);
|
buffer_mut.set_duration(duration);
|
||||||
|
|
||||||
let srcpad = element.get_static_pad("src").unwrap();
|
let srcpad = element.static_pad("src").unwrap();
|
||||||
|
|
||||||
let adapter_map = state.adapter.map(avail).unwrap();
|
let adapter_map = state.adapter.map(avail).unwrap();
|
||||||
let data = adapter_map
|
let data = adapter_map
|
||||||
|
@ -271,7 +271,7 @@ impl CsoundFilter {
|
||||||
|
|
||||||
// Get the required amount of bytes to be read from
|
// Get the required amount of bytes to be read from
|
||||||
// the adapter to fill an ouput buffer of size output_size
|
// the adapter to fill an ouput buffer of size output_size
|
||||||
let bytes_to_read = state.get_bytes_to_read(output_size);
|
let bytes_to_read = state.bytes_to_read(output_size);
|
||||||
|
|
||||||
let indata = state
|
let indata = state
|
||||||
.adapter
|
.adapter
|
||||||
|
@ -547,7 +547,7 @@ impl BaseTransformImpl for CsoundFilter {
|
||||||
if compiled {
|
if compiled {
|
||||||
let csound = self.csound.lock().unwrap();
|
let csound = self.csound.lock().unwrap();
|
||||||
// Use the sample rate and channels configured in the csound score
|
// 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 ichannels = csound.input_channels() as i32;
|
||||||
let ochannels = csound.output_channels() as i32;
|
let ochannels = csound.output_channels() as i32;
|
||||||
for s in new_caps.make_mut().iter_mut() {
|
for s in new_caps.make_mut().iter_mut() {
|
||||||
|
@ -608,7 +608,7 @@ impl BaseTransformImpl for CsoundFilter {
|
||||||
let rate = in_info.rate();
|
let rate = in_info.rate();
|
||||||
|
|
||||||
// Check if the negotiated caps are the right ones
|
// Check if the negotiated caps are the right ones
|
||||||
if rate != out_info.rate() || rate != csound.get_sample_rate() as u32 {
|
if rate != out_info.rate() || rate != csound.sample_rate() as u32 {
|
||||||
return Err(loggable_error!(
|
return Err(loggable_error!(
|
||||||
CAT,
|
CAT,
|
||||||
"Failed to negotiate caps: invalid sample rate {}",
|
"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();
|
let adapter = gst_base::UniqueAdapter::new();
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ impl AudioDecoderImpl for LewtonDec {
|
||||||
|
|
||||||
let mut state = state_guard.as_mut().unwrap();
|
let mut state = state_guard.as_mut().unwrap();
|
||||||
|
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
if let Ok(Some(streamheaders)) = s.get_optional::<gst::Array>("streamheader") {
|
if let Ok(Some(streamheaders)) = s.get_optional::<gst::Array>("streamheader") {
|
||||||
let streamheaders = streamheaders.as_slice();
|
let streamheaders = streamheaders.as_slice();
|
||||||
if streamheaders.len() < 3 {
|
if streamheaders.len() < 3 {
|
||||||
|
@ -336,7 +336,7 @@ impl LewtonDec {
|
||||||
audio_info = audio_info.positions(to);
|
audio_info = audio_info.positions(to);
|
||||||
|
|
||||||
let mut map = [0; 8];
|
let mut map = [0; 8];
|
||||||
if gst_audio::get_channel_reorder_map(from, to, &mut map[..channels]).is_err() {
|
if gst_audio::channel_reorder_map(from, to, &mut map[..channels]).is_err() {
|
||||||
gst_error!(
|
gst_error!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: element,
|
obj: element,
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
.required(true)
|
.required(true)
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.matches();
|
||||||
|
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
gstsodium::plugin_register_static().expect("Failed to register sodium plugin");
|
gstsodium::plugin_register_static().expect("Failed to register sodium plugin");
|
||||||
|
|
|
@ -68,7 +68,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
.required(true)
|
.required(true)
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.matches();
|
||||||
|
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
gstsodium::plugin_register_static().expect("Failed to register sodium plugin");
|
gstsodium::plugin_register_static().expect("Failed to register sodium plugin");
|
||||||
|
|
|
@ -92,7 +92,7 @@ fn main() {
|
||||||
.short("j")
|
.short("j")
|
||||||
.help("Write a JSON file instead of a key.prv/key.pub pair"),
|
.help("Write a JSON file instead of a key.prv/key.pub pair"),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.matches();
|
||||||
|
|
||||||
let keys = Keys::new();
|
let keys = Keys::new();
|
||||||
|
|
||||||
|
|
|
@ -540,7 +540,7 @@ impl Decrypter {
|
||||||
state.decrypt_into_adapter(element, &self.srcpad, &pulled_buffer, chunk_index)?;
|
state.decrypt_into_adapter(element, &self.srcpad, &pulled_buffer, chunk_index)?;
|
||||||
|
|
||||||
let adapter_offset = pull_offset as usize;
|
let adapter_offset = pull_offset as usize;
|
||||||
state.get_requested_buffer(&self.srcpad, buffer, requested_size, adapter_offset)
|
state.requested_buffer(&self.srcpad, buffer, requested_size, adapter_offset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,16 +551,16 @@ impl ObjectSubclass for Decrypter {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::from_template(&templ, Some("sink"));
|
let sinkpad = gst::Pad::from_template(&templ, Some("sink"));
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.getrange_function(|pad, parent, offset, buffer, size| {
|
.getrange_function(|pad, parent, offset, buffer, size| {
|
||||||
Decrypter::catch_panic_pad_function(
|
Decrypter::catch_panic_pad_function(
|
||||||
parent,
|
parent,
|
||||||
|| Err(gst::FlowError::Error),
|
|| Err(gst::FlowError::Error),
|
||||||
|decrypter, element| decrypter.get_range(pad, element, offset, buffer, size),
|
|decrypter, element| decrypter.range(pad, element, offset, buffer, size),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.activatemode_function(|pad, parent, mode, active| {
|
.activatemode_function(|pad, parent, mode, active| {
|
||||||
|
|
|
@ -341,7 +341,7 @@ impl ObjectSubclass for Encrypter {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
Encrypter::catch_panic_pad_function(
|
Encrypter::catch_panic_pad_function(
|
||||||
|
@ -359,7 +359,7 @@ impl ObjectSubclass for Encrypter {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.query_function(|pad, parent, query| {
|
.query_function(|pad, parent, query| {
|
||||||
Encrypter::catch_panic_pad_function(
|
Encrypter::catch_panic_pad_function(
|
||||||
|
|
|
@ -184,7 +184,7 @@ fn test_pull_range() {
|
||||||
pipeline
|
pipeline
|
||||||
.set_state(gst::State::Ready)
|
.set_state(gst::State::Ready)
|
||||||
.expect("Unable to set the pipeline to the `Playing` state");
|
.expect("Unable to set the pipeline to the `Playing` state");
|
||||||
let srcpad = dec.get_static_pad("src").unwrap();
|
let srcpad = dec.static_pad("src").unwrap();
|
||||||
srcpad.activate_mode(gst::PadMode::Pull, true).unwrap();
|
srcpad.activate_mode(gst::PadMode::Pull, true).unwrap();
|
||||||
|
|
||||||
pipeline
|
pipeline
|
||||||
|
@ -213,7 +213,7 @@ fn test_pull_range() {
|
||||||
53, 37, 220, 28, 225, 35, 16, 243, 140, 220, 4, 192, 2, 64, 14, 3, 144, 203, 67, 208, 244,
|
53, 37, 220, 28, 225, 35, 16, 243, 140, 220, 4, 192, 2, 64, 14, 3, 144, 203, 67, 208, 244,
|
||||||
61, 70, 175, 103, 127, 28, 0,
|
61, 70, 175, 103, 127, 28, 0,
|
||||||
];
|
];
|
||||||
let buf1 = srcpad.get_range(0, 50).unwrap();
|
let buf1 = srcpad.range(0, 50).unwrap();
|
||||||
assert_eq!(buf1.size(), 50);
|
assert_eq!(buf1.size(), 50);
|
||||||
let map1 = buf1.map_readable().unwrap();
|
let map1 = buf1.map_readable().unwrap();
|
||||||
assert_eq!(&map1[..], &expected_array_1[..]);
|
assert_eq!(&map1[..], &expected_array_1[..]);
|
||||||
|
@ -225,7 +225,7 @@ fn test_pull_range() {
|
||||||
207, 192, 0, 0, 3, 113, 195, 199, 255, 255, 254, 97, 225, 225, 231, 160, 0, 0, 49, 24, 120,
|
207, 192, 0, 0, 3, 113, 195, 199, 255, 255, 254, 97, 225, 225, 231, 160, 0, 0, 49, 24, 120,
|
||||||
120, 121, 232, 0, 0, 12, 252, 195, 195, 199, 128, 0, 0, 0,
|
120, 121, 232, 0, 0, 12, 252, 195, 195, 199, 128, 0, 0, 0,
|
||||||
];
|
];
|
||||||
let buf2 = srcpad.get_range(0, 100).unwrap();
|
let buf2 = srcpad.range(0, 100).unwrap();
|
||||||
assert_eq!(buf2.size(), 100);
|
assert_eq!(buf2.size(), 100);
|
||||||
let map2 = buf2.map_readable().unwrap();
|
let map2 = buf2.map_readable().unwrap();
|
||||||
assert_eq!(&map2[..], &expected_array_2[..]);
|
assert_eq!(&map2[..], &expected_array_2[..]);
|
||||||
|
@ -235,37 +235,37 @@ fn test_pull_range() {
|
||||||
assert_eq!(&map1[..], &map2[..map1.len()]);
|
assert_eq!(&map1[..], &map2[..map1.len()]);
|
||||||
|
|
||||||
// request in the middle of a block
|
// request in the middle of a block
|
||||||
let buf = srcpad.get_range(853, 100).unwrap();
|
let buf = srcpad.range(853, 100).unwrap();
|
||||||
// result size doesn't include the block macs,
|
// result size doesn't include the block macs,
|
||||||
assert_eq!(buf.size(), 100);
|
assert_eq!(buf.size(), 100);
|
||||||
|
|
||||||
// read till eos, this also will pull multiple blocks
|
// read till eos, this also will pull multiple blocks
|
||||||
let buf = srcpad.get_range(853, 42000).unwrap();
|
let buf = srcpad.range(853, 42000).unwrap();
|
||||||
// 6031 (size of file) - 883 (requersted offset) - headers size - (numbler of blcks * block mac)
|
// 6031 (size of file) - 883 (requersted offset) - headers size - (numbler of blcks * block mac)
|
||||||
assert_eq!(buf.size(), 5054);
|
assert_eq!(buf.size(), 5054);
|
||||||
|
|
||||||
// read 0 bytes from the start
|
// read 0 bytes from the start
|
||||||
let buf = srcpad.get_range(0, 0).unwrap();
|
let buf = srcpad.range(0, 0).unwrap();
|
||||||
assert_eq!(buf.size(), 0);
|
assert_eq!(buf.size(), 0);
|
||||||
|
|
||||||
// read 0 bytes somewhere in the middle
|
// read 0 bytes somewhere in the middle
|
||||||
let buf = srcpad.get_range(4242, 0).unwrap();
|
let buf = srcpad.range(4242, 0).unwrap();
|
||||||
assert_eq!(buf.size(), 0);
|
assert_eq!(buf.size(), 0);
|
||||||
|
|
||||||
// read 0 bytes to eos
|
// read 0 bytes to eos
|
||||||
let res = srcpad.get_range(6003, 0);
|
let res = srcpad.range(6003, 0);
|
||||||
assert_eq!(res, Err(gst::FlowError::Eos));
|
assert_eq!(res, Err(gst::FlowError::Eos));
|
||||||
|
|
||||||
// read 100 bytes at eos
|
// read 100 bytes at eos
|
||||||
let res = srcpad.get_range(6003, 100);
|
let res = srcpad.range(6003, 100);
|
||||||
assert_eq!(res, Err(gst::FlowError::Eos));
|
assert_eq!(res, Err(gst::FlowError::Eos));
|
||||||
|
|
||||||
// read 100 bytes way past eos
|
// read 100 bytes way past eos
|
||||||
let res = srcpad.get_range(424_242, 100);
|
let res = srcpad.range(424_242, 100);
|
||||||
assert_eq!(res, Err(gst::FlowError::Eos));
|
assert_eq!(res, Err(gst::FlowError::Eos));
|
||||||
|
|
||||||
// read 10 bytes at eos -1, should return a single byte
|
// read 10 bytes at eos -1, should return a single byte
|
||||||
let buf = srcpad.get_range(5906, 10).unwrap();
|
let buf = srcpad.range(5906, 10).unwrap();
|
||||||
assert_eq!(buf.size(), 1);
|
assert_eq!(buf.size(), 1);
|
||||||
|
|
||||||
pipeline
|
pipeline
|
||||||
|
|
|
@ -82,8 +82,8 @@ fn encrypt_file() {
|
||||||
.expect("failed to set property");
|
.expect("failed to set property");
|
||||||
|
|
||||||
let mut h = gst_check::Harness::with_element(&enc, None, None);
|
let mut h = gst_check::Harness::with_element(&enc, None, None);
|
||||||
h.add_element_src_pad(&enc.get_static_pad("src").expect("failed to get src pad"));
|
h.add_element_src_pad(&enc.static_pad("src").expect("failed to get src pad"));
|
||||||
h.add_element_sink_pad(&enc.get_static_pad("sink").expect("failed to get src pad"));
|
h.add_element_sink_pad(&enc.static_pad("sink").expect("failed to get src pad"));
|
||||||
h.set_src_caps_str("application/x-sodium-encrypted");
|
h.set_src_caps_str("application/x-sodium-encrypted");
|
||||||
|
|
||||||
let buf = gst::Buffer::from_mut_slice(Vec::from(&input[..]));
|
let buf = gst::Buffer::from_mut_slice(Vec::from(&input[..]));
|
||||||
|
|
|
@ -27,5 +27,5 @@ fn main() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ fn main() {
|
||||||
sink.set_property("async", &false).unwrap();
|
sink.set_property("async", &false).unwrap();
|
||||||
|
|
||||||
let counter_clone = Arc::clone(&counter);
|
let counter_clone = Arc::clone(&counter);
|
||||||
sink.get_static_pad("sink").unwrap().add_probe(
|
sink.static_pad("sink").unwrap().add_probe(
|
||||||
gst::PadProbeType::BUFFER,
|
gst::PadProbeType::BUFFER,
|
||||||
move |_pad, _probe_info| {
|
move |_pad, _probe_info| {
|
||||||
let _ = counter_clone.fetch_add(1, Ordering::SeqCst);
|
let _ = counter_clone.fetch_add(1, Ordering::SeqCst);
|
||||||
|
|
|
@ -514,7 +514,7 @@ impl ObjectSubclass for AppSrc {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
src_pad_handler.clone(),
|
src_pad_handler.clone(),
|
||||||
),
|
),
|
||||||
src_pad_handler,
|
src_pad_handler,
|
||||||
|
|
|
@ -399,7 +399,7 @@ impl ObjectSubclass for InputSelector {
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
InputSelectorPadSrcHandler,
|
InputSelectorPadSrcHandler,
|
||||||
),
|
),
|
||||||
state: Mutex::new(State::default()),
|
state: Mutex::new(State::default()),
|
||||||
|
|
|
@ -179,7 +179,7 @@ impl SinkHandler {
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
pt: u8,
|
pt: u8,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let s = caps.get_structure(0).ok_or(gst::FlowError::Error)?;
|
let s = caps.structure(0).ok_or(gst::FlowError::Error)?;
|
||||||
|
|
||||||
gst_info!(CAT, obj: element, "Parsing {:?}", caps);
|
gst_info!(CAT, obj: element, "Parsing {:?}", caps);
|
||||||
|
|
||||||
|
@ -389,12 +389,8 @@ impl SinkHandler {
|
||||||
|
|
||||||
inner.packet_rate_ctx.update(seq, rtptime);
|
inner.packet_rate_ctx.update(seq, rtptime);
|
||||||
|
|
||||||
let max_dropout = inner
|
let max_dropout = inner.packet_rate_ctx.max_dropout(max_dropout_time as i32);
|
||||||
.packet_rate_ctx
|
let max_misorder = inner.packet_rate_ctx.max_dropout(max_misorder_time as i32);
|
||||||
.get_max_dropout(max_dropout_time as i32);
|
|
||||||
let max_misorder = inner
|
|
||||||
.packet_rate_ctx
|
|
||||||
.get_max_dropout(max_misorder_time as i32);
|
|
||||||
|
|
||||||
pts = state.jbuf.borrow().calculate_pts(
|
pts = state.jbuf.borrow().calculate_pts(
|
||||||
dts,
|
dts,
|
||||||
|
@ -532,7 +528,7 @@ impl SinkHandler {
|
||||||
// Reschedule if needed
|
// Reschedule if needed
|
||||||
let (_, next_wakeup) =
|
let (_, next_wakeup) =
|
||||||
jb.src_pad_handler
|
jb.src_pad_handler
|
||||||
.get_next_wakeup(&element, &state, latency, context_wait);
|
.next_wakeup(&element, &state, latency, context_wait);
|
||||||
if let Some((next_wakeup, _)) = next_wakeup {
|
if let Some((next_wakeup, _)) = next_wakeup {
|
||||||
if let Some((previous_next_wakeup, ref abort_handle)) = state.wait_handle {
|
if let Some((previous_next_wakeup, ref abort_handle)) = state.wait_handle {
|
||||||
if previous_next_wakeup.is_none() || previous_next_wakeup > next_wakeup {
|
if previous_next_wakeup.is_none() || previous_next_wakeup > next_wakeup {
|
||||||
|
@ -1110,7 +1106,7 @@ impl TaskImpl for JitterBufferTask {
|
||||||
loop {
|
loop {
|
||||||
let delay_fut = {
|
let delay_fut = {
|
||||||
let mut state = jb.state.lock().unwrap();
|
let mut state = jb.state.lock().unwrap();
|
||||||
let (_, next_wakeup) = self.src_pad_handler.get_next_wakeup(
|
let (_, next_wakeup) = self.src_pad_handler.next_wakeup(
|
||||||
&self.element,
|
&self.element,
|
||||||
&state,
|
&state,
|
||||||
latency,
|
latency,
|
||||||
|
@ -1155,7 +1151,7 @@ impl TaskImpl for JitterBufferTask {
|
||||||
let state = jb.state.lock().unwrap();
|
let state = jb.state.lock().unwrap();
|
||||||
//
|
//
|
||||||
// Check earliest PTS as we have just taken the lock
|
// Check earliest PTS as we have just taken the lock
|
||||||
let (now, next_wakeup) = self.src_pad_handler.get_next_wakeup(
|
let (now, next_wakeup) = self.src_pad_handler.next_wakeup(
|
||||||
&self.element,
|
&self.element,
|
||||||
&state,
|
&state,
|
||||||
latency,
|
latency,
|
||||||
|
@ -1200,7 +1196,7 @@ impl TaskImpl for JitterBufferTask {
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
// Return and reschedule if the next packet would be in the future
|
// Return and reschedule if the next packet would be in the future
|
||||||
// Check earliest PTS as we have just taken the lock
|
// Check earliest PTS as we have just taken the lock
|
||||||
let (now, next_wakeup) = self.src_pad_handler.get_next_wakeup(
|
let (now, next_wakeup) = self.src_pad_handler.next_wakeup(
|
||||||
&self.element,
|
&self.element,
|
||||||
&state,
|
&state,
|
||||||
latency,
|
latency,
|
||||||
|
@ -1342,11 +1338,11 @@ impl ObjectSubclass for JitterBuffer {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
sink_pad: PadSink::new(
|
sink_pad: PadSink::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("sink").unwrap(), Some("sink")),
|
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
|
||||||
sink_pad_handler.clone(),
|
sink_pad_handler.clone(),
|
||||||
),
|
),
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
src_pad_handler.clone(),
|
src_pad_handler.clone(),
|
||||||
),
|
),
|
||||||
sink_pad_handler,
|
sink_pad_handler,
|
||||||
|
|
|
@ -578,7 +578,7 @@ impl ObjectSubclass for ProxySink {
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
sink_pad: PadSink::new(
|
sink_pad: PadSink::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("sink").unwrap(), Some("sink")),
|
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
|
||||||
ProxySinkPadHandler,
|
ProxySinkPadHandler,
|
||||||
),
|
),
|
||||||
proxy_ctx: StdMutex::new(None),
|
proxy_ctx: StdMutex::new(None),
|
||||||
|
@ -1115,7 +1115,7 @@ impl ObjectSubclass for ProxySrc {
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
ProxySrcPadHandler,
|
ProxySrcPadHandler,
|
||||||
),
|
),
|
||||||
task: Task::default(),
|
task: Task::default(),
|
||||||
|
|
|
@ -698,11 +698,11 @@ impl ObjectSubclass for Queue {
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
sink_pad: PadSink::new(
|
sink_pad: PadSink::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("sink").unwrap(), Some("sink")),
|
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
|
||||||
QueuePadSinkHandler,
|
QueuePadSinkHandler,
|
||||||
),
|
),
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
QueuePadSrcHandler,
|
QueuePadSrcHandler,
|
||||||
),
|
),
|
||||||
task: Task::default(),
|
task: Task::default(),
|
||||||
|
|
|
@ -555,7 +555,7 @@ impl ObjectSubclass for TcpClientSrc {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
src_pad_handler.clone(),
|
src_pad_handler.clone(),
|
||||||
),
|
),
|
||||||
src_pad_handler,
|
src_pad_handler,
|
||||||
|
|
|
@ -955,7 +955,7 @@ impl ObjectSubclass for UdpSink {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
sink_pad: PadSink::new(
|
sink_pad: PadSink::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("sink").unwrap(), Some("sink")),
|
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
|
||||||
sink_pad_handler.clone(),
|
sink_pad_handler.clone(),
|
||||||
),
|
),
|
||||||
sink_pad_handler,
|
sink_pad_handler,
|
||||||
|
|
|
@ -696,7 +696,7 @@ impl ObjectSubclass for UdpSrc {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
src_pad_handler.clone(),
|
src_pad_handler.clone(),
|
||||||
),
|
),
|
||||||
src_pad_handler,
|
src_pad_handler,
|
||||||
|
|
|
@ -38,7 +38,7 @@ fn test_active_pad() {
|
||||||
let mut h2 = gst_check::Harness::with_element(&is, Some("sink_%u"), None);
|
let mut h2 = gst_check::Harness::with_element(&is, Some("sink_%u"), None);
|
||||||
|
|
||||||
let active_pad = is
|
let active_pad = is
|
||||||
.get_property("active-pad")
|
.property("active-pad")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<gst::Pad>()
|
.get::<gst::Pad>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -47,7 +47,7 @@ fn test_active_pad() {
|
||||||
is.set_property("active-pad", &h2.srcpad().unwrap().peer())
|
is.set_property("active-pad", &h2.srcpad().unwrap().peer())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let active_pad = is
|
let active_pad = is
|
||||||
.get_property("active-pad")
|
.property("active-pad")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<gst::Pad>()
|
.get::<gst::Pad>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -310,7 +310,7 @@ mod imp_src {
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
ElementSrcTest {
|
ElementSrcTest {
|
||||||
src_pad: PadSrc::new(
|
src_pad: PadSrc::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("src").unwrap(), Some("src")),
|
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
|
||||||
PadSrcTestHandler,
|
PadSrcTestHandler,
|
||||||
),
|
),
|
||||||
task: Task::default(),
|
task: Task::default(),
|
||||||
|
@ -641,7 +641,7 @@ mod imp_sink {
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
ElementSinkTest {
|
ElementSinkTest {
|
||||||
sink_pad: PadSink::new(
|
sink_pad: PadSink::new(
|
||||||
gst::Pad::from_template(&klass.get_pad_template("sink").unwrap(), Some("sink")),
|
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
|
||||||
PadSinkTestHandler,
|
PadSinkTestHandler,
|
||||||
),
|
),
|
||||||
flushing: AtomicBool::new(true),
|
flushing: AtomicBool::new(true),
|
||||||
|
@ -657,7 +657,7 @@ mod imp_sink {
|
||||||
"sender",
|
"sender",
|
||||||
"Sender",
|
"Sender",
|
||||||
"Channel sender to forward the incoming items to",
|
"Channel sender to forward the incoming items to",
|
||||||
ItemSender::get_type(),
|
ItemSender::type_(),
|
||||||
glib::ParamFlags::WRITABLE | glib::ParamFlags::CONSTRUCT_ONLY,
|
glib::ParamFlags::WRITABLE | glib::ParamFlags::CONSTRUCT_ONLY,
|
||||||
)]
|
)]
|
||||||
});
|
});
|
||||||
|
|
|
@ -121,8 +121,8 @@ fn test_from_pipeline_to_pipeline() {
|
||||||
pipe_1.set_state(gst::State::Paused).unwrap();
|
pipe_1.set_state(gst::State::Paused).unwrap();
|
||||||
pipe_2.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_1.state(gst::CLOCK_TIME_NONE);
|
||||||
let _ = pipe_2.get_state(gst::CLOCK_TIME_NONE);
|
let _ = pipe_2.state(gst::CLOCK_TIME_NONE);
|
||||||
|
|
||||||
pipe_1.set_state(gst::State::Null).unwrap();
|
pipe_1.set_state(gst::State::Null).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ fn test_client_management() {
|
||||||
let udpsink = h.element().unwrap();
|
let udpsink = h.element().unwrap();
|
||||||
|
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -49,7 +49,7 @@ fn test_client_management() {
|
||||||
.emit_by_name("add", &[&"192.168.1.1", &57i32])
|
.emit_by_name("add", &[&"192.168.1.1", &57i32])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -61,7 +61,7 @@ fn test_client_management() {
|
||||||
.emit_by_name("add", &[&"192.168.1.1", &57i32])
|
.emit_by_name("add", &[&"192.168.1.1", &57i32])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -72,7 +72,7 @@ fn test_client_management() {
|
||||||
.emit_by_name("remove", &[&"192.168.1.1", &57i32])
|
.emit_by_name("remove", &[&"192.168.1.1", &57i32])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -84,7 +84,7 @@ fn test_client_management() {
|
||||||
.emit_by_name("remove", &[&"192.168.1.1", &57i32])
|
.emit_by_name("remove", &[&"192.168.1.1", &57i32])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -96,7 +96,7 @@ fn test_client_management() {
|
||||||
.emit_by_name("remove", &[&"127.0.0.1", &5004i32])
|
.emit_by_name("remove", &[&"127.0.0.1", &5004i32])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -108,7 +108,7 @@ fn test_client_management() {
|
||||||
.set_property("clients", &"127.0.0.1:5004,192.168.1.1:57")
|
.set_property("clients", &"127.0.0.1:5004,192.168.1.1:57")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -117,7 +117,7 @@ fn test_client_management() {
|
||||||
|
|
||||||
udpsink.emit_by_name("clear", &[]).unwrap();
|
udpsink.emit_by_name("clear", &[]).unwrap();
|
||||||
let clients = udpsink
|
let clients = udpsink
|
||||||
.get_property("clients")
|
.property("clients")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -115,7 +115,7 @@ fn test_socket_reuse() {
|
||||||
{
|
{
|
||||||
let udpsrc = ts_src_h.element().unwrap();
|
let udpsrc = ts_src_h.element().unwrap();
|
||||||
let socket = udpsrc
|
let socket = udpsrc
|
||||||
.get_property("used-socket")
|
.property("used-socket")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<gio::Socket>()
|
.get::<gio::Socket>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ impl ReqwestHttpSrc {
|
||||||
return Ok(client.clone());
|
return Ok(client.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
let srcpad = src.get_static_pad("src").unwrap();
|
let srcpad = src.static_pad("src").unwrap();
|
||||||
let mut q = gst::query::Context::new(REQWEST_CLIENT_CONTEXT);
|
let mut q = gst::query::Context::new(REQWEST_CLIENT_CONTEXT);
|
||||||
if srcpad.peer_query(&mut q) {
|
if srcpad.peer_query(&mut q) {
|
||||||
if let Some(context) = q.context_owned() {
|
if let Some(context) = q.context_owned() {
|
||||||
|
@ -471,15 +471,15 @@ impl ReqwestHttpSrc {
|
||||||
gst_debug!(CAT, obj: src, "Got content type {}", content_type);
|
gst_debug!(CAT, obj: src, "Got content type {}", content_type);
|
||||||
if let Some(ref mut caps) = caps {
|
if let Some(ref mut caps) = caps {
|
||||||
let caps = caps.get_mut().unwrap();
|
let caps = caps.get_mut().unwrap();
|
||||||
let s = caps.get_mut_structure(0).unwrap();
|
let s = caps.structure_mut(0).unwrap();
|
||||||
s.set("content-type", &content_type.as_ref());
|
s.set("content-type", &content_type.as_ref());
|
||||||
} else if content_type.type_() == "audio" && content_type.subtype() == "L16" {
|
} else if content_type.type_() == "audio" && content_type.subtype() == "L16" {
|
||||||
let channels = content_type
|
let channels = content_type
|
||||||
.get_param("channels")
|
.param("channels")
|
||||||
.and_then(|s| s.as_ref().parse::<i32>().ok())
|
.and_then(|s| s.as_ref().parse::<i32>().ok())
|
||||||
.unwrap_or(2);
|
.unwrap_or(2);
|
||||||
let rate = content_type
|
let rate = content_type
|
||||||
.get_param("rate")
|
.param("rate")
|
||||||
.and_then(|s| s.as_ref().parse::<i32>().ok())
|
.and_then(|s| s.as_ref().parse::<i32>().ok())
|
||||||
.unwrap_or(44_100);
|
.unwrap_or(44_100);
|
||||||
|
|
||||||
|
@ -1014,7 +1014,7 @@ impl PushSrcImpl for ReqwestHttpSrc {
|
||||||
|
|
||||||
if let Some(tags) = tags {
|
if let Some(tags) = tags {
|
||||||
gst_debug!(CAT, obj: src, "Sending iradio tags {:?}", tags);
|
gst_debug!(CAT, obj: src, "Sending iradio tags {:?}", tags);
|
||||||
let pad = src.get_static_pad("src").unwrap();
|
let pad = src.static_pad("src").unwrap();
|
||||||
pad.push_event(gst::event::Tag::new(tags));
|
pad.push_event(gst::event::Tag::new(tags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ impl Harness {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let srcpad = src.get_static_pad("src").unwrap();
|
let srcpad = src.static_pad("src").unwrap();
|
||||||
srcpad.link(&pad).unwrap();
|
srcpad.link(&pad).unwrap();
|
||||||
|
|
||||||
let bus = gst::Bus::new();
|
let bus = gst::Bus::new();
|
||||||
|
@ -459,7 +459,7 @@ fn test_extra_headers() {
|
||||||
assert_eq!(headers.get("baz").unwrap(), "1");
|
assert_eq!(headers.get("baz").unwrap(), "1");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
headers
|
headers
|
||||||
.get_all("list")
|
.all("list")
|
||||||
.iter()
|
.iter()
|
||||||
.map(|v| v.to_str().unwrap())
|
.map(|v| v.to_str().unwrap())
|
||||||
.collect::<Vec<&str>>(),
|
.collect::<Vec<&str>>(),
|
||||||
|
@ -467,7 +467,7 @@ fn test_extra_headers() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
headers
|
headers
|
||||||
.get_all("array")
|
.all("array")
|
||||||
.iter()
|
.iter()
|
||||||
.map(|v| v.to_str().unwrap())
|
.map(|v| v.to_str().unwrap())
|
||||||
.collect::<Vec<&str>>(),
|
.collect::<Vec<&str>>(),
|
||||||
|
@ -640,7 +640,7 @@ fn test_iradio_mode() {
|
||||||
// Check if everything was read
|
// Check if everything was read
|
||||||
assert_eq!(cursor.position(), 11);
|
assert_eq!(cursor.position(), 11);
|
||||||
|
|
||||||
let srcpad = h.src.get_static_pad("src").unwrap();
|
let srcpad = h.src.static_pad("src").unwrap();
|
||||||
let caps = srcpad.current_caps().unwrap();
|
let caps = srcpad.current_caps().unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
caps,
|
caps,
|
||||||
|
@ -652,7 +652,7 @@ fn test_iradio_mode() {
|
||||||
|
|
||||||
{
|
{
|
||||||
use gst::EventView;
|
use gst::EventView;
|
||||||
let tag_event = srcpad.get_sticky_event(gst::EventType::Tag, 0).unwrap();
|
let tag_event = srcpad.sticky_event(gst::EventType::Tag, 0).unwrap();
|
||||||
if let EventView::Tag(tags) = tag_event.view() {
|
if let EventView::Tag(tags) = tag_event.view() {
|
||||||
let tags = tags.tag();
|
let tags = tags.tag();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -721,7 +721,7 @@ fn test_audio_l16() {
|
||||||
// Check if everything was read
|
// Check if everything was read
|
||||||
assert_eq!(cursor.position(), 11);
|
assert_eq!(cursor.position(), 11);
|
||||||
|
|
||||||
let srcpad = h.src.get_static_pad("src").unwrap();
|
let srcpad = h.src.static_pad("src").unwrap();
|
||||||
let caps = srcpad.current_caps().unwrap();
|
let caps = srcpad.current_caps().unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
caps,
|
caps,
|
||||||
|
@ -1172,7 +1172,7 @@ fn test_cookies() {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let context = h.src.get_context("gst.reqwest.client").expect("No context");
|
let context = h.src.context("gst.reqwest.client").expect("No context");
|
||||||
h2.src.set_context(&context);
|
h2.src.set_context(&context);
|
||||||
|
|
||||||
// Set the HTTP source to Playing so that everything can start
|
// Set the HTTP source to Playing so that everything can start
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -821,7 +821,7 @@ impl Transcriber {
|
||||||
}
|
}
|
||||||
|
|
||||||
let in_caps = self.sinkpad.current_caps().unwrap();
|
let in_caps = self.sinkpad.current_caps().unwrap();
|
||||||
let s = in_caps.get_structure(0).unwrap();
|
let s = in_caps.structure(0).unwrap();
|
||||||
let sample_rate: i32 = s.get("rate").unwrap().unwrap();
|
let sample_rate: i32 = s.get("rate").unwrap().unwrap();
|
||||||
|
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
|
@ -962,7 +962,7 @@ impl ObjectSubclass for Transcriber {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
Transcriber::catch_panic_pad_function(
|
Transcriber::catch_panic_pad_function(
|
||||||
|
@ -980,7 +980,7 @@ impl ObjectSubclass for Transcriber {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.activatemode_function(|pad, parent, mode, active| {
|
.activatemode_function(|pad, parent, mode, active| {
|
||||||
Transcriber::catch_panic_pad_function(
|
Transcriber::catch_panic_pad_function(
|
||||||
|
|
|
@ -175,7 +175,7 @@ impl S3Src {
|
||||||
offset + length - 1
|
offset + length - 1
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = client.get_object(request);
|
let response = client.object(request);
|
||||||
|
|
||||||
let output = s3utils::wait(&self.canceller, response).map_err(|err| match err {
|
let output = s3utils::wait(&self.canceller, response).map_err(|err| match err {
|
||||||
WaitError::FutureError(err) => Some(gst::error_msg!(
|
WaitError::FutureError(err) => Some(gst::error_msg!(
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ impl JsonGstEnc {
|
||||||
{
|
{
|
||||||
let mut state = self.state.lock().unwrap();
|
let mut state = self.state.lock().unwrap();
|
||||||
let caps = e.caps();
|
let caps = e.caps();
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
state.format = match s.get::<String>("format") {
|
state.format = match s.get::<String>("format") {
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
Ok(format) => format,
|
Ok(format) => format,
|
||||||
|
@ -207,7 +207,7 @@ impl ObjectSubclass for JsonGstEnc {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
JsonGstEnc::catch_panic_pad_function(
|
JsonGstEnc::catch_panic_pad_function(
|
||||||
|
@ -225,7 +225,7 @@ impl ObjectSubclass for JsonGstEnc {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src")).build();
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src")).build();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl State {
|
||||||
self.replay_last_line = false;
|
self.replay_last_line = false;
|
||||||
&self.last_raw_line
|
&self.last_raw_line
|
||||||
} else {
|
} else {
|
||||||
match self.reader.get_line_with_drain(drain) {
|
match self.reader.line_with_drain(drain) {
|
||||||
None => {
|
None => {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ impl JsonGstParse {
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let seeking = state.seeking;
|
let seeking = state.seeking;
|
||||||
let line = state.get_line(drain);
|
let line = state.line(drain);
|
||||||
match line {
|
match line {
|
||||||
Ok(Some(Line::Buffer {
|
Ok(Some(Line::Buffer {
|
||||||
pts,
|
pts,
|
||||||
|
@ -489,7 +489,7 @@ impl JsonGstParse {
|
||||||
reader.push(buf);
|
reader.push(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(line) = reader.get_line_with_drain(true) {
|
while let Some(line) = reader.line_with_drain(true) {
|
||||||
if let Ok(Line::Buffer {
|
if let Ok(Line::Buffer {
|
||||||
pts,
|
pts,
|
||||||
duration,
|
duration,
|
||||||
|
@ -869,7 +869,7 @@ impl ObjectSubclass for JsonGstParse {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.activate_function(|pad, parent| {
|
.activate_function(|pad, parent| {
|
||||||
JsonGstParse::catch_panic_pad_function(
|
JsonGstParse::catch_panic_pad_function(
|
||||||
|
@ -906,7 +906,7 @@ impl ObjectSubclass for JsonGstParse {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
JsonGstParse::catch_panic_pad_function(
|
JsonGstParse::catch_panic_pad_function(
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ impl ObjectSubclass for RegEx {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
RegEx::catch_panic_pad_function(
|
RegEx::catch_panic_pad_function(
|
||||||
|
@ -137,7 +137,7 @@ impl ObjectSubclass for RegEx {
|
||||||
.flags(gst::PadFlags::PROXY_CAPS | gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::PROXY_CAPS | gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.flags(gst::PadFlags::PROXY_CAPS | gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::PROXY_CAPS | gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,7 +428,7 @@ impl ObjectSubclass for TextWrap {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
TextWrap::catch_panic_pad_function(
|
TextWrap::catch_panic_pad_function(
|
||||||
|
@ -447,7 +447,7 @@ impl ObjectSubclass for TextWrap {
|
||||||
.flags(gst::PadFlags::PROXY_CAPS | gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::PROXY_CAPS | gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.query_function(|pad, parent, query| {
|
.query_function(|pad, parent, query| {
|
||||||
TextWrap::catch_panic_pad_function(
|
TextWrap::catch_panic_pad_function(
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ impl ObjectSubclass for Identity {
|
||||||
// - Extract our Identity struct from the object instance and pass it to us
|
// - Extract our Identity struct from the object instance and pass it to us
|
||||||
//
|
//
|
||||||
// Details about what each function is good for is next to each function definition
|
// Details about what each function is good for is next to each function definition
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
Identity::catch_panic_pad_function(
|
Identity::catch_panic_pad_function(
|
||||||
|
@ -157,7 +157,7 @@ impl ObjectSubclass for Identity {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
Identity::catch_panic_pad_function(
|
Identity::catch_panic_pad_function(
|
||||||
|
|
|
@ -57,9 +57,9 @@ impl ObjectSubclass for ProgressBin {
|
||||||
// do so after the progressreport element was added to the bin.
|
// do so after the progressreport element was added to the bin.
|
||||||
//
|
//
|
||||||
// We do that and adding the pads inside glib::Object::constructed() later.
|
// We do that and adding the pads inside glib::Object::constructed() later.
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::GhostPad::from_template(&templ, Some("sink"));
|
let sinkpad = gst::GhostPad::from_template(&templ, Some("sink"));
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::GhostPad::from_template(&templ, Some("src"));
|
let srcpad = gst::GhostPad::from_template(&templ, Some("src"));
|
||||||
|
|
||||||
// Create the progressreport element.
|
// Create the progressreport element.
|
||||||
|
@ -148,10 +148,10 @@ impl ObjectImpl for ProgressBin {
|
||||||
|
|
||||||
// Then set the ghost pad targets to the corresponding pads of the progressreport element.
|
// Then set the ghost pad targets to the corresponding pads of the progressreport element.
|
||||||
self.sinkpad
|
self.sinkpad
|
||||||
.set_target(Some(&self.progress.get_static_pad("sink").unwrap()))
|
.set_target(Some(&self.progress.static_pad("sink").unwrap()))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
self.srcpad
|
self.srcpad
|
||||||
.set_target(Some(&self.progress.get_static_pad("src").unwrap()))
|
.set_target(Some(&self.progress.static_pad("src").unwrap()))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// And finally add the two ghostpads to the bin.
|
// And finally add the two ghostpads to the bin.
|
||||||
|
|
|
@ -522,7 +522,7 @@ impl BaseSrcImpl for SineSrc {
|
||||||
caps.truncate();
|
caps.truncate();
|
||||||
{
|
{
|
||||||
let caps = caps.make_mut();
|
let caps = caps.make_mut();
|
||||||
let s = caps.get_mut_structure(0).unwrap();
|
let s = caps.structure_mut(0).unwrap();
|
||||||
s.fixate_field_nearest_int("rate", 48_000);
|
s.fixate_field_nearest_int("rate", 48_000);
|
||||||
s.fixate_field_nearest_int("channels", 1);
|
s.fixate_field_nearest_int("channels", 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info();
|
gst_plugin_version_helper::info();
|
||||||
|
|
||||||
if cfg!(feature = "v1_18") {
|
if cfg!(feature = "v1_18") {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -50,9 +50,9 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
|
||||||
let videoconvert_clone = videoconvert.clone();
|
let videoconvert_clone = videoconvert.clone();
|
||||||
decodebin.connect_pad_added(move |_, pad| {
|
decodebin.connect_pad_added(move |_, pad| {
|
||||||
let caps = pad.current_caps().unwrap();
|
let caps = pad.current_caps().unwrap();
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
|
|
||||||
let sinkpad = videoconvert_clone.get_static_pad("sink").unwrap();
|
let sinkpad = videoconvert_clone.static_pad("sink").unwrap();
|
||||||
|
|
||||||
if s.name() == "video/x-raw" && !sinkpad.is_linked() {
|
if s.name() == "video/x-raw" && !sinkpad.is_linked() {
|
||||||
pad.link(&sinkpad).unwrap();
|
pad.link(&sinkpad).unwrap();
|
||||||
|
@ -69,7 +69,7 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
|
||||||
//} else
|
//} else
|
||||||
{
|
{
|
||||||
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
|
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
|
||||||
let widget = sink.get_property("widget").unwrap();
|
let widget = sink.property("widget").unwrap();
|
||||||
(sink, widget.get::<gtk::Widget>().unwrap().unwrap())
|
(sink, widget.get::<gtk::Widget>().unwrap().unwrap())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
|
||||||
|
|
||||||
(
|
(
|
||||||
pipeline,
|
pipeline,
|
||||||
video_src.get_static_pad("src").unwrap(),
|
video_src.static_pad("src").unwrap(),
|
||||||
video_sink,
|
video_sink,
|
||||||
video_widget,
|
video_widget,
|
||||||
)
|
)
|
||||||
|
|
|
@ -881,7 +881,7 @@ unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, {
|
||||||
imp.get_next_time(wrap.unsafe_cast_ref())
|
imp.next_time(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ impl CustomSource {
|
||||||
let mut stream_type = None;
|
let mut stream_type = None;
|
||||||
|
|
||||||
// Take stream type from stream-start event if we can
|
// Take stream type from stream-start event if we can
|
||||||
if let Some(event) = pad.get_sticky_event(gst::EventType::StreamStart, 0) {
|
if let Some(event) = pad.sticky_event(gst::EventType::StreamStart, 0) {
|
||||||
if let gst::EventView::StreamStart(ev) = event.view() {
|
if let gst::EventView::StreamStart(ev) = event.view() {
|
||||||
stream_type = ev.stream().map(|s| s.stream_type());
|
stream_type = ev.stream().map(|s| s.stream_type());
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ impl CustomSource {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
|
|
||||||
if s.name().starts_with("audio/") {
|
if s.name().starts_with("audio/") {
|
||||||
stream_type = Some(gst::StreamType::AUDIO);
|
stream_type = Some(gst::StreamType::AUDIO);
|
||||||
|
@ -295,11 +295,11 @@ impl CustomSource {
|
||||||
let (templ, name) = if stream_type.contains(gst::StreamType::AUDIO) {
|
let (templ, name) = if stream_type.contains(gst::StreamType::AUDIO) {
|
||||||
let name = format!("audio_{}", state.num_audio);
|
let name = format!("audio_{}", state.num_audio);
|
||||||
state.num_audio += 1;
|
state.num_audio += 1;
|
||||||
(element.get_pad_template("audio_%u").unwrap(), name)
|
(element.pad_template("audio_%u").unwrap(), name)
|
||||||
} else {
|
} else {
|
||||||
let name = format!("video_{}", state.num_video);
|
let name = format!("video_{}", state.num_video);
|
||||||
state.num_video += 1;
|
state.num_video += 1;
|
||||||
(element.get_pad_template("video_%u").unwrap(), name)
|
(element.pad_template("video_%u").unwrap(), name)
|
||||||
};
|
};
|
||||||
|
|
||||||
let ghost_pad = gst::GhostPad::builder_with_template(&templ, Some(&name))
|
let ghost_pad = gst::GhostPad::builder_with_template(&templ, Some(&name))
|
||||||
|
|
|
@ -756,7 +756,7 @@ impl FallbackSrc {
|
||||||
audiotestsrc.set_property_from_str("wave", "silence");
|
audiotestsrc.set_property_from_str("wave", "silence");
|
||||||
audiotestsrc.set_property("is-live", &true).unwrap();
|
audiotestsrc.set_property("is-live", &true).unwrap();
|
||||||
|
|
||||||
let srcpad = audiotestsrc.get_static_pad("src").unwrap();
|
let srcpad = audiotestsrc.static_pad("src").unwrap();
|
||||||
input
|
input
|
||||||
.add_pad(
|
.add_pad(
|
||||||
&gst::GhostPad::builder(Some("src"), gst::PadDirection::Src)
|
&gst::GhostPad::builder(Some("src"), gst::PadDirection::Src)
|
||||||
|
@ -827,9 +827,9 @@ impl FallbackSrc {
|
||||||
gst::Element::link_pads(&clocksync, Some("src"), &switch, Some("sink")).unwrap();
|
gst::Element::link_pads(&clocksync, Some("src"), &switch, Some("sink")).unwrap();
|
||||||
// clocksync_queue sink pad is not connected to anything yet at this point!
|
// clocksync_queue sink pad is not connected to anything yet at this point!
|
||||||
|
|
||||||
let srcpad = switch.get_static_pad("src").unwrap();
|
let srcpad = switch.static_pad("src").unwrap();
|
||||||
let templ = element
|
let templ = element
|
||||||
.get_pad_template(if is_audio { "audio" } else { "video" })
|
.pad_template(if is_audio { "audio" } else { "video" })
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let ghostpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.name()))
|
let ghostpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.name()))
|
||||||
.proxy_pad_chain_function({
|
.proxy_pad_chain_function({
|
||||||
|
@ -854,7 +854,7 @@ impl FallbackSrc {
|
||||||
source_srcpad: None,
|
source_srcpad: None,
|
||||||
source_srcpad_block: None,
|
source_srcpad_block: None,
|
||||||
clocksync,
|
clocksync,
|
||||||
clocksync_queue_srcpad: clocksync_queue.get_static_pad("src").unwrap(),
|
clocksync_queue_srcpad: clocksync_queue.static_pad("src").unwrap(),
|
||||||
clocksync_queue,
|
clocksync_queue,
|
||||||
switch,
|
switch,
|
||||||
srcpad: ghostpad.upcast(),
|
srcpad: ghostpad.upcast(),
|
||||||
|
@ -1115,7 +1115,7 @@ impl FallbackSrc {
|
||||||
_ => return Ok(()),
|
_ => return Ok(()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
|
|
||||||
if s.name().starts_with("audio/") {
|
if s.name().starts_with("audio/") {
|
||||||
("audio", &mut state.audio_stream)
|
("audio", &mut state.audio_stream)
|
||||||
|
@ -1143,7 +1143,7 @@ impl FallbackSrc {
|
||||||
Some(ref mut stream) => stream,
|
Some(ref mut stream) => stream,
|
||||||
};
|
};
|
||||||
|
|
||||||
let sinkpad = stream.clocksync_queue.get_static_pad("sink").unwrap();
|
let sinkpad = stream.clocksync_queue.static_pad("sink").unwrap();
|
||||||
pad.link(&sinkpad).map_err(|err| {
|
pad.link(&sinkpad).map_err(|err| {
|
||||||
gst_error!(
|
gst_error!(
|
||||||
CAT,
|
CAT,
|
||||||
|
@ -1338,7 +1338,7 @@ impl FallbackSrc {
|
||||||
None => return Ok(()),
|
None => return Ok(()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let ev = match pad.get_sticky_event(gst::EventType::Segment, 0) {
|
let ev = match pad.sticky_event(gst::EventType::Segment, 0) {
|
||||||
Some(ev) => ev,
|
Some(ev) => ev,
|
||||||
None => {
|
None => {
|
||||||
gst_warning!(CAT, obj: element, "Have no segment event yet");
|
gst_warning!(CAT, obj: element, "Have no segment event yet");
|
||||||
|
@ -1762,7 +1762,7 @@ impl FallbackSrc {
|
||||||
|
|
||||||
let prev_fallback_uri = video_stream
|
let prev_fallback_uri = video_stream
|
||||||
.fallback_input
|
.fallback_input
|
||||||
.get_property("uri")
|
.property("uri")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<String>()
|
.get::<String>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -2114,7 +2114,7 @@ impl FallbackSrc {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|s| {
|
.and_then(|s| {
|
||||||
s.switch
|
s.switch
|
||||||
.get_property("active-pad")
|
.property("active-pad")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<gst::Pad>()
|
.get::<gst::Pad>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -2128,7 +2128,7 @@ impl FallbackSrc {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|s| {
|
.and_then(|s| {
|
||||||
s.switch
|
s.switch
|
||||||
.get_property("active-pad")
|
.property("active-pad")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get::<gst::Pad>()
|
.get::<gst::Pad>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl ObjectSubclass for VideoFallbackSource {
|
||||||
type ParentType = gst::Bin;
|
type ParentType = gst::Bin;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.name())).build();
|
let srcpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.name())).build();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
@ -264,7 +264,7 @@ impl VideoFallbackSource {
|
||||||
// To invoke GstBaseSrc::start() method, activate pad manually.
|
// To invoke GstBaseSrc::start() method, activate pad manually.
|
||||||
// filesrc will check whether given file is readable or not
|
// filesrc will check whether given file is readable or not
|
||||||
// via open() and fstat() in there.
|
// via open() and fstat() in there.
|
||||||
let pad = filesrc.get_static_pad("src").unwrap();
|
let pad = filesrc.static_pad("src").unwrap();
|
||||||
if pad.set_active(true).is_err() {
|
if pad.set_active(true).is_err() {
|
||||||
gst_warning!(CAT, obj: element, "Couldn't active pad");
|
gst_warning!(CAT, obj: element, "Couldn't active pad");
|
||||||
let _ = filesrc.set_state(gst::State::Null);
|
let _ = filesrc.set_state(gst::State::Null);
|
||||||
|
@ -283,7 +283,7 @@ impl VideoFallbackSource {
|
||||||
gst_debug!(CAT, obj: element, "Creating source with uri {:?}", uri);
|
gst_debug!(CAT, obj: element, "Creating source with uri {:?}", uri);
|
||||||
|
|
||||||
let source = gst::Bin::new(None);
|
let source = gst::Bin::new(None);
|
||||||
let filesrc = self.get_file_src_for_uri(element, uri);
|
let filesrc = self.file_src_for_uri(element, uri);
|
||||||
|
|
||||||
let srcpad = match filesrc {
|
let srcpad = match filesrc {
|
||||||
Some(filesrc) => {
|
Some(filesrc) => {
|
||||||
|
@ -377,7 +377,7 @@ impl VideoFallbackSource {
|
||||||
None => return None,
|
None => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
let decoder;
|
let decoder;
|
||||||
if s.name() == "image/jpeg" {
|
if s.name() == "image/jpeg" {
|
||||||
decoder = gst::ElementFactory::make("jpegdec", Some("decoder"))
|
decoder = gst::ElementFactory::make("jpegdec", Some("decoder"))
|
||||||
|
@ -413,7 +413,7 @@ impl VideoFallbackSource {
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
queue.get_static_pad("src").unwrap()
|
queue.static_pad("src").unwrap()
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let videotestsrc =
|
let videotestsrc =
|
||||||
|
@ -424,7 +424,7 @@ impl VideoFallbackSource {
|
||||||
videotestsrc.set_property_from_str("pattern", "black");
|
videotestsrc.set_property_from_str("pattern", "black");
|
||||||
videotestsrc.set_property("is-live", &true).unwrap();
|
videotestsrc.set_property("is-live", &true).unwrap();
|
||||||
|
|
||||||
videotestsrc.get_static_pad("src").unwrap()
|
videotestsrc.static_pad("src").unwrap()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ impl VideoFallbackSource {
|
||||||
|
|
||||||
element.add(&source).unwrap();
|
element.add(&source).unwrap();
|
||||||
|
|
||||||
let srcpad = source.get_static_pad("src").unwrap();
|
let srcpad = source.static_pad("src").unwrap();
|
||||||
let _ = self.srcpad.set_target(Some(&srcpad));
|
let _ = self.srcpad.set_target(Some(&srcpad));
|
||||||
|
|
||||||
*state_guard = Some(State { source });
|
*state_guard = Some(State { source });
|
||||||
|
|
|
@ -153,9 +153,9 @@ impl OutputState {
|
||||||
preferred_is_primary: bool,
|
preferred_is_primary: bool,
|
||||||
cur_running_time: gst::ClockTime,
|
cur_running_time: gst::ClockTime,
|
||||||
) -> (bool, bool) {
|
) -> (bool, bool) {
|
||||||
let preferred_health = self.get_health(settings, preferred_is_primary, cur_running_time);
|
let preferred_health = self.health(settings, preferred_is_primary, cur_running_time);
|
||||||
let backup_health = if backup_pad.is_some() {
|
let backup_health = if backup_pad.is_some() {
|
||||||
self.get_health(settings, !preferred_is_primary, cur_running_time)
|
self.health(settings, !preferred_is_primary, cur_running_time)
|
||||||
} else {
|
} else {
|
||||||
StreamHealth::Inactive
|
StreamHealth::Inactive
|
||||||
};
|
};
|
||||||
|
@ -615,7 +615,7 @@ impl FallbackSwitch {
|
||||||
)
|
)
|
||||||
} else if let (true, Some(backup_pad)) = (timeout, &backup_pad) {
|
} else if let (true, Some(backup_pad)) = (timeout, &backup_pad) {
|
||||||
(
|
(
|
||||||
self.get_backup_buffer(&mut *state, &settings, backup_pad),
|
self.backup_buffer(&mut *state, &settings, backup_pad),
|
||||||
state.check_health_changes(
|
state.check_health_changes(
|
||||||
&settings,
|
&settings,
|
||||||
&Some(backup_pad),
|
&Some(backup_pad),
|
||||||
|
@ -650,7 +650,7 @@ impl ObjectSubclass for FallbackSwitch {
|
||||||
type ParentType = gst_base::Aggregator;
|
type ParentType = gst_base::Aggregator;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad =
|
let sinkpad =
|
||||||
gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("sink")).build();
|
gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("sink")).build();
|
||||||
|
|
||||||
|
@ -857,7 +857,7 @@ impl ElementImpl for FallbackSwitch {
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
_caps: Option<&gst::Caps>,
|
_caps: Option<&gst::Caps>,
|
||||||
) -> Option<gst::Pad> {
|
) -> Option<gst::Pad> {
|
||||||
let fallback_sink_templ = element.get_pad_template("fallback_sink").unwrap();
|
let fallback_sink_templ = element.pad_template("fallback_sink").unwrap();
|
||||||
if templ != &fallback_sink_templ
|
if templ != &fallback_sink_templ
|
||||||
|| (name.is_some() && name.as_deref() != Some("fallback_sink"))
|
|| (name.is_some() && name.as_deref() != Some("fallback_sink"))
|
||||||
{
|
{
|
||||||
|
@ -951,10 +951,10 @@ impl AggregatorImpl for FallbackSwitch {
|
||||||
|
|
||||||
let audio_info;
|
let audio_info;
|
||||||
let video_info;
|
let video_info;
|
||||||
if caps.get_structure(0).unwrap().name() == "audio/x-raw" {
|
if caps.structure(0).unwrap().name() == "audio/x-raw" {
|
||||||
audio_info = gst_audio::AudioInfo::from_caps(&caps).ok();
|
audio_info = gst_audio::AudioInfo::from_caps(&caps).ok();
|
||||||
video_info = None;
|
video_info = None;
|
||||||
} else if caps.get_structure(0).unwrap().name() == "video/x-raw" {
|
} else if caps.structure(0).unwrap().name() == "video/x-raw" {
|
||||||
audio_info = None;
|
audio_info = None;
|
||||||
video_info = gst_video::VideoInfo::from_caps(&caps).ok();
|
video_info = gst_video::VideoInfo::from_caps(&caps).ok();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1155,8 +1155,7 @@ impl AggregatorImpl for FallbackSwitch {
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
gst_debug!(CAT, obj: agg, "Aggregate called: timeout {}", timeout);
|
gst_debug!(CAT, obj: agg, "Aggregate called: timeout {}", timeout);
|
||||||
|
|
||||||
let (res, (primary_health_change, fallback_health_change)) =
|
let (res, (primary_health_change, fallback_health_change)) = self.next_buffer(agg, timeout);
|
||||||
self.get_next_buffer(agg, timeout);
|
|
||||||
|
|
||||||
if primary_health_change {
|
if primary_health_change {
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
|
@ -1179,7 +1178,7 @@ impl AggregatorImpl for FallbackSwitch {
|
||||||
|
|
||||||
let (mut buffer, active_caps, pad_change) = res?;
|
let (mut buffer, active_caps, pad_change) = res?;
|
||||||
|
|
||||||
let current_src_caps = agg.get_static_pad("src").unwrap().current_caps();
|
let current_src_caps = agg.static_pad("src").unwrap().current_caps();
|
||||||
if Some(&active_caps) != current_src_caps.as_ref() {
|
if Some(&active_caps) != current_src_caps.as_ref() {
|
||||||
gst_info!(
|
gst_info!(
|
||||||
CAT,
|
CAT,
|
||||||
|
|
|
@ -453,7 +453,7 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
||||||
|
|
||||||
fn push_buffer(pipeline: &Pipeline, time: gst::ClockTime) {
|
fn push_buffer(pipeline: &Pipeline, time: gst::ClockTime) {
|
||||||
let src = pipeline
|
let src = pipeline
|
||||||
.get_by_name("src")
|
.by_name("src")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<gst_app::AppSrc>()
|
.downcast::<gst_app::AppSrc>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -467,7 +467,7 @@ fn push_buffer(pipeline: &Pipeline, time: gst::ClockTime) {
|
||||||
|
|
||||||
fn push_fallback_buffer(pipeline: &Pipeline, time: gst::ClockTime) {
|
fn push_fallback_buffer(pipeline: &Pipeline, time: gst::ClockTime) {
|
||||||
let src = pipeline
|
let src = pipeline
|
||||||
.get_by_name("fallback-src")
|
.by_name("fallback-src")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<gst_app::AppSrc>()
|
.downcast::<gst_app::AppSrc>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -481,7 +481,7 @@ fn push_fallback_buffer(pipeline: &Pipeline, time: gst::ClockTime) {
|
||||||
|
|
||||||
fn push_eos(pipeline: &Pipeline) {
|
fn push_eos(pipeline: &Pipeline) {
|
||||||
let src = pipeline
|
let src = pipeline
|
||||||
.get_by_name("src")
|
.by_name("src")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<gst_app::AppSrc>()
|
.downcast::<gst_app::AppSrc>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -490,7 +490,7 @@ fn push_eos(pipeline: &Pipeline) {
|
||||||
|
|
||||||
fn push_fallback_eos(pipeline: &Pipeline) {
|
fn push_fallback_eos(pipeline: &Pipeline) {
|
||||||
let src = pipeline
|
let src = pipeline
|
||||||
.get_by_name("fallback-src")
|
.by_name("fallback-src")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<gst_app::AppSrc>()
|
.downcast::<gst_app::AppSrc>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -499,7 +499,7 @@ fn push_fallback_eos(pipeline: &Pipeline) {
|
||||||
|
|
||||||
fn pull_buffer(pipeline: &Pipeline) -> gst::Buffer {
|
fn pull_buffer(pipeline: &Pipeline) -> gst::Buffer {
|
||||||
let sink = pipeline
|
let sink = pipeline
|
||||||
.get_by_name("sink")
|
.by_name("sink")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<gst_app::AppSink>()
|
.downcast::<gst_app::AppSink>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -520,7 +520,7 @@ fn set_time(pipeline: &Pipeline, time: gst::ClockTime) {
|
||||||
|
|
||||||
fn wait_eos(pipeline: &Pipeline) {
|
fn wait_eos(pipeline: &Pipeline) {
|
||||||
let sink = pipeline
|
let sink = pipeline
|
||||||
.get_by_name("sink")
|
.by_name("sink")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.downcast::<gst_app::AppSink>()
|
.downcast::<gst_app::AppSink>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -549,7 +549,7 @@ fn stop_pipeline(mut pipeline: Pipeline) {
|
||||||
let clock_id = clock.new_single_shot_id(0.into());
|
let clock_id = clock.new_single_shot_id(0.into());
|
||||||
let _ = clock_id.wait();
|
let _ = clock_id.wait();
|
||||||
|
|
||||||
let switch = pipeline.get_by_name("switch").unwrap();
|
let switch = pipeline.by_name("switch").unwrap();
|
||||||
let switch_weak = switch.downgrade();
|
let switch_weak = switch.downgrade();
|
||||||
drop(switch);
|
drop(switch);
|
||||||
let pipeline_weak = pipeline.downgrade();
|
let pipeline_weak = pipeline.downgrade();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,11 +52,11 @@ fn create_pipeline() -> (
|
||||||
let glsinkbin = gst::ElementFactory::make("glsinkbin", None).unwrap();
|
let glsinkbin = gst::ElementFactory::make("glsinkbin", None).unwrap();
|
||||||
glsinkbin.set_property("sink", >kglsink).unwrap();
|
glsinkbin.set_property("sink", >kglsink).unwrap();
|
||||||
|
|
||||||
let widget = gtkglsink.get_property("widget").unwrap();
|
let widget = gtkglsink.property("widget").unwrap();
|
||||||
(glsinkbin, widget.get::<gtk::Widget>().unwrap().unwrap())
|
(glsinkbin, widget.get::<gtk::Widget>().unwrap().unwrap())
|
||||||
} else {
|
} else {
|
||||||
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
|
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
|
||||||
let widget = sink.get_property("widget").unwrap();
|
let widget = sink.property("widget").unwrap();
|
||||||
(sink, widget.get::<gtk::Widget>().unwrap().unwrap())
|
(sink, widget.get::<gtk::Widget>().unwrap().unwrap())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ fn create_pipeline() -> (
|
||||||
|
|
||||||
(
|
(
|
||||||
pipeline,
|
pipeline,
|
||||||
video_queue2.get_static_pad("sink").unwrap(),
|
video_queue2.static_pad("sink").unwrap(),
|
||||||
audio_queue2.get_static_pad("sink").unwrap(),
|
audio_queue2.static_pad("sink").unwrap(),
|
||||||
togglerecord,
|
togglerecord,
|
||||||
video_sink,
|
video_sink,
|
||||||
video_widget,
|
video_widget,
|
||||||
|
@ -240,7 +240,7 @@ fn create_ui(app: >k::Application) {
|
||||||
position_label.set_text(&format!("Position: {:.1}", position));
|
position_label.set_text(&format!("Position: {:.1}", position));
|
||||||
|
|
||||||
let recording_duration = togglerecord
|
let recording_duration = togglerecord
|
||||||
.get_static_pad("src")
|
.static_pad("src")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.query_position::<gst::ClockTime>()
|
.query_position::<gst::ClockTime>()
|
||||||
.unwrap_or_else(|| 0.into());
|
.unwrap_or_else(|| 0.into());
|
||||||
|
@ -257,7 +257,7 @@ fn create_ui(app: >k::Application) {
|
||||||
};
|
};
|
||||||
|
|
||||||
let recording = !togglerecord
|
let recording = !togglerecord
|
||||||
.get_property("record")
|
.property("record")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -295,7 +295,7 @@ impl HandleData for gst::Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
let pts = HandleData::pts(&self);
|
let pts = HandleData::pts(&self);
|
||||||
let duration = HandleData::get_duration(&self, state);
|
let duration = HandleData::duration(&self, state);
|
||||||
let stop = if duration.is_some() {
|
let stop = if duration.is_some() {
|
||||||
pts + duration
|
pts + duration
|
||||||
} else {
|
} else {
|
||||||
|
@ -356,7 +356,7 @@ impl ToggleRecord {
|
||||||
let mut state = stream.state.lock();
|
let mut state = stream.state.lock();
|
||||||
|
|
||||||
let mut dts_or_pts = data.dts_or_pts();
|
let mut dts_or_pts = data.dts_or_pts();
|
||||||
let duration = data.get_duration(&state);
|
let duration = data.duration(&state);
|
||||||
|
|
||||||
if !dts_or_pts.is_some() {
|
if !dts_or_pts.is_some() {
|
||||||
gst::element_error!(
|
gst::element_error!(
|
||||||
|
@ -610,7 +610,7 @@ impl ToggleRecord {
|
||||||
let mut state = stream.state.lock();
|
let mut state = stream.state.lock();
|
||||||
|
|
||||||
let mut pts = data.pts();
|
let mut pts = data.pts();
|
||||||
let duration = data.get_duration(&state);
|
let duration = data.duration(&state);
|
||||||
|
|
||||||
if pts.is_none() {
|
if pts.is_none() {
|
||||||
gst::element_error!(element, gst::StreamError::Format, ["Buffer without PTS"]);
|
gst::element_error!(element, gst::StreamError::Format, ["Buffer without PTS"]);
|
||||||
|
@ -1245,7 +1245,7 @@ impl ToggleRecord {
|
||||||
EventView::Caps(c) => {
|
EventView::Caps(c) => {
|
||||||
let mut state = stream.state.lock();
|
let mut state = stream.state.lock();
|
||||||
let caps = c.caps();
|
let caps = c.caps();
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
if s.name().starts_with("audio/") {
|
if s.name().starts_with("audio/") {
|
||||||
state.audio_info = gst_audio::AudioInfo::from_caps(caps).ok();
|
state.audio_info = gst_audio::AudioInfo::from_caps(caps).ok();
|
||||||
gst_log!(CAT, obj: pad, "Got audio caps {:?}", state.audio_info);
|
gst_log!(CAT, obj: pad, "Got audio caps {:?}", state.audio_info);
|
||||||
|
@ -1620,7 +1620,7 @@ impl ObjectSubclass for ToggleRecord {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
ToggleRecord::catch_panic_pad_function(
|
ToggleRecord::catch_panic_pad_function(
|
||||||
|
@ -1652,7 +1652,7 @@ impl ObjectSubclass for ToggleRecord {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
ToggleRecord::catch_panic_pad_function(
|
ToggleRecord::catch_panic_pad_function(
|
||||||
|
@ -1899,7 +1899,7 @@ impl ElementImpl for ToggleRecord {
|
||||||
let id = *pad_count;
|
let id = *pad_count;
|
||||||
*pad_count += 1;
|
*pad_count += 1;
|
||||||
|
|
||||||
let templ = element.get_pad_template("sink_%u").unwrap();
|
let templ = element.pad_template("sink_%u").unwrap();
|
||||||
let sinkpad =
|
let sinkpad =
|
||||||
gst::Pad::builder_with_template(&templ, Some(format!("sink_{}", id).as_str()))
|
gst::Pad::builder_with_template(&templ, Some(format!("sink_{}", id).as_str()))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
|
@ -1932,7 +1932,7 @@ impl ElementImpl for ToggleRecord {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = element.get_pad_template("src_%u").unwrap();
|
let templ = element.pad_template("src_%u").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some(format!("src_{}", id).as_str()))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some(format!("src_{}", id).as_str()))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
ToggleRecord::catch_panic_pad_function(
|
ToggleRecord::catch_panic_pad_function(
|
||||||
|
|
|
@ -62,16 +62,16 @@ fn setup_sender_receiver(
|
||||||
|
|
||||||
let (srcpad, sinkpad) = if main_stream {
|
let (srcpad, sinkpad) = if main_stream {
|
||||||
(
|
(
|
||||||
togglerecord.get_static_pad("src").unwrap(),
|
togglerecord.static_pad("src").unwrap(),
|
||||||
togglerecord.get_static_pad("sink").unwrap(),
|
togglerecord.static_pad("sink").unwrap(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let sinkpad = togglerecord.get_request_pad("sink_%u").unwrap();
|
let sinkpad = togglerecord.request_pad("sink_%u").unwrap();
|
||||||
let srcpad = sinkpad.iterate_internal_links().next().unwrap().unwrap();
|
let srcpad = sinkpad.iterate_internal_links().next().unwrap().unwrap();
|
||||||
(srcpad, sinkpad)
|
(srcpad, sinkpad)
|
||||||
};
|
};
|
||||||
|
|
||||||
let fakesink_sinkpad = fakesink.get_static_pad("sink").unwrap();
|
let fakesink_sinkpad = fakesink.static_pad("sink").unwrap();
|
||||||
srcpad.link(&fakesink_sinkpad).unwrap();
|
srcpad.link(&fakesink_sinkpad).unwrap();
|
||||||
|
|
||||||
let (sender_output, receiver_output) = mpsc::channel::<Either<gst::Buffer, gst::Event>>();
|
let (sender_output, receiver_output) = mpsc::channel::<Either<gst::Buffer, gst::Event>>();
|
||||||
|
@ -263,7 +263,7 @@ fn test_create_pads() {
|
||||||
init();
|
init();
|
||||||
let togglerecord = gst::ElementFactory::make("togglerecord", None).unwrap();
|
let togglerecord = gst::ElementFactory::make("togglerecord", None).unwrap();
|
||||||
|
|
||||||
let sinkpad = togglerecord.get_request_pad("sink_%u").unwrap();
|
let sinkpad = togglerecord.request_pad("sink_%u").unwrap();
|
||||||
let srcpad = sinkpad.iterate_internal_links().next().unwrap().unwrap();
|
let srcpad = sinkpad.iterate_internal_links().next().unwrap().unwrap();
|
||||||
|
|
||||||
assert_eq!(sinkpad.name(), "sink_0");
|
assert_eq!(sinkpad.name(), "sink_0");
|
||||||
|
@ -1201,7 +1201,7 @@ fn test_two_stream_main_eos() {
|
||||||
receiver_input_done_1.recv().unwrap();
|
receiver_input_done_1.recv().unwrap();
|
||||||
|
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1220,7 +1220,7 @@ fn test_two_stream_main_eos() {
|
||||||
// At this moment, all streams should be in eos state. So togglerecord
|
// At this moment, all streams should be in eos state. So togglerecord
|
||||||
// must be in stopped state
|
// must be in stopped state
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1284,7 +1284,7 @@ fn test_two_stream_secondary_eos_first() {
|
||||||
|
|
||||||
// Since main stream is not yet EOS state, we should be in recording state
|
// Since main stream is not yet EOS state, we should be in recording state
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1295,7 +1295,7 @@ fn test_two_stream_secondary_eos_first() {
|
||||||
receiver_input_done_1.recv().unwrap();
|
receiver_input_done_1.recv().unwrap();
|
||||||
|
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1363,7 +1363,7 @@ fn test_three_stream_main_eos() {
|
||||||
receiver_input_done_1.recv().unwrap();
|
receiver_input_done_1.recv().unwrap();
|
||||||
|
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1382,7 +1382,7 @@ fn test_three_stream_main_eos() {
|
||||||
|
|
||||||
// The third stream is not in EOS state yet, so still recording == true
|
// The third stream is not in EOS state yet, so still recording == true
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1397,7 +1397,7 @@ fn test_three_stream_main_eos() {
|
||||||
// At this moment, all streams should be in eos state. So togglerecord
|
// At this moment, all streams should be in eos state. So togglerecord
|
||||||
// must be in stopped state
|
// must be in stopped state
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1476,7 +1476,7 @@ fn test_three_stream_main_and_second_eos() {
|
||||||
receiver_input_done_1.recv().unwrap();
|
receiver_input_done_1.recv().unwrap();
|
||||||
|
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1488,7 +1488,7 @@ fn test_three_stream_main_and_second_eos() {
|
||||||
receiver_input_done_2.recv().unwrap();
|
receiver_input_done_2.recv().unwrap();
|
||||||
|
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1509,7 +1509,7 @@ fn test_three_stream_main_and_second_eos() {
|
||||||
// At this moment, all streams should be in eos state. So togglerecord
|
// At this moment, all streams should be in eos state. So togglerecord
|
||||||
// must be in stopped state
|
// must be in stopped state
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1592,7 +1592,7 @@ fn test_three_stream_secondary_eos_first() {
|
||||||
|
|
||||||
// Since main stream is not yet EOS state, we should be in recording state
|
// Since main stream is not yet EOS state, we should be in recording state
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1604,7 +1604,7 @@ fn test_three_stream_secondary_eos_first() {
|
||||||
receiver_input_done_1.recv().unwrap();
|
receiver_input_done_1.recv().unwrap();
|
||||||
|
|
||||||
let recording = togglerecord
|
let recording = togglerecord
|
||||||
.get_property("recording")
|
.property("recording")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<bool>()
|
.get_some::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl VideoDecoderImpl for CdgDec {
|
||||||
.take(CDG_WIDTH as usize)
|
.take(CDG_WIDTH as usize)
|
||||||
.enumerate()
|
.enumerate()
|
||||||
{
|
{
|
||||||
let p = cdg_inter.get_pixel(x as u32, y as u32);
|
let p = cdg_inter.pixel(x as u32, y as u32);
|
||||||
pixel.copy_from_slice(&p.0);
|
pixel.copy_from_slice(&p.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info();
|
gst_plugin_version_helper::info();
|
||||||
|
|
||||||
cc::Build::new()
|
cc::Build::new()
|
||||||
.file("src/c/caption.c")
|
.file("src/c/caption.c")
|
||||||
|
|
|
@ -414,7 +414,7 @@ impl BaseTransformImpl for CCDetect {
|
||||||
}
|
}
|
||||||
|
|
||||||
let s = incaps
|
let s = incaps
|
||||||
.get_structure(0)
|
.structure(0)
|
||||||
.ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
|
.ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
|
||||||
let format_str = s
|
let format_str = s
|
||||||
.get::<&str>("format")
|
.get::<&str>("format")
|
||||||
|
|
|
@ -286,7 +286,7 @@ impl Cea608Overlay {
|
||||||
let mut downstream_accepts_meta = false;
|
let mut downstream_accepts_meta = false;
|
||||||
|
|
||||||
let upstream_has_meta = caps
|
let upstream_has_meta = caps
|
||||||
.get_features(0)
|
.features(0)
|
||||||
.map(|f| f.contains(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION))
|
.map(|f| f.contains(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ impl Cea608Overlay {
|
||||||
let mut caps_clone = caps.clone();
|
let mut caps_clone = caps.clone();
|
||||||
let overlay_caps = caps_clone.make_mut();
|
let overlay_caps = caps_clone.make_mut();
|
||||||
|
|
||||||
if let Some(features) = overlay_caps.get_mut_features(0) {
|
if let Some(features) = overlay_caps.features_mut(0) {
|
||||||
features.add(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
|
features.add(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
|
||||||
let peercaps = self.srcpad.peer_query_caps(Some(&caps_clone));
|
let peercaps = self.srcpad.peer_query_caps(Some(&caps_clone));
|
||||||
downstream_accepts_meta = !peercaps.is_empty();
|
downstream_accepts_meta = !peercaps.is_empty();
|
||||||
|
@ -542,7 +542,7 @@ impl ObjectSubclass for Cea608Overlay {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
Cea608Overlay::catch_panic_pad_function(
|
Cea608Overlay::catch_panic_pad_function(
|
||||||
|
@ -561,7 +561,7 @@ impl ObjectSubclass for Cea608Overlay {
|
||||||
.flags(gst::PadFlags::PROXY_CAPS)
|
.flags(gst::PadFlags::PROXY_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.flags(gst::PadFlags::PROXY_CAPS)
|
.flags(gst::PadFlags::PROXY_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -824,7 +824,7 @@ impl ObjectSubclass for Cea608ToJson {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
Cea608ToJson::catch_panic_pad_function(
|
Cea608ToJson::catch_panic_pad_function(
|
||||||
|
@ -843,7 +843,7 @@ impl ObjectSubclass for Cea608ToJson {
|
||||||
.flags(gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.flags(gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -303,7 +303,7 @@ impl Cea608ToTt {
|
||||||
downstream_caps
|
downstream_caps
|
||||||
);
|
);
|
||||||
|
|
||||||
let s = downstream_caps.get_structure(0).unwrap();
|
let s = downstream_caps.structure(0).unwrap();
|
||||||
let new_caps = if s.name() == "application/x-subtitle-vtt" {
|
let new_caps = if s.name() == "application/x-subtitle-vtt" {
|
||||||
state.format = Some(Format::Vtt);
|
state.format = Some(Format::Vtt);
|
||||||
gst::Caps::builder("application/x-subtitle-vtt").build()
|
gst::Caps::builder("application/x-subtitle-vtt").build()
|
||||||
|
@ -377,7 +377,7 @@ impl ObjectSubclass for Cea608ToTt {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
Cea608ToTt::catch_panic_pad_function(
|
Cea608ToTt::catch_panic_pad_function(
|
||||||
|
@ -396,7 +396,7 @@ impl ObjectSubclass for Cea608ToTt {
|
||||||
.flags(gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.flags(gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -62,12 +62,12 @@ impl<T: AsRef<[u8]>> LineReader<T> {
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub fn line_or_drain(&mut self) -> Option<&[u8]> {
|
pub fn line_or_drain(&mut self) -> Option<&[u8]> {
|
||||||
self.get_line_with_drain(true)
|
self.line_with_drain(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub fn line(&mut self) -> Option<&[u8]> {
|
pub fn line(&mut self) -> Option<&[u8]> {
|
||||||
self.get_line_with_drain(false)
|
self.line_with_drain(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Searches the first '\n' in the currently queued buffers and returns the index in buffers
|
/// Searches the first '\n' in the currently queued buffers and returns the index in buffers
|
||||||
|
|
|
@ -93,7 +93,7 @@ impl MccEnc {
|
||||||
.current_caps()
|
.current_caps()
|
||||||
.ok_or(gst::FlowError::NotNegotiated)?;
|
.ok_or(gst::FlowError::NotNegotiated)?;
|
||||||
let framerate = match caps
|
let framerate = match caps
|
||||||
.get_structure(0)
|
.structure(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_some::<gst::Fraction>("framerate")
|
.get_some::<gst::Fraction>("framerate")
|
||||||
{
|
{
|
||||||
|
@ -276,7 +276,7 @@ impl MccEnc {
|
||||||
outbuf: &mut Vec<u8>,
|
outbuf: &mut Vec<u8>,
|
||||||
) -> Result<(), gst::FlowError> {
|
) -> Result<(), gst::FlowError> {
|
||||||
let meta = buffer
|
let meta = buffer
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
gst::element_error!(
|
gst::element_error!(
|
||||||
element,
|
element,
|
||||||
|
@ -370,7 +370,7 @@ impl MccEnc {
|
||||||
match event.view() {
|
match event.view() {
|
||||||
EventView::Caps(ev) => {
|
EventView::Caps(ev) => {
|
||||||
let caps = ev.caps();
|
let caps = ev.caps();
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
let framerate = match s.get_some::<gst::Fraction>("framerate") {
|
let framerate = match s.get_some::<gst::Fraction>("framerate") {
|
||||||
Ok(framerate) => framerate,
|
Ok(framerate) => framerate,
|
||||||
Err(structure::GetError::FieldNotFound { .. }) => {
|
Err(structure::GetError::FieldNotFound { .. }) => {
|
||||||
|
@ -451,7 +451,7 @@ impl ObjectSubclass for MccEnc {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
MccEnc::catch_panic_pad_function(
|
MccEnc::catch_panic_pad_function(
|
||||||
|
@ -469,7 +469,7 @@ impl ObjectSubclass for MccEnc {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
MccEnc::catch_panic_pad_function(
|
MccEnc::catch_panic_pad_function(
|
||||||
|
|
|
@ -161,7 +161,7 @@ impl State {
|
||||||
self.replay_last_line = false;
|
self.replay_last_line = false;
|
||||||
&self.last_raw_line
|
&self.last_raw_line
|
||||||
} else {
|
} else {
|
||||||
match self.reader.get_line_with_drain(drain) {
|
match self.reader.line_with_drain(drain) {
|
||||||
None => {
|
None => {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ impl MccParse {
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let line = state.get_line(drain);
|
let line = state.line(drain);
|
||||||
match line {
|
match line {
|
||||||
Ok(Some(MccLine::Caption(tc, Some(data)))) => {
|
Ok(Some(MccLine::Caption(tc, Some(data)))) => {
|
||||||
assert!(!state.seeking);
|
assert!(!state.seeking);
|
||||||
|
@ -711,7 +711,7 @@ impl MccParse {
|
||||||
reader.push(buf);
|
reader.push(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(line) = reader.get_line_with_drain(true) {
|
while let Some(line) = reader.line_with_drain(true) {
|
||||||
if let Ok(MccLine::Caption(tc, None)) =
|
if let Ok(MccLine::Caption(tc, None)) =
|
||||||
parser.parse_line(line, false).map_err(|err| (line, err))
|
parser.parse_line(line, false).map_err(|err| (line, err))
|
||||||
{
|
{
|
||||||
|
@ -1121,7 +1121,7 @@ impl ObjectSubclass for MccParse {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.activate_function(|pad, parent| {
|
.activate_function(|pad, parent| {
|
||||||
MccParse::catch_panic_pad_function(
|
MccParse::catch_panic_pad_function(
|
||||||
|
@ -1153,7 +1153,7 @@ impl ObjectSubclass for MccParse {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
MccParse::catch_panic_pad_function(
|
MccParse::catch_panic_pad_function(
|
||||||
|
|
|
@ -89,7 +89,7 @@ impl State {
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut timecode = buffer
|
let mut timecode = buffer
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
gst::element_error!(
|
gst::element_error!(
|
||||||
element,
|
element,
|
||||||
|
@ -169,7 +169,7 @@ impl State {
|
||||||
// else, separate the packets with a space
|
// else, separate the packets with a space
|
||||||
if line_start {
|
if line_start {
|
||||||
let timecode = buffer
|
let timecode = buffer
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
// Checked already before the buffer has been pushed to the
|
// Checked already before the buffer has been pushed to the
|
||||||
// internal_buffer
|
// internal_buffer
|
||||||
.expect("Buffer without timecode")
|
.expect("Buffer without timecode")
|
||||||
|
@ -253,7 +253,7 @@ impl SccEnc {
|
||||||
match event.view() {
|
match event.view() {
|
||||||
EventView::Caps(ev) => {
|
EventView::Caps(ev) => {
|
||||||
let caps = ev.caps();
|
let caps = ev.caps();
|
||||||
let s = caps.get_structure(0).unwrap();
|
let s = caps.structure(0).unwrap();
|
||||||
let framerate = match s.get_some::<gst::Fraction>("framerate") {
|
let framerate = match s.get_some::<gst::Fraction>("framerate") {
|
||||||
Ok(framerate) => Some(framerate),
|
Ok(framerate) => Some(framerate),
|
||||||
Err(structure::GetError::FieldNotFound { .. }) => {
|
Err(structure::GetError::FieldNotFound { .. }) => {
|
||||||
|
@ -339,7 +339,7 @@ impl ObjectSubclass for SccEnc {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
SccEnc::catch_panic_pad_function(
|
SccEnc::catch_panic_pad_function(
|
||||||
|
@ -357,7 +357,7 @@ impl ObjectSubclass for SccEnc {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
SccEnc::catch_panic_pad_function(
|
SccEnc::catch_panic_pad_function(
|
||||||
|
|
|
@ -140,7 +140,7 @@ fn parse_timecode(
|
||||||
impl State {
|
impl State {
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
fn line(&mut self, drain: bool) -> Result<Option<SccLine>, (&[u8], nom::error::Error<&[u8]>)> {
|
fn line(&mut self, drain: bool) -> Result<Option<SccLine>, (&[u8], nom::error::Error<&[u8]>)> {
|
||||||
let line = match self.reader.get_line_with_drain(drain) {
|
let line = match self.reader.line_with_drain(drain) {
|
||||||
None => {
|
None => {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ impl SccParse {
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let line = state.get_line(drain);
|
let line = state.line(drain);
|
||||||
match line {
|
match line {
|
||||||
Ok(Some(SccLine::Caption(tc, data))) => {
|
Ok(Some(SccLine::Caption(tc, data))) => {
|
||||||
state = self.handle_line(tc, data, element, state)?;
|
state = self.handle_line(tc, data, element, state)?;
|
||||||
|
@ -604,7 +604,7 @@ impl SccParse {
|
||||||
reader.push(buf);
|
reader.push(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(line) = reader.get_line_with_drain(true) {
|
while let Some(line) = reader.line_with_drain(true) {
|
||||||
if let Ok(SccLine::Caption(tc, data)) =
|
if let Ok(SccLine::Caption(tc, data)) =
|
||||||
parser.parse_line(line).map_err(|err| (line, err))
|
parser.parse_line(line).map_err(|err| (line, err))
|
||||||
{
|
{
|
||||||
|
@ -1001,7 +1001,7 @@ impl ObjectSubclass for SccParse {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.activate_function(|pad, parent| {
|
.activate_function(|pad, parent| {
|
||||||
SccParse::catch_panic_pad_function(
|
SccParse::catch_panic_pad_function(
|
||||||
|
@ -1033,7 +1033,7 @@ impl ObjectSubclass for SccParse {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
SccParse::catch_panic_pad_function(
|
SccParse::catch_panic_pad_function(
|
||||||
|
|
|
@ -899,7 +899,7 @@ impl TtToCea608 {
|
||||||
}
|
}
|
||||||
|
|
||||||
let caps = downstream_caps.make_mut();
|
let caps = downstream_caps.make_mut();
|
||||||
let s = caps.get_mut_structure(0).unwrap();
|
let s = caps.structure_mut(0).unwrap();
|
||||||
|
|
||||||
s.fixate_field_nearest_fraction(
|
s.fixate_field_nearest_fraction(
|
||||||
"framerate",
|
"framerate",
|
||||||
|
@ -911,7 +911,7 @@ impl TtToCea608 {
|
||||||
state.framerate = s.get_some::<gst::Fraction>("framerate").unwrap();
|
state.framerate = s.get_some::<gst::Fraction>("framerate").unwrap();
|
||||||
|
|
||||||
let upstream_caps = e.caps();
|
let upstream_caps = e.caps();
|
||||||
let s = upstream_caps.get_structure(0).unwrap();
|
let s = upstream_caps.structure(0).unwrap();
|
||||||
state.json_input = s.name() == "application/x-json";
|
state.json_input = s.name() == "application/x-json";
|
||||||
|
|
||||||
gst_debug!(CAT, obj: pad, "Pushing caps {}", caps);
|
gst_debug!(CAT, obj: pad, "Pushing caps {}", caps);
|
||||||
|
@ -987,7 +987,7 @@ impl ObjectSubclass for TtToCea608 {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
TtToCea608::catch_panic_pad_function(
|
TtToCea608::catch_panic_pad_function(
|
||||||
|
@ -1006,7 +1006,7 @@ impl ObjectSubclass for TtToCea608 {
|
||||||
.flags(gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.flags(gst::PadFlags::FIXED_CAPS)
|
.flags(gst::PadFlags::FIXED_CAPS)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -194,7 +194,7 @@ impl ObjectSubclass for TtToJson {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
TtToJson::catch_panic_pad_function(
|
TtToJson::catch_panic_pad_function(
|
||||||
|
@ -212,7 +212,7 @@ impl ObjectSubclass for TtToJson {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src")).build();
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src")).build();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -82,7 +82,7 @@ fn test_have_cc_data_notify() {
|
||||||
.connect_notify(Some("cc608"), move |o, _pspec| {
|
.connect_notify(Some("cc608"), move |o, _pspec| {
|
||||||
let mut state_guard = state_c.lock().unwrap();
|
let mut state_guard = state_c.lock().unwrap();
|
||||||
state_guard.cc608_count += 1;
|
state_guard.cc608_count += 1;
|
||||||
o.get_property("cc608").unwrap();
|
o.property("cc608").unwrap();
|
||||||
});
|
});
|
||||||
let state_c = state.clone();
|
let state_c = state.clone();
|
||||||
h.element()
|
h.element()
|
||||||
|
@ -90,7 +90,7 @@ fn test_have_cc_data_notify() {
|
||||||
.connect_notify(Some("cc708"), move |o, _pspec| {
|
.connect_notify(Some("cc708"), move |o, _pspec| {
|
||||||
let mut state_guard = state_c.lock().unwrap();
|
let mut state_guard = state_c.lock().unwrap();
|
||||||
state_guard.cc708_count += 1;
|
state_guard.cc708_count += 1;
|
||||||
o.get_property("cc708").unwrap();
|
o.property("cc708").unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
/* valid cc608 data moves cc608 property to true */
|
/* valid cc608 data moves cc608 property to true */
|
||||||
|
|
|
@ -130,7 +130,7 @@ Time Code Rate=30DF\r\n\
|
||||||
|
|
||||||
let buf = h.pull().expect("Couldn't pull buffer");
|
let buf = h.pull().expect("Couldn't pull buffer");
|
||||||
let timecode = buf
|
let timecode = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode for buffer")
|
.expect("No timecode for buffer")
|
||||||
.tc();
|
.tc();
|
||||||
assert_eq!(timecode, tc);
|
assert_eq!(timecode, tc);
|
||||||
|
|
|
@ -76,7 +76,7 @@ fn test_parse() {
|
||||||
);
|
);
|
||||||
|
|
||||||
let tc_meta = buf
|
let tc_meta = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode meta");
|
.expect("No timecode meta");
|
||||||
if let Some(ref timecode) = expected_timecode {
|
if let Some(ref timecode) = expected_timecode {
|
||||||
assert_eq!(&tc_meta.tc(), timecode);
|
assert_eq!(&tc_meta.tc(), timecode);
|
||||||
|
@ -101,7 +101,7 @@ fn test_parse() {
|
||||||
);
|
);
|
||||||
|
|
||||||
let tc_meta = buf
|
let tc_meta = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode meta");
|
.expect("No timecode meta");
|
||||||
if let Some(ref timecode) = expected_timecode {
|
if let Some(ref timecode) = expected_timecode {
|
||||||
assert_eq!(&tc_meta.tc(), timecode);
|
assert_eq!(&tc_meta.tc(), timecode);
|
||||||
|
|
|
@ -64,7 +64,7 @@ fn test_encode_single_packet() {
|
||||||
let buf = h.pull().expect("Couldn't pull buffer");
|
let buf = h.pull().expect("Couldn't pull buffer");
|
||||||
|
|
||||||
let timecode = buf
|
let timecode = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode for buffer")
|
.expect("No timecode for buffer")
|
||||||
.tc();
|
.tc();
|
||||||
assert_eq!(timecode, tc);
|
assert_eq!(timecode, tc);
|
||||||
|
@ -163,7 +163,7 @@ fn test_encode_multiple_packets() {
|
||||||
let buf = h.pull().expect("Couldn't pull buffer");
|
let buf = h.pull().expect("Couldn't pull buffer");
|
||||||
|
|
||||||
let timecode = buf
|
let timecode = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode for buffer")
|
.expect("No timecode for buffer")
|
||||||
.tc();
|
.tc();
|
||||||
assert_eq!(timecode, tc1);
|
assert_eq!(timecode, tc1);
|
||||||
|
@ -181,7 +181,7 @@ fn test_encode_multiple_packets() {
|
||||||
// Pull 2
|
// Pull 2
|
||||||
let buf = h.pull().expect("Couldn't pull buffer");
|
let buf = h.pull().expect("Couldn't pull buffer");
|
||||||
let timecode = buf
|
let timecode = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode for buffer")
|
.expect("No timecode for buffer")
|
||||||
.tc();
|
.tc();
|
||||||
assert_eq!(timecode, tc2);
|
assert_eq!(timecode, tc2);
|
||||||
|
@ -210,7 +210,7 @@ fn test_encode_multiple_packets() {
|
||||||
// Pull 3
|
// Pull 3
|
||||||
let buf = h.pull().expect("Couldn't pull buffer");
|
let buf = h.pull().expect("Couldn't pull buffer");
|
||||||
let timecode = buf
|
let timecode = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode for buffer")
|
.expect("No timecode for buffer")
|
||||||
.tc();
|
.tc();
|
||||||
assert_eq!(timecode, tc3);
|
assert_eq!(timecode, tc3);
|
||||||
|
|
|
@ -170,7 +170,7 @@ fn test_timecodes() {
|
||||||
|
|
||||||
// get the timecode of the buffer
|
// get the timecode of the buffer
|
||||||
let tc = buf
|
let tc = buf
|
||||||
.get_meta::<gst_video::VideoTimeCodeMeta>()
|
.meta::<gst_video::VideoTimeCodeMeta>()
|
||||||
.expect("No timecode meta")
|
.expect("No timecode meta")
|
||||||
.tc();
|
.tc();
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ impl Dav1dDec {
|
||||||
.output_state()
|
.output_state()
|
||||||
.expect("Output state not set. Shouldn't happen!");
|
.expect("Output state not set. Shouldn't happen!");
|
||||||
let offset = pic.offset() as i32;
|
let offset = pic.offset() as i32;
|
||||||
if let Some(mut frame) = element.get_frame(offset) {
|
if let Some(mut frame) = element.frame(offset) {
|
||||||
let output_buffer = self.decoded_picture_as_buffer(&pic, output_state)?;
|
let output_buffer = self.decoded_picture_as_buffer(&pic, output_state)?;
|
||||||
frame.set_output_buffer(output_buffer);
|
frame.set_output_buffer(output_buffer);
|
||||||
element.finish_frame(frame)?;
|
element.finish_frame(frame)?;
|
||||||
|
@ -278,7 +278,7 @@ impl Dav1dDec {
|
||||||
|
|
||||||
fn drop_decoded_pictures(&self) {
|
fn drop_decoded_pictures(&self) {
|
||||||
let mut decoder = self.decoder.lock().unwrap();
|
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");
|
gst_debug!(CAT, "Dropping picture");
|
||||||
drop(pic);
|
drop(pic);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ impl Dav1dDec {
|
||||||
) -> Result<Vec<(dav1d::Picture, gst_video::VideoFormat)>, gst::FlowError> {
|
) -> Result<Vec<(dav1d::Picture, gst_video::VideoFormat)>, gst::FlowError> {
|
||||||
let mut decoder = self.decoder.lock().unwrap();
|
let mut decoder = self.decoder.lock().unwrap();
|
||||||
let mut pictures = vec![];
|
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);
|
let format = self.gst_video_format_from_dav1d_picture(&pic);
|
||||||
if format == gst_video::VideoFormat::Unknown {
|
if format == gst_video::VideoFormat::Unknown {
|
||||||
return Err(gst::FlowError::NotNegotiated);
|
return Err(gst::FlowError::NotNegotiated);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl ObjectSubclass for FlvDemux {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.activate_function(|pad, parent| {
|
.activate_function(|pad, parent| {
|
||||||
FlvDemux::catch_panic_pad_function(
|
FlvDemux::catch_panic_pad_function(
|
||||||
|
@ -637,7 +637,7 @@ impl FlvDemux {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_srcpad(&self, element: &super::FlvDemux, name: &str, caps: &gst::Caps) -> gst::Pad {
|
fn create_srcpad(&self, element: &super::FlvDemux, name: &str, caps: &gst::Caps) -> gst::Pad {
|
||||||
let templ = element.element_class().get_pad_template(name).unwrap();
|
let templ = element.element_class().pad_template(name).unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some(name))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some(name))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
FlvDemux::catch_panic_pad_function(
|
FlvDemux::catch_panic_pad_function(
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,7 @@ impl VideoEncoderImpl for GifEnc {
|
||||||
return Err(gst::FlowError::Error);
|
return Err(gst::FlowError::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut raw_frame = get_tightly_packed_framebuffer(&in_frame);
|
let mut raw_frame = tightly_packed_framebuffer(&in_frame);
|
||||||
let mut gif_frame = match in_frame.info().format() {
|
let mut gif_frame = match in_frame.info().format() {
|
||||||
gst_video::VideoFormat::Rgb => {
|
gst_video::VideoFormat::Rgb => {
|
||||||
gif::Frame::from_rgb_speed(
|
gif::Frame::from_rgb_speed(
|
||||||
|
@ -414,7 +414,7 @@ impl GifEnc {
|
||||||
});
|
});
|
||||||
if let Some(trailer_buffer) = trailer_buffer {
|
if let Some(trailer_buffer) = trailer_buffer {
|
||||||
// manually push GIF trailer to the encoder's src pad
|
// manually push GIF trailer to the encoder's src pad
|
||||||
let srcpad = element.get_static_pad("src").unwrap();
|
let srcpad = element.static_pad("src").unwrap();
|
||||||
srcpad.push(trailer_buffer)?;
|
srcpad.push(trailer_buffer)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -739,9 +739,7 @@ impl Rav1Enc {
|
||||||
packet_type
|
packet_type
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut frame = element
|
let mut frame = element.frame(frame_number as i32).expect("frame not found");
|
||||||
.get_frame(frame_number as i32)
|
|
||||||
.expect("frame not found");
|
|
||||||
|
|
||||||
if packet_type == data::FrameType::KEY {
|
if packet_type == data::FrameType::KEY {
|
||||||
frame.set_flags(gst_video::VideoCodecFrameFlags::SYNC_POINT);
|
frame.set_flags(gst_video::VideoCodecFrameFlags::SYNC_POINT);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
gst_plugin_version_helper::get_info()
|
gst_plugin_version_helper::info()
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@ impl ObjectSubclass for WebPDec {
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.pad_template("sink").unwrap();
|
||||||
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
|
||||||
.chain_function(|pad, parent, buffer| {
|
.chain_function(|pad, parent, buffer| {
|
||||||
WebPDec::catch_panic_pad_function(
|
WebPDec::catch_panic_pad_function(
|
||||||
|
@ -309,7 +309,7 @@ impl ObjectSubclass for WebPDec {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.pad_template("src").unwrap();
|
||||||
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
|
||||||
.event_function(|pad, parent, event| {
|
.event_function(|pad, parent, event| {
|
||||||
WebPDec::catch_panic_pad_function(
|
WebPDec::catch_panic_pad_function(
|
||||||
|
|
Loading…
Reference in a new issue