feat: Get iced-video working
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
use crate::*;
|
||||
use gstreamer::Fraction;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[repr(transparent)]
|
||||
pub struct Caps {
|
||||
pub(crate) inner: gstreamer::caps::Caps,
|
||||
@@ -16,7 +18,6 @@ pub struct CapsBuilder {
|
||||
|
||||
impl CapsBuilder {
|
||||
pub fn field<V: Into<glib::Value> + Send>(mut self, name: impl AsRef<str>, value: V) -> Self {
|
||||
use gstreamer::prelude::*;
|
||||
self.inner = self.inner.field(name.as_ref(), value);
|
||||
self
|
||||
}
|
||||
@@ -53,10 +54,25 @@ impl CapsBuilder {
|
||||
}
|
||||
|
||||
impl Caps {
|
||||
pub fn format(&self) -> Option<&str> {
|
||||
use gstreamer::prelude::*;
|
||||
pub fn format(&self) -> Option<gstreamer_video::VideoFormat> {
|
||||
self.inner
|
||||
.structure(0)
|
||||
.and_then(|s| s.get::<&str>("format").ok())
|
||||
.map(|s| gstreamer_video::VideoFormat::from_string(s))
|
||||
}
|
||||
pub fn width(&self) -> Option<i32> {
|
||||
self.inner
|
||||
.structure(0)
|
||||
.and_then(|s| s.get::<i32>("width").ok())
|
||||
}
|
||||
pub fn height(&self) -> Option<i32> {
|
||||
self.inner
|
||||
.structure(0)
|
||||
.and_then(|s| s.get::<i32>("height").ok())
|
||||
}
|
||||
pub fn framerate(&self) -> Option<gstreamer::Fraction> {
|
||||
self.inner
|
||||
.structure(0)
|
||||
.and_then(|s| s.get::<Fraction>("framerate").ok())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user