From d257ece388fa76e933a2908e29fd826eb288afbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 25 Dec 2018 01:15:43 +0100 Subject: [PATCH] Make `Value` serialize/deserialize `Buffer`s --- gstreamer/src/structure_serde.rs | 1 + gstreamer/src/value_serde.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/gstreamer/src/structure_serde.rs b/gstreamer/src/structure_serde.rs index 48c5c9bff..0c50d4196 100644 --- a/gstreamer/src/structure_serde.rs +++ b/gstreamer/src/structure_serde.rs @@ -16,6 +16,7 @@ use serde::ser::{Serialize, SerializeSeq, SerializeTuple, Serializer}; use std::fmt; +use Buffer; use DateTime; use Sample; diff --git a/gstreamer/src/value_serde.rs b/gstreamer/src/value_serde.rs index a72fc1817..6fce3bc89 100644 --- a/gstreamer/src/value_serde.rs +++ b/gstreamer/src/value_serde.rs @@ -18,6 +18,7 @@ use serde::ser::{Serialize, SerializeTuple, Serializer}; use std::{fmt, mem}; +use Buffer; use DateTime; use Sample; @@ -41,6 +42,7 @@ lazy_static! { pub(crate) static ref INT_RANGE_I64_OTHER_TYPE_ID: usize = get_other_type_id::>(); pub(crate) static ref LIST_OTHER_TYPE_ID: usize = get_other_type_id::(); pub(crate) static ref SAMPLE_OTHER_TYPE_ID: usize = get_other_type_id::(); + pub(crate) static ref BUFFER_OTHER_TYPE_ID: usize = get_other_type_id::(); } impl<'a> Serialize for Fraction { @@ -94,6 +96,8 @@ macro_rules! ser_value ( ser_value!($value, List, $ser_closure) } else if *SAMPLE_OTHER_TYPE_ID == type_id { ser_value!($value, Sample, $ser_closure) + } else if *BUFFER_OTHER_TYPE_ID == type_id { + ser_value!($value, Buffer, $ser_closure) } else { Err( ser::Error::custom( @@ -208,6 +212,7 @@ macro_rules! de_send_value( "IntRange" => de_send_value!($type_name, $seq, IntRange), "IntRange" => de_send_value!($type_name, $seq, IntRange), "Sample" => de_send_value!($type_name, $seq, Sample), + "Buffer" => de_send_value!($type_name, $seq, Buffer), _ => return Err( de::Error::custom( format!(