2017-07-07 11:47:28 +00:00
|
|
|
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2017-07-31 11:16:42 +00:00
|
|
|
#![recursion_limit = "256"]
|
2017-05-12 12:24:03 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate bitflags;
|
2017-07-30 22:11:57 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate lazy_static;
|
2017-09-10 11:55:29 +00:00
|
|
|
extern crate libc;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
|
|
|
extern crate glib_sys as glib_ffi;
|
|
|
|
extern crate gobject_sys as gobject_ffi;
|
|
|
|
extern crate gstreamer_sys as ffi;
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate glib;
|
|
|
|
|
2017-07-12 10:25:11 +00:00
|
|
|
extern crate num_rational;
|
|
|
|
|
2017-11-12 12:33:02 +00:00
|
|
|
#[cfg(any(feature = "futures", feature = "dox"))]
|
2017-08-17 10:07:32 +00:00
|
|
|
extern crate futures;
|
|
|
|
|
2017-11-11 10:21:55 +00:00
|
|
|
extern crate muldiv;
|
|
|
|
|
2017-07-03 09:26:40 +00:00
|
|
|
use glib::translate::{from_glib, from_glib_full};
|
|
|
|
|
2017-05-12 12:24:03 +00:00
|
|
|
macro_rules! callback_guard {
|
|
|
|
() => (
|
|
|
|
let _guard = ::glib::CallbackGuard::new();
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2017-07-10 09:36:15 +00:00
|
|
|
macro_rules! assert_initialized_main_thread {
|
|
|
|
() => (
|
2017-08-30 09:48:01 +00:00
|
|
|
if unsafe {::ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
|
|
|
|
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
|
|
}
|
2017-07-10 09:36:15 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! skip_assert_initialized {
|
|
|
|
() => (
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2017-07-10 21:33:24 +00:00
|
|
|
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2017-08-03 18:56:39 +00:00
|
|
|
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
|
|
|
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
|
|
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
|
|
|
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
2017-09-10 11:54:43 +00:00
|
|
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
2017-05-12 12:24:03 +00:00
|
|
|
mod auto;
|
2017-07-03 15:08:43 +00:00
|
|
|
pub use auto::*;
|
2017-08-17 12:31:00 +00:00
|
|
|
pub use auto::functions::*;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2017-09-09 11:12:49 +00:00
|
|
|
#[macro_use]
|
|
|
|
mod log;
|
|
|
|
pub use log::*;
|
|
|
|
|
2017-07-03 10:56:26 +00:00
|
|
|
pub mod miniobject;
|
2017-08-10 11:39:57 +00:00
|
|
|
pub use miniobject::{GstRc, MiniObject};
|
2017-07-03 10:56:26 +00:00
|
|
|
pub mod message;
|
2017-09-15 15:35:54 +00:00
|
|
|
pub use message::{Message, MessageErrorDomain, MessageRef, MessageView};
|
2017-07-07 13:04:54 +00:00
|
|
|
pub mod structure;
|
2017-07-24 22:17:50 +00:00
|
|
|
pub use structure::{Structure, StructureRef};
|
2017-07-10 21:02:08 +00:00
|
|
|
pub mod caps;
|
2017-07-24 22:17:50 +00:00
|
|
|
pub use caps::{Caps, CapsRef};
|
2017-07-12 07:27:43 +00:00
|
|
|
pub mod tags;
|
2017-08-11 12:32:28 +00:00
|
|
|
pub use tags::{Tag, TagList, TagListRef};
|
2017-07-25 12:01:24 +00:00
|
|
|
pub mod buffer;
|
2017-12-16 15:39:32 +00:00
|
|
|
pub use buffer::{Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_METADATA, BUFFER_COPY_ALL};
|
2017-07-28 17:04:15 +00:00
|
|
|
pub mod sample;
|
|
|
|
pub use sample::{Sample, SampleRef};
|
2017-07-28 17:20:11 +00:00
|
|
|
pub mod bufferlist;
|
|
|
|
pub use bufferlist::{BufferList, BufferListRef};
|
2017-07-29 11:58:54 +00:00
|
|
|
pub mod query;
|
|
|
|
pub use query::{Query, QueryRef, QueryView};
|
2017-07-30 14:06:44 +00:00
|
|
|
pub mod event;
|
2017-12-05 19:32:16 +00:00
|
|
|
pub use event::{Event, EventRef, EventView, GroupId, Seqnum, GROUP_ID_INVALID, SEQNUM_INVALID};
|
2017-08-02 17:34:37 +00:00
|
|
|
pub mod context;
|
|
|
|
pub use context::{Context, ContextRef};
|
2017-10-15 08:08:56 +00:00
|
|
|
mod static_caps;
|
|
|
|
pub use static_caps::*;
|
|
|
|
mod static_pad_template;
|
|
|
|
pub use static_pad_template::*;
|
2017-07-03 10:56:26 +00:00
|
|
|
|
2017-07-05 08:09:49 +00:00
|
|
|
mod element;
|
|
|
|
mod bin;
|
2017-07-11 16:29:16 +00:00
|
|
|
mod bus;
|
2017-07-24 08:51:14 +00:00
|
|
|
mod pad;
|
2017-10-27 21:03:45 +00:00
|
|
|
mod object;
|
2017-07-20 08:39:44 +00:00
|
|
|
mod gobject;
|
2017-07-29 13:19:15 +00:00
|
|
|
mod proxy_pad;
|
|
|
|
mod ghost_pad;
|
2017-07-29 14:10:10 +00:00
|
|
|
mod child_proxy;
|
2017-07-29 14:21:25 +00:00
|
|
|
mod tag_setter;
|
|
|
|
mod iterator;
|
2017-08-17 09:48:54 +00:00
|
|
|
mod device_provider;
|
2017-08-17 13:17:02 +00:00
|
|
|
mod parse_context;
|
2017-11-05 17:58:44 +00:00
|
|
|
mod enums;
|
2017-11-11 10:21:55 +00:00
|
|
|
mod clock_time;
|
2017-12-01 09:21:20 +00:00
|
|
|
mod date_time;
|
2017-10-27 21:03:45 +00:00
|
|
|
pub use object::GstObjectExtManual;
|
2017-10-27 15:55:48 +00:00
|
|
|
pub use element::{ElementExtManual, ElementMessageType, NotifyWatchId};
|
2017-09-10 11:55:29 +00:00
|
|
|
pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
|
|
|
|
ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME};
|
2017-07-05 08:09:49 +00:00
|
|
|
pub use bin::BinExtManual;
|
2017-07-31 11:16:42 +00:00
|
|
|
pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID};
|
2017-07-20 08:39:44 +00:00
|
|
|
pub use gobject::GObjectExtManualGst;
|
2017-07-29 14:10:10 +00:00
|
|
|
pub use child_proxy::ChildProxyExtManual;
|
2017-07-29 14:21:25 +00:00
|
|
|
pub use tag_setter::TagSetterExtManual;
|
2017-09-17 15:51:45 +00:00
|
|
|
pub use self::iterator::{Iterator, IteratorError, IteratorImpl};
|
2017-08-17 09:48:54 +00:00
|
|
|
pub use device_provider::DeviceProviderExtManual;
|
2017-08-17 13:17:02 +00:00
|
|
|
pub use parse_context::ParseContext;
|
2017-11-12 12:33:02 +00:00
|
|
|
#[cfg(any(feature = "futures", feature = "dox"))]
|
2017-08-17 10:07:32 +00:00
|
|
|
pub use bus::BusStream;
|
2017-11-26 18:38:53 +00:00
|
|
|
pub use enums::{ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess,
|
|
|
|
StateChangeError, StateChangeSuccess};
|
2017-11-11 10:21:55 +00:00
|
|
|
pub use clock_time::ClockTime;
|
2017-12-09 16:20:21 +00:00
|
|
|
|
2017-12-17 12:26:17 +00:00
|
|
|
mod plugin;
|
|
|
|
|
2017-12-19 17:13:54 +00:00
|
|
|
mod typefind;
|
|
|
|
pub use typefind::*;
|
|
|
|
|
2017-12-09 16:20:21 +00:00
|
|
|
pub mod format;
|
|
|
|
pub use format::{FormattedValue, GenericFormattedValue, SpecificFormattedValue};
|
2017-07-05 08:09:49 +00:00
|
|
|
|
2017-07-12 10:25:11 +00:00
|
|
|
mod value;
|
|
|
|
pub use value::*;
|
|
|
|
|
2017-07-31 09:45:04 +00:00
|
|
|
mod segment;
|
|
|
|
pub use segment::*;
|
|
|
|
|
2017-08-08 20:37:48 +00:00
|
|
|
pub mod toc;
|
|
|
|
pub use toc::{Toc, TocEntry, TocEntryRef, TocRef};
|
|
|
|
|
2017-08-13 22:40:43 +00:00
|
|
|
mod clock;
|
2017-09-10 11:55:29 +00:00
|
|
|
pub use clock::{ClockExtManual, ClockId};
|
2017-08-13 22:40:43 +00:00
|
|
|
|
2017-08-17 13:17:02 +00:00
|
|
|
pub mod functions;
|
|
|
|
pub use functions::*;
|
|
|
|
|
2017-05-12 12:24:03 +00:00
|
|
|
use std::ptr;
|
|
|
|
|
2017-07-03 09:26:40 +00:00
|
|
|
pub fn init() -> Result<(), glib::Error> {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
2017-07-03 09:26:40 +00:00
|
|
|
let mut error = ptr::null_mut();
|
2017-07-10 21:33:24 +00:00
|
|
|
if from_glib(ffi::gst_init_check(
|
|
|
|
ptr::null_mut(),
|
|
|
|
ptr::null_mut(),
|
|
|
|
&mut error,
|
|
|
|
)) {
|
2017-07-03 09:26:40 +00:00
|
|
|
Ok(())
|
|
|
|
} else {
|
|
|
|
Err(from_glib_full(error))
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-25 12:31:45 +00:00
|
|
|
|
|
|
|
pub const BUFFER_OFFSET_NONE: u64 = ffi::GST_BUFFER_OFFSET_NONE;
|
2017-11-11 10:21:55 +00:00
|
|
|
pub const CLOCK_TIME_NONE: ClockTime = ClockTime(None);
|
|
|
|
|
|
|
|
pub const SECOND: ClockTime = ClockTime(Some(1_000_000_000));
|
|
|
|
pub const MSECOND: ClockTime = ClockTime(Some(1_000_000));
|
|
|
|
pub const USECOND: ClockTime = ClockTime(Some(1_000));
|
|
|
|
pub const NSECOND: ClockTime = ClockTime(Some(1));
|
2017-08-29 08:07:59 +00:00
|
|
|
|
2017-11-11 12:00:50 +00:00
|
|
|
pub const SECOND_VAL: u64 = 1_000_000_000;
|
|
|
|
pub const MSECOND_VAL: u64 = 1_000_000;
|
|
|
|
pub const USECOND_VAL: u64 = 1_000;
|
|
|
|
pub const NSECOND_VAL: u64 = 1;
|
|
|
|
|
2017-11-11 10:21:55 +00:00
|
|
|
pub const FORMAT_PERCENT_MAX: u32 = ffi::GST_FORMAT_PERCENT_MAX as u32;
|
|
|
|
pub const FORMAT_PERCENT_SCALE: u32 = ffi::GST_FORMAT_PERCENT_SCALE as u32;
|
2017-08-17 14:58:15 +00:00
|
|
|
|
|
|
|
// Re-export all the traits in a prelude module, so that applications
|
|
|
|
// can always "use gst::prelude::*" without getting conflicts
|
|
|
|
pub mod prelude {
|
|
|
|
pub use glib::prelude::*;
|
|
|
|
|
|
|
|
pub use auto::traits::*;
|
|
|
|
|
|
|
|
pub use element::ElementExtManual;
|
|
|
|
pub use bin::BinExtManual;
|
|
|
|
pub use pad::PadExtManual;
|
2017-10-27 21:03:45 +00:00
|
|
|
pub use object::GstObjectExtManual;
|
2017-08-17 14:58:15 +00:00
|
|
|
pub use gobject::GObjectExtManualGst;
|
|
|
|
pub use child_proxy::ChildProxyExtManual;
|
|
|
|
pub use tag_setter::TagSetterExtManual;
|
|
|
|
pub use device_provider::DeviceProviderExtManual;
|
|
|
|
pub use clock::ClockExtManual;
|
|
|
|
pub use value::GstValueExt;
|
|
|
|
|
|
|
|
pub use tags::Tag;
|
|
|
|
pub use miniobject::MiniObject;
|
2017-11-11 10:21:55 +00:00
|
|
|
|
|
|
|
pub use muldiv::MulDiv;
|
2017-12-09 16:20:21 +00:00
|
|
|
|
|
|
|
pub use format::{FormattedValue, SpecificFormattedValue};
|
2017-08-17 14:58:15 +00:00
|
|
|
}
|
2017-10-25 10:54:52 +00:00
|
|
|
|
|
|
|
mod utils;
|