mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
audio: Implement From/ToValue in Audio/VideoConverterConfig
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1408>
This commit is contained in:
parent
7cea7ba6f1
commit
6111663e26
2 changed files with 49 additions and 1 deletions
|
@ -73,6 +73,30 @@ impl From<AudioConverterConfig> for gst::Structure {
|
|||
}
|
||||
}
|
||||
|
||||
impl glib::value::ToValue for AudioConverterConfig {
|
||||
fn to_value(&self) -> glib::Value {
|
||||
self.0.to_value()
|
||||
}
|
||||
|
||||
fn value_type(&self) -> glib::Type {
|
||||
self.0.value_type()
|
||||
}
|
||||
}
|
||||
|
||||
impl glib::value::ToValueOptional for AudioConverterConfig {
|
||||
fn to_value_optional(s: Option<&Self>) -> glib::Value {
|
||||
skip_assert_initialized!();
|
||||
s.map(|s| &s.0).to_value()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AudioConverterConfig> for glib::Value {
|
||||
fn from(s: AudioConverterConfig) -> glib::Value {
|
||||
skip_assert_initialized!();
|
||||
s.0.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl AudioConverterConfig {
|
||||
pub fn new() -> Self {
|
||||
Self(gst::Structure::new_empty("GstAudioConverter"))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use std::{ops, ptr};
|
||||
|
||||
use crate::VideoFrameExt;
|
||||
use glib::translate::*;
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[doc(alias = "GstVideoConverter")]
|
||||
|
@ -179,6 +179,30 @@ impl From<VideoConverterConfig> for gst::Structure {
|
|||
}
|
||||
}
|
||||
|
||||
impl glib::value::ToValue for VideoConverterConfig {
|
||||
fn to_value(&self) -> glib::Value {
|
||||
self.0.to_value()
|
||||
}
|
||||
|
||||
fn value_type(&self) -> glib::Type {
|
||||
self.0.value_type()
|
||||
}
|
||||
}
|
||||
|
||||
impl glib::value::ToValueOptional for VideoConverterConfig {
|
||||
fn to_value_optional(s: Option<&Self>) -> glib::Value {
|
||||
skip_assert_initialized!();
|
||||
s.map(|s| &s.0).to_value()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<VideoConverterConfig> for glib::Value {
|
||||
fn from(s: VideoConverterConfig) -> glib::Value {
|
||||
skip_assert_initialized!();
|
||||
s.0.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl VideoConverterConfig {
|
||||
pub fn new() -> Self {
|
||||
Self(gst::Structure::new_empty("GstVideoConverter"))
|
||||
|
|
Loading…
Reference in a new issue