1 // Take a look at the license at the top of the repository in the LICENSE file.
2 
3 #![cfg_attr(feature = "dox", feature(doc_cfg))]
4 #![recursion_limit = "256"]
5 
6 // Re-exported for the subclass gst_plugin_define! macro
7 pub use ffi;
8 pub use glib;
9 pub use paste;
10 
11 use glib::translate::{from_glib, from_glib_full};
12 
13 macro_rules! assert_initialized_main_thread {
14     () => {
15         if unsafe { ffi::gst_is_initialized() } != glib::ffi::GTRUE {
16             panic!("GStreamer has not been initialized. Call `gst::init` first.");
17         }
18     };
19 }
20 
21 macro_rules! skip_assert_initialized {
22     () => {};
23 }
24 
25 #[allow(clippy::unreadable_literal)]
26 #[allow(clippy::too_many_arguments)]
27 #[allow(clippy::match_same_arms)]
28 #[allow(clippy::type_complexity)]
29 #[allow(clippy::use_self)]
30 #[allow(clippy::needless_borrow)]
31 mod auto;
32 pub use crate::auto::functions::*;
33 pub use crate::auto::*;
34 
35 #[macro_use]
36 mod log;
37 pub use crate::log::*;
38 
39 #[macro_use]
40 mod error;
41 pub use crate::error::*;
42 
43 #[macro_use]
44 pub mod miniobject;
45 pub mod message;
46 pub use crate::message::{Message, MessageErrorDomain, MessageRef, MessageView};
47 
48 mod value;
49 pub use crate::value::*;
50 #[cfg(feature = "ser_de")]
51 #[macro_use]
52 mod value_serde;
53 
54 pub mod structure;
55 pub use crate::structure::{Structure, StructureRef};
56 #[cfg(feature = "ser_de")]
57 mod structure_serde;
58 
59 pub mod caps;
60 pub use crate::caps::{Caps, CapsRef};
61 mod caps_features;
62 #[cfg(feature = "ser_de")]
63 mod caps_serde;
64 pub use crate::caps_features::{
65     CapsFeatures, CapsFeaturesRef, CAPS_FEATURES_MEMORY_SYSTEM_MEMORY,
66     CAPS_FEATURE_MEMORY_SYSTEM_MEMORY,
67 };
68 #[cfg(feature = "ser_de")]
69 mod caps_features_serde;
70 
71 pub mod tags;
72 pub use crate::tags::{
73     tag_exists, tag_get_description, tag_get_flag, tag_get_nick, tag_get_type, Tag, TagList,
74     TagListRef,
75 };
76 #[cfg(feature = "ser_de")]
77 mod tags_serde;
78 
79 pub mod meta;
80 #[cfg(any(feature = "v1_16", feature = "dox"))]
81 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
82 pub use crate::meta::MetaSeqnum;
83 #[cfg(any(feature = "v1_14", feature = "dox"))]
84 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
85 pub use crate::meta::ReferenceTimestampMeta;
86 pub use crate::meta::{Meta, MetaAPI, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta};
87 pub mod buffer;
88 pub use crate::buffer::{
89     Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_ALL, BUFFER_COPY_METADATA,
90 };
91 mod buffer_cursor;
92 pub use crate::buffer_cursor::{BufferCursor, BufferRefCursor};
93 pub mod memory;
94 pub use crate::memory::{MappedMemory, Memory, MemoryMap, MemoryRef};
95 #[cfg(feature = "ser_de")]
96 mod buffer_serde;
97 
98 pub mod sample;
99 pub use crate::sample::{Sample, SampleRef};
100 #[cfg(feature = "ser_de")]
101 mod sample_serde;
102 
103 pub mod bufferlist;
104 pub use crate::bufferlist::{BufferList, BufferListRef};
105 #[cfg(feature = "ser_de")]
106 mod bufferlist_serde;
107 
108 pub mod query;
109 pub use crate::query::{Query, QueryRef, QueryView};
110 pub mod event;
111 pub use crate::event::{Event, EventRef, EventView, GroupId, Seqnum};
112 pub mod context;
113 pub use crate::context::{Context, ContextRef};
114 mod static_caps;
115 pub use crate::static_caps::*;
116 mod static_pad_template;
117 pub use crate::static_pad_template::*;
118 
119 #[cfg(any(feature = "v1_14", feature = "dox"))]
120 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
121 pub mod promise;
122 #[cfg(any(feature = "v1_14", feature = "dox"))]
123 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
124 pub use promise::{Promise, PromiseError};
125 
126 pub mod bus;
127 mod element;
128 
129 mod bin;
130 
131 mod pipeline;
132 
133 mod allocation_params;
134 pub use self::allocation_params::AllocationParams;
135 
136 mod element_factory_list_type;
137 pub use element_factory_list_type::*;
138 
139 mod tracer;
140 
141 // OS dependent Bus extensions (also import the other plateform mod for doc)
142 #[cfg(any(feature = "v1_14", feature = "dox"))]
143 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
144 cfg_if::cfg_if! {
145     if #[cfg(unix)] {
146         mod bus_unix;
147         #[cfg(feature = "dox")]
148         mod bus_windows;
149     } else {
150         mod bus_windows;
151         #[cfg(feature = "dox")]
152         mod bus_unix;
153     }
154 }
155 
156 mod child_proxy;
157 #[macro_use]
158 mod clock_time;
159 #[cfg(feature = "ser_de")]
160 mod clock_time_serde;
161 mod date_time;
162 #[cfg(feature = "ser_de")]
163 mod date_time_serde;
164 mod device_monitor;
165 mod device_provider;
166 mod enums;
167 pub use crate::enums::MessageType;
168 mod ghost_pad;
169 mod gobject;
170 mod iterator;
171 mod object;
172 mod pad;
173 pub use crate::pad::PadBuilder;
174 mod control_binding;
175 mod control_source;
176 mod parse_context;
177 mod proxy_pad;
178 mod tag_setter;
179 pub use crate::element::{ElementMessageType, NotifyWatchId};
180 pub use crate::element::{
181     ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
182     ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME,
183 };
184 
185 pub use self::iterator::{Iterator, IteratorError, IteratorImpl, StdIterator};
186 pub use crate::clock_time::ClockTime;
187 pub use crate::device_monitor::DeviceMonitorFilterId;
188 pub use crate::enums::{
189     ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess,
190     StateChangeError, StateChangeSuccess, TagError,
191 };
192 pub use crate::pad::{PadGetRangeSuccess, PadProbeData, PadProbeId, PadProbeInfo};
193 pub use crate::parse_context::ParseContext;
194 mod plugin_feature;
195 
196 mod plugin;
197 #[cfg(any(feature = "v1_10", feature = "dox"))]
198 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
199 pub mod stream;
200 #[cfg(any(feature = "v1_10", feature = "dox"))]
201 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
202 pub mod stream_collection;
203 
204 mod typefind;
205 pub use crate::typefind::*;
206 
207 pub mod format;
208 pub use crate::format::{
209     FormattedValue, FormattedValueIntrinsic, GenericFormattedValue, SpecificFormattedValue,
210     SpecificFormattedValueIntrinsic,
211 };
212 #[cfg(feature = "ser_de")]
213 mod format_serde;
214 
215 mod segment;
216 pub use crate::segment::*;
217 #[cfg(feature = "ser_de")]
218 mod segment_serde;
219 
220 pub mod toc;
221 pub use crate::toc::{Toc, TocEntry, TocEntryRef, TocRef};
222 #[cfg(feature = "ser_de")]
223 mod toc_serde;
224 
225 mod clock;
226 pub use crate::clock::{AtomicClockReturn, ClockId, PeriodicClockId, SingleShotClockId};
227 
228 mod buffer_pool;
229 pub use crate::buffer_pool::*;
230 
231 mod pad_template;
232 
233 mod param_spec;
234 pub use crate::param_spec::*;
235 
236 pub mod functions;
237 pub use crate::functions::*;
238 
239 mod utils;
240 
241 use std::ptr;
242 
243 #[doc(alias = "gst_init_check")]
init() -> Result<(), glib::Error>244 pub fn init() -> Result<(), glib::Error> {
245     unsafe {
246         let mut error = ptr::null_mut();
247         if from_glib(ffi::gst_init_check(
248             ptr::null_mut(),
249             ptr::null_mut(),
250             &mut error,
251         )) {
252             Ok(())
253         } else {
254             Err(from_glib_full(error))
255         }
256     }
257 }
258 
259 // rustdoc-stripper-ignore-next
260 /// Deinitialize GStreamer
261 ///
262 /// # Safety
263 ///
264 /// This must only be called once during the lifetime of the process, once no GStreamer threads
265 /// are running anymore and all GStreamer resources are released.
deinit()266 pub unsafe fn deinit() {
267     ffi::gst_deinit();
268 }
269 
270 pub const PARAM_FLAG_CONTROLLABLE: glib::ParamFlags = glib::ParamFlags::USER_1;
271 pub const PARAM_FLAG_MUTABLE_READY: glib::ParamFlags = glib::ParamFlags::USER_2;
272 pub const PARAM_FLAG_MUTABLE_PAUSED: glib::ParamFlags = glib::ParamFlags::USER_3;
273 pub const PARAM_FLAG_MUTABLE_PLAYING: glib::ParamFlags = glib::ParamFlags::USER_4;
274 #[cfg(any(feature = "v1_18", feature = "dox"))]
275 pub const PARAM_FLAG_DOC_SHOW_DEFAULT: glib::ParamFlags = glib::ParamFlags::USER_5;
276 #[cfg(any(feature = "v1_18", feature = "dox"))]
277 pub const PARAM_FLAG_CONDITIONALLY_AVAILABLE: glib::ParamFlags = glib::ParamFlags::USER_6;
278 
279 // Re-export all the traits in a prelude module, so that applications
280 // can always "use gst::prelude::*" without getting conflicts
281 pub mod prelude {
282     #[doc(hidden)]
283     pub use glib::prelude::*;
284 
285     pub use crate::auto::traits::*;
286 
287     pub use crate::meta::MetaAPI;
288 
289     // OS dependent Bus extensions (also import the other platform trait for doc)
290     #[cfg(any(feature = "v1_14", feature = "dox"))]
291     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
292     cfg_if::cfg_if! {
293         if #[cfg(unix)] {
294             pub use crate::bus_unix::UnixBusExtManual;
295             #[cfg(feature = "dox")]
296             pub use crate::bus_windows::WindowsBusExtManual;
297         } else {
298             pub use crate::bus_windows::WindowsBusExtManual;
299             #[cfg(feature = "dox")]
300             pub use crate::bus_unix::UnixBusExtManual;
301         }
302     }
303 
304     pub use crate::bin::GstBinExtManual;
305     pub use crate::buffer_pool::BufferPoolExtManual;
306     pub use crate::child_proxy::ChildProxyExtManual;
307     pub use crate::clock::ClockExtManual;
308     pub use crate::device_monitor::DeviceMonitorExtManual;
309     pub use crate::device_provider::DeviceProviderExtManual;
310     pub use crate::element::{ElementClassExt, ElementExtManual};
311     pub use crate::gobject::GObjectExtManualGst;
312     pub use crate::message::MessageErrorDomain;
313     pub use crate::object::GstObjectExtManual;
314     pub use crate::pad::PadExtManual;
315     pub use crate::param_spec::GstParamSpecExt;
316     pub use crate::pipeline::GstPipelineExtManual;
317     pub use crate::plugin::GstPluginExtManual;
318     pub use crate::plugin_feature::PluginFeatureExtManual;
319     pub use crate::proxy_pad::ProxyPadExtManual;
320     pub use crate::tag_setter::TagSetterExtManual;
321     pub use crate::typefind::TypeFindImpl;
322     pub use crate::value::GstValueExt;
323 
324     pub use crate::tags::{CustomTag, Tag};
325 
326     pub use muldiv::MulDiv;
327 
328     pub use crate::format::{
329         FormattedValue, FormattedValueIntrinsic, SpecificFormattedValue,
330         SpecificFormattedValueIntrinsic,
331     };
332     pub use crate::utils::Displayable;
333 }
334 
335 #[macro_use]
336 pub mod subclass;
337