mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
Add remaining gst_init() assertions
This commit is contained in:
parent
f05df73088
commit
f0935d7e1e
22 changed files with 401 additions and 131 deletions
|
@ -27,6 +27,8 @@ impl AudioChannelPosition {
|
|||
}
|
||||
|
||||
pub fn positions_to_mask(positions: &[AudioChannelPosition], force_order: bool) -> Option<u64> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
let len = positions.len();
|
||||
if len > 64 {
|
||||
return None;
|
||||
|
@ -59,6 +61,8 @@ impl AudioChannelPosition {
|
|||
mask: u64,
|
||||
positions: &mut [AudioChannelPosition],
|
||||
) -> Result<(), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
if positions.len() > 64 {
|
||||
return Err(glib::BoolError("Invalid number of channels"));
|
||||
}
|
||||
|
@ -89,6 +93,8 @@ impl AudioChannelPosition {
|
|||
pub fn positions_to_valid_order(
|
||||
positions: &mut [AudioChannelPosition],
|
||||
) -> Result<(), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
if positions.len() > 64 {
|
||||
return Err(glib::BoolError("Invalid number of channels"));
|
||||
}
|
||||
|
@ -121,6 +127,8 @@ impl AudioChannelPosition {
|
|||
}
|
||||
|
||||
pub fn get_fallback_mask(channels: u32) -> u64 {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
unsafe { ffi::gst_audio_channel_get_fallback_mask(channels as i32) }
|
||||
}
|
||||
|
||||
|
@ -128,6 +136,8 @@ impl AudioChannelPosition {
|
|||
positions: &[::AudioChannelPosition],
|
||||
force_order: bool,
|
||||
) -> bool {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
if positions.len() > 64 {
|
||||
return false;
|
||||
}
|
||||
|
@ -157,6 +167,8 @@ pub fn buffer_reorder_channels(
|
|||
from: &[AudioChannelPosition],
|
||||
to: &[AudioChannelPosition],
|
||||
) -> Result<(), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
if from.len() != to.len() || from.len() > 64 {
|
||||
return Err(glib::BoolError("Invalid number of channels"));
|
||||
}
|
||||
|
@ -202,6 +214,8 @@ pub fn reorder_channels(
|
|||
from: &[AudioChannelPosition],
|
||||
to: &[AudioChannelPosition],
|
||||
) -> Result<(), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
if from.len() != to.len() || from.len() > 64 {
|
||||
return Err(glib::BoolError("Invalid number of channels"));
|
||||
}
|
||||
|
@ -246,6 +260,8 @@ pub fn get_channel_reorder_map(
|
|||
to: &[AudioChannelPosition],
|
||||
reorder_map: &mut [usize],
|
||||
) -> Result<(), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
if from.len() != to.len() || from.len() != reorder_map.len() || from.len() > 64 {
|
||||
return Err(glib::BoolError("Invalid number of channels"));
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ impl ::AudioFormat {
|
|||
width: i32,
|
||||
depth: i32,
|
||||
) -> ::AudioFormat {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
unsafe {
|
||||
from_glib(ffi::gst_audio_format_build_integer(
|
||||
sign.to_glib(),
|
||||
|
@ -32,6 +34,8 @@ impl ::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)) }
|
||||
}
|
||||
|
||||
|
@ -48,6 +52,8 @@ impl str::FromStr for ::AudioFormat {
|
|||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, ()> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
let format = Self::from_string(s);
|
||||
if format == ::AudioFormat::Unknown {
|
||||
Err(())
|
||||
|
|
|
@ -26,6 +26,8 @@ pub enum AudioEndianness {
|
|||
|
||||
impl FromGlib<i32> for AudioEndianness {
|
||||
fn from_glib(value: i32) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
match value {
|
||||
1234 => AudioEndianness::LittleEndian,
|
||||
4321 => AudioEndianness::BigEndian,
|
||||
|
@ -50,6 +52,8 @@ pub struct AudioFormatInfo(&'static ffi::GstAudioFormatInfo);
|
|||
|
||||
impl AudioFormatInfo {
|
||||
pub fn from_format(format: ::AudioFormat) -> AudioFormatInfo {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
unsafe {
|
||||
let info = ffi::gst_audio_format_get_info(format.to_glib());
|
||||
assert!(!info.is_null());
|
||||
|
@ -227,6 +231,7 @@ impl str::FromStr for ::AudioFormatInfo {
|
|||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, ()> {
|
||||
skip_assert_initialized!();
|
||||
let format = s.parse()?;
|
||||
Ok(AudioFormatInfo::from_format(format))
|
||||
}
|
||||
|
@ -234,6 +239,7 @@ impl str::FromStr for ::AudioFormatInfo {
|
|||
|
||||
impl From<::AudioFormat> for AudioFormatInfo {
|
||||
fn from(f: ::AudioFormat) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::from_format(f)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@ impl<'a> AudioInfoBuilder<'a> {
|
|||
|
||||
impl AudioInfo {
|
||||
pub fn new<'a>(format: ::AudioFormat, rate: u32, channels: u32) -> AudioInfoBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
AudioInfoBuilder {
|
||||
format: format,
|
||||
rate: rate,
|
||||
|
@ -128,6 +130,8 @@ impl AudioInfo {
|
|||
}
|
||||
|
||||
pub fn from_caps(caps: &gst::Caps) -> Option<Self> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut info = mem::uninitialized();
|
||||
if from_glib(ffi::gst_audio_info_from_caps(&mut info, caps.as_ptr())) {
|
||||
|
@ -156,6 +160,8 @@ impl AudioInfo {
|
|||
src_val: i64,
|
||||
dest_fmt: gst::Format,
|
||||
) -> Option<i64> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
if from_glib(ffi::gst_audio_info_convert(
|
||||
|
|
|
@ -21,8 +21,9 @@ extern crate glib;
|
|||
|
||||
macro_rules! assert_initialized_main_thread {
|
||||
() => (
|
||||
use gst_ffi;
|
||||
assert_eq!(unsafe {gst_ffi::gst_is_initialized()}, ::glib_ffi::GTRUE)
|
||||
if 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,
|
||||
channels: u32,
|
||||
) -> gst::Buffer {
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_audio_buffer_clip(
|
||||
buffer.into_ptr(),
|
||||
|
|
|
@ -179,7 +179,7 @@ impl VideoFrame<Readable> {
|
|||
buffer: gst::Buffer,
|
||||
info: &::VideoInfo,
|
||||
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
||||
assert_initialized_main_thread!();
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut frame = mem::zeroed();
|
||||
|
@ -206,7 +206,7 @@ impl VideoFrame<Readable> {
|
|||
id: i32,
|
||||
info: &::VideoInfo,
|
||||
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
||||
assert_initialized_main_thread!();
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut frame = mem::zeroed();
|
||||
|
@ -239,7 +239,7 @@ impl VideoFrame<Writable> {
|
|||
buffer: gst::Buffer,
|
||||
info: &::VideoInfo,
|
||||
) -> Result<VideoFrame<Writable>, gst::Buffer> {
|
||||
assert_initialized_main_thread!();
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut frame = mem::zeroed();
|
||||
|
@ -267,7 +267,7 @@ impl VideoFrame<Writable> {
|
|||
id: i32,
|
||||
info: &::VideoInfo,
|
||||
) -> Result<VideoFrame<Writable>, gst::Buffer> {
|
||||
assert_initialized_main_thread!();
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut frame = mem::zeroed();
|
||||
|
|
|
@ -420,7 +420,7 @@ impl VideoInfo {
|
|||
}
|
||||
|
||||
pub fn from_caps(caps: &gst::Caps) -> Option<Self> {
|
||||
assert_initialized_main_thread!();
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut info = mem::uninitialized();
|
||||
|
|
|
@ -54,6 +54,8 @@ impl GstRc<BufferRef> {
|
|||
}
|
||||
|
||||
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()) };
|
||||
if raw.is_null() {
|
||||
None
|
||||
|
@ -68,6 +70,8 @@ impl GstRc<BufferRef> {
|
|||
}
|
||||
|
||||
pub fn from_vec(vec: Vec<u8>) -> Option<Self> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
let raw = unsafe {
|
||||
let mut vec = Box::new(vec);
|
||||
let maxsize = vec.capacity();
|
||||
|
@ -133,6 +137,7 @@ impl GstRc<BufferRef> {
|
|||
}
|
||||
|
||||
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())) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ pub struct Iter<'a> {
|
|||
|
||||
impl<'a> Iter<'a> {
|
||||
fn new(list: &'a BufferListRef) -> Iter<'a> {
|
||||
skip_assert_initialized!();
|
||||
Iter {
|
||||
list: list,
|
||||
idx: 0,
|
||||
|
|
|
@ -87,6 +87,7 @@ impl Bus {
|
|||
where
|
||||
F: FnMut(&Bus, &Message) -> Continue + Send + 'static,
|
||||
{
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
let source = ffi::gst_bus_create_watch(self.to_glib_none().0);
|
||||
let trampoline = trampoline_watch as gpointer;
|
||||
|
@ -147,6 +148,7 @@ pub struct BusStream(Bus, Arc<Mutex<Option<Task>>>);
|
|||
#[cfg(feature = "futures")]
|
||||
impl BusStream {
|
||||
pub fn new(bus: &Bus) -> Self {
|
||||
skip_assert_initialized!();
|
||||
let task = Arc::new(Mutex::new(None));
|
||||
let task_clone = task.clone();
|
||||
|
||||
|
|
|
@ -62,14 +62,17 @@ impl GstRc<CapsRef> {
|
|||
}
|
||||
|
||||
pub fn fixate(caps: Self) -> Self {
|
||||
skip_assert_initialized!();
|
||||
unsafe { from_glib_full(ffi::gst_caps_fixate(caps.into_ptr())) }
|
||||
}
|
||||
|
||||
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())) }
|
||||
}
|
||||
|
||||
pub fn merge_structure(caps: Self, other: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_caps_merge_structure(
|
||||
caps.into_ptr(),
|
||||
|
@ -79,18 +82,22 @@ impl GstRc<CapsRef> {
|
|||
}
|
||||
|
||||
pub fn normalize(caps: Self) -> Self {
|
||||
skip_assert_initialized!();
|
||||
unsafe { from_glib_full(ffi::gst_caps_normalize(caps.into_ptr())) }
|
||||
}
|
||||
|
||||
pub fn simplify(caps: Self) -> Self {
|
||||
skip_assert_initialized!();
|
||||
unsafe { from_glib_full(ffi::gst_caps_simplify(caps.into_ptr())) }
|
||||
}
|
||||
|
||||
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())) }
|
||||
}
|
||||
|
||||
pub fn truncate(caps: Self) -> Self {
|
||||
skip_assert_initialized!();
|
||||
unsafe { from_glib_full(ffi::gst_caps_truncate(caps.into_ptr())) }
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +106,7 @@ impl str::FromStr for Caps {
|
|||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, ()> {
|
||||
skip_assert_initialized!();
|
||||
Caps::from_string(s).ok_or(())
|
||||
}
|
||||
}
|
||||
|
@ -251,80 +259,80 @@ impl glib::types::StaticType for CapsRef {
|
|||
|
||||
macro_rules! define_iter(
|
||||
($name:ident, $typ:ty, $styp:ty) => {
|
||||
pub struct $name<'a> {
|
||||
caps: $typ,
|
||||
idx: u32,
|
||||
n_structures: u32,
|
||||
}
|
||||
|
||||
pub struct $name<'a> {
|
||||
caps: $typ,
|
||||
idx: u32,
|
||||
n_structures: u32,
|
||||
}
|
||||
impl<'a> $name<'a> {
|
||||
fn new(caps: $typ) -> $name<'a> {
|
||||
skip_assert_initialized!();
|
||||
let n_structures = caps.get_size();
|
||||
|
||||
impl<'a> $name<'a> {
|
||||
pub fn new(caps: $typ) -> $name<'a> {
|
||||
let n_structures = caps.get_size();
|
||||
|
||||
$name {
|
||||
caps: caps,
|
||||
idx: 0,
|
||||
n_structures: n_structures,
|
||||
$name {
|
||||
caps: caps,
|
||||
idx: 0,
|
||||
n_structures: n_structures,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for $name<'a> {
|
||||
type Item = $styp;
|
||||
impl<'a> Iterator for $name<'a> {
|
||||
type Item = $styp;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if self.idx >= self.n_structures {
|
||||
return None;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
let structure = ffi::gst_caps_get_structure(self.caps.as_ptr(), self.idx);
|
||||
if structure.is_null() {
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if self.idx >= self.n_structures {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.idx += 1;
|
||||
Some(StructureRef::from_glib_borrow_mut(
|
||||
structure as *mut ffi::GstStructure,
|
||||
))
|
||||
unsafe {
|
||||
let structure = ffi::gst_caps_get_structure(self.caps.as_ptr(), self.idx);
|
||||
if structure.is_null() {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.idx += 1;
|
||||
Some(StructureRef::from_glib_borrow_mut(
|
||||
structure as *mut ffi::GstStructure,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
if self.idx == self.n_structures {
|
||||
return (0, Some(0));
|
||||
}
|
||||
|
||||
let remaining = (self.n_structures - self.idx) as usize;
|
||||
|
||||
(remaining, Some(remaining))
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
if self.idx == self.n_structures {
|
||||
return (0, Some(0));
|
||||
}
|
||||
|
||||
let remaining = (self.n_structures - self.idx) as usize;
|
||||
|
||||
(remaining, Some(remaining))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DoubleEndedIterator for $name<'a> {
|
||||
fn next_back(&mut self) -> Option<Self::Item> {
|
||||
if self.idx == self.n_structures {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.n_structures -= 1;
|
||||
|
||||
unsafe {
|
||||
let structure = ffi::gst_caps_get_structure(self.caps.as_ptr(), self.n_structures);
|
||||
if structure.is_null() {
|
||||
impl<'a> DoubleEndedIterator for $name<'a> {
|
||||
fn next_back(&mut self) -> Option<Self::Item> {
|
||||
if self.idx == self.n_structures {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(StructureRef::from_glib_borrow_mut(
|
||||
structure as *mut ffi::GstStructure,
|
||||
))
|
||||
self.n_structures -= 1;
|
||||
|
||||
unsafe {
|
||||
let structure = ffi::gst_caps_get_structure(self.caps.as_ptr(), self.n_structures);
|
||||
if structure.is_null() {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(StructureRef::from_glib_borrow_mut(
|
||||
structure as *mut ffi::GstStructure,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for $name<'a> {}
|
||||
}
|
||||
impl<'a> ExactSizeIterator for $name<'a> {}
|
||||
}
|
||||
);
|
||||
|
||||
define_iter!(Iter, &'a CapsRef, &'a StructureRef);
|
||||
|
|
|
@ -152,6 +152,7 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExtManual for O {
|
|||
start_time: ClockTime,
|
||||
interval: ClockTime,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit(
|
||||
self.to_glib_none().0,
|
||||
|
|
|
@ -23,6 +23,7 @@ use gobject_ffi;
|
|||
|
||||
impl Element {
|
||||
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)) {
|
||||
unsafe {
|
||||
let ret: bool = from_glib(ffi::gst_element_link(
|
||||
|
@ -39,6 +40,7 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn unlink_many<E: IsA<Element>>(elements: &[&E]) {
|
||||
skip_assert_initialized!();
|
||||
for (e1, e2) in elements.iter().zip(elements.iter().skip(1)) {
|
||||
unsafe {
|
||||
ffi::gst_element_unlink(e1.to_glib_none().0, e2.to_glib_none().0);
|
||||
|
|
|
@ -135,22 +135,27 @@ impl EventRef {
|
|||
|
||||
impl Event {
|
||||
pub fn new_flush_start() -> FlushStartBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
FlushStartBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_flush_stop(reset_time: bool) -> FlushStopBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
FlushStopBuilder::new(reset_time)
|
||||
}
|
||||
|
||||
pub fn new_stream_start(stream_id: &str) -> StreamStartBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StreamStartBuilder::new(stream_id)
|
||||
}
|
||||
|
||||
pub fn new_caps(caps: &::Caps) -> CapsBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
CapsBuilder::new(caps)
|
||||
}
|
||||
|
||||
pub fn new_segment(segment: &::Segment) -> SegmentBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
SegmentBuilder::new(segment)
|
||||
}
|
||||
|
||||
|
@ -158,10 +163,12 @@ impl Event {
|
|||
pub fn new_stream_collection(
|
||||
stream_collection: &::StreamCollection,
|
||||
) -> StreamCollectionBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StreamCollectionBuilder::new(stream_collection)
|
||||
}
|
||||
|
||||
pub fn new_tag(tags: ::TagList) -> TagBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
TagBuilder::new(tags)
|
||||
}
|
||||
|
||||
|
@ -171,23 +178,28 @@ impl Event {
|
|||
maxsize: i64,
|
||||
async: bool,
|
||||
) -> BufferSizeBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
BufferSizeBuilder::new(format, minsize, maxsize, async)
|
||||
}
|
||||
|
||||
pub fn new_sink_message<'a>(name: &'a str, msg: &'a ::Message) -> SinkMessageBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
SinkMessageBuilder::new(name, msg)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_10")]
|
||||
pub fn new_stream_group_done(group_id: u32) -> StreamGroupDoneBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StreamGroupDoneBuilder::new(group_id)
|
||||
}
|
||||
|
||||
pub fn new_eos() -> EosBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
EosBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_toc(toc: &::Toc, updated: bool) -> TocBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
TocBuilder::new(toc, updated)
|
||||
}
|
||||
|
||||
|
@ -196,18 +208,22 @@ impl Event {
|
|||
data: &'a ::Buffer,
|
||||
origin: &'a str,
|
||||
) -> ProtectionBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
ProtectionBuilder::new(system_id, data, origin)
|
||||
}
|
||||
|
||||
pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
SegmentDoneBuilder::new(format, position)
|
||||
}
|
||||
|
||||
pub fn new_gap(timestamp: u64, duration: u64) -> GapBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
GapBuilder::new(timestamp, duration)
|
||||
}
|
||||
|
||||
pub fn new_qos(type_: ::QOSType, proportion: f64, diff: i64, timestamp: u64) -> QosBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
QosBuilder::new(type_, proportion, diff, timestamp)
|
||||
}
|
||||
|
||||
|
@ -220,14 +236,17 @@ impl Event {
|
|||
stop_type: ::SeekType,
|
||||
stop: i64,
|
||||
) -> SeekBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
SeekBuilder::new(rate, format, flags, start_type, start, stop_type, stop)
|
||||
}
|
||||
|
||||
pub fn new_navigation(structure: ::Structure) -> NavigationBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
NavigationBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_latency(latency: u64) -> LatencyBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
LatencyBuilder::new(latency)
|
||||
}
|
||||
|
||||
|
@ -238,43 +257,53 @@ impl Event {
|
|||
flush: bool,
|
||||
intermediate: bool,
|
||||
) -> StepBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StepBuilder::new(format, amount, rate, flush, intermediate)
|
||||
}
|
||||
|
||||
pub fn new_reconfigure() -> ReconfigureBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
ReconfigureBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_toc_select(uid: &str) -> TocSelectBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
TocSelectBuilder::new(uid)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_10")]
|
||||
pub fn new_select_streams<'a>(streams: &'a [&'a str]) -> SelectStreamsBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
SelectStreamsBuilder::new(streams)
|
||||
}
|
||||
|
||||
pub fn new_custom_upstream(structure: ::Structure) -> CustomUpstreamBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
CustomUpstreamBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_custom_downstream(structure: ::Structure) -> CustomDownstreamBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
CustomDownstreamBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_custom_downstream_oob(structure: ::Structure) -> CustomDownstreamOobBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
CustomDownstreamOobBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_custom_downstream_sticky(structure: ::Structure) -> CustomDownstreamStickyBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
CustomDownstreamStickyBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_custom_both(structure: ::Structure) -> CustomBothBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
CustomBothBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_custom_both_oob(structure: ::Structure) -> CustomBothOobBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
CustomBothOobBuilder::new(structure)
|
||||
}
|
||||
}
|
||||
|
@ -712,7 +741,8 @@ pub struct FlushStartBuilder {
|
|||
running_time_offset: Option<i64>,
|
||||
}
|
||||
impl FlushStartBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -728,7 +758,8 @@ pub struct FlushStopBuilder {
|
|||
reset_time: bool,
|
||||
}
|
||||
impl FlushStopBuilder {
|
||||
pub fn new(reset_time: bool) -> Self {
|
||||
fn new(reset_time: bool) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -749,7 +780,8 @@ pub struct StreamStartBuilder<'a> {
|
|||
group_id: Option<u32>,
|
||||
}
|
||||
impl<'a> StreamStartBuilder<'a> {
|
||||
pub fn new(stream_id: &'a str) -> Self {
|
||||
fn new(stream_id: &'a str) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -791,7 +823,8 @@ pub struct CapsBuilder<'a> {
|
|||
caps: &'a ::Caps,
|
||||
}
|
||||
impl<'a> CapsBuilder<'a> {
|
||||
pub fn new(caps: &'a ::Caps) -> Self {
|
||||
fn new(caps: &'a ::Caps) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -808,7 +841,8 @@ pub struct SegmentBuilder<'a> {
|
|||
segment: &'a ::Segment,
|
||||
}
|
||||
impl<'a> SegmentBuilder<'a> {
|
||||
pub fn new(segment: &'a ::Segment) -> Self {
|
||||
fn new(segment: &'a ::Segment) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -829,7 +863,8 @@ pub struct StreamCollectionBuilder<'a> {
|
|||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
impl<'a> StreamCollectionBuilder<'a> {
|
||||
pub fn new(stream_collection: &'a ::StreamCollection) -> Self {
|
||||
fn new(stream_collection: &'a ::StreamCollection) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -848,7 +883,8 @@ pub struct TagBuilder {
|
|||
tags: Option<::TagList>,
|
||||
}
|
||||
impl TagBuilder {
|
||||
pub fn new(tags: ::TagList) -> Self {
|
||||
fn new(tags: ::TagList) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -871,7 +907,8 @@ pub struct BufferSizeBuilder {
|
|||
async: bool,
|
||||
}
|
||||
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 {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -894,7 +931,8 @@ pub struct SinkMessageBuilder<'a> {
|
|||
msg: &'a ::Message,
|
||||
}
|
||||
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 {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -916,7 +954,8 @@ pub struct StreamGroupDoneBuilder {
|
|||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
impl StreamGroupDoneBuilder {
|
||||
pub fn new(uid: u32) -> Self {
|
||||
fn new(uid: u32) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -932,7 +971,8 @@ pub struct EosBuilder {
|
|||
running_time_offset: Option<i64>,
|
||||
}
|
||||
impl EosBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -949,7 +989,8 @@ pub struct TocBuilder<'a> {
|
|||
updated: bool,
|
||||
}
|
||||
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 {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -971,7 +1012,8 @@ pub struct ProtectionBuilder<'a> {
|
|||
origin: &'a str,
|
||||
}
|
||||
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 {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -997,7 +1039,8 @@ pub struct SegmentDoneBuilder {
|
|||
position: i64,
|
||||
}
|
||||
impl SegmentDoneBuilder {
|
||||
pub fn new(fmt: ::Format, position: i64) -> Self {
|
||||
fn new(fmt: ::Format, position: i64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1018,7 +1061,8 @@ pub struct GapBuilder {
|
|||
duration: u64,
|
||||
}
|
||||
impl GapBuilder {
|
||||
pub fn new(timestamp: u64, duration: u64) -> Self {
|
||||
fn new(timestamp: u64, duration: u64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1039,7 +1083,8 @@ pub struct QosBuilder {
|
|||
timestamp: u64,
|
||||
}
|
||||
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 {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1067,7 +1112,7 @@ pub struct SeekBuilder {
|
|||
stop: i64,
|
||||
}
|
||||
impl SeekBuilder {
|
||||
pub fn new(
|
||||
fn new(
|
||||
rate: f64,
|
||||
fmt: ::Format,
|
||||
flags: ::SeekFlags,
|
||||
|
@ -1076,6 +1121,7 @@ impl SeekBuilder {
|
|||
stop_type: ::SeekType,
|
||||
stop: i64,
|
||||
) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1108,7 +1154,8 @@ pub struct NavigationBuilder {
|
|||
structure: Option<Structure>,
|
||||
}
|
||||
impl NavigationBuilder {
|
||||
pub fn new(structure: Structure) -> Self {
|
||||
fn new(structure: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1131,7 +1178,8 @@ pub struct LatencyBuilder {
|
|||
latency: u64,
|
||||
}
|
||||
impl LatencyBuilder {
|
||||
pub fn new(latency: u64) -> Self {
|
||||
fn new(latency: u64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1152,7 +1200,8 @@ pub struct StepBuilder {
|
|||
intermediate: bool,
|
||||
}
|
||||
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 {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1180,7 +1229,8 @@ pub struct ReconfigureBuilder {
|
|||
running_time_offset: Option<i64>,
|
||||
}
|
||||
impl ReconfigureBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1196,7 +1246,8 @@ pub struct TocSelectBuilder<'a> {
|
|||
uid: &'a str,
|
||||
}
|
||||
impl<'a> TocSelectBuilder<'a> {
|
||||
pub fn new(uid: &'a str) -> Self {
|
||||
fn new(uid: &'a str) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1217,7 +1268,8 @@ pub struct SelectStreamsBuilder<'a> {
|
|||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
impl<'a> SelectStreamsBuilder<'a> {
|
||||
pub fn new(streams: &'a [&'a str]) -> Self {
|
||||
fn new(streams: &'a [&'a str]) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1236,7 +1288,8 @@ pub struct CustomUpstreamBuilder {
|
|||
structure: Option<Structure>,
|
||||
}
|
||||
impl CustomUpstreamBuilder {
|
||||
pub fn new(structure: Structure) -> Self {
|
||||
fn new(structure: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1260,7 +1313,8 @@ pub struct CustomDownstreamBuilder {
|
|||
structure: Option<Structure>,
|
||||
}
|
||||
impl CustomDownstreamBuilder {
|
||||
pub fn new(structure: Structure) -> Self {
|
||||
fn new(structure: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1284,7 +1338,8 @@ pub struct CustomDownstreamOobBuilder {
|
|||
structure: Option<Structure>,
|
||||
}
|
||||
impl CustomDownstreamOobBuilder {
|
||||
pub fn new(structure: Structure) -> Self {
|
||||
fn new(structure: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1310,7 +1365,8 @@ pub struct CustomDownstreamStickyBuilder {
|
|||
structure: Option<Structure>,
|
||||
}
|
||||
impl CustomDownstreamStickyBuilder {
|
||||
pub fn new(structure: Structure) -> Self {
|
||||
fn new(structure: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1336,7 +1392,8 @@ pub struct CustomBothBuilder {
|
|||
structure: Option<Structure>,
|
||||
}
|
||||
impl CustomBothBuilder {
|
||||
pub fn new(structure: Structure) -> Self {
|
||||
fn new(structure: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
@ -1359,7 +1416,8 @@ pub struct CustomBothOobBuilder {
|
|||
structure: Option<Structure>,
|
||||
}
|
||||
impl CustomBothOobBuilder {
|
||||
pub fn new(structure: Structure) -> Self {
|
||||
fn new(structure: Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
|
|
|
@ -129,34 +129,42 @@ impl MessageRef {
|
|||
|
||||
impl Message {
|
||||
pub fn new_eos() -> EosBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
EosBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_error(error: &glib::Error) -> ErrorBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
ErrorBuilder::new(error)
|
||||
}
|
||||
|
||||
pub fn new_warning(error: &glib::Error) -> WarningBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
WarningBuilder::new(error)
|
||||
}
|
||||
|
||||
pub fn new_info(error: &glib::Error) -> InfoBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
InfoBuilder::new(error)
|
||||
}
|
||||
|
||||
pub fn new_tag(tags: &TagList) -> TagBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
TagBuilder::new(tags)
|
||||
}
|
||||
|
||||
pub fn new_buffering(percent: i32) -> BufferingBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
BufferingBuilder::new(percent)
|
||||
}
|
||||
|
||||
pub fn new_state_changed(old: ::State, new: ::State, pending: ::State) -> StateChangedBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StateChangedBuilder::new(old, new, pending)
|
||||
}
|
||||
|
||||
pub fn new_state_dirty() -> StateDirtyBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StateDirtyBuilder::new()
|
||||
}
|
||||
|
||||
|
@ -169,18 +177,22 @@ impl Message {
|
|||
duration: u64,
|
||||
eos: bool,
|
||||
) -> StepDoneBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StepDoneBuilder::new(format, amount, rate, flush, intermediate, duration, eos)
|
||||
}
|
||||
|
||||
pub fn new_clock_provide(clock: &::Clock, ready: bool) -> ClockProvideBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
ClockProvideBuilder::new(clock, ready)
|
||||
}
|
||||
|
||||
pub fn new_clock_lost(clock: &::Clock) -> ClockLostBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
ClockLostBuilder::new(clock)
|
||||
}
|
||||
|
||||
pub fn new_new_clock(clock: &::Clock) -> NewClockBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
NewClockBuilder::new(clock)
|
||||
}
|
||||
|
||||
|
@ -189,45 +201,60 @@ impl Message {
|
|||
owner: &::Element,
|
||||
busy: bool,
|
||||
) -> StructureChangeBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StructureChangeBuilder::new(type_, owner, busy)
|
||||
}
|
||||
|
||||
pub fn new_stream_status(type_: ::StreamStatusType, owner: &::Element) -> StreamStatusBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StreamStatusBuilder::new(type_, owner)
|
||||
}
|
||||
|
||||
pub fn new_application(structure: ::Structure) -> ApplicationBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
ApplicationBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_element(structure: ::Structure) -> ElementBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
ElementBuilder::new(structure)
|
||||
}
|
||||
|
||||
pub fn new_segment_start(format: ::Format, position: i64) -> SegmentStartBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
SegmentStartBuilder::new(format, position)
|
||||
}
|
||||
|
||||
pub fn new_segment_done(format: ::Format, position: i64) -> SegmentDoneBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
SegmentDoneBuilder::new(format, position)
|
||||
}
|
||||
|
||||
pub fn new_duration_changed() -> DurationChangedBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
DurationChangedBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_latency() -> LatencyBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
LatencyBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_async_start() -> AsyncStartBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
AsyncStartBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_async_done(running_time: u64) -> AsyncDoneBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
AsyncDoneBuilder::new(running_time)
|
||||
}
|
||||
|
||||
pub fn new_request_state(state: ::State) -> RequestStateBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
RequestStateBuilder::new(state)
|
||||
}
|
||||
|
||||
pub fn new_step_start(
|
||||
active: bool,
|
||||
format: ::Format,
|
||||
|
@ -236,6 +263,7 @@ impl Message {
|
|||
flush: bool,
|
||||
intermediate: bool,
|
||||
) -> StepStartBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StepStartBuilder::new(active, format, amount, rate, flush, intermediate)
|
||||
}
|
||||
|
||||
|
@ -246,34 +274,47 @@ impl Message {
|
|||
timestamp: u64,
|
||||
duration: u64,
|
||||
) -> QosBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
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 {
|
||||
assert_initialized_main_thread!();
|
||||
TocBuilder::new(toc, updated)
|
||||
}
|
||||
|
||||
pub fn new_reset_time(running_time: u64) -> ResetTimeBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
ResetTimeBuilder::new(running_time)
|
||||
}
|
||||
|
||||
pub fn new_stream_start() -> StreamStartBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StreamStartBuilder::new()
|
||||
}
|
||||
|
||||
pub fn new_need_context(context_type: &str) -> NeedContextBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
NeedContextBuilder::new(context_type)
|
||||
}
|
||||
|
||||
pub fn new_have_context(context: ::Context) -> HaveContextBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
HaveContextBuilder::new(context)
|
||||
}
|
||||
|
||||
pub fn new_device_added(device: &::Device) -> DeviceAddedBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
DeviceAddedBuilder::new(device)
|
||||
}
|
||||
|
||||
pub fn new_device_removed(device: &::Device) -> DeviceRemovedBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
DeviceRemovedBuilder::new(device)
|
||||
}
|
||||
|
||||
|
@ -282,16 +323,19 @@ impl Message {
|
|||
property_name: &'a str,
|
||||
value: &'a glib::Value,
|
||||
) -> PropertyNotifyBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
PropertyNotifyBuilder::new(property_name, value)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_10")]
|
||||
pub fn new_stream_collection(collection: &::StreamCollection) -> StreamCollectionBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StreamCollectionBuilder::new(collection)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_10")]
|
||||
pub fn new_streams_selected(collection: &::StreamCollection) -> StreamsSelectedBuilder {
|
||||
assert_initialized_main_thread!();
|
||||
StreamsSelectedBuilder::new(collection)
|
||||
}
|
||||
|
||||
|
@ -301,6 +345,7 @@ impl Message {
|
|||
tag_list: Option<&'a TagList>,
|
||||
entry_struct: Option<Structure>,
|
||||
) -> RedirectBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
RedirectBuilder::new(location, tag_list, entry_struct)
|
||||
}
|
||||
}
|
||||
|
@ -1120,7 +1165,8 @@ pub struct EosBuilder {
|
|||
seqnum: Option<u32>,
|
||||
}
|
||||
impl EosBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1139,7 +1185,8 @@ pub struct ErrorBuilder<'a> {
|
|||
details: Option<Structure>,
|
||||
}
|
||||
impl<'a> ErrorBuilder<'a> {
|
||||
pub fn new(error: &'a glib::Error) -> Self {
|
||||
fn new(error: &'a glib::Error) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1199,7 +1246,8 @@ pub struct WarningBuilder<'a> {
|
|||
details: Option<Structure>,
|
||||
}
|
||||
impl<'a> WarningBuilder<'a> {
|
||||
pub fn new(error: &'a glib::Error) -> Self {
|
||||
fn new(error: &'a glib::Error) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1259,7 +1307,8 @@ pub struct InfoBuilder<'a> {
|
|||
details: Option<Structure>,
|
||||
}
|
||||
impl<'a> InfoBuilder<'a> {
|
||||
pub fn new(error: &'a glib::Error) -> Self {
|
||||
fn new(error: &'a glib::Error) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1316,7 +1365,8 @@ pub struct TagBuilder<'a> {
|
|||
tags: &'a TagList,
|
||||
}
|
||||
impl<'a> TagBuilder<'a> {
|
||||
pub fn new(tags: &'a TagList) -> Self {
|
||||
fn new(tags: &'a TagList) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1336,7 +1386,8 @@ pub struct BufferingBuilder {
|
|||
stats: Option<(::BufferingMode, i32, i32, i64)>,
|
||||
}
|
||||
impl BufferingBuilder {
|
||||
pub fn new(percent: i32) -> Self {
|
||||
fn new(percent: i32) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1352,6 +1403,7 @@ impl BufferingBuilder {
|
|||
avg_out: i32,
|
||||
buffering_left: i64,
|
||||
) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
stats: Some((mode, avg_in, avg_out, buffering_left)),
|
||||
..self
|
||||
|
@ -1383,7 +1435,8 @@ pub struct StateChangedBuilder {
|
|||
pending: ::State,
|
||||
}
|
||||
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 {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1408,7 +1461,8 @@ pub struct StateDirtyBuilder {
|
|||
seqnum: Option<u32>,
|
||||
}
|
||||
impl StateDirtyBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1430,7 +1484,7 @@ pub struct StepDoneBuilder {
|
|||
eos: bool,
|
||||
}
|
||||
impl StepDoneBuilder {
|
||||
pub fn new(
|
||||
fn new(
|
||||
format: ::Format,
|
||||
amount: u64,
|
||||
rate: f64,
|
||||
|
@ -1439,6 +1493,7 @@ impl StepDoneBuilder {
|
|||
duration: u64,
|
||||
eos: bool,
|
||||
) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1473,7 +1528,8 @@ pub struct ClockProvideBuilder<'a> {
|
|||
ready: bool,
|
||||
}
|
||||
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 {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1493,7 +1549,8 @@ pub struct ClockLostBuilder<'a> {
|
|||
clock: &'a ::Clock,
|
||||
}
|
||||
impl<'a> ClockLostBuilder<'a> {
|
||||
pub fn new(clock: &'a ::Clock) -> Self {
|
||||
fn new(clock: &'a ::Clock) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1512,7 +1569,8 @@ pub struct NewClockBuilder<'a> {
|
|||
clock: &'a ::Clock,
|
||||
}
|
||||
impl<'a> NewClockBuilder<'a> {
|
||||
pub fn new(clock: &'a ::Clock) -> Self {
|
||||
fn new(clock: &'a ::Clock) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1533,7 +1591,8 @@ pub struct StructureChangeBuilder<'a> {
|
|||
busy: bool,
|
||||
}
|
||||
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 {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1561,7 +1620,8 @@ pub struct StreamStatusBuilder<'a> {
|
|||
status_object: Option<&'a glib::Value>,
|
||||
}
|
||||
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 {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1594,7 +1654,8 @@ pub struct ApplicationBuilder {
|
|||
structure: Option<::Structure>,
|
||||
}
|
||||
impl ApplicationBuilder {
|
||||
pub fn new(structure: ::Structure) -> Self {
|
||||
fn new(structure: ::Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1613,7 +1674,8 @@ pub struct ElementBuilder {
|
|||
structure: Option<::Structure>,
|
||||
}
|
||||
impl ElementBuilder {
|
||||
pub fn new(structure: ::Structure) -> Self {
|
||||
fn new(structure: ::Structure) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1633,7 +1695,8 @@ pub struct SegmentStartBuilder {
|
|||
position: i64,
|
||||
}
|
||||
impl SegmentStartBuilder {
|
||||
pub fn new(format: ::Format, position: i64) -> Self {
|
||||
fn new(format: ::Format, position: i64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1654,7 +1717,8 @@ pub struct SegmentDoneBuilder {
|
|||
position: i64,
|
||||
}
|
||||
impl SegmentDoneBuilder {
|
||||
pub fn new(format: ::Format, position: i64) -> Self {
|
||||
fn new(format: ::Format, position: i64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1673,7 +1737,8 @@ pub struct DurationChangedBuilder {
|
|||
seqnum: Option<u32>,
|
||||
}
|
||||
impl DurationChangedBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1688,7 +1753,8 @@ pub struct LatencyBuilder {
|
|||
seqnum: Option<u32>,
|
||||
}
|
||||
impl LatencyBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1703,7 +1769,8 @@ pub struct AsyncStartBuilder {
|
|||
seqnum: Option<u32>,
|
||||
}
|
||||
impl AsyncStartBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1719,7 +1786,8 @@ pub struct AsyncDoneBuilder {
|
|||
running_time: u64,
|
||||
}
|
||||
impl AsyncDoneBuilder {
|
||||
pub fn new(running_time: u64) -> Self {
|
||||
fn new(running_time: u64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1738,7 +1806,8 @@ pub struct RequestStateBuilder {
|
|||
state: ::State,
|
||||
}
|
||||
impl RequestStateBuilder {
|
||||
pub fn new(state: ::State) -> Self {
|
||||
fn new(state: ::State) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1762,7 +1831,7 @@ pub struct StepStartBuilder {
|
|||
intermediate: bool,
|
||||
}
|
||||
impl StepStartBuilder {
|
||||
pub fn new(
|
||||
fn new(
|
||||
active: bool,
|
||||
format: ::Format,
|
||||
amount: u64,
|
||||
|
@ -1770,6 +1839,7 @@ impl StepStartBuilder {
|
|||
flush: bool,
|
||||
intermediate: bool,
|
||||
) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1807,13 +1877,14 @@ pub struct QosBuilder {
|
|||
stats: Option<(::Format, u64, u64)>,
|
||||
}
|
||||
impl QosBuilder {
|
||||
pub fn new(
|
||||
fn new(
|
||||
live: bool,
|
||||
running_time: u64,
|
||||
stream_time: u64,
|
||||
timestamp: u64,
|
||||
duration: u64,
|
||||
) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1868,7 +1939,8 @@ pub struct ProgressBuilder<'a> {
|
|||
text: Option<&'a str>,
|
||||
}
|
||||
impl<'a> ProgressBuilder<'a> {
|
||||
pub fn new(type_: ::ProgressType) -> Self {
|
||||
fn new(type_: ::ProgressType) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1909,7 +1981,8 @@ pub struct TocBuilder<'a> {
|
|||
updated: bool,
|
||||
}
|
||||
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 {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1929,7 +2002,8 @@ pub struct ResetTimeBuilder {
|
|||
running_time: u64,
|
||||
}
|
||||
impl ResetTimeBuilder {
|
||||
pub fn new(running_time: u64) -> Self {
|
||||
fn new(running_time: u64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1948,7 +2022,8 @@ pub struct StreamStartBuilder {
|
|||
group_id: Option<u32>,
|
||||
}
|
||||
impl StreamStartBuilder {
|
||||
pub fn new() -> Self {
|
||||
fn new() -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1978,7 +2053,8 @@ pub struct NeedContextBuilder<'a> {
|
|||
context_type: &'a str,
|
||||
}
|
||||
impl<'a> NeedContextBuilder<'a> {
|
||||
pub fn new(context_type: &'a str) -> Self {
|
||||
fn new(context_type: &'a str) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -1997,7 +2073,8 @@ pub struct HaveContextBuilder {
|
|||
context: Option<::Context>,
|
||||
}
|
||||
impl HaveContextBuilder {
|
||||
pub fn new(context: ::Context) -> Self {
|
||||
fn new(context: ::Context) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -2017,7 +2094,8 @@ pub struct DeviceAddedBuilder<'a> {
|
|||
device: &'a ::Device,
|
||||
}
|
||||
impl<'a> DeviceAddedBuilder<'a> {
|
||||
pub fn new(device: &'a ::Device) -> Self {
|
||||
fn new(device: &'a ::Device) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -2036,7 +2114,8 @@ pub struct DeviceRemovedBuilder<'a> {
|
|||
device: &'a ::Device,
|
||||
}
|
||||
impl<'a> DeviceRemovedBuilder<'a> {
|
||||
pub fn new(device: &'a ::Device) -> Self {
|
||||
fn new(device: &'a ::Device) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -2058,7 +2137,8 @@ pub struct PropertyNotifyBuilder<'a> {
|
|||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
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 {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -2084,7 +2164,8 @@ pub struct StreamCollectionBuilder<'a> {
|
|||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
impl<'a> StreamCollectionBuilder<'a> {
|
||||
pub fn new(collection: &'a ::StreamCollection) -> Self {
|
||||
fn new(collection: &'a ::StreamCollection) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -2108,7 +2189,8 @@ pub struct StreamsSelectedBuilder<'a> {
|
|||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
impl<'a> StreamsSelectedBuilder<'a> {
|
||||
pub fn new(collection: &'a ::StreamCollection) -> Self {
|
||||
fn new(collection: &'a ::StreamCollection) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -2146,11 +2228,12 @@ pub struct RedirectBuilder<'a> {
|
|||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
impl<'a> RedirectBuilder<'a> {
|
||||
pub fn new(
|
||||
fn new(
|
||||
location: &'a str,
|
||||
tag_list: Option<&'a TagList>,
|
||||
entry_struct: Option<Structure>,
|
||||
) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
seqnum: None,
|
||||
|
@ -2165,6 +2248,7 @@ impl<'a> RedirectBuilder<'a> {
|
|||
self,
|
||||
entries: &'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)],
|
||||
) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
entries: Some(entries),
|
||||
..self
|
||||
|
|
|
@ -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>>);
|
||||
|
||||
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 mut v_ptr: Vec<_> = v.iter().map(|s| s.0).collect();
|
||||
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) {
|
||||
skip_assert_initialized!();
|
||||
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
|
||||
|
||||
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 {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
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>>);
|
||||
|
||||
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);
|
||||
(ptr as *const *mut T::GstType, stash)
|
||||
}
|
||||
|
||||
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
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn to_glib_full_from_slice(_: &[GstRc<T>]) -> *const *mut T::GstType {
|
||||
skip_assert_initialized!();
|
||||
// Can't have consumer free a *const pointer
|
||||
unimplemented!()
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ impl ToGlib for PadProbeId {
|
|||
|
||||
impl FromGlib<libc::c_ulong> for PadProbeId {
|
||||
fn from_glib(val: libc::c_ulong) -> PadProbeId {
|
||||
skip_assert_initialized!();
|
||||
PadProbeId(val)
|
||||
}
|
||||
}
|
||||
|
@ -208,6 +209,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
parent: Q,
|
||||
query: &mut QueryRef,
|
||||
) -> bool {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
let parent = parent.to_glib_none();
|
||||
unsafe {
|
||||
|
@ -242,6 +244,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
parent: Q,
|
||||
event: Event,
|
||||
) -> bool {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
let parent = parent.to_glib_none();
|
||||
unsafe {
|
||||
|
|
|
@ -29,26 +29,32 @@ unsafe impl MiniObject for QueryRef {
|
|||
|
||||
impl Query {
|
||||
pub fn new_position(fmt: ::Format) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_position(fmt.to_glib())) }
|
||||
}
|
||||
|
||||
pub fn new_duration(fmt: ::Format) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_duration(fmt.to_glib())) }
|
||||
}
|
||||
|
||||
pub fn new_latency() -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_latency()) }
|
||||
}
|
||||
|
||||
pub fn new_seeking(fmt: ::Format) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_seeking(fmt.to_glib())) }
|
||||
}
|
||||
|
||||
pub fn new_segment(fmt: ::Format) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
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 {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_query_new_convert(
|
||||
src_fmt.to_glib(),
|
||||
|
@ -59,14 +65,17 @@ impl Query {
|
|||
}
|
||||
|
||||
pub fn new_formats() -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_formats()) }
|
||||
}
|
||||
|
||||
pub fn new_buffering(fmt: ::Format) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_buffering(fmt.to_glib())) }
|
||||
}
|
||||
|
||||
pub fn new_custom(structure: ::Structure) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_query_new_custom(
|
||||
ffi::GST_QUERY_CUSTOM,
|
||||
|
@ -76,26 +85,32 @@ impl Query {
|
|||
}
|
||||
|
||||
pub fn new_uri() -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_uri()) }
|
||||
}
|
||||
|
||||
pub fn new_scheduling() -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_scheduling()) }
|
||||
}
|
||||
|
||||
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())) }
|
||||
}
|
||||
|
||||
pub fn new_caps(filter: &::Caps) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_caps(filter.as_mut_ptr())) }
|
||||
}
|
||||
|
||||
pub fn new_drain() -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_query_new_drain()) }
|
||||
}
|
||||
|
||||
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)) }
|
||||
}
|
||||
}
|
||||
|
@ -584,6 +599,7 @@ impl<'a> Buffering<&'a mut QueryRef> {
|
|||
avg_out: i32,
|
||||
buffering_left: i64,
|
||||
) {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
ffi::gst_query_set_buffering_stats(
|
||||
self.0.as_mut_ptr(),
|
||||
|
@ -698,6 +714,7 @@ impl<'a> Scheduling<&'a QueryRef> {
|
|||
mode: ::PadMode,
|
||||
flags: ::SchedulingFlags,
|
||||
) -> bool {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_query_has_scheduling_mode_with_flags(
|
||||
self.0.as_mut_ptr(),
|
||||
|
|
|
@ -61,6 +61,7 @@ impl Segment {
|
|||
stop_type: SeekType,
|
||||
stop: u64,
|
||||
) -> Option<bool> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
let mut update = mem::uninitialized();
|
||||
let ret = from_glib(ffi::gst_segment_do_seek(
|
||||
|
|
|
@ -132,6 +132,7 @@ impl str::FromStr for Structure {
|
|||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, ()> {
|
||||
skip_assert_initialized!();
|
||||
Structure::from_string(s).ok_or(())
|
||||
}
|
||||
}
|
||||
|
@ -446,6 +447,8 @@ impl StructureRef {
|
|||
name: &str,
|
||||
target: T,
|
||||
) -> bool {
|
||||
skip_assert_initialized!();
|
||||
|
||||
let target = target.into();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_structure_fixate_field_nearest_fraction(
|
||||
|
@ -489,7 +492,8 @@ pub struct 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();
|
||||
|
||||
FieldIterator {
|
||||
|
@ -549,7 +553,8 @@ pub struct 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: FieldIterator::new(structure),
|
||||
}
|
||||
|
|
|
@ -351,6 +351,7 @@ pub struct TagIterator<'a, T: Tag<'a>> {
|
|||
|
||||
impl<'a, T: Tag<'a>> TagIterator<'a, T> {
|
||||
fn new(taglist: &'a TagListRef) -> TagIterator<'a, T> {
|
||||
skip_assert_initialized!();
|
||||
TagIterator {
|
||||
taglist: taglist,
|
||||
idx: 0,
|
||||
|
|
|
@ -25,14 +25,17 @@ pub struct Fraction(pub Rational32);
|
|||
|
||||
impl Fraction {
|
||||
pub fn new(num: i32, den: i32) -> Fraction {
|
||||
assert_initialized_main_thread!();
|
||||
(num, den).into()
|
||||
}
|
||||
|
||||
pub fn approximate_f32(x: f32) -> Option<Fraction> {
|
||||
assert_initialized_main_thread!();
|
||||
Rational32::approximate_float(x).map(|r| r.into())
|
||||
}
|
||||
|
||||
pub fn approximate_f64(x: f64) -> Option<Fraction> {
|
||||
assert_initialized_main_thread!();
|
||||
Rational32::approximate_float(x).map(|r| r.into())
|
||||
}
|
||||
}
|
||||
|
@ -153,12 +156,14 @@ impl ops::Neg for Fraction {
|
|||
|
||||
impl From<i32> for Fraction {
|
||||
fn from(x: i32) -> Fraction {
|
||||
assert_initialized_main_thread!();
|
||||
Fraction(x.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(i32, i32)> for Fraction {
|
||||
fn from(x: (i32, i32)) -> Fraction {
|
||||
assert_initialized_main_thread!();
|
||||
Fraction(x.into())
|
||||
}
|
||||
}
|
||||
|
@ -171,12 +176,14 @@ impl Into<(i32, i32)> for Fraction {
|
|||
|
||||
impl From<Rational32> for Fraction {
|
||||
fn from(x: Rational32) -> Fraction {
|
||||
assert_initialized_main_thread!();
|
||||
Fraction(x)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Fraction> for Rational32 {
|
||||
fn from(x: Fraction) -> Rational32 {
|
||||
skip_assert_initialized!();
|
||||
x.0
|
||||
}
|
||||
}
|
||||
|
@ -231,10 +238,13 @@ impl<T: Copy> IntRange<T> {
|
|||
|
||||
impl IntRange<i32> {
|
||||
pub fn new(min: i32, max: i32) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::new_with_step(min, max, 1)
|
||||
}
|
||||
|
||||
pub fn new_with_step(min: i32, max: i32, step: i32) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
assert!(min <= max);
|
||||
assert!(step > 0);
|
||||
|
||||
|
@ -248,10 +258,13 @@ impl IntRange<i32> {
|
|||
|
||||
impl IntRange<i64> {
|
||||
pub fn new(min: i64, max: i64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::new_with_step(min, max, 1)
|
||||
}
|
||||
|
||||
pub fn new_with_step(min: i64, max: i64, step: i64) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
assert!(min <= max);
|
||||
assert!(step > 0);
|
||||
|
||||
|
@ -265,24 +278,28 @@ impl IntRange<i64> {
|
|||
|
||||
impl From<(i32, i32)> for IntRange<i32> {
|
||||
fn from((min, max): (i32, i32)) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::new(min, max)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(i32, i32, i32)> for IntRange<i32> {
|
||||
fn from((min, max, step): (i32, i32, i32)) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::new_with_step(min, max, step)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(i64, i64)> for IntRange<i64> {
|
||||
fn from((min, max): (i64, i64)) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::new(min, max)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(i64, i64, i64)> for IntRange<i64> {
|
||||
fn from((min, max, step): (i64, i64, i64)) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::new_with_step(min, max, step)
|
||||
}
|
||||
}
|
||||
|
@ -351,6 +368,8 @@ pub struct FractionRange {
|
|||
|
||||
impl FractionRange {
|
||||
pub fn new<T: Into<Fraction>, U: Into<Fraction>>(min: T, max: U) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
let min = min.into();
|
||||
let max = max.into();
|
||||
|
||||
|
@ -370,6 +389,8 @@ impl FractionRange {
|
|||
|
||||
impl From<(Fraction, Fraction)> for FractionRange {
|
||||
fn from((min, max): (Fraction, Fraction)) -> Self {
|
||||
skip_assert_initialized!();
|
||||
|
||||
Self::new(min, max)
|
||||
}
|
||||
}
|
||||
|
@ -417,6 +438,7 @@ pub struct Bitmask(u64);
|
|||
|
||||
impl Bitmask {
|
||||
pub fn new(v: u64) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
Bitmask(v)
|
||||
}
|
||||
}
|
||||
|
@ -469,6 +491,7 @@ impl ops::Not for Bitmask {
|
|||
|
||||
impl From<u64> for Bitmask {
|
||||
fn from(v: u64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::new(v)
|
||||
}
|
||||
}
|
||||
|
@ -503,6 +526,8 @@ pub struct Array<'a>(Cow<'a, [glib::Value]>);
|
|||
|
||||
impl<'a> Array<'a> {
|
||||
pub fn new(values: &[&ToValue]) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
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> {
|
||||
fn from(values: &'a [&'a ToValue]) -> Self {
|
||||
skip_assert_initialized!();
|
||||
|
||||
Self::new(values)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a [glib::Value]> for Array<'a> {
|
||||
fn from(values: &'a [glib::Value]) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
Array(Cow::Borrowed(values))
|
||||
}
|
||||
}
|
||||
|
@ -566,6 +595,8 @@ pub struct List<'a>(Cow<'a, [glib::Value]>);
|
|||
|
||||
impl<'a> List<'a> {
|
||||
pub fn new(values: &[&ToValue]) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
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> {
|
||||
fn from(values: &'a [&'a ToValue]) -> Self {
|
||||
skip_assert_initialized!();
|
||||
|
||||
Self::new(values)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a [glib::Value]> for List<'a> {
|
||||
fn from(values: &'a [glib::Value]) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
List(Cow::Borrowed(values))
|
||||
}
|
||||
}
|
||||
|
@ -646,6 +681,8 @@ impl ToGlib for ValueOrder {
|
|||
|
||||
impl FromGlib<i32> for ValueOrder {
|
||||
fn from_glib(v: i32) -> Self {
|
||||
skip_assert_initialized!();
|
||||
|
||||
match v {
|
||||
ffi::GST_VALUE_LESS_THAN => ValueOrder::LessThan,
|
||||
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> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
let s = s.into();
|
||||
|
||||
unsafe {
|
||||
|
|
Loading…
Reference in a new issue