Add remaining gst_init() assertions

This commit is contained in:
Sebastian Dröge 2017-08-30 14:39:09 +03:00
parent f05df73088
commit f0935d7e1e
22 changed files with 401 additions and 131 deletions

View file

@ -27,6 +27,8 @@ impl AudioChannelPosition {
} }
pub fn positions_to_mask(positions: &[AudioChannelPosition], force_order: bool) -> Option<u64> { pub fn positions_to_mask(positions: &[AudioChannelPosition], force_order: bool) -> Option<u64> {
assert_initialized_main_thread!();
let len = positions.len(); let len = positions.len();
if len > 64 { if len > 64 {
return None; return None;
@ -59,6 +61,8 @@ impl AudioChannelPosition {
mask: u64, mask: u64,
positions: &mut [AudioChannelPosition], positions: &mut [AudioChannelPosition],
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
assert_initialized_main_thread!();
if positions.len() > 64 { if positions.len() > 64 {
return Err(glib::BoolError("Invalid number of channels")); return Err(glib::BoolError("Invalid number of channels"));
} }
@ -89,6 +93,8 @@ impl AudioChannelPosition {
pub fn positions_to_valid_order( pub fn positions_to_valid_order(
positions: &mut [AudioChannelPosition], positions: &mut [AudioChannelPosition],
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
assert_initialized_main_thread!();
if positions.len() > 64 { if positions.len() > 64 {
return Err(glib::BoolError("Invalid number of channels")); return Err(glib::BoolError("Invalid number of channels"));
} }
@ -121,6 +127,8 @@ impl AudioChannelPosition {
} }
pub fn get_fallback_mask(channels: u32) -> u64 { pub fn get_fallback_mask(channels: u32) -> u64 {
assert_initialized_main_thread!();
unsafe { ffi::gst_audio_channel_get_fallback_mask(channels as i32) } unsafe { ffi::gst_audio_channel_get_fallback_mask(channels as i32) }
} }
@ -128,6 +136,8 @@ impl AudioChannelPosition {
positions: &[::AudioChannelPosition], positions: &[::AudioChannelPosition],
force_order: bool, force_order: bool,
) -> bool { ) -> bool {
assert_initialized_main_thread!();
if positions.len() > 64 { if positions.len() > 64 {
return false; return false;
} }
@ -157,6 +167,8 @@ pub fn buffer_reorder_channels(
from: &[AudioChannelPosition], from: &[AudioChannelPosition],
to: &[AudioChannelPosition], to: &[AudioChannelPosition],
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
assert_initialized_main_thread!();
if from.len() != to.len() || from.len() > 64 { if from.len() != to.len() || from.len() > 64 {
return Err(glib::BoolError("Invalid number of channels")); return Err(glib::BoolError("Invalid number of channels"));
} }
@ -202,6 +214,8 @@ pub fn reorder_channels(
from: &[AudioChannelPosition], from: &[AudioChannelPosition],
to: &[AudioChannelPosition], to: &[AudioChannelPosition],
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
assert_initialized_main_thread!();
if from.len() != to.len() || from.len() > 64 { if from.len() != to.len() || from.len() > 64 {
return Err(glib::BoolError("Invalid number of channels")); return Err(glib::BoolError("Invalid number of channels"));
} }
@ -246,6 +260,8 @@ pub fn get_channel_reorder_map(
to: &[AudioChannelPosition], to: &[AudioChannelPosition],
reorder_map: &mut [usize], reorder_map: &mut [usize],
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
assert_initialized_main_thread!();
if from.len() != to.len() || from.len() != reorder_map.len() || from.len() > 64 { if from.len() != to.len() || from.len() != reorder_map.len() || from.len() > 64 {
return Err(glib::BoolError("Invalid number of channels")); return Err(glib::BoolError("Invalid number of channels"));
} }

View file

@ -21,6 +21,8 @@ impl ::AudioFormat {
width: i32, width: i32,
depth: i32, depth: i32,
) -> ::AudioFormat { ) -> ::AudioFormat {
assert_initialized_main_thread!();
unsafe { unsafe {
from_glib(ffi::gst_audio_format_build_integer( from_glib(ffi::gst_audio_format_build_integer(
sign.to_glib(), sign.to_glib(),
@ -32,6 +34,8 @@ impl ::AudioFormat {
} }
pub fn from_string(s: &str) -> ::AudioFormat { pub fn from_string(s: &str) -> ::AudioFormat {
assert_initialized_main_thread!();
unsafe { from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)) } unsafe { from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)) }
} }
@ -48,6 +52,8 @@ impl str::FromStr for ::AudioFormat {
type Err = (); type Err = ();
fn from_str(s: &str) -> Result<Self, ()> { fn from_str(s: &str) -> Result<Self, ()> {
skip_assert_initialized!();
let format = Self::from_string(s); let format = Self::from_string(s);
if format == ::AudioFormat::Unknown { if format == ::AudioFormat::Unknown {
Err(()) Err(())

View file

@ -26,6 +26,8 @@ pub enum AudioEndianness {
impl FromGlib<i32> for AudioEndianness { impl FromGlib<i32> for AudioEndianness {
fn from_glib(value: i32) -> Self { fn from_glib(value: i32) -> Self {
assert_initialized_main_thread!();
match value { match value {
1234 => AudioEndianness::LittleEndian, 1234 => AudioEndianness::LittleEndian,
4321 => AudioEndianness::BigEndian, 4321 => AudioEndianness::BigEndian,
@ -50,6 +52,8 @@ pub struct AudioFormatInfo(&'static ffi::GstAudioFormatInfo);
impl AudioFormatInfo { impl AudioFormatInfo {
pub fn from_format(format: ::AudioFormat) -> AudioFormatInfo { pub fn from_format(format: ::AudioFormat) -> AudioFormatInfo {
assert_initialized_main_thread!();
unsafe { unsafe {
let info = ffi::gst_audio_format_get_info(format.to_glib()); let info = ffi::gst_audio_format_get_info(format.to_glib());
assert!(!info.is_null()); assert!(!info.is_null());
@ -227,6 +231,7 @@ impl str::FromStr for ::AudioFormatInfo {
type Err = (); type Err = ();
fn from_str(s: &str) -> Result<Self, ()> { fn from_str(s: &str) -> Result<Self, ()> {
skip_assert_initialized!();
let format = s.parse()?; let format = s.parse()?;
Ok(AudioFormatInfo::from_format(format)) Ok(AudioFormatInfo::from_format(format))
} }
@ -234,6 +239,7 @@ impl str::FromStr for ::AudioFormatInfo {
impl From<::AudioFormat> for AudioFormatInfo { impl From<::AudioFormat> for AudioFormatInfo {
fn from(f: ::AudioFormat) -> Self { fn from(f: ::AudioFormat) -> Self {
skip_assert_initialized!();
Self::from_format(f) Self::from_format(f)
} }
} }

View file

@ -117,6 +117,8 @@ impl<'a> AudioInfoBuilder<'a> {
impl AudioInfo { impl AudioInfo {
pub fn new<'a>(format: ::AudioFormat, rate: u32, channels: u32) -> AudioInfoBuilder<'a> { pub fn new<'a>(format: ::AudioFormat, rate: u32, channels: u32) -> AudioInfoBuilder<'a> {
assert_initialized_main_thread!();
AudioInfoBuilder { AudioInfoBuilder {
format: format, format: format,
rate: rate, rate: rate,
@ -128,6 +130,8 @@ impl AudioInfo {
} }
pub fn from_caps(caps: &gst::Caps) -> Option<Self> { pub fn from_caps(caps: &gst::Caps) -> Option<Self> {
skip_assert_initialized!();
unsafe { unsafe {
let mut info = mem::uninitialized(); let mut info = mem::uninitialized();
if from_glib(ffi::gst_audio_info_from_caps(&mut info, caps.as_ptr())) { if from_glib(ffi::gst_audio_info_from_caps(&mut info, caps.as_ptr())) {
@ -156,6 +160,8 @@ impl AudioInfo {
src_val: i64, src_val: i64,
dest_fmt: gst::Format, dest_fmt: gst::Format,
) -> Option<i64> { ) -> Option<i64> {
assert_initialized_main_thread!();
unsafe { unsafe {
let mut dest_val = mem::uninitialized(); let mut dest_val = mem::uninitialized();
if from_glib(ffi::gst_audio_info_convert( if from_glib(ffi::gst_audio_info_convert(

View file

@ -21,8 +21,9 @@ extern crate glib;
macro_rules! assert_initialized_main_thread { macro_rules! assert_initialized_main_thread {
() => ( () => (
use gst_ffi; if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
assert_eq!(unsafe {gst_ffi::gst_is_initialized()}, ::glib_ffi::GTRUE) panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
) )
} }
@ -56,6 +57,8 @@ pub fn audio_buffer_clip(
rate: u32, rate: u32,
channels: u32, channels: u32,
) -> gst::Buffer { ) -> gst::Buffer {
skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_audio_buffer_clip( from_glib_full(ffi::gst_audio_buffer_clip(
buffer.into_ptr(), buffer.into_ptr(),

View file

@ -179,7 +179,7 @@ impl VideoFrame<Readable> {
buffer: gst::Buffer, buffer: gst::Buffer,
info: &::VideoInfo, info: &::VideoInfo,
) -> Result<VideoFrame<Readable>, gst::Buffer> { ) -> Result<VideoFrame<Readable>, gst::Buffer> {
assert_initialized_main_thread!(); skip_assert_initialized!();
unsafe { unsafe {
let mut frame = mem::zeroed(); let mut frame = mem::zeroed();
@ -206,7 +206,7 @@ impl VideoFrame<Readable> {
id: i32, id: i32,
info: &::VideoInfo, info: &::VideoInfo,
) -> Result<VideoFrame<Readable>, gst::Buffer> { ) -> Result<VideoFrame<Readable>, gst::Buffer> {
assert_initialized_main_thread!(); skip_assert_initialized!();
unsafe { unsafe {
let mut frame = mem::zeroed(); let mut frame = mem::zeroed();
@ -239,7 +239,7 @@ impl VideoFrame<Writable> {
buffer: gst::Buffer, buffer: gst::Buffer,
info: &::VideoInfo, info: &::VideoInfo,
) -> Result<VideoFrame<Writable>, gst::Buffer> { ) -> Result<VideoFrame<Writable>, gst::Buffer> {
assert_initialized_main_thread!(); skip_assert_initialized!();
unsafe { unsafe {
let mut frame = mem::zeroed(); let mut frame = mem::zeroed();
@ -267,7 +267,7 @@ impl VideoFrame<Writable> {
id: i32, id: i32,
info: &::VideoInfo, info: &::VideoInfo,
) -> Result<VideoFrame<Writable>, gst::Buffer> { ) -> Result<VideoFrame<Writable>, gst::Buffer> {
assert_initialized_main_thread!(); skip_assert_initialized!();
unsafe { unsafe {
let mut frame = mem::zeroed(); let mut frame = mem::zeroed();

View file

@ -420,7 +420,7 @@ impl VideoInfo {
} }
pub fn from_caps(caps: &gst::Caps) -> Option<Self> { pub fn from_caps(caps: &gst::Caps) -> Option<Self> {
assert_initialized_main_thread!(); skip_assert_initialized!();
unsafe { unsafe {
let mut info = mem::uninitialized(); let mut info = mem::uninitialized();

View file

@ -54,6 +54,8 @@ impl GstRc<BufferRef> {
} }
pub fn with_size(size: usize) -> Option<Self> { pub fn with_size(size: usize) -> Option<Self> {
assert_initialized_main_thread!();
let raw = unsafe { ffi::gst_buffer_new_allocate(ptr::null_mut(), size, ptr::null_mut()) }; let raw = unsafe { ffi::gst_buffer_new_allocate(ptr::null_mut(), size, ptr::null_mut()) };
if raw.is_null() { if raw.is_null() {
None None
@ -68,6 +70,8 @@ impl GstRc<BufferRef> {
} }
pub fn from_vec(vec: Vec<u8>) -> Option<Self> { pub fn from_vec(vec: Vec<u8>) -> Option<Self> {
assert_initialized_main_thread!();
let raw = unsafe { let raw = unsafe {
let mut vec = Box::new(vec); let mut vec = Box::new(vec);
let maxsize = vec.capacity(); let maxsize = vec.capacity();
@ -133,6 +137,7 @@ impl GstRc<BufferRef> {
} }
pub fn append(buffer: Self, other: Self) -> Self { pub fn append(buffer: Self, other: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_buffer_append(buffer.into_ptr(), other.into_ptr())) } unsafe { from_glib_full(ffi::gst_buffer_append(buffer.into_ptr(), other.into_ptr())) }
} }
} }

View file

@ -101,6 +101,7 @@ pub struct Iter<'a> {
impl<'a> Iter<'a> { impl<'a> Iter<'a> {
fn new(list: &'a BufferListRef) -> Iter<'a> { fn new(list: &'a BufferListRef) -> Iter<'a> {
skip_assert_initialized!();
Iter { Iter {
list: list, list: list,
idx: 0, idx: 0,

View file

@ -87,6 +87,7 @@ impl Bus {
where where
F: FnMut(&Bus, &Message) -> Continue + Send + 'static, F: FnMut(&Bus, &Message) -> Continue + Send + 'static,
{ {
skip_assert_initialized!();
unsafe { unsafe {
let source = ffi::gst_bus_create_watch(self.to_glib_none().0); let source = ffi::gst_bus_create_watch(self.to_glib_none().0);
let trampoline = trampoline_watch as gpointer; let trampoline = trampoline_watch as gpointer;
@ -147,6 +148,7 @@ pub struct BusStream(Bus, Arc<Mutex<Option<Task>>>);
#[cfg(feature = "futures")] #[cfg(feature = "futures")]
impl BusStream { impl BusStream {
pub fn new(bus: &Bus) -> Self { pub fn new(bus: &Bus) -> Self {
skip_assert_initialized!();
let task = Arc::new(Mutex::new(None)); let task = Arc::new(Mutex::new(None));
let task_clone = task.clone(); let task_clone = task.clone();

View file

@ -62,14 +62,17 @@ impl GstRc<CapsRef> {
} }
pub fn fixate(caps: Self) -> Self { pub fn fixate(caps: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_caps_fixate(caps.into_ptr())) } unsafe { from_glib_full(ffi::gst_caps_fixate(caps.into_ptr())) }
} }
pub fn merge(caps: Self, other: Self) -> Self { pub fn merge(caps: Self, other: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_caps_merge(caps.into_ptr(), other.into_ptr())) } unsafe { from_glib_full(ffi::gst_caps_merge(caps.into_ptr(), other.into_ptr())) }
} }
pub fn merge_structure(caps: Self, other: Structure) -> Self { pub fn merge_structure(caps: Self, other: Structure) -> Self {
skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_caps_merge_structure( from_glib_full(ffi::gst_caps_merge_structure(
caps.into_ptr(), caps.into_ptr(),
@ -79,18 +82,22 @@ impl GstRc<CapsRef> {
} }
pub fn normalize(caps: Self) -> Self { pub fn normalize(caps: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_caps_normalize(caps.into_ptr())) } unsafe { from_glib_full(ffi::gst_caps_normalize(caps.into_ptr())) }
} }
pub fn simplify(caps: Self) -> Self { pub fn simplify(caps: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_caps_simplify(caps.into_ptr())) } unsafe { from_glib_full(ffi::gst_caps_simplify(caps.into_ptr())) }
} }
pub fn subtract(caps: Self, other: Self) -> Self { pub fn subtract(caps: Self, other: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_caps_subtract(caps.into_ptr(), other.into_ptr())) } unsafe { from_glib_full(ffi::gst_caps_subtract(caps.into_ptr(), other.into_ptr())) }
} }
pub fn truncate(caps: Self) -> Self { pub fn truncate(caps: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_caps_truncate(caps.into_ptr())) } unsafe { from_glib_full(ffi::gst_caps_truncate(caps.into_ptr())) }
} }
} }
@ -99,6 +106,7 @@ impl str::FromStr for Caps {
type Err = (); type Err = ();
fn from_str(s: &str) -> Result<Self, ()> { fn from_str(s: &str) -> Result<Self, ()> {
skip_assert_initialized!();
Caps::from_string(s).ok_or(()) Caps::from_string(s).ok_or(())
} }
} }
@ -251,7 +259,6 @@ impl glib::types::StaticType for CapsRef {
macro_rules! define_iter( macro_rules! define_iter(
($name:ident, $typ:ty, $styp:ty) => { ($name:ident, $typ:ty, $styp:ty) => {
pub struct $name<'a> { pub struct $name<'a> {
caps: $typ, caps: $typ,
idx: u32, idx: u32,
@ -259,7 +266,8 @@ pub struct $name<'a> {
} }
impl<'a> $name<'a> { impl<'a> $name<'a> {
pub fn new(caps: $typ) -> $name<'a> { fn new(caps: $typ) -> $name<'a> {
skip_assert_initialized!();
let n_structures = caps.get_size(); let n_structures = caps.get_size();
$name { $name {

View file

@ -152,6 +152,7 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExtManual for O {
start_time: ClockTime, start_time: ClockTime,
interval: ClockTime, interval: ClockTime,
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
skip_assert_initialized!();
unsafe { unsafe {
let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit( let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit(
self.to_glib_none().0, self.to_glib_none().0,

View file

@ -23,6 +23,7 @@ use gobject_ffi;
impl Element { impl Element {
pub fn link_many<E: IsA<Element>>(elements: &[&E]) -> Result<(), glib::BoolError> { pub fn link_many<E: IsA<Element>>(elements: &[&E]) -> Result<(), glib::BoolError> {
skip_assert_initialized!();
for (e1, e2) in elements.iter().zip(elements.iter().skip(1)) { for (e1, e2) in elements.iter().zip(elements.iter().skip(1)) {
unsafe { unsafe {
let ret: bool = from_glib(ffi::gst_element_link( let ret: bool = from_glib(ffi::gst_element_link(
@ -39,6 +40,7 @@ impl Element {
} }
pub fn unlink_many<E: IsA<Element>>(elements: &[&E]) { pub fn unlink_many<E: IsA<Element>>(elements: &[&E]) {
skip_assert_initialized!();
for (e1, e2) in elements.iter().zip(elements.iter().skip(1)) { for (e1, e2) in elements.iter().zip(elements.iter().skip(1)) {
unsafe { unsafe {
ffi::gst_element_unlink(e1.to_glib_none().0, e2.to_glib_none().0); ffi::gst_element_unlink(e1.to_glib_none().0, e2.to_glib_none().0);

View file

@ -135,22 +135,27 @@ impl EventRef {
impl Event { impl Event {
pub fn new_flush_start() -> FlushStartBuilder { pub fn new_flush_start() -> FlushStartBuilder {
assert_initialized_main_thread!();
FlushStartBuilder::new() FlushStartBuilder::new()
} }
pub fn new_flush_stop(reset_time: bool) -> FlushStopBuilder { pub fn new_flush_stop(reset_time: bool) -> FlushStopBuilder {
assert_initialized_main_thread!();
FlushStopBuilder::new(reset_time) FlushStopBuilder::new(reset_time)
} }
pub fn new_stream_start(stream_id: &str) -> StreamStartBuilder { pub fn new_stream_start(stream_id: &str) -> StreamStartBuilder {
assert_initialized_main_thread!();
StreamStartBuilder::new(stream_id) StreamStartBuilder::new(stream_id)
} }
pub fn new_caps(caps: &::Caps) -> CapsBuilder { pub fn new_caps(caps: &::Caps) -> CapsBuilder {
assert_initialized_main_thread!();
CapsBuilder::new(caps) CapsBuilder::new(caps)
} }
pub fn new_segment(segment: &::Segment) -> SegmentBuilder { pub fn new_segment(segment: &::Segment) -> SegmentBuilder {
assert_initialized_main_thread!();
SegmentBuilder::new(segment) SegmentBuilder::new(segment)
} }
@ -158,10 +163,12 @@ impl Event {
pub fn new_stream_collection( pub fn new_stream_collection(
stream_collection: &::StreamCollection, stream_collection: &::StreamCollection,
) -> StreamCollectionBuilder { ) -> StreamCollectionBuilder {
assert_initialized_main_thread!();
StreamCollectionBuilder::new(stream_collection) StreamCollectionBuilder::new(stream_collection)
} }
pub fn new_tag(tags: ::TagList) -> TagBuilder { pub fn new_tag(tags: ::TagList) -> TagBuilder {
assert_initialized_main_thread!();
TagBuilder::new(tags) TagBuilder::new(tags)
} }
@ -171,23 +178,28 @@ impl Event {
maxsize: i64, maxsize: i64,
async: bool, async: bool,
) -> BufferSizeBuilder { ) -> BufferSizeBuilder {
assert_initialized_main_thread!();
BufferSizeBuilder::new(format, minsize, maxsize, async) BufferSizeBuilder::new(format, minsize, maxsize, async)
} }
pub fn new_sink_message<'a>(name: &'a str, msg: &'a ::Message) -> SinkMessageBuilder<'a> { pub fn new_sink_message<'a>(name: &'a str, msg: &'a ::Message) -> SinkMessageBuilder<'a> {
assert_initialized_main_thread!();
SinkMessageBuilder::new(name, msg) SinkMessageBuilder::new(name, msg)
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
pub fn new_stream_group_done(group_id: u32) -> StreamGroupDoneBuilder { pub fn new_stream_group_done(group_id: u32) -> StreamGroupDoneBuilder {
assert_initialized_main_thread!();
StreamGroupDoneBuilder::new(group_id) StreamGroupDoneBuilder::new(group_id)
} }
pub fn new_eos() -> EosBuilder { pub fn new_eos() -> EosBuilder {
assert_initialized_main_thread!();
EosBuilder::new() EosBuilder::new()
} }
pub fn new_toc(toc: &::Toc, updated: bool) -> TocBuilder { pub fn new_toc(toc: &::Toc, updated: bool) -> TocBuilder {
assert_initialized_main_thread!();
TocBuilder::new(toc, updated) TocBuilder::new(toc, updated)
} }
@ -196,18 +208,22 @@ impl Event {
data: &'a ::Buffer, data: &'a ::Buffer,
origin: &'a str, origin: &'a str,
) -> ProtectionBuilder<'a> { ) -> ProtectionBuilder<'a> {
assert_initialized_main_thread!();
ProtectionBuilder::new(system_id, data, origin) ProtectionBuilder::new(system_id, data, origin)
} }
pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder { pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder {
assert_initialized_main_thread!();
SegmentDoneBuilder::new(format, position) SegmentDoneBuilder::new(format, position)
} }
pub fn new_gap(timestamp: u64, duration: u64) -> GapBuilder { pub fn new_gap(timestamp: u64, duration: u64) -> GapBuilder {
assert_initialized_main_thread!();
GapBuilder::new(timestamp, duration) GapBuilder::new(timestamp, duration)
} }
pub fn new_qos(type_: ::QOSType, proportion: f64, diff: i64, timestamp: u64) -> QosBuilder { pub fn new_qos(type_: ::QOSType, proportion: f64, diff: i64, timestamp: u64) -> QosBuilder {
assert_initialized_main_thread!();
QosBuilder::new(type_, proportion, diff, timestamp) QosBuilder::new(type_, proportion, diff, timestamp)
} }
@ -220,14 +236,17 @@ impl Event {
stop_type: ::SeekType, stop_type: ::SeekType,
stop: i64, stop: i64,
) -> SeekBuilder { ) -> SeekBuilder {
assert_initialized_main_thread!();
SeekBuilder::new(rate, format, flags, start_type, start, stop_type, stop) SeekBuilder::new(rate, format, flags, start_type, start, stop_type, stop)
} }
pub fn new_navigation(structure: ::Structure) -> NavigationBuilder { pub fn new_navigation(structure: ::Structure) -> NavigationBuilder {
assert_initialized_main_thread!();
NavigationBuilder::new(structure) NavigationBuilder::new(structure)
} }
pub fn new_latency(latency: u64) -> LatencyBuilder { pub fn new_latency(latency: u64) -> LatencyBuilder {
assert_initialized_main_thread!();
LatencyBuilder::new(latency) LatencyBuilder::new(latency)
} }
@ -238,43 +257,53 @@ impl Event {
flush: bool, flush: bool,
intermediate: bool, intermediate: bool,
) -> StepBuilder { ) -> StepBuilder {
assert_initialized_main_thread!();
StepBuilder::new(format, amount, rate, flush, intermediate) StepBuilder::new(format, amount, rate, flush, intermediate)
} }
pub fn new_reconfigure() -> ReconfigureBuilder { pub fn new_reconfigure() -> ReconfigureBuilder {
assert_initialized_main_thread!();
ReconfigureBuilder::new() ReconfigureBuilder::new()
} }
pub fn new_toc_select(uid: &str) -> TocSelectBuilder { pub fn new_toc_select(uid: &str) -> TocSelectBuilder {
assert_initialized_main_thread!();
TocSelectBuilder::new(uid) TocSelectBuilder::new(uid)
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
pub fn new_select_streams<'a>(streams: &'a [&'a str]) -> SelectStreamsBuilder<'a> { pub fn new_select_streams<'a>(streams: &'a [&'a str]) -> SelectStreamsBuilder<'a> {
assert_initialized_main_thread!();
SelectStreamsBuilder::new(streams) SelectStreamsBuilder::new(streams)
} }
pub fn new_custom_upstream(structure: ::Structure) -> CustomUpstreamBuilder { pub fn new_custom_upstream(structure: ::Structure) -> CustomUpstreamBuilder {
assert_initialized_main_thread!();
CustomUpstreamBuilder::new(structure) CustomUpstreamBuilder::new(structure)
} }
pub fn new_custom_downstream(structure: ::Structure) -> CustomDownstreamBuilder { pub fn new_custom_downstream(structure: ::Structure) -> CustomDownstreamBuilder {
assert_initialized_main_thread!();
CustomDownstreamBuilder::new(structure) CustomDownstreamBuilder::new(structure)
} }
pub fn new_custom_downstream_oob(structure: ::Structure) -> CustomDownstreamOobBuilder { pub fn new_custom_downstream_oob(structure: ::Structure) -> CustomDownstreamOobBuilder {
assert_initialized_main_thread!();
CustomDownstreamOobBuilder::new(structure) CustomDownstreamOobBuilder::new(structure)
} }
pub fn new_custom_downstream_sticky(structure: ::Structure) -> CustomDownstreamStickyBuilder { pub fn new_custom_downstream_sticky(structure: ::Structure) -> CustomDownstreamStickyBuilder {
assert_initialized_main_thread!();
CustomDownstreamStickyBuilder::new(structure) CustomDownstreamStickyBuilder::new(structure)
} }
pub fn new_custom_both(structure: ::Structure) -> CustomBothBuilder { pub fn new_custom_both(structure: ::Structure) -> CustomBothBuilder {
assert_initialized_main_thread!();
CustomBothBuilder::new(structure) CustomBothBuilder::new(structure)
} }
pub fn new_custom_both_oob(structure: ::Structure) -> CustomBothOobBuilder { pub fn new_custom_both_oob(structure: ::Structure) -> CustomBothOobBuilder {
assert_initialized_main_thread!();
CustomBothOobBuilder::new(structure) CustomBothOobBuilder::new(structure)
} }
} }
@ -712,7 +741,8 @@ pub struct FlushStartBuilder {
running_time_offset: Option<i64>, running_time_offset: Option<i64>,
} }
impl FlushStartBuilder { impl FlushStartBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -728,7 +758,8 @@ pub struct FlushStopBuilder {
reset_time: bool, reset_time: bool,
} }
impl FlushStopBuilder { impl FlushStopBuilder {
pub fn new(reset_time: bool) -> Self { fn new(reset_time: bool) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -749,7 +780,8 @@ pub struct StreamStartBuilder<'a> {
group_id: Option<u32>, group_id: Option<u32>,
} }
impl<'a> StreamStartBuilder<'a> { impl<'a> StreamStartBuilder<'a> {
pub fn new(stream_id: &'a str) -> Self { fn new(stream_id: &'a str) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -791,7 +823,8 @@ pub struct CapsBuilder<'a> {
caps: &'a ::Caps, caps: &'a ::Caps,
} }
impl<'a> CapsBuilder<'a> { impl<'a> CapsBuilder<'a> {
pub fn new(caps: &'a ::Caps) -> Self { fn new(caps: &'a ::Caps) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -808,7 +841,8 @@ pub struct SegmentBuilder<'a> {
segment: &'a ::Segment, segment: &'a ::Segment,
} }
impl<'a> SegmentBuilder<'a> { impl<'a> SegmentBuilder<'a> {
pub fn new(segment: &'a ::Segment) -> Self { fn new(segment: &'a ::Segment) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -829,7 +863,8 @@ pub struct StreamCollectionBuilder<'a> {
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
impl<'a> StreamCollectionBuilder<'a> { impl<'a> StreamCollectionBuilder<'a> {
pub fn new(stream_collection: &'a ::StreamCollection) -> Self { fn new(stream_collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -848,7 +883,8 @@ pub struct TagBuilder {
tags: Option<::TagList>, tags: Option<::TagList>,
} }
impl TagBuilder { impl TagBuilder {
pub fn new(tags: ::TagList) -> Self { fn new(tags: ::TagList) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -871,7 +907,8 @@ pub struct BufferSizeBuilder {
async: bool, async: bool,
} }
impl BufferSizeBuilder { impl BufferSizeBuilder {
pub fn new(fmt: ::Format, minsize: i64, maxsize: i64, async: bool) -> Self { fn new(fmt: ::Format, minsize: i64, maxsize: i64, async: bool) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -894,7 +931,8 @@ pub struct SinkMessageBuilder<'a> {
msg: &'a ::Message, msg: &'a ::Message,
} }
impl<'a> SinkMessageBuilder<'a> { impl<'a> SinkMessageBuilder<'a> {
pub fn new(name: &'a str, msg: &'a ::Message) -> Self { fn new(name: &'a str, msg: &'a ::Message) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -916,7 +954,8 @@ pub struct StreamGroupDoneBuilder {
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
impl StreamGroupDoneBuilder { impl StreamGroupDoneBuilder {
pub fn new(uid: u32) -> Self { fn new(uid: u32) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -932,7 +971,8 @@ pub struct EosBuilder {
running_time_offset: Option<i64>, running_time_offset: Option<i64>,
} }
impl EosBuilder { impl EosBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -949,7 +989,8 @@ pub struct TocBuilder<'a> {
updated: bool, updated: bool,
} }
impl<'a> TocBuilder<'a> { impl<'a> TocBuilder<'a> {
pub fn new(toc: &'a ::Toc, updated: bool) -> Self { fn new(toc: &'a ::Toc, updated: bool) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -971,7 +1012,8 @@ pub struct ProtectionBuilder<'a> {
origin: &'a str, origin: &'a str,
} }
impl<'a> ProtectionBuilder<'a> { impl<'a> ProtectionBuilder<'a> {
pub fn new(system_id: &'a str, data: &'a ::Buffer, origin: &'a str) -> Self { fn new(system_id: &'a str, data: &'a ::Buffer, origin: &'a str) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -997,7 +1039,8 @@ pub struct SegmentDoneBuilder {
position: i64, position: i64,
} }
impl SegmentDoneBuilder { impl SegmentDoneBuilder {
pub fn new(fmt: ::Format, position: i64) -> Self { fn new(fmt: ::Format, position: i64) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1018,7 +1061,8 @@ pub struct GapBuilder {
duration: u64, duration: u64,
} }
impl GapBuilder { impl GapBuilder {
pub fn new(timestamp: u64, duration: u64) -> Self { fn new(timestamp: u64, duration: u64) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1039,7 +1083,8 @@ pub struct QosBuilder {
timestamp: u64, timestamp: u64,
} }
impl QosBuilder { impl QosBuilder {
pub fn new(type_: ::QOSType, proportion: f64, diff: i64, timestamp: u64) -> Self { fn new(type_: ::QOSType, proportion: f64, diff: i64, timestamp: u64) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1067,7 +1112,7 @@ pub struct SeekBuilder {
stop: i64, stop: i64,
} }
impl SeekBuilder { impl SeekBuilder {
pub fn new( fn new(
rate: f64, rate: f64,
fmt: ::Format, fmt: ::Format,
flags: ::SeekFlags, flags: ::SeekFlags,
@ -1076,6 +1121,7 @@ impl SeekBuilder {
stop_type: ::SeekType, stop_type: ::SeekType,
stop: i64, stop: i64,
) -> Self { ) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1108,7 +1154,8 @@ pub struct NavigationBuilder {
structure: Option<Structure>, structure: Option<Structure>,
} }
impl NavigationBuilder { impl NavigationBuilder {
pub fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1131,7 +1178,8 @@ pub struct LatencyBuilder {
latency: u64, latency: u64,
} }
impl LatencyBuilder { impl LatencyBuilder {
pub fn new(latency: u64) -> Self { fn new(latency: u64) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1152,7 +1200,8 @@ pub struct StepBuilder {
intermediate: bool, intermediate: bool,
} }
impl StepBuilder { impl StepBuilder {
pub fn new(fmt: ::Format, amount: u64, rate: f64, flush: bool, intermediate: bool) -> Self { fn new(fmt: ::Format, amount: u64, rate: f64, flush: bool, intermediate: bool) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1180,7 +1229,8 @@ pub struct ReconfigureBuilder {
running_time_offset: Option<i64>, running_time_offset: Option<i64>,
} }
impl ReconfigureBuilder { impl ReconfigureBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1196,7 +1246,8 @@ pub struct TocSelectBuilder<'a> {
uid: &'a str, uid: &'a str,
} }
impl<'a> TocSelectBuilder<'a> { impl<'a> TocSelectBuilder<'a> {
pub fn new(uid: &'a str) -> Self { fn new(uid: &'a str) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1217,7 +1268,8 @@ pub struct SelectStreamsBuilder<'a> {
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
impl<'a> SelectStreamsBuilder<'a> { impl<'a> SelectStreamsBuilder<'a> {
pub fn new(streams: &'a [&'a str]) -> Self { fn new(streams: &'a [&'a str]) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1236,7 +1288,8 @@ pub struct CustomUpstreamBuilder {
structure: Option<Structure>, structure: Option<Structure>,
} }
impl CustomUpstreamBuilder { impl CustomUpstreamBuilder {
pub fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1260,7 +1313,8 @@ pub struct CustomDownstreamBuilder {
structure: Option<Structure>, structure: Option<Structure>,
} }
impl CustomDownstreamBuilder { impl CustomDownstreamBuilder {
pub fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1284,7 +1338,8 @@ pub struct CustomDownstreamOobBuilder {
structure: Option<Structure>, structure: Option<Structure>,
} }
impl CustomDownstreamOobBuilder { impl CustomDownstreamOobBuilder {
pub fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1310,7 +1365,8 @@ pub struct CustomDownstreamStickyBuilder {
structure: Option<Structure>, structure: Option<Structure>,
} }
impl CustomDownstreamStickyBuilder { impl CustomDownstreamStickyBuilder {
pub fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1336,7 +1392,8 @@ pub struct CustomBothBuilder {
structure: Option<Structure>, structure: Option<Structure>,
} }
impl CustomBothBuilder { impl CustomBothBuilder {
pub fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,
@ -1359,7 +1416,8 @@ pub struct CustomBothOobBuilder {
structure: Option<Structure>, structure: Option<Structure>,
} }
impl CustomBothOobBuilder { impl CustomBothOobBuilder {
pub fn new(structure: Structure) -> Self { fn new(structure: Structure) -> Self {
skip_assert_initialized!();
Self { Self {
seqnum: None, seqnum: None,
running_time_offset: None, running_time_offset: None,

View file

@ -129,34 +129,42 @@ impl MessageRef {
impl Message { impl Message {
pub fn new_eos() -> EosBuilder { pub fn new_eos() -> EosBuilder {
assert_initialized_main_thread!();
EosBuilder::new() EosBuilder::new()
} }
pub fn new_error(error: &glib::Error) -> ErrorBuilder { pub fn new_error(error: &glib::Error) -> ErrorBuilder {
assert_initialized_main_thread!();
ErrorBuilder::new(error) ErrorBuilder::new(error)
} }
pub fn new_warning(error: &glib::Error) -> WarningBuilder { pub fn new_warning(error: &glib::Error) -> WarningBuilder {
assert_initialized_main_thread!();
WarningBuilder::new(error) WarningBuilder::new(error)
} }
pub fn new_info(error: &glib::Error) -> InfoBuilder { pub fn new_info(error: &glib::Error) -> InfoBuilder {
assert_initialized_main_thread!();
InfoBuilder::new(error) InfoBuilder::new(error)
} }
pub fn new_tag(tags: &TagList) -> TagBuilder { pub fn new_tag(tags: &TagList) -> TagBuilder {
assert_initialized_main_thread!();
TagBuilder::new(tags) TagBuilder::new(tags)
} }
pub fn new_buffering(percent: i32) -> BufferingBuilder { pub fn new_buffering(percent: i32) -> BufferingBuilder {
assert_initialized_main_thread!();
BufferingBuilder::new(percent) BufferingBuilder::new(percent)
} }
pub fn new_state_changed(old: ::State, new: ::State, pending: ::State) -> StateChangedBuilder { pub fn new_state_changed(old: ::State, new: ::State, pending: ::State) -> StateChangedBuilder {
assert_initialized_main_thread!();
StateChangedBuilder::new(old, new, pending) StateChangedBuilder::new(old, new, pending)
} }
pub fn new_state_dirty() -> StateDirtyBuilder { pub fn new_state_dirty() -> StateDirtyBuilder {
assert_initialized_main_thread!();
StateDirtyBuilder::new() StateDirtyBuilder::new()
} }
@ -169,18 +177,22 @@ impl Message {
duration: u64, duration: u64,
eos: bool, eos: bool,
) -> StepDoneBuilder { ) -> StepDoneBuilder {
assert_initialized_main_thread!();
StepDoneBuilder::new(format, amount, rate, flush, intermediate, duration, eos) StepDoneBuilder::new(format, amount, rate, flush, intermediate, duration, eos)
} }
pub fn new_clock_provide(clock: &::Clock, ready: bool) -> ClockProvideBuilder { pub fn new_clock_provide(clock: &::Clock, ready: bool) -> ClockProvideBuilder {
assert_initialized_main_thread!();
ClockProvideBuilder::new(clock, ready) ClockProvideBuilder::new(clock, ready)
} }
pub fn new_clock_lost(clock: &::Clock) -> ClockLostBuilder { pub fn new_clock_lost(clock: &::Clock) -> ClockLostBuilder {
assert_initialized_main_thread!();
ClockLostBuilder::new(clock) ClockLostBuilder::new(clock)
} }
pub fn new_new_clock(clock: &::Clock) -> NewClockBuilder { pub fn new_new_clock(clock: &::Clock) -> NewClockBuilder {
assert_initialized_main_thread!();
NewClockBuilder::new(clock) NewClockBuilder::new(clock)
} }
@ -189,45 +201,60 @@ impl Message {
owner: &::Element, owner: &::Element,
busy: bool, busy: bool,
) -> StructureChangeBuilder { ) -> StructureChangeBuilder {
assert_initialized_main_thread!();
StructureChangeBuilder::new(type_, owner, busy) StructureChangeBuilder::new(type_, owner, busy)
} }
pub fn new_stream_status(type_: ::StreamStatusType, owner: &::Element) -> StreamStatusBuilder { pub fn new_stream_status(type_: ::StreamStatusType, owner: &::Element) -> StreamStatusBuilder {
assert_initialized_main_thread!();
StreamStatusBuilder::new(type_, owner) StreamStatusBuilder::new(type_, owner)
} }
pub fn new_application(structure: ::Structure) -> ApplicationBuilder { pub fn new_application(structure: ::Structure) -> ApplicationBuilder {
assert_initialized_main_thread!();
ApplicationBuilder::new(structure) ApplicationBuilder::new(structure)
} }
pub fn new_element(structure: ::Structure) -> ElementBuilder { pub fn new_element(structure: ::Structure) -> ElementBuilder {
assert_initialized_main_thread!();
ElementBuilder::new(structure) ElementBuilder::new(structure)
} }
pub fn new_segment_start(format: ::Format, position: i64) -> SegmentStartBuilder { pub fn new_segment_start(format: ::Format, position: i64) -> SegmentStartBuilder {
assert_initialized_main_thread!();
SegmentStartBuilder::new(format, position) SegmentStartBuilder::new(format, position)
} }
pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder { pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder {
assert_initialized_main_thread!();
SegmentDoneBuilder::new(format, position) SegmentDoneBuilder::new(format, position)
} }
pub fn new_duration_changed() -> DurationChangedBuilder { pub fn new_duration_changed() -> DurationChangedBuilder {
assert_initialized_main_thread!();
DurationChangedBuilder::new() DurationChangedBuilder::new()
} }
pub fn new_latency() -> LatencyBuilder { pub fn new_latency() -> LatencyBuilder {
assert_initialized_main_thread!();
LatencyBuilder::new() LatencyBuilder::new()
} }
pub fn new_async_start() -> AsyncStartBuilder { pub fn new_async_start() -> AsyncStartBuilder {
assert_initialized_main_thread!();
AsyncStartBuilder::new() AsyncStartBuilder::new()
} }
pub fn new_async_done(running_time: u64) -> AsyncDoneBuilder { pub fn new_async_done(running_time: u64) -> AsyncDoneBuilder {
assert_initialized_main_thread!();
AsyncDoneBuilder::new(running_time) AsyncDoneBuilder::new(running_time)
} }
pub fn new_request_state(state: ::State) -> RequestStateBuilder {
assert_initialized_main_thread!();
RequestStateBuilder::new(state)
}
pub fn new_step_start( pub fn new_step_start(
active: bool, active: bool,
format: ::Format, format: ::Format,
@ -236,6 +263,7 @@ impl Message {
flush: bool, flush: bool,
intermediate: bool, intermediate: bool,
) -> StepStartBuilder { ) -> StepStartBuilder {
assert_initialized_main_thread!();
StepStartBuilder::new(active, format, amount, rate, flush, intermediate) StepStartBuilder::new(active, format, amount, rate, flush, intermediate)
} }
@ -246,34 +274,47 @@ impl Message {
timestamp: u64, timestamp: u64,
duration: u64, duration: u64,
) -> QosBuilder { ) -> QosBuilder {
assert_initialized_main_thread!();
QosBuilder::new(live, running_time, stream_time, timestamp, duration) QosBuilder::new(live, running_time, stream_time, timestamp, duration)
} }
pub fn new_progress<'a>(type_: ::ProgressType) -> ProgressBuilder<'a> {
assert_initialized_main_thread!();
ProgressBuilder::new(type_)
}
pub fn new_toc(toc: &::Toc, updated: bool) -> TocBuilder { pub fn new_toc(toc: &::Toc, updated: bool) -> TocBuilder {
assert_initialized_main_thread!();
TocBuilder::new(toc, updated) TocBuilder::new(toc, updated)
} }
pub fn new_reset_time(running_time: u64) -> ResetTimeBuilder { pub fn new_reset_time(running_time: u64) -> ResetTimeBuilder {
assert_initialized_main_thread!();
ResetTimeBuilder::new(running_time) ResetTimeBuilder::new(running_time)
} }
pub fn new_stream_start() -> StreamStartBuilder { pub fn new_stream_start() -> StreamStartBuilder {
assert_initialized_main_thread!();
StreamStartBuilder::new() StreamStartBuilder::new()
} }
pub fn new_need_context(context_type: &str) -> NeedContextBuilder { pub fn new_need_context(context_type: &str) -> NeedContextBuilder {
assert_initialized_main_thread!();
NeedContextBuilder::new(context_type) NeedContextBuilder::new(context_type)
} }
pub fn new_have_context(context: ::Context) -> HaveContextBuilder { pub fn new_have_context(context: ::Context) -> HaveContextBuilder {
assert_initialized_main_thread!();
HaveContextBuilder::new(context) HaveContextBuilder::new(context)
} }
pub fn new_device_added(device: &::Device) -> DeviceAddedBuilder { pub fn new_device_added(device: &::Device) -> DeviceAddedBuilder {
assert_initialized_main_thread!();
DeviceAddedBuilder::new(device) DeviceAddedBuilder::new(device)
} }
pub fn new_device_removed(device: &::Device) -> DeviceRemovedBuilder { pub fn new_device_removed(device: &::Device) -> DeviceRemovedBuilder {
assert_initialized_main_thread!();
DeviceRemovedBuilder::new(device) DeviceRemovedBuilder::new(device)
} }
@ -282,16 +323,19 @@ impl Message {
property_name: &'a str, property_name: &'a str,
value: &'a glib::Value, value: &'a glib::Value,
) -> PropertyNotifyBuilder<'a> { ) -> PropertyNotifyBuilder<'a> {
assert_initialized_main_thread!();
PropertyNotifyBuilder::new(property_name, value) PropertyNotifyBuilder::new(property_name, value)
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
pub fn new_stream_collection(collection: &::StreamCollection) -> StreamCollectionBuilder { pub fn new_stream_collection(collection: &::StreamCollection) -> StreamCollectionBuilder {
assert_initialized_main_thread!();
StreamCollectionBuilder::new(collection) StreamCollectionBuilder::new(collection)
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
pub fn new_streams_selected(collection: &::StreamCollection) -> StreamsSelectedBuilder { pub fn new_streams_selected(collection: &::StreamCollection) -> StreamsSelectedBuilder {
assert_initialized_main_thread!();
StreamsSelectedBuilder::new(collection) StreamsSelectedBuilder::new(collection)
} }
@ -301,6 +345,7 @@ impl Message {
tag_list: Option<&'a TagList>, tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>, entry_struct: Option<Structure>,
) -> RedirectBuilder<'a> { ) -> RedirectBuilder<'a> {
assert_initialized_main_thread!();
RedirectBuilder::new(location, tag_list, entry_struct) RedirectBuilder::new(location, tag_list, entry_struct)
} }
} }
@ -1120,7 +1165,8 @@ pub struct EosBuilder {
seqnum: Option<u32>, seqnum: Option<u32>,
} }
impl EosBuilder { impl EosBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1139,7 +1185,8 @@ pub struct ErrorBuilder<'a> {
details: Option<Structure>, details: Option<Structure>,
} }
impl<'a> ErrorBuilder<'a> { impl<'a> ErrorBuilder<'a> {
pub fn new(error: &'a glib::Error) -> Self { fn new(error: &'a glib::Error) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1199,7 +1246,8 @@ pub struct WarningBuilder<'a> {
details: Option<Structure>, details: Option<Structure>,
} }
impl<'a> WarningBuilder<'a> { impl<'a> WarningBuilder<'a> {
pub fn new(error: &'a glib::Error) -> Self { fn new(error: &'a glib::Error) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1259,7 +1307,8 @@ pub struct InfoBuilder<'a> {
details: Option<Structure>, details: Option<Structure>,
} }
impl<'a> InfoBuilder<'a> { impl<'a> InfoBuilder<'a> {
pub fn new(error: &'a glib::Error) -> Self { fn new(error: &'a glib::Error) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1316,7 +1365,8 @@ pub struct TagBuilder<'a> {
tags: &'a TagList, tags: &'a TagList,
} }
impl<'a> TagBuilder<'a> { impl<'a> TagBuilder<'a> {
pub fn new(tags: &'a TagList) -> Self { fn new(tags: &'a TagList) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1336,7 +1386,8 @@ pub struct BufferingBuilder {
stats: Option<(::BufferingMode, i32, i32, i64)>, stats: Option<(::BufferingMode, i32, i32, i64)>,
} }
impl BufferingBuilder { impl BufferingBuilder {
pub fn new(percent: i32) -> Self { fn new(percent: i32) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1352,6 +1403,7 @@ impl BufferingBuilder {
avg_out: i32, avg_out: i32,
buffering_left: i64, buffering_left: i64,
) -> Self { ) -> Self {
skip_assert_initialized!();
Self { Self {
stats: Some((mode, avg_in, avg_out, buffering_left)), stats: Some((mode, avg_in, avg_out, buffering_left)),
..self ..self
@ -1383,7 +1435,8 @@ pub struct StateChangedBuilder {
pending: ::State, pending: ::State,
} }
impl StateChangedBuilder { impl StateChangedBuilder {
pub fn new(old: ::State, new: ::State, pending: ::State) -> Self { fn new(old: ::State, new: ::State, pending: ::State) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1408,7 +1461,8 @@ pub struct StateDirtyBuilder {
seqnum: Option<u32>, seqnum: Option<u32>,
} }
impl StateDirtyBuilder { impl StateDirtyBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1430,7 +1484,7 @@ pub struct StepDoneBuilder {
eos: bool, eos: bool,
} }
impl StepDoneBuilder { impl StepDoneBuilder {
pub fn new( fn new(
format: ::Format, format: ::Format,
amount: u64, amount: u64,
rate: f64, rate: f64,
@ -1439,6 +1493,7 @@ impl StepDoneBuilder {
duration: u64, duration: u64,
eos: bool, eos: bool,
) -> Self { ) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1473,7 +1528,8 @@ pub struct ClockProvideBuilder<'a> {
ready: bool, ready: bool,
} }
impl<'a> ClockProvideBuilder<'a> { impl<'a> ClockProvideBuilder<'a> {
pub fn new(clock: &'a ::Clock, ready: bool) -> Self { fn new(clock: &'a ::Clock, ready: bool) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1493,7 +1549,8 @@ pub struct ClockLostBuilder<'a> {
clock: &'a ::Clock, clock: &'a ::Clock,
} }
impl<'a> ClockLostBuilder<'a> { impl<'a> ClockLostBuilder<'a> {
pub fn new(clock: &'a ::Clock) -> Self { fn new(clock: &'a ::Clock) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1512,7 +1569,8 @@ pub struct NewClockBuilder<'a> {
clock: &'a ::Clock, clock: &'a ::Clock,
} }
impl<'a> NewClockBuilder<'a> { impl<'a> NewClockBuilder<'a> {
pub fn new(clock: &'a ::Clock) -> Self { fn new(clock: &'a ::Clock) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1533,7 +1591,8 @@ pub struct StructureChangeBuilder<'a> {
busy: bool, busy: bool,
} }
impl<'a> StructureChangeBuilder<'a> { impl<'a> StructureChangeBuilder<'a> {
pub fn new(type_: ::StructureChangeType, owner: &'a ::Element, busy: bool) -> Self { fn new(type_: ::StructureChangeType, owner: &'a ::Element, busy: bool) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1561,7 +1620,8 @@ pub struct StreamStatusBuilder<'a> {
status_object: Option<&'a glib::Value>, status_object: Option<&'a glib::Value>,
} }
impl<'a> StreamStatusBuilder<'a> { impl<'a> StreamStatusBuilder<'a> {
pub fn new(type_: ::StreamStatusType, owner: &'a ::Element) -> Self { fn new(type_: ::StreamStatusType, owner: &'a ::Element) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1594,7 +1654,8 @@ pub struct ApplicationBuilder {
structure: Option<::Structure>, structure: Option<::Structure>,
} }
impl ApplicationBuilder { impl ApplicationBuilder {
pub fn new(structure: ::Structure) -> Self { fn new(structure: ::Structure) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1613,7 +1674,8 @@ pub struct ElementBuilder {
structure: Option<::Structure>, structure: Option<::Structure>,
} }
impl ElementBuilder { impl ElementBuilder {
pub fn new(structure: ::Structure) -> Self { fn new(structure: ::Structure) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1633,7 +1695,8 @@ pub struct SegmentStartBuilder {
position: i64, position: i64,
} }
impl SegmentStartBuilder { impl SegmentStartBuilder {
pub fn new(format: ::Format, position: i64) -> Self { fn new(format: ::Format, position: i64) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1654,7 +1717,8 @@ pub struct SegmentDoneBuilder {
position: i64, position: i64,
} }
impl SegmentDoneBuilder { impl SegmentDoneBuilder {
pub fn new(format: ::Format, position: i64) -> Self { fn new(format: ::Format, position: i64) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1673,7 +1737,8 @@ pub struct DurationChangedBuilder {
seqnum: Option<u32>, seqnum: Option<u32>,
} }
impl DurationChangedBuilder { impl DurationChangedBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1688,7 +1753,8 @@ pub struct LatencyBuilder {
seqnum: Option<u32>, seqnum: Option<u32>,
} }
impl LatencyBuilder { impl LatencyBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1703,7 +1769,8 @@ pub struct AsyncStartBuilder {
seqnum: Option<u32>, seqnum: Option<u32>,
} }
impl AsyncStartBuilder { impl AsyncStartBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1719,7 +1786,8 @@ pub struct AsyncDoneBuilder {
running_time: u64, running_time: u64,
} }
impl AsyncDoneBuilder { impl AsyncDoneBuilder {
pub fn new(running_time: u64) -> Self { fn new(running_time: u64) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1738,7 +1806,8 @@ pub struct RequestStateBuilder {
state: ::State, state: ::State,
} }
impl RequestStateBuilder { impl RequestStateBuilder {
pub fn new(state: ::State) -> Self { fn new(state: ::State) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1762,7 +1831,7 @@ pub struct StepStartBuilder {
intermediate: bool, intermediate: bool,
} }
impl StepStartBuilder { impl StepStartBuilder {
pub fn new( fn new(
active: bool, active: bool,
format: ::Format, format: ::Format,
amount: u64, amount: u64,
@ -1770,6 +1839,7 @@ impl StepStartBuilder {
flush: bool, flush: bool,
intermediate: bool, intermediate: bool,
) -> Self { ) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1807,13 +1877,14 @@ pub struct QosBuilder {
stats: Option<(::Format, u64, u64)>, stats: Option<(::Format, u64, u64)>,
} }
impl QosBuilder { impl QosBuilder {
pub fn new( fn new(
live: bool, live: bool,
running_time: u64, running_time: u64,
stream_time: u64, stream_time: u64,
timestamp: u64, timestamp: u64,
duration: u64, duration: u64,
) -> Self { ) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1868,7 +1939,8 @@ pub struct ProgressBuilder<'a> {
text: Option<&'a str>, text: Option<&'a str>,
} }
impl<'a> ProgressBuilder<'a> { impl<'a> ProgressBuilder<'a> {
pub fn new(type_: ::ProgressType) -> Self { fn new(type_: ::ProgressType) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1909,7 +1981,8 @@ pub struct TocBuilder<'a> {
updated: bool, updated: bool,
} }
impl<'a> TocBuilder<'a> { impl<'a> TocBuilder<'a> {
pub fn new(toc: &'a ::Toc, updated: bool) -> Self { fn new(toc: &'a ::Toc, updated: bool) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1929,7 +2002,8 @@ pub struct ResetTimeBuilder {
running_time: u64, running_time: u64,
} }
impl ResetTimeBuilder { impl ResetTimeBuilder {
pub fn new(running_time: u64) -> Self { fn new(running_time: u64) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1948,7 +2022,8 @@ pub struct StreamStartBuilder {
group_id: Option<u32>, group_id: Option<u32>,
} }
impl StreamStartBuilder { impl StreamStartBuilder {
pub fn new() -> Self { fn new() -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1978,7 +2053,8 @@ pub struct NeedContextBuilder<'a> {
context_type: &'a str, context_type: &'a str,
} }
impl<'a> NeedContextBuilder<'a> { impl<'a> NeedContextBuilder<'a> {
pub fn new(context_type: &'a str) -> Self { fn new(context_type: &'a str) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -1997,7 +2073,8 @@ pub struct HaveContextBuilder {
context: Option<::Context>, context: Option<::Context>,
} }
impl HaveContextBuilder { impl HaveContextBuilder {
pub fn new(context: ::Context) -> Self { fn new(context: ::Context) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -2017,7 +2094,8 @@ pub struct DeviceAddedBuilder<'a> {
device: &'a ::Device, device: &'a ::Device,
} }
impl<'a> DeviceAddedBuilder<'a> { impl<'a> DeviceAddedBuilder<'a> {
pub fn new(device: &'a ::Device) -> Self { fn new(device: &'a ::Device) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -2036,7 +2114,8 @@ pub struct DeviceRemovedBuilder<'a> {
device: &'a ::Device, device: &'a ::Device,
} }
impl<'a> DeviceRemovedBuilder<'a> { impl<'a> DeviceRemovedBuilder<'a> {
pub fn new(device: &'a ::Device) -> Self { fn new(device: &'a ::Device) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -2058,7 +2137,8 @@ pub struct PropertyNotifyBuilder<'a> {
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
impl<'a> PropertyNotifyBuilder<'a> { impl<'a> PropertyNotifyBuilder<'a> {
pub fn new(property_name: &'a str, value: &'a glib::Value) -> Self { fn new(property_name: &'a str, value: &'a glib::Value) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -2084,7 +2164,8 @@ pub struct StreamCollectionBuilder<'a> {
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
impl<'a> StreamCollectionBuilder<'a> { impl<'a> StreamCollectionBuilder<'a> {
pub fn new(collection: &'a ::StreamCollection) -> Self { fn new(collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -2108,7 +2189,8 @@ pub struct StreamsSelectedBuilder<'a> {
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
impl<'a> StreamsSelectedBuilder<'a> { impl<'a> StreamsSelectedBuilder<'a> {
pub fn new(collection: &'a ::StreamCollection) -> Self { fn new(collection: &'a ::StreamCollection) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -2146,11 +2228,12 @@ pub struct RedirectBuilder<'a> {
} }
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
impl<'a> RedirectBuilder<'a> { impl<'a> RedirectBuilder<'a> {
pub fn new( fn new(
location: &'a str, location: &'a str,
tag_list: Option<&'a TagList>, tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>, entry_struct: Option<Structure>,
) -> Self { ) -> Self {
skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
@ -2165,6 +2248,7 @@ impl<'a> RedirectBuilder<'a> {
self, self,
entries: &'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)], entries: &'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)],
) -> Self { ) -> Self {
skip_assert_initialized!();
Self { Self {
entries: Some(entries), entries: Some(entries),
..self ..self

View file

@ -244,6 +244,7 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>); type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*mut *mut T::GstType, Self::Storage) { fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*mut *mut T::GstType, Self::Storage) {
skip_assert_initialized!();
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect(); let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
let mut v_ptr: Vec<_> = v.iter().map(|s| s.0).collect(); let mut v_ptr: Vec<_> = v.iter().map(|s| s.0).collect();
v_ptr.push(ptr::null_mut() as *mut T::GstType); v_ptr.push(ptr::null_mut() as *mut T::GstType);
@ -252,6 +253,7 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
} }
fn to_glib_container_from_slice(t: &'a [GstRc<T>]) -> (*mut *mut T::GstType, Self::Storage) { fn to_glib_container_from_slice(t: &'a [GstRc<T>]) -> (*mut *mut T::GstType, Self::Storage) {
skip_assert_initialized!();
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect(); let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
let v_ptr = unsafe { let v_ptr = unsafe {
@ -268,6 +270,7 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
} }
fn to_glib_full_from_slice(t: &[GstRc<T>]) -> *mut *mut T::GstType { fn to_glib_full_from_slice(t: &[GstRc<T>]) -> *mut *mut T::GstType {
skip_assert_initialized!();
unsafe { unsafe {
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as *mut *mut T::GstType; let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as *mut *mut T::GstType;
@ -284,16 +287,19 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::Gs
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>); type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*const *mut T::GstType, Self::Storage) { fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*const *mut T::GstType, Self::Storage) {
skip_assert_initialized!();
let (ptr, stash) = ToGlibContainerFromSlice::<'a, *mut *mut T::GstType>::to_glib_none_from_slice(t); let (ptr, stash) = ToGlibContainerFromSlice::<'a, *mut *mut T::GstType>::to_glib_none_from_slice(t);
(ptr as *const *mut T::GstType, stash) (ptr as *const *mut T::GstType, stash)
} }
fn to_glib_container_from_slice(_: &'a [GstRc<T>]) -> (*const *mut T::GstType, Self::Storage) { fn to_glib_container_from_slice(_: &'a [GstRc<T>]) -> (*const *mut T::GstType, Self::Storage) {
skip_assert_initialized!();
// Can't have consumer free a *const pointer // Can't have consumer free a *const pointer
unimplemented!() unimplemented!()
} }
fn to_glib_full_from_slice(_: &[GstRc<T>]) -> *const *mut T::GstType { fn to_glib_full_from_slice(_: &[GstRc<T>]) -> *const *mut T::GstType {
skip_assert_initialized!();
// Can't have consumer free a *const pointer // Can't have consumer free a *const pointer
unimplemented!() unimplemented!()
} }

View file

@ -45,6 +45,7 @@ impl ToGlib for PadProbeId {
impl FromGlib<libc::c_ulong> for PadProbeId { impl FromGlib<libc::c_ulong> for PadProbeId {
fn from_glib(val: libc::c_ulong) -> PadProbeId { fn from_glib(val: libc::c_ulong) -> PadProbeId {
skip_assert_initialized!();
PadProbeId(val) PadProbeId(val)
} }
} }
@ -208,6 +209,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
parent: Q, parent: Q,
query: &mut QueryRef, query: &mut QueryRef,
) -> bool { ) -> bool {
skip_assert_initialized!();
let parent = parent.into(); let parent = parent.into();
let parent = parent.to_glib_none(); let parent = parent.to_glib_none();
unsafe { unsafe {
@ -242,6 +244,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
parent: Q, parent: Q,
event: Event, event: Event,
) -> bool { ) -> bool {
skip_assert_initialized!();
let parent = parent.into(); let parent = parent.into();
let parent = parent.to_glib_none(); let parent = parent.to_glib_none();
unsafe { unsafe {

View file

@ -29,26 +29,32 @@ unsafe impl MiniObject for QueryRef {
impl Query { impl Query {
pub fn new_position(fmt: ::Format) -> Self { pub fn new_position(fmt: ::Format) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_position(fmt.to_glib())) } unsafe { from_glib_full(ffi::gst_query_new_position(fmt.to_glib())) }
} }
pub fn new_duration(fmt: ::Format) -> Self { pub fn new_duration(fmt: ::Format) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_duration(fmt.to_glib())) } unsafe { from_glib_full(ffi::gst_query_new_duration(fmt.to_glib())) }
} }
pub fn new_latency() -> Self { pub fn new_latency() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_latency()) } unsafe { from_glib_full(ffi::gst_query_new_latency()) }
} }
pub fn new_seeking(fmt: ::Format) -> Self { pub fn new_seeking(fmt: ::Format) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_seeking(fmt.to_glib())) } unsafe { from_glib_full(ffi::gst_query_new_seeking(fmt.to_glib())) }
} }
pub fn new_segment(fmt: ::Format) -> Self { pub fn new_segment(fmt: ::Format) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_segment(fmt.to_glib())) } unsafe { from_glib_full(ffi::gst_query_new_segment(fmt.to_glib())) }
} }
pub fn new_convert(src_fmt: ::Format, value: i64, dest_fmt: ::Format) -> Self { pub fn new_convert(src_fmt: ::Format, value: i64, dest_fmt: ::Format) -> Self {
assert_initialized_main_thread!();
unsafe { unsafe {
from_glib_full(ffi::gst_query_new_convert( from_glib_full(ffi::gst_query_new_convert(
src_fmt.to_glib(), src_fmt.to_glib(),
@ -59,14 +65,17 @@ impl Query {
} }
pub fn new_formats() -> Self { pub fn new_formats() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_formats()) } unsafe { from_glib_full(ffi::gst_query_new_formats()) }
} }
pub fn new_buffering(fmt: ::Format) -> Self { pub fn new_buffering(fmt: ::Format) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_buffering(fmt.to_glib())) } unsafe { from_glib_full(ffi::gst_query_new_buffering(fmt.to_glib())) }
} }
pub fn new_custom(structure: ::Structure) -> Self { pub fn new_custom(structure: ::Structure) -> Self {
assert_initialized_main_thread!();
unsafe { unsafe {
from_glib_full(ffi::gst_query_new_custom( from_glib_full(ffi::gst_query_new_custom(
ffi::GST_QUERY_CUSTOM, ffi::GST_QUERY_CUSTOM,
@ -76,26 +85,32 @@ impl Query {
} }
pub fn new_uri() -> Self { pub fn new_uri() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_uri()) } unsafe { from_glib_full(ffi::gst_query_new_uri()) }
} }
pub fn new_scheduling() -> Self { pub fn new_scheduling() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_scheduling()) } unsafe { from_glib_full(ffi::gst_query_new_scheduling()) }
} }
pub fn new_accept_caps(caps: &::Caps) -> Self { pub fn new_accept_caps(caps: &::Caps) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_accept_caps(caps.as_mut_ptr())) } unsafe { from_glib_full(ffi::gst_query_new_accept_caps(caps.as_mut_ptr())) }
} }
pub fn new_caps(filter: &::Caps) -> Self { pub fn new_caps(filter: &::Caps) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_caps(filter.as_mut_ptr())) } unsafe { from_glib_full(ffi::gst_query_new_caps(filter.as_mut_ptr())) }
} }
pub fn new_drain() -> Self { pub fn new_drain() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_drain()) } unsafe { from_glib_full(ffi::gst_query_new_drain()) }
} }
pub fn new_context(context_type: &str) -> Self { pub fn new_context(context_type: &str) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_query_new_context(context_type.to_glib_none().0)) } unsafe { from_glib_full(ffi::gst_query_new_context(context_type.to_glib_none().0)) }
} }
} }
@ -584,6 +599,7 @@ impl<'a> Buffering<&'a mut QueryRef> {
avg_out: i32, avg_out: i32,
buffering_left: i64, buffering_left: i64,
) { ) {
skip_assert_initialized!();
unsafe { unsafe {
ffi::gst_query_set_buffering_stats( ffi::gst_query_set_buffering_stats(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
@ -698,6 +714,7 @@ impl<'a> Scheduling<&'a QueryRef> {
mode: ::PadMode, mode: ::PadMode,
flags: ::SchedulingFlags, flags: ::SchedulingFlags,
) -> bool { ) -> bool {
skip_assert_initialized!();
unsafe { unsafe {
from_glib(ffi::gst_query_has_scheduling_mode_with_flags( from_glib(ffi::gst_query_has_scheduling_mode_with_flags(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),

View file

@ -61,6 +61,7 @@ impl Segment {
stop_type: SeekType, stop_type: SeekType,
stop: u64, stop: u64,
) -> Option<bool> { ) -> Option<bool> {
skip_assert_initialized!();
unsafe { unsafe {
let mut update = mem::uninitialized(); let mut update = mem::uninitialized();
let ret = from_glib(ffi::gst_segment_do_seek( let ret = from_glib(ffi::gst_segment_do_seek(

View file

@ -132,6 +132,7 @@ impl str::FromStr for Structure {
type Err = (); type Err = ();
fn from_str(s: &str) -> Result<Self, ()> { fn from_str(s: &str) -> Result<Self, ()> {
skip_assert_initialized!();
Structure::from_string(s).ok_or(()) Structure::from_string(s).ok_or(())
} }
} }
@ -446,6 +447,8 @@ impl StructureRef {
name: &str, name: &str,
target: T, target: T,
) -> bool { ) -> bool {
skip_assert_initialized!();
let target = target.into(); let target = target.into();
unsafe { unsafe {
from_glib(ffi::gst_structure_fixate_field_nearest_fraction( from_glib(ffi::gst_structure_fixate_field_nearest_fraction(
@ -489,7 +492,8 @@ pub struct FieldIterator<'a> {
} }
impl<'a> FieldIterator<'a> { impl<'a> FieldIterator<'a> {
pub fn new(structure: &'a StructureRef) -> FieldIterator<'a> { fn new(structure: &'a StructureRef) -> FieldIterator<'a> {
skip_assert_initialized!();
let n_fields = structure.n_fields(); let n_fields = structure.n_fields();
FieldIterator { FieldIterator {
@ -549,7 +553,8 @@ pub struct Iter<'a> {
} }
impl<'a> Iter<'a> { impl<'a> Iter<'a> {
pub fn new(structure: &'a StructureRef) -> Iter<'a> { fn new(structure: &'a StructureRef) -> Iter<'a> {
skip_assert_initialized!();
Iter { Iter {
iter: FieldIterator::new(structure), iter: FieldIterator::new(structure),
} }

View file

@ -351,6 +351,7 @@ pub struct TagIterator<'a, T: Tag<'a>> {
impl<'a, T: Tag<'a>> TagIterator<'a, T> { impl<'a, T: Tag<'a>> TagIterator<'a, T> {
fn new(taglist: &'a TagListRef) -> TagIterator<'a, T> { fn new(taglist: &'a TagListRef) -> TagIterator<'a, T> {
skip_assert_initialized!();
TagIterator { TagIterator {
taglist: taglist, taglist: taglist,
idx: 0, idx: 0,

View file

@ -25,14 +25,17 @@ pub struct Fraction(pub Rational32);
impl Fraction { impl Fraction {
pub fn new(num: i32, den: i32) -> Fraction { pub fn new(num: i32, den: i32) -> Fraction {
assert_initialized_main_thread!();
(num, den).into() (num, den).into()
} }
pub fn approximate_f32(x: f32) -> Option<Fraction> { pub fn approximate_f32(x: f32) -> Option<Fraction> {
assert_initialized_main_thread!();
Rational32::approximate_float(x).map(|r| r.into()) Rational32::approximate_float(x).map(|r| r.into())
} }
pub fn approximate_f64(x: f64) -> Option<Fraction> { pub fn approximate_f64(x: f64) -> Option<Fraction> {
assert_initialized_main_thread!();
Rational32::approximate_float(x).map(|r| r.into()) Rational32::approximate_float(x).map(|r| r.into())
} }
} }
@ -153,12 +156,14 @@ impl ops::Neg for Fraction {
impl From<i32> for Fraction { impl From<i32> for Fraction {
fn from(x: i32) -> Fraction { fn from(x: i32) -> Fraction {
assert_initialized_main_thread!();
Fraction(x.into()) Fraction(x.into())
} }
} }
impl From<(i32, i32)> for Fraction { impl From<(i32, i32)> for Fraction {
fn from(x: (i32, i32)) -> Fraction { fn from(x: (i32, i32)) -> Fraction {
assert_initialized_main_thread!();
Fraction(x.into()) Fraction(x.into())
} }
} }
@ -171,12 +176,14 @@ impl Into<(i32, i32)> for Fraction {
impl From<Rational32> for Fraction { impl From<Rational32> for Fraction {
fn from(x: Rational32) -> Fraction { fn from(x: Rational32) -> Fraction {
assert_initialized_main_thread!();
Fraction(x) Fraction(x)
} }
} }
impl From<Fraction> for Rational32 { impl From<Fraction> for Rational32 {
fn from(x: Fraction) -> Rational32 { fn from(x: Fraction) -> Rational32 {
skip_assert_initialized!();
x.0 x.0
} }
} }
@ -231,10 +238,13 @@ impl<T: Copy> IntRange<T> {
impl IntRange<i32> { impl IntRange<i32> {
pub fn new(min: i32, max: i32) -> Self { pub fn new(min: i32, max: i32) -> Self {
skip_assert_initialized!();
Self::new_with_step(min, max, 1) Self::new_with_step(min, max, 1)
} }
pub fn new_with_step(min: i32, max: i32, step: i32) -> Self { pub fn new_with_step(min: i32, max: i32, step: i32) -> Self {
assert_initialized_main_thread!();
assert!(min <= max); assert!(min <= max);
assert!(step > 0); assert!(step > 0);
@ -248,10 +258,13 @@ impl IntRange<i32> {
impl IntRange<i64> { impl IntRange<i64> {
pub fn new(min: i64, max: i64) -> Self { pub fn new(min: i64, max: i64) -> Self {
skip_assert_initialized!();
Self::new_with_step(min, max, 1) Self::new_with_step(min, max, 1)
} }
pub fn new_with_step(min: i64, max: i64, step: i64) -> Self { pub fn new_with_step(min: i64, max: i64, step: i64) -> Self {
assert_initialized_main_thread!();
assert!(min <= max); assert!(min <= max);
assert!(step > 0); assert!(step > 0);
@ -265,24 +278,28 @@ impl IntRange<i64> {
impl From<(i32, i32)> for IntRange<i32> { impl From<(i32, i32)> for IntRange<i32> {
fn from((min, max): (i32, i32)) -> Self { fn from((min, max): (i32, i32)) -> Self {
skip_assert_initialized!();
Self::new(min, max) Self::new(min, max)
} }
} }
impl From<(i32, i32, i32)> for IntRange<i32> { impl From<(i32, i32, i32)> for IntRange<i32> {
fn from((min, max, step): (i32, i32, i32)) -> Self { fn from((min, max, step): (i32, i32, i32)) -> Self {
skip_assert_initialized!();
Self::new_with_step(min, max, step) Self::new_with_step(min, max, step)
} }
} }
impl From<(i64, i64)> for IntRange<i64> { impl From<(i64, i64)> for IntRange<i64> {
fn from((min, max): (i64, i64)) -> Self { fn from((min, max): (i64, i64)) -> Self {
skip_assert_initialized!();
Self::new(min, max) Self::new(min, max)
} }
} }
impl From<(i64, i64, i64)> for IntRange<i64> { impl From<(i64, i64, i64)> for IntRange<i64> {
fn from((min, max, step): (i64, i64, i64)) -> Self { fn from((min, max, step): (i64, i64, i64)) -> Self {
skip_assert_initialized!();
Self::new_with_step(min, max, step) Self::new_with_step(min, max, step)
} }
} }
@ -351,6 +368,8 @@ pub struct FractionRange {
impl FractionRange { impl FractionRange {
pub fn new<T: Into<Fraction>, U: Into<Fraction>>(min: T, max: U) -> Self { pub fn new<T: Into<Fraction>, U: Into<Fraction>>(min: T, max: U) -> Self {
assert_initialized_main_thread!();
let min = min.into(); let min = min.into();
let max = max.into(); let max = max.into();
@ -370,6 +389,8 @@ impl FractionRange {
impl From<(Fraction, Fraction)> for FractionRange { impl From<(Fraction, Fraction)> for FractionRange {
fn from((min, max): (Fraction, Fraction)) -> Self { fn from((min, max): (Fraction, Fraction)) -> Self {
skip_assert_initialized!();
Self::new(min, max) Self::new(min, max)
} }
} }
@ -417,6 +438,7 @@ pub struct Bitmask(u64);
impl Bitmask { impl Bitmask {
pub fn new(v: u64) -> Self { pub fn new(v: u64) -> Self {
assert_initialized_main_thread!();
Bitmask(v) Bitmask(v)
} }
} }
@ -469,6 +491,7 @@ impl ops::Not for Bitmask {
impl From<u64> for Bitmask { impl From<u64> for Bitmask {
fn from(v: u64) -> Self { fn from(v: u64) -> Self {
skip_assert_initialized!();
Self::new(v) Self::new(v)
} }
} }
@ -503,6 +526,8 @@ pub struct Array<'a>(Cow<'a, [glib::Value]>);
impl<'a> Array<'a> { impl<'a> Array<'a> {
pub fn new(values: &[&ToValue]) -> Self { pub fn new(values: &[&ToValue]) -> Self {
assert_initialized_main_thread!();
Array(values.iter().map(|v| v.to_value()).collect()) Array(values.iter().map(|v| v.to_value()).collect())
} }
@ -517,12 +542,16 @@ impl<'a> Array<'a> {
impl<'a> From<&'a [&'a ToValue]> for Array<'a> { impl<'a> From<&'a [&'a ToValue]> for Array<'a> {
fn from(values: &'a [&'a ToValue]) -> Self { fn from(values: &'a [&'a ToValue]) -> Self {
skip_assert_initialized!();
Self::new(values) Self::new(values)
} }
} }
impl<'a> From<&'a [glib::Value]> for Array<'a> { impl<'a> From<&'a [glib::Value]> for Array<'a> {
fn from(values: &'a [glib::Value]) -> Self { fn from(values: &'a [glib::Value]) -> Self {
assert_initialized_main_thread!();
Array(Cow::Borrowed(values)) Array(Cow::Borrowed(values))
} }
} }
@ -566,6 +595,8 @@ pub struct List<'a>(Cow<'a, [glib::Value]>);
impl<'a> List<'a> { impl<'a> List<'a> {
pub fn new(values: &[&ToValue]) -> Self { pub fn new(values: &[&ToValue]) -> Self {
assert_initialized_main_thread!();
List(values.iter().map(|v| v.to_value()).collect()) List(values.iter().map(|v| v.to_value()).collect())
} }
@ -580,12 +611,16 @@ impl<'a> List<'a> {
impl<'a> From<&'a [&'a ToValue]> for List<'a> { impl<'a> From<&'a [&'a ToValue]> for List<'a> {
fn from(values: &'a [&'a ToValue]) -> Self { fn from(values: &'a [&'a ToValue]) -> Self {
skip_assert_initialized!();
Self::new(values) Self::new(values)
} }
} }
impl<'a> From<&'a [glib::Value]> for List<'a> { impl<'a> From<&'a [glib::Value]> for List<'a> {
fn from(values: &'a [glib::Value]) -> Self { fn from(values: &'a [glib::Value]) -> Self {
assert_initialized_main_thread!();
List(Cow::Borrowed(values)) List(Cow::Borrowed(values))
} }
} }
@ -646,6 +681,8 @@ impl ToGlib for ValueOrder {
impl FromGlib<i32> for ValueOrder { impl FromGlib<i32> for ValueOrder {
fn from_glib(v: i32) -> Self { fn from_glib(v: i32) -> Self {
skip_assert_initialized!();
match v { match v {
ffi::GST_VALUE_LESS_THAN => ValueOrder::LessThan, ffi::GST_VALUE_LESS_THAN => ValueOrder::LessThan,
ffi::GST_VALUE_EQUAL => ValueOrder::Equal, ffi::GST_VALUE_EQUAL => ValueOrder::Equal,
@ -799,6 +836,8 @@ impl GstValueExt for glib::Value {
} }
fn deserialize<'a, T: Into<&'a str>>(s: T) -> Option<glib::Value> { fn deserialize<'a, T: Into<&'a str>>(s: T) -> Option<glib::Value> {
assert_initialized_main_thread!();
let s = s.into(); let s = s.into();
unsafe { unsafe {