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