Use SendValue instead of Value for all our GValue usage

We require types that can be sent between threads.
This commit is contained in:
Sebastian Dröge 2017-11-15 19:18:58 +02:00
parent 9734ec29cc
commit 0629a0283e
7 changed files with 101 additions and 96 deletions

View file

@ -16,7 +16,7 @@ use CapsIntersectMode;
use glib;
use ffi;
use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr};
use glib::value::ToValue;
use glib::value::ToSendValue;
#[repr(C)]
pub struct CapsRef(ffi::GstCaps);
@ -43,7 +43,7 @@ impl GstRc<CapsRef> {
unsafe { from_glib_full(ffi::gst_caps_new_any()) }
}
pub fn new_simple(name: &str, values: &[(&str, &ToValue)]) -> Self {
pub fn new_simple(name: &str, values: &[(&str, &ToSendValue)]) -> Self {
assert_initialized_main_thread!();
let mut caps = Caps::new_empty();
@ -117,7 +117,7 @@ impl str::FromStr for Caps {
}
impl CapsRef {
pub fn set_simple(&mut self, values: &[(&str, &ToValue)]) {
pub fn set_simple(&mut self, values: &[(&str, &ToSendValue)]) {
for &(name, value) in values {
let value = value.to_value();
@ -382,7 +382,7 @@ impl Builder {
}
}
pub fn field<V: ToValue>(mut self, name: &str, value: V) -> Self {
pub fn field<V: ToSendValue>(mut self, name: &str, value: V) -> Self {
self.s.set(name, value);
self
}

View file

@ -15,7 +15,7 @@ use std::mem;
use std::ffi::CStr;
use glib;
use glib::value::ToValue;
use glib::value::ToSendValue;
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
#[cfg(any(feature = "v1_10", feature = "dox"))]
@ -723,7 +723,7 @@ macro_rules! event_builder_generic_impl {
}
}
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToValue)]) -> Self {
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
Self {
other_fields: self.other_fields.iter().cloned()
.chain(other_fields.iter().cloned())
@ -750,7 +750,7 @@ macro_rules! event_builder_generic_impl {
);
for (k, v) in self.other_fields {
s.set_value(k, v.to_value());
s.set_value(k, v.to_send_value());
}
}
@ -763,7 +763,7 @@ macro_rules! event_builder_generic_impl {
pub struct FlushStartBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> FlushStartBuilder<'a> {
fn new() -> Self {
@ -781,7 +781,7 @@ impl<'a> FlushStartBuilder<'a> {
pub struct FlushStopBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
reset_time: bool,
}
impl<'a> FlushStopBuilder<'a> {
@ -803,7 +803,7 @@ impl<'a> FlushStopBuilder<'a> {
pub struct StreamStartBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
stream_id: &'a str,
flags: Option<::StreamFlags>,
group_id: Option<u32>,
@ -850,7 +850,7 @@ impl<'a> StreamStartBuilder<'a> {
pub struct CapsBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
caps: &'a ::Caps,
}
impl<'a> CapsBuilder<'a> {
@ -870,7 +870,7 @@ impl<'a> CapsBuilder<'a> {
pub struct SegmentBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
segment: &'a ::Segment,
}
impl<'a> SegmentBuilder<'a> {
@ -893,7 +893,7 @@ impl<'a> SegmentBuilder<'a> {
pub struct StreamCollectionBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
stream_collection: &'a ::StreamCollection,
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
@ -916,7 +916,7 @@ impl<'a> StreamCollectionBuilder<'a> {
pub struct TagBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
tags: Option<::TagList>,
}
impl<'a> TagBuilder<'a> {
@ -939,7 +939,7 @@ impl<'a> TagBuilder<'a> {
pub struct BufferSizeBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
minsize: ::FormatValue,
maxsize: ::FormatValue,
async: bool,
@ -970,7 +970,7 @@ impl<'a> BufferSizeBuilder<'a> {
pub struct SinkMessageBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
name: &'a str,
msg: &'a ::Message,
}
@ -995,7 +995,7 @@ impl<'a> SinkMessageBuilder<'a> {
pub struct StreamGroupDoneBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
uid: u32,
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
@ -1016,7 +1016,7 @@ impl<'a> StreamGroupDoneBuilder<'a> {
pub struct EosBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> EosBuilder<'a> {
fn new() -> Self {
@ -1034,7 +1034,7 @@ impl<'a> EosBuilder<'a> {
pub struct TocBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
toc: &'a ::Toc,
updated: bool,
}
@ -1058,7 +1058,7 @@ impl<'a> TocBuilder<'a> {
pub struct ProtectionBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
system_id: &'a str,
data: &'a ::Buffer,
origin: &'a str,
@ -1088,7 +1088,7 @@ impl<'a> ProtectionBuilder<'a> {
pub struct SegmentDoneBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
position: ::FormatValue,
}
impl<'a> SegmentDoneBuilder<'a> {
@ -1110,7 +1110,7 @@ impl<'a> SegmentDoneBuilder<'a> {
pub struct GapBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
timestamp: u64,
duration: u64,
}
@ -1132,7 +1132,7 @@ impl<'a> GapBuilder<'a> {
pub struct QosBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::QOSType,
proportion: f64,
diff: i64,
@ -1160,7 +1160,7 @@ impl<'a> QosBuilder<'a> {
pub struct SeekBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
rate: f64,
flags: ::SeekFlags,
start_type: ::SeekType,
@ -1207,7 +1207,7 @@ impl<'a> SeekBuilder<'a> {
pub struct NavigationBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>,
}
impl<'a> NavigationBuilder<'a> {
@ -1233,7 +1233,7 @@ impl<'a> NavigationBuilder<'a> {
pub struct LatencyBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
latency: u64,
}
impl<'a> LatencyBuilder<'a> {
@ -1253,7 +1253,7 @@ impl<'a> LatencyBuilder<'a> {
pub struct StepBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
fmt: ::Format,
amount: u64,
rate: f64,
@ -1289,7 +1289,7 @@ impl<'a> StepBuilder<'a> {
pub struct ReconfigureBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> ReconfigureBuilder<'a> {
fn new() -> Self {
@ -1307,7 +1307,7 @@ impl<'a> ReconfigureBuilder<'a> {
pub struct TocSelectBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
uid: &'a str,
}
impl<'a> TocSelectBuilder<'a> {
@ -1330,7 +1330,7 @@ impl<'a> TocSelectBuilder<'a> {
pub struct SelectStreamsBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
streams: &'a [&'a str],
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
@ -1353,7 +1353,7 @@ impl<'a> SelectStreamsBuilder<'a> {
pub struct CustomUpstreamBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>,
}
impl<'a> CustomUpstreamBuilder<'a> {
@ -1380,7 +1380,7 @@ impl<'a> CustomUpstreamBuilder<'a> {
pub struct CustomDownstreamBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>,
}
impl<'a> CustomDownstreamBuilder<'a> {
@ -1407,7 +1407,7 @@ impl<'a> CustomDownstreamBuilder<'a> {
pub struct CustomDownstreamOobBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>,
}
impl<'a> CustomDownstreamOobBuilder<'a> {
@ -1436,7 +1436,7 @@ impl<'a> CustomDownstreamOobBuilder<'a> {
pub struct CustomDownstreamStickyBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>,
}
impl<'a> CustomDownstreamStickyBuilder<'a> {
@ -1465,7 +1465,7 @@ impl<'a> CustomDownstreamStickyBuilder<'a> {
pub struct CustomBothBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>,
}
impl<'a> CustomBothBuilder<'a> {
@ -1491,7 +1491,7 @@ impl<'a> CustomBothBuilder<'a> {
pub struct CustomBothOobBuilder<'a> {
seqnum: Option<u32>,
running_time_offset: Option<i64>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<Structure>,
}
impl<'a> CustomBothOobBuilder<'a> {

View file

@ -19,7 +19,7 @@ use std::ffi::CStr;
use glib;
use glib::Cast;
use glib::IsA;
use glib::value::ToValue;
use glib::value::ToSendValue;
use glib::translate::{from_glib, from_glib_full, from_glib_none, mut_override, ToGlib, ToGlibPtr};
#[repr(C)]
@ -1131,7 +1131,7 @@ macro_rules! message_builder_generic_impl {
}
}
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToValue)]) -> Self {
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
Self {
other_fields: self.other_fields.iter().cloned()
.chain(other_fields.iter().cloned())
@ -1155,7 +1155,7 @@ macro_rules! message_builder_generic_impl {
);
for (k, v) in self.other_fields {
s.set_value(k, v.to_value());
s.set_value(k, v.to_send_value());
}
}
@ -1168,7 +1168,7 @@ macro_rules! message_builder_generic_impl {
pub struct EosBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> EosBuilder<'a> {
fn new() -> Self {
@ -1193,7 +1193,7 @@ impl MessageErrorDomain for ::LibraryError {}
pub struct ErrorBuilder<'a, T> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
error: T,
message: &'a str,
debug: Option<&'a str>,
@ -1261,7 +1261,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
pub struct WarningBuilder<'a, T> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
error: T,
message: &'a str,
debug: Option<&'a str>,
@ -1329,7 +1329,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
pub struct InfoBuilder<'a, T> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
error: T,
message: &'a str,
debug: Option<&'a str>,
@ -1397,7 +1397,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
pub struct TagBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
tags: &'a TagList,
}
impl<'a> TagBuilder<'a> {
@ -1419,7 +1419,7 @@ impl<'a> TagBuilder<'a> {
pub struct BufferingBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
percent: i32,
stats: Option<(::BufferingMode, i32, i32, i64)>,
}
@ -1469,7 +1469,7 @@ impl<'a> BufferingBuilder<'a> {
pub struct StateChangedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
old: ::State,
new: ::State,
pending: ::State,
@ -1500,7 +1500,7 @@ impl<'a> StateChangedBuilder<'a> {
pub struct StateDirtyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> StateDirtyBuilder<'a> {
fn new() -> Self {
@ -1518,7 +1518,7 @@ impl<'a> StateDirtyBuilder<'a> {
pub struct StepDoneBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
format: ::Format,
amount: u64,
rate: f64,
@ -1569,7 +1569,7 @@ impl<'a> StepDoneBuilder<'a> {
pub struct ClockProvideBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
clock: &'a ::Clock,
ready: bool,
}
@ -1593,7 +1593,7 @@ impl<'a> ClockProvideBuilder<'a> {
pub struct ClockLostBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
clock: &'a ::Clock,
}
impl<'a> ClockLostBuilder<'a> {
@ -1615,7 +1615,7 @@ impl<'a> ClockLostBuilder<'a> {
pub struct NewClockBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
clock: &'a ::Clock,
}
impl<'a> NewClockBuilder<'a> {
@ -1637,7 +1637,7 @@ impl<'a> NewClockBuilder<'a> {
pub struct StructureChangeBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::StructureChangeType,
owner: &'a ::Element,
busy: bool,
@ -1668,7 +1668,7 @@ impl<'a> StructureChangeBuilder<'a> {
pub struct StreamStatusBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::StreamStatusType,
owner: &'a ::Element,
status_object: Option<&'a glib::Value>,
@ -1706,7 +1706,7 @@ impl<'a> StreamStatusBuilder<'a> {
pub struct ApplicationBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<::Structure>,
}
impl<'a> ApplicationBuilder<'a> {
@ -1728,7 +1728,7 @@ impl<'a> ApplicationBuilder<'a> {
pub struct ElementBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
structure: Option<::Structure>,
}
impl<'a> ElementBuilder<'a> {
@ -1750,7 +1750,7 @@ impl<'a> ElementBuilder<'a> {
pub struct SegmentStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
position: ::FormatValue,
}
impl<'a> SegmentStartBuilder<'a> {
@ -1776,7 +1776,7 @@ impl<'a> SegmentStartBuilder<'a> {
pub struct SegmentDoneBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
position: ::FormatValue,
}
impl<'a> SegmentDoneBuilder<'a> {
@ -1802,7 +1802,7 @@ impl<'a> SegmentDoneBuilder<'a> {
pub struct DurationChangedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> DurationChangedBuilder<'a> {
fn new() -> Self {
@ -1820,7 +1820,7 @@ impl<'a> DurationChangedBuilder<'a> {
pub struct LatencyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> LatencyBuilder<'a> {
fn new() -> Self {
@ -1838,7 +1838,7 @@ impl<'a> LatencyBuilder<'a> {
pub struct AsyncStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
}
impl<'a> AsyncStartBuilder<'a> {
fn new() -> Self {
@ -1856,7 +1856,7 @@ impl<'a> AsyncStartBuilder<'a> {
pub struct AsyncDoneBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
running_time: u64,
}
impl<'a> AsyncDoneBuilder<'a> {
@ -1878,7 +1878,7 @@ impl<'a> AsyncDoneBuilder<'a> {
pub struct RequestStateBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
state: ::State,
}
impl<'a> RequestStateBuilder<'a> {
@ -1900,7 +1900,7 @@ impl<'a> RequestStateBuilder<'a> {
pub struct StepStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
active: bool,
format: ::Format,
amount: u64,
@ -1947,7 +1947,7 @@ impl<'a> StepStartBuilder<'a> {
pub struct QosBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
live: bool,
running_time: u64,
stream_time: u64,
@ -2009,7 +2009,7 @@ impl<'a> QosBuilder<'a> {
pub struct ProgressBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
type_: ::ProgressType,
code: Option<&'a str>,
text: Option<&'a str>,
@ -2054,7 +2054,7 @@ impl<'a> ProgressBuilder<'a> {
pub struct TocBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
toc: &'a ::Toc,
updated: bool,
}
@ -2078,7 +2078,7 @@ impl<'a> TocBuilder<'a> {
pub struct ResetTimeBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
running_time: u64,
}
impl<'a> ResetTimeBuilder<'a> {
@ -2100,7 +2100,7 @@ impl<'a> ResetTimeBuilder<'a> {
pub struct StreamStartBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
group_id: Option<u32>,
}
impl<'a> StreamStartBuilder<'a> {
@ -2133,7 +2133,7 @@ impl<'a> StreamStartBuilder<'a> {
pub struct NeedContextBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
context_type: &'a str,
}
impl<'a> NeedContextBuilder<'a> {
@ -2155,7 +2155,7 @@ impl<'a> NeedContextBuilder<'a> {
pub struct HaveContextBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
context: Option<::Context>,
}
impl<'a> HaveContextBuilder<'a> {
@ -2178,7 +2178,7 @@ impl<'a> HaveContextBuilder<'a> {
pub struct DeviceAddedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
device: &'a ::Device,
}
impl<'a> DeviceAddedBuilder<'a> {
@ -2200,7 +2200,7 @@ impl<'a> DeviceAddedBuilder<'a> {
pub struct DeviceRemovedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
device: &'a ::Device,
}
impl<'a> DeviceRemovedBuilder<'a> {
@ -2223,7 +2223,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
pub struct PropertyNotifyBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
property_name: &'a str,
value: &'a glib::Value,
}
@ -2253,7 +2253,7 @@ impl<'a> PropertyNotifyBuilder<'a> {
pub struct StreamCollectionBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
collection: &'a ::StreamCollection,
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
@ -2277,7 +2277,7 @@ impl<'a> StreamCollectionBuilder<'a> {
pub struct StreamsSelectedBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
#[cfg(any(feature = "v1_10", feature = "dox"))]
collection: &'a ::StreamCollection,
#[cfg(any(feature = "v1_10", feature = "dox"))]
@ -2318,7 +2318,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
pub struct RedirectBuilder<'a> {
src: Option<Object>,
seqnum: Option<u32>,
other_fields: Vec<(&'a str, &'a ToValue)>,
other_fields: Vec<(&'a str, &'a ToSendValue)>,
location: &'a str,
tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>,

View file

@ -20,12 +20,13 @@ use Fraction;
use glib;
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrFull, FromGlibPtrNone,
GlibPtrDefault, Stash, StashMut, ToGlib, ToGlibPtr, ToGlibPtrMut};
use glib::value::{FromValueOptional, ToValue, Value};
use glib::value::{FromValueOptional, ToSendValue, SendValue};
use ffi;
use glib_ffi::gpointer;
use gobject_ffi;
pub struct Structure(*mut StructureRef, PhantomData<StructureRef>);
unsafe impl Send for Structure { }
impl Structure {
pub fn builder(name: &str) -> Builder {
@ -41,12 +42,12 @@ impl Structure {
)
}
pub fn new(name: &str, values: &[(&str, &ToValue)]) -> Structure {
pub fn new(name: &str, values: &[(&str, &ToSendValue)]) -> Structure {
assert_initialized_main_thread!();
let mut structure = Structure::new_empty(name);
for &(f, v) in values {
structure.set_value(f, v.to_value());
structure.set_value(f, v.to_send_value());
}
structure
@ -288,11 +289,11 @@ impl StructureRef {
unsafe { from_glib_full(ffi::gst_structure_to_string(&self.0)) }
}
pub fn get<'a, T: FromValueOptional<'a>>(&'a self, name: &str) -> Option<T> {
pub fn get<'a, T: FromValueOptional<'a> + Send>(&'a self, name: &str) -> Option<T> {
self.get_value(name).and_then(|v| v.get())
}
pub fn get_value<'a>(&'a self, name: &str) -> Option<&Value> {
pub fn get_value<'a>(&'a self, name: &str) -> Option<&SendValue> {
unsafe {
let value = ffi::gst_structure_get_value(&self.0, name.to_glib_none().0);
@ -300,16 +301,16 @@ impl StructureRef {
return None;
}
Some(&*(value as *const Value))
Some(&*(value as *const SendValue))
}
}
pub fn set<T: ToValue>(&mut self, name: &str, value: T) {
let value = value.to_value();
pub fn set<T: ToSendValue>(&mut self, name: &str, value: T) {
let value = value.to_send_value();
self.set_value(name, value);
}
pub fn set_value(&mut self, name: &str, mut value: Value) {
pub fn set_value(&mut self, name: &str, mut value: SendValue) {
unsafe {
ffi::gst_structure_take_value(
&mut self.0,
@ -567,9 +568,9 @@ impl<'a> Iter<'a> {
}
impl<'a> Iterator for Iter<'a> {
type Item = (&'a str, &'a Value);
type Item = (&'a str, &'a SendValue);
fn next(&mut self) -> Option<(&'a str, &'a Value)> {
fn next(&mut self) -> Option<(&'a str, &'a SendValue)> {
if let Some(f) = self.iter.next() {
let v = self.iter.structure.get_value(f);
Some((f, v.unwrap()))
@ -607,7 +608,7 @@ impl Builder {
}
}
pub fn field<V: ToValue>(mut self, name: &str, value: V) -> Self {
pub fn field<V: ToSendValue>(mut self, name: &str, value: V) -> Self {
self.s.set(name, value);
self
}

View file

@ -11,22 +11,22 @@ use TagSetter;
use TagMergeMode;
use glib::object::IsA;
use glib::translate::*;
use glib::value::ToValue;
use glib::value::ToSendValue;
use tags::*;
pub trait TagSetterExtManual {
fn add<'a, T: Tag<'a>>(&mut self, value: T::TagType, mode: TagMergeMode)
where
T::TagType: ToValue;
T::TagType: ToSendValue;
}
impl<O: IsA<TagSetter>> TagSetterExtManual for O {
fn add<'a, T: Tag<'a>>(&mut self, value: T::TagType, mode: TagMergeMode)
where
T::TagType: ToValue,
T::TagType: ToSendValue,
{
unsafe {
let v = value.to_value();
let v = value.to_send_value();
ffi::gst_tag_setter_add_tag_value(
self.to_glib_none().0,

View file

@ -14,7 +14,7 @@ use std::ffi::CStr;
use ffi;
use glib;
use glib::StaticType;
use glib::value::{FromValueOptional, SetValue, ToValue, TypedValue, Value};
use glib::value::{FromValueOptional, SetValue, ToSendValue, TypedValue, Value};
use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr, ToGlibPtrMut};
use miniobject::*;
@ -23,7 +23,7 @@ use TagMergeMode;
use Sample;
pub trait Tag<'a> {
type TagType: FromValueOptional<'a> + SetValue;
type TagType: FromValueOptional<'a> + SetValue + Send;
fn tag_name<'b>() -> &'b str;
}
@ -257,10 +257,10 @@ impl Default for GstRc<TagListRef> {
impl TagListRef {
pub fn add<'a, T: Tag<'a>>(&mut self, value: T::TagType, mode: TagMergeMode)
where
T::TagType: ToValue,
T::TagType: ToSendValue,
{
unsafe {
let v = value.to_value();
let v = value.to_send_value();
ffi::gst_tag_list_add_value(
self.as_mut_ptr(),

View file

@ -524,6 +524,8 @@ impl SetValue for Bitmask {
#[derive(Clone, Debug)]
pub struct Array<'a>(Cow<'a, [glib::Value]>);
unsafe impl<'a> Send for Array<'a> {}
impl<'a> Array<'a> {
pub fn new(values: &[&ToValue]) -> Self {
assert_initialized_main_thread!();
@ -593,6 +595,8 @@ impl<'a> glib::types::StaticType for Array<'a> {
#[derive(Clone, Debug)]
pub struct List<'a>(Cow<'a, [glib::Value]>);
unsafe impl<'a> Send for List<'a> {}
impl<'a> List<'a> {
pub fn new(values: &[&ToValue]) -> Self {
assert_initialized_main_thread!();