feat(gst): enhance GStreamer integration with new modules and improved API
This commit introduces significant enhancements to the GStreamer integration by: - Adding new modules for bins, caps, elements, pads, and plugins - Implementing a more ergonomic API with helper methods like play(), pause(), ready() - Adding support for various GStreamer plugins including app, autodetect, playback, and videoconvertscale - Improving error handling with better context attachment - Updating dependencies to latest versions including gstreamer-video 0.24.4 - Refactoring existing code to use modern Rust patterns and features
This commit is contained in:
30
gst/src/plugins/autodetect/autovideosink.rs
Normal file
30
gst/src/plugins/autodetect/autovideosink.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use crate::*;
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct AutoVideoSink {
|
||||
inner: gstreamer::Element,
|
||||
}
|
||||
|
||||
impl IsElement for AutoVideoSink {
|
||||
fn as_element(&self) -> &Element {
|
||||
unsafe { core::mem::transmute(&self.inner) }
|
||||
}
|
||||
|
||||
fn into_element(self) -> Element {
|
||||
Element { inner: self.inner }
|
||||
}
|
||||
}
|
||||
|
||||
impl Sink for AutoVideoSink {}
|
||||
|
||||
impl AutoVideoSink {
|
||||
pub fn new(name: impl AsRef<str>) -> Result<Self> {
|
||||
use gstreamer::prelude::*;
|
||||
let element = gstreamer::ElementFactory::make("autovideosink")
|
||||
.name(name.as_ref())
|
||||
.build()
|
||||
.change_context(Error)
|
||||
.attach("Failed to create autovideosink element")?;
|
||||
Ok(AutoVideoSink { inner: element })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user