feat(sink): It works!!!!

This commit is contained in:
Wanjohi
2024-01-26 11:26:18 +03:00
parent 8863379c55
commit 8fe7d6ce65

View File

@@ -308,39 +308,33 @@ impl GST {
} }
}); });
// appsink.set_callbacks( appsink.set_callbacks(
// gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
// .new_sample(move |sink| { .new_sample(move |sink| {
// let sample = sink /*FIXME: this error is happening on the last last element... so we need a way to gracefully end the stream. Find out how the muxer works
// .pull_sample() no buffer list
// .with_context(|| "Error pulling sample") note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
// .map_err(|e| { Got error from /GstPipeline:pipeline0/GstAppSink:sink: Panicked: no buffer list ()
// eprintln!("{:?}", e); */
// gst::FlowError::Eos
// })?;
// // The muxer only outputs non-empty buffer lists
// let mut buffer_list = sample.buffer_list_owned().expect("no buffer list");
// Ok(gst::FlowSuccess::Ok) let sample = sink
// }) .pull_sample()
// .query(move |sink, query| { .with_context(|| "Error pulling sample")
// // Handle the seeking query .map_err(|e| {
// if let Some(seeking) = query.downcast_mut::<gst::query::Seeking>() { eprintln!("{:?}", e);
// if seeking.format() == gst::Format::Bytes { gst::FlowError::Eos
// // Set the seekable flag based on your custom sink's seekability })?;
// seeking.set_seekable(true); // Replace with your own logic to determine if the sink is seekable // The muxer only outputs non-empty buffer lists
// return true; let mut buffer_list = sample.buffer_list_owned().expect("no buffer list");
// }
// }
// // Handle other queries if needed for buffer in &*buffer_list {
// // ... println!("Found buffer {:?}", buffer);
}
// // Call the default query handler for unhandled queries Ok(gst::FlowSuccess::Ok)
// sink.parent_query(query) })
// }) .build(),
// .build(), );
// );
// println!("buffer is empty {:?}", buffer_list.is_empty()); // println!("buffer is empty {:?}", buffer_list.is_empty());
// assert!(!buffer_list.is_empty()); // assert!(!buffer_list.is_empty());