1#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
7#![allow(
8 clippy::approx_constant,
9 clippy::type_complexity,
10 clippy::unreadable_literal,
11 clippy::upper_case_acronyms
12)]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14
15use glib_sys as glib;
16use gobject_sys as gobject;
17use gstreamer_sys as gst;
18
19#[cfg(unix)]
20#[allow(unused_imports)]
21use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
22#[allow(unused_imports)]
23use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
24#[allow(unused_imports)]
25use std::ffi::{
26 c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
27};
28
29#[allow(unused_imports)]
30use glib::{gboolean, gconstpointer, gpointer, GType};
31
32pub type GstHarnessPrepareBufferFunc =
34 Option<unsafe extern "C" fn(*mut GstHarness, gpointer) -> *mut gst::GstBuffer>;
35pub type GstHarnessPrepareEventFunc =
36 Option<unsafe extern "C" fn(*mut GstHarness, gpointer) -> *mut gst::GstEvent>;
37
38#[derive(Copy, Clone)]
40#[repr(C)]
41pub struct GstHarness {
42 pub element: *mut gst::GstElement,
43 pub srcpad: *mut gst::GstPad,
44 pub sinkpad: *mut gst::GstPad,
45 pub src_harness: *mut GstHarness,
46 pub sink_harness: *mut GstHarness,
47 pub priv_: *mut GstHarnessPrivate,
48}
49
50impl ::std::fmt::Debug for GstHarness {
51 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
52 f.debug_struct(&format!("GstHarness @ {self:p}"))
53 .field("element", &self.element)
54 .field("srcpad", &self.srcpad)
55 .field("sinkpad", &self.sinkpad)
56 .field("src_harness", &self.src_harness)
57 .field("sink_harness", &self.sink_harness)
58 .finish()
59 }
60}
61
62#[repr(C)]
63#[allow(dead_code)]
64pub struct _GstHarnessPrivate {
65 _data: [u8; 0],
66 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
67}
68
69pub type GstHarnessPrivate = _GstHarnessPrivate;
70
71#[repr(C)]
72#[allow(dead_code)]
73pub struct _GstHarnessThread {
74 _data: [u8; 0],
75 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
76}
77
78pub type GstHarnessThread = _GstHarnessThread;
79
80#[repr(C)]
81#[allow(dead_code)]
82pub struct _GstStreamConsistency {
83 _data: [u8; 0],
84 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
85}
86
87pub type GstStreamConsistency = _GstStreamConsistency;
88
89#[derive(Copy, Clone)]
90#[repr(C)]
91pub struct GstTestClockClass {
92 pub parent_class: gst::GstClockClass,
93}
94
95impl ::std::fmt::Debug for GstTestClockClass {
96 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
97 f.debug_struct(&format!("GstTestClockClass @ {self:p}"))
98 .field("parent_class", &self.parent_class)
99 .finish()
100 }
101}
102
103#[repr(C)]
104#[allow(dead_code)]
105pub struct _GstTestClockPrivate {
106 _data: [u8; 0],
107 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
108}
109
110pub type GstTestClockPrivate = _GstTestClockPrivate;
111
112#[derive(Copy, Clone)]
114#[repr(C)]
115pub struct GstTestClock {
116 pub parent: gst::GstClock,
117 pub priv_: *mut GstTestClockPrivate,
118}
119
120impl ::std::fmt::Debug for GstTestClock {
121 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
122 f.debug_struct(&format!("GstTestClock @ {self:p}"))
123 .field("parent", &self.parent)
124 .finish()
125 }
126}
127
128extern "C" {
129
130 pub fn gst_harness_add_element_full(
134 h: *mut GstHarness,
135 element: *mut gst::GstElement,
136 hsrc: *mut gst::GstStaticPadTemplate,
137 element_sinkpad_name: *const c_char,
138 hsink: *mut gst::GstStaticPadTemplate,
139 element_srcpad_name: *const c_char,
140 );
141 pub fn gst_harness_add_element_sink_pad(h: *mut GstHarness, sinkpad: *mut gst::GstPad);
142 pub fn gst_harness_add_element_src_pad(h: *mut GstHarness, srcpad: *mut gst::GstPad);
143 pub fn gst_harness_add_parse(h: *mut GstHarness, launchline: *const c_char);
144 pub fn gst_harness_add_probe(
145 h: *mut GstHarness,
146 element_name: *const c_char,
147 pad_name: *const c_char,
148 mask: gst::GstPadProbeType,
149 callback: gst::GstPadProbeCallback,
150 user_data: gpointer,
151 destroy_data: glib::GDestroyNotify,
152 );
153 #[cfg(feature = "v1_16")]
154 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
155 pub fn gst_harness_add_propose_allocation_meta(
156 h: *mut GstHarness,
157 api: GType,
158 params: *const gst::GstStructure,
159 );
160 pub fn gst_harness_add_sink(h: *mut GstHarness, sink_element_name: *const c_char);
161 pub fn gst_harness_add_sink_harness(h: *mut GstHarness, sink_harness: *mut GstHarness);
162 pub fn gst_harness_add_sink_parse(h: *mut GstHarness, launchline: *const c_char);
163 pub fn gst_harness_add_src(
164 h: *mut GstHarness,
165 src_element_name: *const c_char,
166 has_clock_wait: gboolean,
167 );
168 pub fn gst_harness_add_src_harness(
169 h: *mut GstHarness,
170 src_harness: *mut GstHarness,
171 has_clock_wait: gboolean,
172 );
173 pub fn gst_harness_add_src_parse(
174 h: *mut GstHarness,
175 launchline: *const c_char,
176 has_clock_wait: gboolean,
177 );
178 pub fn gst_harness_buffers_in_queue(h: *mut GstHarness) -> c_uint;
179 pub fn gst_harness_buffers_received(h: *mut GstHarness) -> c_uint;
180 pub fn gst_harness_crank_multiple_clock_waits(h: *mut GstHarness, waits: c_uint) -> gboolean;
181 pub fn gst_harness_crank_single_clock_wait(h: *mut GstHarness) -> gboolean;
182 pub fn gst_harness_create_buffer(h: *mut GstHarness, size: size_t) -> *mut gst::GstBuffer;
183 pub fn gst_harness_dump_to_file(h: *mut GstHarness, filename: *const c_char);
184 pub fn gst_harness_events_in_queue(h: *mut GstHarness) -> c_uint;
185 pub fn gst_harness_events_received(h: *mut GstHarness) -> c_uint;
186 pub fn gst_harness_find_element(
187 h: *mut GstHarness,
188 element_name: *const c_char,
189 ) -> *mut gst::GstElement;
190 pub fn gst_harness_get(
191 h: *mut GstHarness,
192 element_name: *const c_char,
193 first_property_name: *const c_char,
194 ...
195 );
196 pub fn gst_harness_get_allocator(
197 h: *mut GstHarness,
198 allocator: *mut *mut gst::GstAllocator,
199 params: *mut gst::GstAllocationParams,
200 );
201 pub fn gst_harness_get_last_pushed_timestamp(h: *mut GstHarness) -> gst::GstClockTime;
202 pub fn gst_harness_get_testclock(h: *mut GstHarness) -> *mut GstTestClock;
203 pub fn gst_harness_play(h: *mut GstHarness);
204 pub fn gst_harness_pull(h: *mut GstHarness) -> *mut gst::GstBuffer;
205 pub fn gst_harness_pull_event(h: *mut GstHarness) -> *mut gst::GstEvent;
206 #[cfg(feature = "v1_18")]
207 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
208 pub fn gst_harness_pull_until_eos(
209 h: *mut GstHarness,
210 buf: *mut *mut gst::GstBuffer,
211 ) -> gboolean;
212 pub fn gst_harness_pull_upstream_event(h: *mut GstHarness) -> *mut gst::GstEvent;
213 pub fn gst_harness_push(h: *mut GstHarness, buffer: *mut gst::GstBuffer) -> gst::GstFlowReturn;
214 pub fn gst_harness_push_and_pull(
215 h: *mut GstHarness,
216 buffer: *mut gst::GstBuffer,
217 ) -> *mut gst::GstBuffer;
218 pub fn gst_harness_push_event(h: *mut GstHarness, event: *mut gst::GstEvent) -> gboolean;
219 pub fn gst_harness_push_from_src(h: *mut GstHarness) -> gst::GstFlowReturn;
220 pub fn gst_harness_push_to_sink(h: *mut GstHarness) -> gst::GstFlowReturn;
221 pub fn gst_harness_push_upstream_event(
222 h: *mut GstHarness,
223 event: *mut gst::GstEvent,
224 ) -> gboolean;
225 pub fn gst_harness_query_latency(h: *mut GstHarness) -> gst::GstClockTime;
226 pub fn gst_harness_set(
227 h: *mut GstHarness,
228 element_name: *const c_char,
229 first_property_name: *const c_char,
230 ...
231 );
232 pub fn gst_harness_set_blocking_push_mode(h: *mut GstHarness);
233 pub fn gst_harness_set_caps(h: *mut GstHarness, in_: *mut gst::GstCaps, out: *mut gst::GstCaps);
234 pub fn gst_harness_set_caps_str(h: *mut GstHarness, in_: *const c_char, out: *const c_char);
235 pub fn gst_harness_set_drop_buffers(h: *mut GstHarness, drop_buffers: gboolean);
236 pub fn gst_harness_set_forwarding(h: *mut GstHarness, forwarding: gboolean);
237 #[cfg(feature = "v1_20")]
238 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
239 pub fn gst_harness_set_live(h: *mut GstHarness, is_live: gboolean);
240 pub fn gst_harness_set_propose_allocator(
241 h: *mut GstHarness,
242 allocator: *mut gst::GstAllocator,
243 params: *const gst::GstAllocationParams,
244 );
245 pub fn gst_harness_set_sink_caps(h: *mut GstHarness, caps: *mut gst::GstCaps);
246 pub fn gst_harness_set_sink_caps_str(h: *mut GstHarness, str: *const c_char);
247 pub fn gst_harness_set_src_caps(h: *mut GstHarness, caps: *mut gst::GstCaps);
248 pub fn gst_harness_set_src_caps_str(h: *mut GstHarness, str: *const c_char);
249 pub fn gst_harness_set_time(h: *mut GstHarness, time: gst::GstClockTime) -> gboolean;
250 pub fn gst_harness_set_upstream_latency(h: *mut GstHarness, latency: gst::GstClockTime);
251 pub fn gst_harness_sink_push_many(h: *mut GstHarness, pushes: c_int) -> gst::GstFlowReturn;
252 pub fn gst_harness_src_crank_and_push_many(
253 h: *mut GstHarness,
254 cranks: c_int,
255 pushes: c_int,
256 ) -> gst::GstFlowReturn;
257 pub fn gst_harness_src_push_event(h: *mut GstHarness) -> gboolean;
258 pub fn gst_harness_stress_custom_start(
259 h: *mut GstHarness,
260 init: glib::GFunc,
261 callback: glib::GFunc,
262 data: gpointer,
263 sleep: c_ulong,
264 ) -> *mut GstHarnessThread;
265 pub fn gst_harness_stress_property_start_full(
266 h: *mut GstHarness,
267 name: *const c_char,
268 value: *const gobject::GValue,
269 sleep: c_ulong,
270 ) -> *mut GstHarnessThread;
271 pub fn gst_harness_stress_push_buffer_start_full(
272 h: *mut GstHarness,
273 caps: *mut gst::GstCaps,
274 segment: *const gst::GstSegment,
275 buf: *mut gst::GstBuffer,
276 sleep: c_ulong,
277 ) -> *mut GstHarnessThread;
278 pub fn gst_harness_stress_push_buffer_with_cb_start_full(
279 h: *mut GstHarness,
280 caps: *mut gst::GstCaps,
281 segment: *const gst::GstSegment,
282 func: GstHarnessPrepareBufferFunc,
283 data: gpointer,
284 notify: glib::GDestroyNotify,
285 sleep: c_ulong,
286 ) -> *mut GstHarnessThread;
287 pub fn gst_harness_stress_push_event_start_full(
288 h: *mut GstHarness,
289 event: *mut gst::GstEvent,
290 sleep: c_ulong,
291 ) -> *mut GstHarnessThread;
292 pub fn gst_harness_stress_push_event_with_cb_start_full(
293 h: *mut GstHarness,
294 func: GstHarnessPrepareEventFunc,
295 data: gpointer,
296 notify: glib::GDestroyNotify,
297 sleep: c_ulong,
298 ) -> *mut GstHarnessThread;
299 pub fn gst_harness_stress_push_upstream_event_start_full(
300 h: *mut GstHarness,
301 event: *mut gst::GstEvent,
302 sleep: c_ulong,
303 ) -> *mut GstHarnessThread;
304 pub fn gst_harness_stress_push_upstream_event_with_cb_start_full(
305 h: *mut GstHarness,
306 func: GstHarnessPrepareEventFunc,
307 data: gpointer,
308 notify: glib::GDestroyNotify,
309 sleep: c_ulong,
310 ) -> *mut GstHarnessThread;
311 pub fn gst_harness_stress_requestpad_start_full(
312 h: *mut GstHarness,
313 templ: *mut gst::GstPadTemplate,
314 name: *const c_char,
315 caps: *mut gst::GstCaps,
316 release: gboolean,
317 sleep: c_ulong,
318 ) -> *mut GstHarnessThread;
319 pub fn gst_harness_stress_statechange_start_full(
320 h: *mut GstHarness,
321 sleep: c_ulong,
322 ) -> *mut GstHarnessThread;
323 pub fn gst_harness_take_all_data(h: *mut GstHarness, size: *mut size_t) -> *mut u8;
324 pub fn gst_harness_take_all_data_as_buffer(h: *mut GstHarness) -> *mut gst::GstBuffer;
325 pub fn gst_harness_take_all_data_as_bytes(h: *mut GstHarness) -> *mut glib::GBytes;
326 pub fn gst_harness_teardown(h: *mut GstHarness);
327 pub fn gst_harness_try_pull(h: *mut GstHarness) -> *mut gst::GstBuffer;
328 pub fn gst_harness_try_pull_event(h: *mut GstHarness) -> *mut gst::GstEvent;
329 pub fn gst_harness_try_pull_upstream_event(h: *mut GstHarness) -> *mut gst::GstEvent;
330 pub fn gst_harness_upstream_events_in_queue(h: *mut GstHarness) -> c_uint;
331 pub fn gst_harness_upstream_events_received(h: *mut GstHarness) -> c_uint;
332 pub fn gst_harness_use_systemclock(h: *mut GstHarness);
333 pub fn gst_harness_use_testclock(h: *mut GstHarness);
334 pub fn gst_harness_wait_for_clock_id_waits(
335 h: *mut GstHarness,
336 waits: c_uint,
337 timeout: c_uint,
338 ) -> gboolean;
339 pub fn gst_harness_new(element_name: *const c_char) -> *mut GstHarness;
340 pub fn gst_harness_new_empty() -> *mut GstHarness;
341 pub fn gst_harness_new_full(
342 element: *mut gst::GstElement,
343 hsrc: *mut gst::GstStaticPadTemplate,
344 element_sinkpad_name: *const c_char,
345 hsink: *mut gst::GstStaticPadTemplate,
346 element_srcpad_name: *const c_char,
347 ) -> *mut GstHarness;
348 pub fn gst_harness_new_parse(launchline: *const c_char) -> *mut GstHarness;
349 pub fn gst_harness_new_with_element(
350 element: *mut gst::GstElement,
351 element_sinkpad_name: *const c_char,
352 element_srcpad_name: *const c_char,
353 ) -> *mut GstHarness;
354 pub fn gst_harness_new_with_padnames(
355 element_name: *const c_char,
356 element_sinkpad_name: *const c_char,
357 element_srcpad_name: *const c_char,
358 ) -> *mut GstHarness;
359 pub fn gst_harness_new_with_templates(
360 element_name: *const c_char,
361 hsrc: *mut gst::GstStaticPadTemplate,
362 hsink: *mut gst::GstStaticPadTemplate,
363 ) -> *mut GstHarness;
364 pub fn gst_harness_stress_thread_stop(t: *mut GstHarnessThread) -> c_uint;
365
366 pub fn gst_test_clock_get_type() -> GType;
370 pub fn gst_test_clock_new() -> *mut gst::GstClock;
371 pub fn gst_test_clock_new_with_start_time(start_time: gst::GstClockTime) -> *mut gst::GstClock;
372 pub fn gst_test_clock_id_list_get_latest_time(
373 pending_list: *const glib::GList,
374 ) -> gst::GstClockTime;
375 pub fn gst_test_clock_advance_time(test_clock: *mut GstTestClock, delta: gst::GstClockTimeDiff);
376 pub fn gst_test_clock_crank(test_clock: *mut GstTestClock) -> gboolean;
377 pub fn gst_test_clock_get_next_entry_time(test_clock: *mut GstTestClock) -> gst::GstClockTime;
378 pub fn gst_test_clock_has_id(test_clock: *mut GstTestClock, id: gst::GstClockID) -> gboolean;
379 pub fn gst_test_clock_peek_id_count(test_clock: *mut GstTestClock) -> c_uint;
380 pub fn gst_test_clock_peek_next_pending_id(
381 test_clock: *mut GstTestClock,
382 pending_id: *mut gst::GstClockID,
383 ) -> gboolean;
384 #[cfg(feature = "v1_18")]
385 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
386 pub fn gst_test_clock_process_id(
387 test_clock: *mut GstTestClock,
388 pending_id: gst::GstClockID,
389 ) -> gboolean;
390 pub fn gst_test_clock_process_id_list(
391 test_clock: *mut GstTestClock,
392 pending_list: *const glib::GList,
393 ) -> c_uint;
394 pub fn gst_test_clock_process_next_clock_id(test_clock: *mut GstTestClock) -> gst::GstClockID;
395 pub fn gst_test_clock_set_time(test_clock: *mut GstTestClock, new_time: gst::GstClockTime);
396 #[cfg(feature = "v1_16")]
397 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
398 pub fn gst_test_clock_timed_wait_for_multiple_pending_ids(
399 test_clock: *mut GstTestClock,
400 count: c_uint,
401 timeout_ms: c_uint,
402 pending_list: *mut *mut glib::GList,
403 ) -> gboolean;
404 pub fn gst_test_clock_wait_for_multiple_pending_ids(
405 test_clock: *mut GstTestClock,
406 count: c_uint,
407 pending_list: *mut *mut glib::GList,
408 );
409 pub fn gst_test_clock_wait_for_next_pending_id(
410 test_clock: *mut GstTestClock,
411 pending_id: *mut gst::GstClockID,
412 );
413 pub fn gst_test_clock_wait_for_pending_id_count(test_clock: *mut GstTestClock, count: c_uint);
414
415 pub fn gst_consistency_checker_add_pad(
419 consist: *mut GstStreamConsistency,
420 pad: *mut gst::GstPad,
421 ) -> gboolean;
422 pub fn gst_consistency_checker_free(consist: *mut GstStreamConsistency);
423 pub fn gst_consistency_checker_new(pad: *mut gst::GstPad) -> *mut GstStreamConsistency;
424 pub fn gst_consistency_checker_reset(consist: *mut GstStreamConsistency);
425
426}