1 /*
2 * This file is part of gtkD.
3 *
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 3
7 * of the License, or (at your option) any later version, with
8 * some exceptions, please read the COPYING file.
9 *
10 * gtkD is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with gtkD; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18 */19 20 // generated automatically - do not change21 // find conversion definition on APILookup.txt22 // implement new conversion functionalities on the wrap.utils pakage23 24 25 modulegstreamer.Clock;
26 27 privateimportgobject.ObjectG;
28 privateimportgobject.Signals;
29 privateimportgstreamer.ObjectGst;
30 privateimportgstreamer.c.functions;
31 publicimportgstreamer.c.types;
32 privateimportstd.algorithm;
33 34 35 /**
36 * GStreamer uses a global clock to synchronize the plugins in a pipeline.
37 * Different clock implementations are possible by implementing this abstract
38 * base class or, more conveniently, by subclassing #GstSystemClock.
39 *
40 * The #GstClock returns a monotonically increasing time with the method
41 * gst_clock_get_time(). Its accuracy and base time depend on the specific
42 * clock implementation but time is always expressed in nanoseconds. Since the
43 * baseline of the clock is undefined, the clock time returned is not
44 * meaningful in itself, what matters are the deltas between two clock times.
45 * The time returned by a clock is called the absolute time.
46 *
47 * The pipeline uses the clock to calculate the running time. Usually all
48 * renderers synchronize to the global clock using the buffer timestamps, the
49 * newsegment events and the element's base time, see #GstPipeline.
50 *
51 * A clock implementation can support periodic and single shot clock
52 * notifications both synchronous and asynchronous.
53 *
54 * One first needs to create a #GstClockID for the periodic or single shot
55 * notification using gst_clock_new_single_shot_id() or
56 * gst_clock_new_periodic_id().
57 *
58 * To perform a blocking wait for the specific time of the #GstClockID use the
59 * gst_clock_id_wait(). To receive a callback when the specific time is reached
60 * in the clock use gst_clock_id_wait_async(). Both these calls can be
61 * interrupted with the gst_clock_id_unschedule() call. If the blocking wait is
62 * unscheduled a return value of #GST_CLOCK_UNSCHEDULED is returned.
63 *
64 * Periodic callbacks scheduled async will be repeatedly called automatically
65 * until it is unscheduled. To schedule a sync periodic callback,
66 * gst_clock_id_wait() should be called repeatedly.
67 *
68 * The async callbacks can happen from any thread, either provided by the core
69 * or from a streaming thread. The application should be prepared for this.
70 *
71 * A #GstClockID that has been unscheduled cannot be used again for any wait
72 * operation, a new #GstClockID should be created and the old unscheduled one
73 * should be destroyed with gst_clock_id_unref().
74 *
75 * It is possible to perform a blocking wait on the same #GstClockID from
76 * multiple threads. However, registering the same #GstClockID for multiple
77 * async notifications is not possible, the callback will only be called for
78 * the thread registering the entry last.
79 *
80 * None of the wait operations unref the #GstClockID, the owner is responsible
81 * for unreffing the ids itself. This holds for both periodic and single shot
82 * notifications. The reason being that the owner of the #GstClockID has to
83 * keep a handle to the #GstClockID to unblock the wait on FLUSHING events or
84 * state changes and if the entry would be unreffed automatically, the handle
85 * might become invalid without any notification.
86 *
87 * These clock operations do not operate on the running time, so the callbacks
88 * will also occur when not in PLAYING state as if the clock just keeps on
89 * running. Some clocks however do not progress when the element that provided
90 * the clock is not PLAYING.
91 *
92 * When a clock has the #GST_CLOCK_FLAG_CAN_SET_MASTER flag set, it can be
93 * slaved to another #GstClock with the gst_clock_set_master(). The clock will
94 * then automatically be synchronized to this master clock by repeatedly
95 * sampling the master clock and the slave clock and recalibrating the slave
96 * clock with gst_clock_set_calibration(). This feature is mostly useful for
97 * plugins that have an internal clock but must operate with another clock
98 * selected by the #GstPipeline. They can track the offset and rate difference
99 * of their internal clock relative to the master clock by using the
100 * gst_clock_get_calibration() function.
101 *
102 * The master/slave synchronisation can be tuned with the #GstClock:timeout,
103 * #GstClock:window-size and #GstClock:window-threshold properties.
104 * The #GstClock:timeout property defines the interval to sample the master
105 * clock and run the calibration functions. #GstClock:window-size defines the
106 * number of samples to use when calibrating and #GstClock:window-threshold
107 * defines the minimum number of samples before the calibration is performed.
108 */109 publicclassClock : ObjectGst110 {
111 /** the main Gtk struct */112 protectedGstClock* gstClock;
113 114 /** Get the main Gtk struct */115 publicGstClock* getClockStruct(booltransferOwnership = false)
116 {
117 if (transferOwnership)
118 ownedRef = false;
119 returngstClock;
120 }
121 122 /** the main Gtk struct as a void* */123 protectedoverridevoid* getStruct()
124 {
125 returncast(void*)gstClock;
126 }
127 128 /**
129 * Sets our main struct and passes it to the parent class.
130 */131 publicthis (GstClock* gstClock, boolownedRef = false)
132 {
133 this.gstClock = gstClock;
134 super(cast(GstObject*)gstClock, ownedRef);
135 }
136 137 138 /** */139 publicstaticGTypegetType()
140 {
141 returngst_clock_get_type();
142 }
143 144 /**
145 * Compares the two #GstClockID instances. This function can be used
146 * as a GCompareFunc when sorting ids.
147 *
148 * Params:
149 * id1 = A #GstClockID
150 * id2 = A #GstClockID to compare with
151 *
152 * Returns: negative value if a < b; zero if a = b; positive value if a > b
153 *
154 * MT safe.
155 */156 publicstaticintidCompareFunc(void* id1, void* id2)
157 {
158 returngst_clock_id_compare_func(id1, id2);
159 }
160 161 /**
162 * This function returns the underlying clock.
163 *
164 * Params:
165 * id = a #GstClockID
166 *
167 * Returns: a #GstClock or %NULL when the
168 * underlying clock has been freed. Unref after usage.
169 *
170 * MT safe.
171 *
172 * Since: 1.16
173 */174 publicstaticClockidGetClock(GstClockIDid)
175 {
176 auto__p = gst_clock_id_get_clock(id);
177 178 if(__pisnull)
179 {
180 returnnull;
181 }
182 183 returnObjectG.getDObject!(Clock)(cast(GstClock*) __p, true);
184 }
185 186 /**
187 * Get the time of the clock ID
188 *
189 * Params:
190 * id = The #GstClockID to query
191 *
192 * Returns: the time of the given clock id.
193 *
194 * MT safe.
195 */196 publicstaticGstClockTimeidGetTime(GstClockIDid)
197 {
198 returngst_clock_id_get_time(id);
199 }
200 201 /**
202 * Increase the refcount of given @id.
203 *
204 * Params:
205 * id = The #GstClockID to ref
206 *
207 * Returns: The same #GstClockID with increased refcount.
208 *
209 * MT safe.
210 */211 publicstaticGstClockIDidRef(GstClockIDid)
212 {
213 returngst_clock_id_ref(id);
214 }
215 216 /**
217 * Unref given @id. When the refcount reaches 0 the
218 * #GstClockID will be freed.
219 *
220 * MT safe.
221 *
222 * Params:
223 * id = The #GstClockID to unref
224 */225 publicstaticvoididUnref(GstClockIDid)
226 {
227 gst_clock_id_unref(id);
228 }
229 230 /**
231 * Cancel an outstanding request with @id. This can either
232 * be an outstanding async notification or a pending sync notification.
233 * After this call, @id cannot be used anymore to receive sync or
234 * async notifications, you need to create a new #GstClockID.
235 *
236 * MT safe.
237 *
238 * Params:
239 * id = The id to unschedule
240 */241 publicstaticvoididUnschedule(GstClockIDid)
242 {
243 gst_clock_id_unschedule(id);
244 }
245 246 /**
247 * This function returns whether @id uses @clock as the underlying clock.
248 * @clock can be NULL, in which case the return value indicates whether
249 * the underlying clock has been freed. If this is the case, the @id is
250 * no longer usable and should be freed.
251 *
252 * Params:
253 * id = a #GstClockID to check
254 * clock = a #GstClock to compare against
255 *
256 * Returns: whether the clock @id uses the same underlying #GstClock @clock.
257 *
258 * MT safe.
259 *
260 * Since: 1.16
261 */262 publicstaticboolidUsesClock(GstClockIDid, Clockclock)
263 {
264 returngst_clock_id_uses_clock(id, (clockisnull) ? null : clock.getClockStruct()) != 0;
265 }
266 267 /**
268 * Perform a blocking wait on @id.
269 * @id should have been created with gst_clock_new_single_shot_id()
270 * or gst_clock_new_periodic_id() and should not have been unscheduled
271 * with a call to gst_clock_id_unschedule().
272 *
273 * If the @jitter argument is not %NULL and this function returns #GST_CLOCK_OK
274 * or #GST_CLOCK_EARLY, it will contain the difference
275 * against the clock and the time of @id when this method was
276 * called.
277 * Positive values indicate how late @id was relative to the clock
278 * (in which case this function will return #GST_CLOCK_EARLY).
279 * Negative values indicate how much time was spent waiting on the clock
280 * before this function returned.
281 *
282 * Params:
283 * id = The #GstClockID to wait on
284 * jitter = a pointer that will contain the jitter,
285 * can be %NULL.
286 *
287 * Returns: the result of the blocking wait. #GST_CLOCK_EARLY will be returned
288 * if the current clock time is past the time of @id, #GST_CLOCK_OK if
289 * @id was scheduled in time. #GST_CLOCK_UNSCHEDULED if @id was
290 * unscheduled with gst_clock_id_unschedule().
291 *
292 * MT safe.
293 */294 publicstaticGstClockReturnidWait(GstClockIDid, outGstClockTimeDiffjitter)
295 {
296 returngst_clock_id_wait(id, &jitter);
297 }
298 299 /**
300 * Register a callback on the given #GstClockID @id with the given
301 * function and user_data. When passing a #GstClockID with an invalid
302 * time to this function, the callback will be called immediately
303 * with a time set to GST_CLOCK_TIME_NONE. The callback will
304 * be called when the time of @id has been reached.
305 *
306 * The callback @func can be invoked from any thread, either provided by the
307 * core or from a streaming thread. The application should be prepared for this.
308 *
309 * Params:
310 * id = a #GstClockID to wait on
311 * func = The callback function
312 * userData = User data passed in the callback
313 * destroyData = #GDestroyNotify for user_data
314 *
315 * Returns: the result of the non blocking wait.
316 *
317 * MT safe.
318 */319 publicstaticGstClockReturnidWaitAsync(GstClockIDid, GstClockCallbackfunc, void* userData, GDestroyNotifydestroyData)
320 {
321 returngst_clock_id_wait_async(id, func, userData, destroyData);
322 }
323 324 /**
325 * The time @master of the master clock and the time @slave of the slave
326 * clock are added to the list of observations. If enough observations
327 * are available, a linear regression algorithm is run on the
328 * observations and @clock is recalibrated.
329 *
330 * If this functions returns %TRUE, @r_squared will contain the
331 * correlation coefficient of the interpolation. A value of 1.0
332 * means a perfect regression was performed. This value can
333 * be used to control the sampling frequency of the master and slave
334 * clocks.
335 *
336 * Params:
337 * slave = a time on the slave
338 * master = a time on the master
339 * rSquared = a pointer to hold the result
340 *
341 * Returns: %TRUE if enough observations were added to run the
342 * regression algorithm.
343 *
344 * MT safe.
345 */346 publicbooladdObservation(GstClockTimeslave, GstClockTimemaster, outdoublerSquared)
347 {
348 returngst_clock_add_observation(gstClock, slave, master, &rSquared) != 0;
349 }
350 351 /**
352 * Add a clock observation to the internal slaving algorithm the same as
353 * gst_clock_add_observation(), and return the result of the master clock
354 * estimation, without updating the internal calibration.
355 *
356 * The caller can then take the results and call gst_clock_set_calibration()
357 * with the values, or some modified version of them.
358 *
359 * Params:
360 * slave = a time on the slave
361 * master = a time on the master
362 * rSquared = a pointer to hold the result
363 * internal = a location to store the internal time
364 * external = a location to store the external time
365 * rateNum = a location to store the rate numerator
366 * rateDenom = a location to store the rate denominator
367 *
368 * Since: 1.6
369 */370 publicbooladdObservationUnapplied(GstClockTimeslave, GstClockTimemaster, outdoublerSquared, outGstClockTimeinternal, outGstClockTimeexternal, outGstClockTimerateNum, outGstClockTimerateDenom)
371 {
372 returngst_clock_add_observation_unapplied(gstClock, slave, master, &rSquared, &internal, &external, &rateNum, &rateDenom) != 0;
373 }
374 375 /**
376 * Converts the given @internal clock time to the external time, adjusting for the
377 * rate and reference time set with gst_clock_set_calibration() and making sure
378 * that the returned time is increasing. This function should be called with the
379 * clock's OBJECT_LOCK held and is mainly used by clock subclasses.
380 *
381 * This function is the reverse of gst_clock_unadjust_unlocked().
382 *
383 * Params:
384 * internal = a clock time
385 *
386 * Returns: the converted time of the clock.
387 */388 publicGstClockTimeadjustUnlocked(GstClockTimeinternal)
389 {
390 returngst_clock_adjust_unlocked(gstClock, internal);
391 }
392 393 /**
394 * Converts the given @internal_target clock time to the external time,
395 * using the passed calibration parameters. This function performs the
396 * same calculation as gst_clock_adjust_unlocked() when called using the
397 * current calibration parameters, but doesn't ensure a monotonically
398 * increasing result as gst_clock_adjust_unlocked() does.
399 *
400 * Note: The @clock parameter is unused and can be NULL
401 *
402 * Params:
403 * internalTarget = a clock time
404 * cinternal = a reference internal time
405 * cexternal = a reference external time
406 * cnum = the numerator of the rate of the clock relative to its
407 * internal time
408 * cdenom = the denominator of the rate of the clock
409 *
410 * Returns: the converted time of the clock.
411 *
412 * Since: 1.6
413 */414 publicGstClockTimeadjustWithCalibration(GstClockTimeinternalTarget, GstClockTimecinternal, GstClockTimecexternal, GstClockTimecnum, GstClockTimecdenom)
415 {
416 returngst_clock_adjust_with_calibration(gstClock, internalTarget, cinternal, cexternal, cnum, cdenom);
417 }
418 419 /**
420 * Gets the internal rate and reference time of @clock. See
421 * gst_clock_set_calibration() for more information.
422 *
423 * @internal, @external, @rate_num, and @rate_denom can be left %NULL if the
424 * caller is not interested in the values.
425 *
426 * MT safe.
427 *
428 * Params:
429 * internal = a location to store the internal time
430 * external = a location to store the external time
431 * rateNum = a location to store the rate numerator
432 * rateDenom = a location to store the rate denominator
433 */434 publicvoidgetCalibration(outGstClockTimeinternal, outGstClockTimeexternal, outGstClockTimerateNum, outGstClockTimerateDenom)
435 {
436 gst_clock_get_calibration(gstClock, &internal, &external, &rateNum, &rateDenom);
437 }
438 439 /**
440 * Gets the current internal time of the given clock. The time is returned
441 * unadjusted for the offset and the rate.
442 *
443 * Returns: the internal time of the clock. Or GST_CLOCK_TIME_NONE when
444 * given invalid input.
445 *
446 * MT safe.
447 */448 publicGstClockTimegetInternalTime()
449 {
450 returngst_clock_get_internal_time(gstClock);
451 }
452 453 /**
454 * Get the master clock that @clock is slaved to or %NULL when the clock is
455 * not slaved to any master clock.
456 *
457 * Returns: a master #GstClock or %NULL
458 * when this clock is not slaved to a master clock. Unref after
459 * usage.
460 *
461 * MT safe.
462 */463 publicClockgetMaster()
464 {
465 auto__p = gst_clock_get_master(gstClock);
466 467 if(__pisnull)
468 {
469 returnnull;
470 }
471 472 returnObjectG.getDObject!(Clock)(cast(GstClock*) __p, true);
473 }
474 475 /**
476 * Get the accuracy of the clock. The accuracy of the clock is the granularity
477 * of the values returned by gst_clock_get_time().
478 *
479 * Returns: the resolution of the clock in units of #GstClockTime.
480 *
481 * MT safe.
482 */483 publicGstClockTimegetResolution()
484 {
485 returngst_clock_get_resolution(gstClock);
486 }
487 488 /**
489 * Gets the current time of the given clock. The time is always
490 * monotonically increasing and adjusted according to the current
491 * offset and rate.
492 *
493 * Returns: the time of the clock. Or GST_CLOCK_TIME_NONE when
494 * given invalid input.
495 *
496 * MT safe.
497 */498 publicGstClockTimegetTime()
499 {
500 returngst_clock_get_time(gstClock);
501 }
502 503 /**
504 * Get the amount of time that master and slave clocks are sampled.
505 *
506 * Returns: the interval between samples.
507 */508 publicGstClockTimegetTimeout()
509 {
510 returngst_clock_get_timeout(gstClock);
511 }
512 513 /**
514 * Checks if the clock is currently synced.
515 *
516 * This returns if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is not set on the clock.
517 *
518 * Returns: %TRUE if the clock is currently synced
519 *
520 * Since: 1.6
521 */522 publicboolisSynced()
523 {
524 returngst_clock_is_synced(gstClock) != 0;
525 }
526 527 /**
528 * Get an ID from @clock to trigger a periodic notification.
529 * The periodic notifications will start at time @start_time and
530 * will then be fired with the given @interval. @id should be unreffed
531 * after usage.
532 *
533 * Free-function: gst_clock_id_unref
534 *
535 * Params:
536 * startTime = the requested start time
537 * interval = the requested interval
538 *
539 * Returns: a #GstClockID that can be used to request the
540 * time notification.
541 *
542 * MT safe.
543 */544 publicGstClockIDnewPeriodicId(GstClockTimestartTime, GstClockTimeinterval)
545 {
546 returngst_clock_new_periodic_id(gstClock, startTime, interval);
547 }
548 549 /**
550 * Get a #GstClockID from @clock to trigger a single shot
551 * notification at the requested time. The single shot id should be
552 * unreffed after usage.
553 *
554 * Free-function: gst_clock_id_unref
555 *
556 * Params:
557 * time = the requested time
558 *
559 * Returns: a #GstClockID that can be used to request the
560 * time notification.
561 *
562 * MT safe.
563 */564 publicGstClockIDnewSingleShotId(GstClockTimetime)
565 {
566 returngst_clock_new_single_shot_id(gstClock, time);
567 }
568 569 /**
570 * Reinitializes the provided periodic @id to the provided start time and
571 * interval. Does not modify the reference count.
572 *
573 * Params:
574 * id = a #GstClockID
575 * startTime = the requested start time
576 * interval = the requested interval
577 *
578 * Returns: %TRUE if the GstClockID could be reinitialized to the provided
579 * @time, else %FALSE.
580 */581 publicboolperiodicIdReinit(GstClockIDid, GstClockTimestartTime, GstClockTimeinterval)
582 {
583 returngst_clock_periodic_id_reinit(gstClock, id, startTime, interval) != 0;
584 }
585 586 /**
587 * Adjusts the rate and time of @clock. A rate of 1/1 is the normal speed of
588 * the clock. Values bigger than 1/1 make the clock go faster.
589 *
590 * @internal and @external are calibration parameters that arrange that
591 * gst_clock_get_time() should have been @external at internal time @internal.
592 * This internal time should not be in the future; that is, it should be less
593 * than the value of gst_clock_get_internal_time() when this function is called.
594 *
595 * Subsequent calls to gst_clock_get_time() will return clock times computed as
596 * follows:
597 *
598 * |[
599 * time = (internal_time - internal) * rate_num / rate_denom + external
600 * ]|
601 *
602 * This formula is implemented in gst_clock_adjust_unlocked(). Of course, it
603 * tries to do the integer arithmetic as precisely as possible.
604 *
605 * Note that gst_clock_get_time() always returns increasing values so when you
606 * move the clock backwards, gst_clock_get_time() will report the previous value
607 * until the clock catches up.
608 *
609 * MT safe.
610 *
611 * Params:
612 * internal = a reference internal time
613 * external = a reference external time
614 * rateNum = the numerator of the rate of the clock relative to its
615 * internal time
616 * rateDenom = the denominator of the rate of the clock
617 */618 publicvoidsetCalibration(GstClockTimeinternal, GstClockTimeexternal, GstClockTimerateNum, GstClockTimerateDenom)
619 {
620 gst_clock_set_calibration(gstClock, internal, external, rateNum, rateDenom);
621 }
622 623 /**
624 * Set @master as the master clock for @clock. @clock will be automatically
625 * calibrated so that gst_clock_get_time() reports the same time as the
626 * master clock.
627 *
628 * A clock provider that slaves its clock to a master can get the current
629 * calibration values with gst_clock_get_calibration().
630 *
631 * @master can be %NULL in which case @clock will not be slaved anymore. It will
632 * however keep reporting its time adjusted with the last configured rate
633 * and time offsets.
634 *
635 * Params:
636 * master = a master #GstClock
637 *
638 * Returns: %TRUE if the clock is capable of being slaved to a master clock.
639 * Trying to set a master on a clock without the
640 * #GST_CLOCK_FLAG_CAN_SET_MASTER flag will make this function return %FALSE.
641 *
642 * MT safe.
643 */644 publicboolsetMaster(Clockmaster)
645 {
646 returngst_clock_set_master(gstClock, (masterisnull) ? null : master.getClockStruct()) != 0;
647 }
648 649 /**
650 * Set the accuracy of the clock. Some clocks have the possibility to operate
651 * with different accuracy at the expense of more resource usage. There is
652 * normally no need to change the default resolution of a clock. The resolution
653 * of a clock can only be changed if the clock has the
654 * #GST_CLOCK_FLAG_CAN_SET_RESOLUTION flag set.
655 *
656 * Params:
657 * resolution = The resolution to set
658 *
659 * Returns: the new resolution of the clock.
660 */661 publicGstClockTimesetResolution(GstClockTimeresolution)
662 {
663 returngst_clock_set_resolution(gstClock, resolution);
664 }
665 666 /**
667 * Sets @clock to synced and emits the GstClock::synced signal, and wakes up any
668 * thread waiting in gst_clock_wait_for_sync().
669 *
670 * This function must only be called if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC
671 * is set on the clock, and is intended to be called by subclasses only.
672 *
673 * Params:
674 * synced = if the clock is synced
675 *
676 * Since: 1.6
677 */678 publicvoidsetSynced(boolsynced)
679 {
680 gst_clock_set_synced(gstClock, synced);
681 }
682 683 /**
684 * Set the amount of time, in nanoseconds, to sample master and slave
685 * clocks
686 *
687 * Params:
688 * timeout = a timeout
689 */690 publicvoidsetTimeout(GstClockTimetimeout)
691 {
692 gst_clock_set_timeout(gstClock, timeout);
693 }
694 695 /**
696 * Reinitializes the provided single shot @id to the provided time. Does not
697 * modify the reference count.
698 *
699 * Params:
700 * id = a #GstClockID
701 * time = The requested time.
702 *
703 * Returns: %TRUE if the GstClockID could be reinitialized to the provided
704 * @time, else %FALSE.
705 */706 publicboolsingleShotIdReinit(GstClockIDid, GstClockTimetime)
707 {
708 returngst_clock_single_shot_id_reinit(gstClock, id, time) != 0;
709 }
710 711 /**
712 * Converts the given @external clock time to the internal time of @clock,
713 * using the rate and reference time set with gst_clock_set_calibration().
714 * This function should be called with the clock's OBJECT_LOCK held and
715 * is mainly used by clock subclasses.
716 *
717 * This function is the reverse of gst_clock_adjust_unlocked().
718 *
719 * Params:
720 * external = an external clock time
721 *
722 * Returns: the internal time of the clock corresponding to @external.
723 */724 publicGstClockTimeunadjustUnlocked(GstClockTimeexternal)
725 {
726 returngst_clock_unadjust_unlocked(gstClock, external);
727 }
728 729 /**
730 * Converts the given @external_target clock time to the internal time,
731 * using the passed calibration parameters. This function performs the
732 * same calculation as gst_clock_unadjust_unlocked() when called using the
733 * current calibration parameters.
734 *
735 * Note: The @clock parameter is unused and can be NULL
736 *
737 * Params:
738 * externalTarget = a clock time
739 * cinternal = a reference internal time
740 * cexternal = a reference external time
741 * cnum = the numerator of the rate of the clock relative to its
742 * internal time
743 * cdenom = the denominator of the rate of the clock
744 *
745 * Returns: the converted time of the clock.
746 *
747 * Since: 1.8
748 */749 publicGstClockTimeunadjustWithCalibration(GstClockTimeexternalTarget, GstClockTimecinternal, GstClockTimecexternal, GstClockTimecnum, GstClockTimecdenom)
750 {
751 returngst_clock_unadjust_with_calibration(gstClock, externalTarget, cinternal, cexternal, cnum, cdenom);
752 }
753 754 /**
755 * Waits until @clock is synced for reporting the current time. If @timeout
756 * is %GST_CLOCK_TIME_NONE it will wait forever, otherwise it will time out
757 * after @timeout nanoseconds.
758 *
759 * For asynchronous waiting, the GstClock::synced signal can be used.
760 *
761 * This returns immediately with TRUE if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC
762 * is not set on the clock, or if the clock is already synced.
763 *
764 * Params:
765 * timeout = timeout for waiting or %GST_CLOCK_TIME_NONE
766 *
767 * Returns: %TRUE if waiting was successful, or %FALSE on timeout
768 *
769 * Since: 1.6
770 */771 publicboolwaitForSync(GstClockTimetimeout)
772 {
773 returngst_clock_wait_for_sync(gstClock, timeout) != 0;
774 }
775 776 /**
777 * Signaled on clocks with GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC set once
778 * the clock is synchronized, or when it completely lost synchronization.
779 * This signal will not be emitted on clocks without the flag.
780 *
781 * This signal will be emitted from an arbitrary thread, most likely not
782 * the application's main thread.
783 *
784 * Params:
785 * synced = if the clock is synced now
786 *
787 * Since: 1.6
788 */789 gulongaddOnSynced(voiddelegate(bool, Clock) dlg, ConnectFlagsconnectFlags=cast(ConnectFlags)0)
790 {
791 returnSignals.connect(this, "synced", dlg, connectFlags ^ ConnectFlags.SWAPPED);
792 }
793 }