gstreamer-rs/gstreamer/src/lib.rs

340 lines
9.4 KiB
Rust
Raw Normal View History

2020-12-15 10:53:31 +00:00
// Take a look at the license at the top of the repository in the LICENSE file.
2017-07-07 11:47:28 +00:00
#![cfg_attr(feature = "dox", feature(doc_cfg))]
#![recursion_limit = "256"]
2021-07-30 19:23:46 +00:00
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::manual_range_contains)]
#![doc = include_str!("../README.md")]
// Re-exported for the subclass gst_plugin_define! macro
pub use ffi;
pub use glib;
pub use paste;
2020-01-30 12:30:17 +00:00
use glib::translate::{from_glib, from_glib_full};
macro_rules! assert_initialized_main_thread {
2018-04-01 08:30:03 +00:00
() => {
if unsafe { ffi::gst_is_initialized() } != glib::ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
2018-04-01 08:30:03 +00:00
};
}
macro_rules! skip_assert_initialized {
2018-04-01 08:30:03 +00:00
() => {};
}
#[allow(clippy::unreadable_literal)]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)]
#[allow(clippy::type_complexity)]
2021-04-29 20:06:11 +00:00
#[allow(clippy::use_self)]
#[allow(clippy::needless_borrow)]
mod auto;
pub use crate::auto::functions::*;
pub use crate::auto::*;
#[macro_use]
mod log;
pub use crate::log::*;
#[macro_use]
mod error;
pub use crate::error::*;
#[macro_use]
pub mod miniobject;
pub mod message;
pub use crate::message::{Message, MessageErrorDomain, MessageRef, MessageView};
2018-06-21 18:44:51 +00:00
mod value;
pub use crate::value::*;
#[cfg(feature = "ser_de")]
#[macro_use]
2018-07-30 19:10:34 +00:00
mod value_serde;
2017-07-07 13:04:54 +00:00
pub mod structure;
pub use crate::structure::{Structure, StructureRef};
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod structure_serde;
2017-07-10 21:02:08 +00:00
pub mod caps;
pub use crate::caps::{Caps, CapsRef};
2018-09-28 09:01:14 +00:00
mod caps_features;
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod caps_serde;
pub use crate::caps_features::{
2018-09-28 09:01:14 +00:00
CapsFeatures, CapsFeaturesRef, CAPS_FEATURES_MEMORY_SYSTEM_MEMORY,
CAPS_FEATURE_MEMORY_SYSTEM_MEMORY,
};
#[cfg(feature = "ser_de")]
mod caps_features_serde;
2017-07-12 07:27:43 +00:00
pub mod tags;
pub use crate::tags::{
tag_exists, tag_get_description, tag_get_flag, tag_get_nick, tag_get_type, Tag, TagList,
TagListRef,
};
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod tags_serde;
pub mod meta;
#[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
pub use crate::meta::MetaSeqnum;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use crate::meta::ReferenceTimestampMeta;
pub use crate::meta::{Meta, MetaAPI, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta};
2017-07-25 12:01:24 +00:00
pub mod buffer;
pub use crate::buffer::{
Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_ALL, BUFFER_COPY_METADATA,
2018-07-27 10:36:40 +00:00
};
mod buffer_cursor;
pub use crate::buffer_cursor::{BufferCursor, BufferRefCursor};
pub mod memory;
pub use crate::memory::{MappedMemory, Memory, MemoryMap, MemoryRef};
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod buffer_serde;
2017-07-28 17:04:15 +00:00
pub mod sample;
pub use crate::sample::{Sample, SampleRef};
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod sample_serde;
2017-07-28 17:20:11 +00:00
pub mod bufferlist;
pub use crate::bufferlist::{BufferList, BufferListRef};
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod bufferlist_serde;
2017-07-29 11:58:54 +00:00
pub mod query;
pub use crate::query::{Query, QueryRef, QueryView};
pub mod event;
pub use crate::event::{Event, EventRef, EventView, GroupId, Seqnum};
2017-08-02 17:34:37 +00:00
pub mod context;
pub use crate::context::{Context, ContextRef};
mod static_caps;
pub use crate::static_caps::*;
mod static_pad_template;
pub use crate::static_pad_template::*;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub mod promise;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use promise::{Promise, PromiseError};
2018-03-15 09:43:35 +00:00
pub mod bus;
2018-04-01 08:30:03 +00:00
mod element;
2018-11-19 16:37:00 +00:00
mod bin;
2018-11-19 23:22:22 +00:00
2019-05-12 13:38:16 +00:00
mod pipeline;
mod allocation_params;
pub use self::allocation_params::AllocationParams;
mod element_factory_list_type;
pub use element_factory_list_type::*;
mod tracer;
// OS dependent Bus extensions (also import the other plateform mod for doc)
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
cfg_if::cfg_if! {
if #[cfg(unix)] {
mod bus_unix;
#[cfg(feature = "dox")]
mod bus_windows;
} else {
mod bus_windows;
#[cfg(feature = "dox")]
mod bus_unix;
}
}
2017-07-29 14:10:10 +00:00
mod child_proxy;
#[macro_use]
mod clock_time;
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod clock_time_serde;
mod date_time;
#[cfg(feature = "ser_de")]
mod date_time_serde;
mod device_monitor;
2018-04-01 08:30:03 +00:00
mod device_provider;
mod enums;
pub use crate::enums::MessageType;
2018-04-01 08:30:03 +00:00
mod ghost_pad;
mod gobject;
mod iterator;
mod object;
mod pad;
pub use crate::pad::PadBuilder;
2020-06-09 01:06:49 +00:00
mod control_binding;
mod control_source;
2018-04-01 08:30:03 +00:00
mod parse_context;
mod proxy_pad;
mod tag_setter;
pub use crate::element::{ElementMessageType, NotifyWatchId};
pub use crate::element::{
2018-07-27 10:36:40 +00:00
ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME,
};
pub use self::iterator::{Iterator, IteratorError, IteratorImpl, StdIterator};
pub use crate::clock_time::ClockTime;
pub use crate::device_monitor::DeviceMonitorFilterId;
pub use crate::enums::{
2018-07-27 10:36:40 +00:00
ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess,
StateChangeError, StateChangeSuccess, TagError,
};
pub use crate::pad::{PadGetRangeSuccess, PadProbeData, PadProbeId, PadProbeInfo};
pub use crate::parse_context::ParseContext;
mod plugin_feature;
mod plugin;
#[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
pub mod stream;
#[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
2018-07-27 10:36:40 +00:00
pub mod stream_collection;
mod typefind;
pub use crate::typefind::*;
pub mod format;
2020-10-27 17:27:16 +00:00
pub use crate::format::{
FormattedValue, FormattedValueIntrinsic, GenericFormattedValue, SpecificFormattedValue,
SpecificFormattedValueIntrinsic,
};
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod format_serde;
mod segment;
pub use crate::segment::*;
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod segment_serde;
pub mod toc;
pub use crate::toc::{Toc, TocEntry, TocEntryRef, TocRef};
#[cfg(feature = "ser_de")]
2018-07-30 19:10:34 +00:00
mod toc_serde;
mod clock;
pub use crate::clock::{AtomicClockReturn, ClockId, PeriodicClockId, SingleShotClockId};
2018-03-07 09:07:30 +00:00
mod buffer_pool;
pub use crate::buffer_pool::*;
2018-03-07 09:07:30 +00:00
2018-03-15 08:46:49 +00:00
mod pad_template;
mod param_spec;
pub use crate::param_spec::*;
pub mod functions;
pub use crate::functions::*;
2020-10-27 17:27:16 +00:00
mod utils;
use std::ptr;
#[doc(alias = "gst_init_check")]
pub fn init() -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
if from_glib(ffi::gst_init_check(
2017-07-10 21:33:24 +00:00
ptr::null_mut(),
ptr::null_mut(),
&mut error,
)) {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
// rustdoc-stripper-ignore-next
/// Deinitialize GStreamer
///
/// # Safety
///
/// This must only be called once during the lifetime of the process, once no GStreamer threads
/// are running anymore and all GStreamer resources are released.
pub unsafe fn deinit() {
ffi::gst_deinit();
}
pub const PARAM_FLAG_CONTROLLABLE: glib::ParamFlags = glib::ParamFlags::USER_1;
pub const PARAM_FLAG_MUTABLE_READY: glib::ParamFlags = glib::ParamFlags::USER_2;
pub const PARAM_FLAG_MUTABLE_PAUSED: glib::ParamFlags = glib::ParamFlags::USER_3;
pub const PARAM_FLAG_MUTABLE_PLAYING: glib::ParamFlags = glib::ParamFlags::USER_4;
#[cfg(any(feature = "v1_18", feature = "dox"))]
pub const PARAM_FLAG_DOC_SHOW_DEFAULT: glib::ParamFlags = glib::ParamFlags::USER_5;
#[cfg(any(feature = "v1_18", feature = "dox"))]
pub const PARAM_FLAG_CONDITIONALLY_AVAILABLE: glib::ParamFlags = glib::ParamFlags::USER_6;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts
pub mod prelude {
#[doc(hidden)]
pub use glib::prelude::*;
pub use crate::auto::traits::*;
pub use crate::meta::MetaAPI;
// OS dependent Bus extensions (also import the other platform trait for doc)
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
cfg_if::cfg_if! {
if #[cfg(unix)] {
pub use crate::bus_unix::UnixBusExtManual;
#[cfg(feature = "dox")]
pub use crate::bus_windows::WindowsBusExtManual;
} else {
pub use crate::bus_windows::WindowsBusExtManual;
#[cfg(feature = "dox")]
pub use crate::bus_unix::UnixBusExtManual;
}
}
pub use crate::bin::GstBinExtManual;
pub use crate::buffer_pool::BufferPoolExtManual;
pub use crate::child_proxy::ChildProxyExtManual;
pub use crate::clock::ClockExtManual;
pub use crate::device_monitor::DeviceMonitorExtManual;
pub use crate::device_provider::DeviceProviderExtManual;
pub use crate::element::{ElementClassExt, ElementExtManual};
pub use crate::gobject::GObjectExtManualGst;
pub use crate::message::MessageErrorDomain;
pub use crate::object::GstObjectExtManual;
pub use crate::pad::PadExtManual;
pub use crate::param_spec::GstParamSpecExt;
pub use crate::pipeline::GstPipelineExtManual;
pub use crate::plugin::GstPluginExtManual;
pub use crate::plugin_feature::PluginFeatureExtManual;
pub use crate::proxy_pad::ProxyPadExtManual;
pub use crate::tag_setter::TagSetterExtManual;
pub use crate::typefind::TypeFindImpl;
pub use crate::value::GstValueExt;
pub use crate::tags::{CustomTag, Tag};
pub use muldiv::MulDiv;
2020-10-27 17:27:16 +00:00
pub use crate::format::{
FormattedValue, FormattedValueIntrinsic, SpecificFormattedValue,
SpecificFormattedValueIntrinsic,
};
pub use crate::utils::Displayable;
}
#[macro_use]
pub mod subclass;