48 typedef guint64 GstClockTime; |
48 typedef guint64 GstClockTime; |
49 |
49 |
50 /** |
50 /** |
51 * GST_TYPE_CLOCK_TIME: |
51 * GST_TYPE_CLOCK_TIME: |
52 * |
52 * |
53 * The #GType of a #GstClockTime. |
53 * The GType of a GstClockTime. |
54 */ |
54 */ |
55 #define GST_TYPE_CLOCK_TIME G_TYPE_UINT64 |
55 #define GST_TYPE_CLOCK_TIME G_TYPE_UINT64 |
56 |
56 |
57 /** |
57 /** |
58 * GstClockTimeDiff: |
58 * GstClockTimeDiff: |
59 * |
59 * |
60 * A datatype to hold a time difference, measured in nanoseconds. |
60 * A datatype to hold a timedifference, measured in nanoseconds. |
61 */ |
61 */ |
62 typedef gint64 GstClockTimeDiff; |
62 typedef gint64 GstClockTimeDiff; |
63 /** |
63 /** |
64 * GstClockID: |
64 * GstClockID: |
65 * |
65 * |
116 * Since: 0.10.16 |
116 * Since: 0.10.16 |
117 */ |
117 */ |
118 #define GST_TIME_AS_SECONDS(time) ((time) / GST_SECOND) |
118 #define GST_TIME_AS_SECONDS(time) ((time) / GST_SECOND) |
119 /** |
119 /** |
120 * GST_TIME_AS_MSECONDS: |
120 * GST_TIME_AS_MSECONDS: |
121 * @time: the time |
|
122 * |
121 * |
123 * Convert a #GstClockTime to milliseconds (1/1000 of a second). |
122 * Convert a #GstClockTime to milliseconds (1/1000 of a second). |
124 * |
123 * |
125 * Since: 0.10.16 |
124 * Since: 0.10.16 |
126 */ |
125 */ |
127 #define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000)) |
126 #define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000)) |
128 /** |
127 /** |
129 * GST_TIME_AS_USECONDS: |
128 * GST_TIME_TO_USECONDS: |
130 * @time: the time |
|
131 * |
129 * |
132 * Convert a #GstClockTime to microseconds (1/1000000 of a second). |
130 * Convert a #GstClockTime to microseconds (1/1000000 of a second). |
133 * |
131 * |
134 * Since: 0.10.16 |
132 * Since: 0.10.16 |
135 */ |
133 */ |
136 #define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000)) |
134 #define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000)) |
137 /** |
135 /** |
138 * GST_TIME_AS_NSECONDS: |
136 * GST_TIME_TO_NSECONDS: |
139 * @time: the time |
|
140 * |
137 * |
141 * Convert a #GstClockTime to nanoseconds (1/1000000000 of a second). |
138 * Convert a #GstClockTime to nanoseconds (1/1000000000 of a second). |
142 * |
139 * |
143 * Since: 0.10.16 |
140 * Since: 0.10.16 |
144 */ |
141 */ |
156 |
153 |
157 /** |
154 /** |
158 * GST_TIMEVAL_TO_TIME: |
155 * GST_TIMEVAL_TO_TIME: |
159 * @tv: the timeval to convert |
156 * @tv: the timeval to convert |
160 * |
157 * |
161 * Convert a #GTimeVal to a #GstClockTime. |
158 * Convert a GTimeVal to a #GstClockTime. |
162 */ |
159 */ |
163 #define GST_TIMEVAL_TO_TIME(tv) (GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND) |
160 #define GST_TIMEVAL_TO_TIME(tv) (GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND) |
164 |
161 |
165 /** |
162 /** |
166 * GST_TIME_TO_TIMEVAL: |
163 * GST_TIME_TO_TIMEVAL: |
167 * @t: The #GstClockTime to convert |
164 * @t: The GstClockTime to convert |
168 * @tv: The target timeval |
165 * @tv: The target timeval |
169 * |
166 * |
170 * Convert a #GstClockTime to a #GTimeVal |
167 * Note: on 32-bit systems, a timeval has a range of only 2^32 - 1 seconds, |
171 * |
|
172 * <note>on 32-bit systems, a timeval has a range of only 2^32 - 1 seconds, |
|
173 * which is about 68 years. Expect trouble if you want to schedule stuff |
168 * which is about 68 years. Expect trouble if you want to schedule stuff |
174 * in your pipeline for 2038.</note> |
169 * in your pipeline for 2038. |
|
170 * |
|
171 * Convert a GstClockTime to a GTimeVal |
175 */ |
172 */ |
176 #define GST_TIME_TO_TIMEVAL(t,tv) \ |
173 #define GST_TIME_TO_TIMEVAL(t,tv) \ |
177 G_STMT_START { \ |
174 G_STMT_START { \ |
178 (tv).tv_sec = ((GstClockTime) (t)) / GST_SECOND; \ |
175 (tv).tv_sec = ((GstClockTime) (t)) / GST_SECOND; \ |
179 (tv).tv_usec = (((GstClockTime) (t)) - \ |
176 (tv).tv_usec = (((GstClockTime) (t)) - \ |
188 * Convert a struct timespec (see man pselect) to a #GstClockTime. |
185 * Convert a struct timespec (see man pselect) to a #GstClockTime. |
189 */ |
186 */ |
190 #define GST_TIMESPEC_TO_TIME(ts) (GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND) |
187 #define GST_TIMESPEC_TO_TIME(ts) (GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND) |
191 /** |
188 /** |
192 * GST_TIME_TO_TIMESPEC: |
189 * GST_TIME_TO_TIMESPEC: |
193 * @t: The #GstClockTime to convert |
190 * @t: The GstClockTime to convert |
194 * @ts: The target timespec |
191 * @ts: The target timespec |
195 * |
192 * |
196 * Convert a #GstClockTime to a struct timespec (see man pselect) |
193 * Convert a #GstClockTime to a struct timespec (see man pselect) |
197 */ |
194 */ |
198 #define GST_TIME_TO_TIMESPEC(t,ts) \ |
195 #define GST_TIME_TO_TIMESPEC(t,ts) \ |
204 /* timestamp debugging macros */ |
201 /* timestamp debugging macros */ |
205 /** |
202 /** |
206 * GST_TIME_FORMAT: |
203 * GST_TIME_FORMAT: |
207 * |
204 * |
208 * A format that can be used in printf like format strings to format |
205 * A format that can be used in printf like format strings to format |
209 * a #GstClockTime value. |
206 * a GstClockTime value. |
210 */ |
207 */ |
211 #define GST_TIME_FORMAT "u:%02u:%02u.%09u" |
208 #define GST_TIME_FORMAT "u:%02u:%02u.%09u" |
212 /** |
209 /** |
213 * GST_TIME_ARGS: |
210 * GST_TIME_ARGS: |
214 * @t: a #GstClockTime |
211 * @t: a #GstClockTime |
233 #define GST_CLOCK_ENTRY_TRACE_NAME "GstClockEntry" |
230 #define GST_CLOCK_ENTRY_TRACE_NAME "GstClockEntry" |
234 |
231 |
235 typedef struct _GstClockEntry GstClockEntry; |
232 typedef struct _GstClockEntry GstClockEntry; |
236 typedef struct _GstClock GstClock; |
233 typedef struct _GstClock GstClock; |
237 typedef struct _GstClockClass GstClockClass; |
234 typedef struct _GstClockClass GstClockClass; |
238 typedef struct _GstClockPrivate GstClockPrivate; |
|
239 |
235 |
240 /* --- prototype for async callbacks --- */ |
236 /* --- prototype for async callbacks --- */ |
241 /** |
237 /** |
242 * GstClockCallback: |
238 * GstClockCallback: |
243 * @clock: The clock that triggered the callback |
239 * @clock: The clock that triggered the callback |
251 */ |
247 */ |
252 typedef gboolean (*GstClockCallback) (GstClock *clock, GstClockTime time, |
248 typedef gboolean (*GstClockCallback) (GstClock *clock, GstClockTime time, |
253 GstClockID id, gpointer user_data); |
249 GstClockID id, gpointer user_data); |
254 /** |
250 /** |
255 * GstClockReturn: |
251 * GstClockReturn: |
256 * @GST_CLOCK_OK: The operation succeeded. |
252 * @GST_CLOCK_OK: The operation succeded. |
257 * @GST_CLOCK_EARLY: The operation was scheduled too late. |
253 * @GST_CLOCK_EARLY: The operation was scheduled too late. |
258 * @GST_CLOCK_UNSCHEDULED: The clockID was unscheduled |
254 * @GST_CLOCK_UNSCHEDULED: The clockID was unscheduled |
259 * @GST_CLOCK_BUSY: The ClockID is busy |
255 * @GST_CLOCK_BUSY: The ClockID is busy |
260 * @GST_CLOCK_BADTIME: A bad time was provided to a function. |
256 * @GST_CLOCK_BADTIME: A bad time was provided to a function. |
261 * @GST_CLOCK_ERROR: An error occurred |
257 * @GST_CLOCK_ERROR: An error occured |
262 * @GST_CLOCK_UNSUPPORTED: Operation is not supported |
258 * @GST_CLOCK_UNSUPPORTED: Operation is not supported |
263 * |
259 * |
264 * The return value of a clock operation. |
260 * The return value of a clock operation. |
265 */ |
261 */ |
266 typedef enum |
262 typedef enum |
395 */ |
391 */ |
396 #define GST_CLOCK_WAIT(clock) g_cond_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock)) |
392 #define GST_CLOCK_WAIT(clock) g_cond_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock)) |
397 /** |
393 /** |
398 * GST_CLOCK_TIMED_WAIT: |
394 * GST_CLOCK_TIMED_WAIT: |
399 * @clock: the clock to wait on |
395 * @clock: the clock to wait on |
400 * @tv: a #GTimeVal to wait. |
396 * @tv: a GTimeVal to wait. |
401 * |
397 * |
402 * Wait on the clock until the entries changed or the specified timeout |
398 * Wait on the clock until the entries changed or the specified timeout |
403 * occurred. |
399 * occured. |
404 */ |
400 */ |
405 #define GST_CLOCK_TIMED_WAIT(clock,tv) g_cond_timed_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock),tv) |
401 #define GST_CLOCK_TIMED_WAIT(clock,tv) g_cond_timed_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock),tv) |
406 /** |
402 /** |
407 * GST_CLOCK_BROADCAST: |
403 * GST_CLOCK_BROADCAST: |
408 * @clock: the clock to broadcast |
404 * @clock: the clock to broadcast |
446 GstClockTime timeout; |
442 GstClockTime timeout; |
447 GstClockTime *times; |
443 GstClockTime *times; |
448 GstClockID clockid; |
444 GstClockID clockid; |
449 |
445 |
450 /*< private >*/ |
446 /*< private >*/ |
451 union { |
447 GstClockTime _gst_reserved[GST_PADDING]; |
452 GstClockPrivate *priv; |
|
453 GstClockTime _gst_reserved[GST_PADDING]; |
|
454 } ABI; |
|
455 }; |
448 }; |
456 |
449 |
457 /** |
450 /** |
458 * GstClockClass: |
451 * GstClockClass: |
459 * @parent_class: the parent class structure |
452 * @parent_class: the parent class structure |
460 * @change_resolution: change the resolution of the clock. Not all values might |
453 * @change_resolution: change the resolution of the clock. Not all values might |
461 * be acceptable. The new resolution should be returned. |
454 * be acceptable. The new resolution should be returned. |
462 * @get_resolution: get the resolution of the clock. |
455 * @get_resolution: get the resolution of the clock. |
463 * @get_internal_time: get the internal unadjusted time of the clock. |
456 * @get_internal_time: get the internal unadjusted time of the clock. |
464 * @wait: perform a blocking wait for the given #GstClockEntry. Deprecated, |
457 * @wait: perform a blocking wait for the given GstClockEntry. Deprecated, |
465 * implement @wait_jitter instead. |
458 * implement @wait_jitter instead. |
466 * @wait_async: perform an asynchronous wait for the given #GstClockEntry. |
459 * @wait_async: perform an asynchronous wait for the given GstClockEntry. |
467 * @unschedule: unblock a blocking or async wait operation. |
460 * @unschedule: unblock a blocking or async wait operation. |
468 * @wait_jitter: perform a blocking wait on the given #GstClockEntry and return |
461 * @wait_jitter: perform a blocking wait on the given GstClockEntry and return |
469 * the jitter. (Since: 0.10.10) |
462 * the jitter. (Since: 0.10.10) |
470 * |
463 * |
471 * GStreamer clock class. Override the vmethods to implement the clock |
464 * GStreamer clock class. Override the vmethods to implement the clock |
472 * functionality. |
465 * functionality. |
473 */ |
466 */ |