audio: Implement From/ToValue in Audio/VideoConverterConfig

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1408>
This commit is contained in:
Piotr Brzeziński 2024-03-20 19:24:33 +01:00 committed by GStreamer Marge Bot
parent 7cea7ba6f1
commit 6111663e26
2 changed files with 49 additions and 1 deletions

View file

@ -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"))

View file

@ -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"))