branch | RCL_3 |
changeset 29 | 567bb019e3e3 |
parent 0 | 0e761a78d257 |
child 30 | 7e817e7e631c |
6:9b2c3c7a1a9c | 29:567bb019e3e3 |
---|---|
55 #include "gstenumtypes.h" |
55 #include "gstenumtypes.h" |
56 #include "gstinfo.h" |
56 #include "gstinfo.h" |
57 #include "gstmessage.h" |
57 #include "gstmessage.h" |
58 #include "gsttaglist.h" |
58 #include "gsttaglist.h" |
59 #include "gstutils.h" |
59 #include "gstutils.h" |
60 #include "gstquark.h" |
|
60 |
61 |
61 #ifdef __SYMBIAN32__ |
62 #ifdef __SYMBIAN32__ |
62 #include <glib_global.h> |
63 #include <glib_global.h> |
63 #endif |
64 #endif |
64 |
65 |
65 |
66 #define GST_MESSAGE_SEQNUM(e) ((GstMessage*)e)->abidata.ABI.seqnum |
66 static void gst_message_init (GTypeInstance * instance, gpointer g_class); |
67 |
67 static void gst_message_class_init (gpointer g_class, gpointer class_data); |
|
68 static void gst_message_finalize (GstMessage * message); |
68 static void gst_message_finalize (GstMessage * message); |
69 static GstMessage *_gst_message_copy (GstMessage * message); |
69 static GstMessage *_gst_message_copy (GstMessage * message); |
70 |
70 |
71 static GstMiniObjectClass *parent_class = NULL; |
71 static GstMiniObjectClass *parent_class = NULL; |
72 #ifdef __SYMBIAN32__ |
72 #ifdef __SYMBIAN32__ |
114 {GST_MESSAGE_SEGMENT_DONE, "segment-done", 0}, |
114 {GST_MESSAGE_SEGMENT_DONE, "segment-done", 0}, |
115 {GST_MESSAGE_DURATION, "duration", 0}, |
115 {GST_MESSAGE_DURATION, "duration", 0}, |
116 {GST_MESSAGE_LATENCY, "latency", 0}, |
116 {GST_MESSAGE_LATENCY, "latency", 0}, |
117 {GST_MESSAGE_ASYNC_START, "async-start", 0}, |
117 {GST_MESSAGE_ASYNC_START, "async-start", 0}, |
118 {GST_MESSAGE_ASYNC_DONE, "async-done", 0}, |
118 {GST_MESSAGE_ASYNC_DONE, "async-done", 0}, |
119 {GST_MESSAGE_REQUEST_STATE, "request-state", 0}, |
|
120 {GST_MESSAGE_STEP_START, "step-start", 0}, |
|
119 {0, NULL, 0} |
121 {0, NULL, 0} |
120 }; |
122 }; |
121 |
123 |
122 /** |
124 /** |
123 * gst_message_type_get_name: |
125 * gst_message_type_get_name: |
164 if (type == message_quarks[i].type) |
166 if (type == message_quarks[i].type) |
165 return message_quarks[i].quark; |
167 return message_quarks[i].quark; |
166 } |
168 } |
167 return 0; |
169 return 0; |
168 } |
170 } |
169 #ifdef __SYMBIAN32__ |
171 |
170 EXPORT_C |
172 #define _do_init \ |
171 #endif |
173 { \ |
172 |
174 gint i; \ |
173 |
175 \ |
174 GType |
176 for (i = 0; message_quarks[i].name; i++) { \ |
175 gst_message_get_type (void) |
177 message_quarks[i].quark = \ |
176 { |
178 g_quark_from_static_string (message_quarks[i].name); \ |
177 static GType _gst_message_type; |
179 } \ |
178 |
180 } |
179 if (G_UNLIKELY (_gst_message_type == 0)) { |
181 |
180 gint i; |
182 G_DEFINE_TYPE_WITH_CODE (GstMessage, gst_message, GST_TYPE_MINI_OBJECT, |
181 static const GTypeInfo message_info = { |
183 _do_init); |
182 sizeof (GstMessageClass), |
|
183 NULL, |
|
184 NULL, |
|
185 gst_message_class_init, |
|
186 NULL, |
|
187 NULL, |
|
188 sizeof (GstMessage), |
|
189 0, |
|
190 gst_message_init, |
|
191 NULL |
|
192 }; |
|
193 |
|
194 _gst_message_type = g_type_register_static (GST_TYPE_MINI_OBJECT, |
|
195 "GstMessage", &message_info, 0); |
|
196 |
|
197 for (i = 0; message_quarks[i].name; i++) { |
|
198 message_quarks[i].quark = |
|
199 g_quark_from_static_string (message_quarks[i].name); |
|
200 } |
|
201 } |
|
202 return _gst_message_type; |
|
203 } |
|
204 |
184 |
205 static void |
185 static void |
206 gst_message_class_init (gpointer g_class, gpointer class_data) |
186 gst_message_class_init (GstMessageClass * klass) |
207 { |
187 { |
208 GstMessageClass *message_class = GST_MESSAGE_CLASS (g_class); |
188 parent_class = g_type_class_peek_parent (klass); |
209 |
189 |
210 parent_class = g_type_class_peek_parent (g_class); |
190 klass->mini_object_class.copy = (GstMiniObjectCopyFunction) _gst_message_copy; |
211 |
191 klass->mini_object_class.finalize = |
212 message_class->mini_object_class.copy = |
|
213 (GstMiniObjectCopyFunction) _gst_message_copy; |
|
214 message_class->mini_object_class.finalize = |
|
215 (GstMiniObjectFinalizeFunction) gst_message_finalize; |
192 (GstMiniObjectFinalizeFunction) gst_message_finalize; |
216 } |
193 } |
217 |
194 |
218 static void |
195 static void |
219 gst_message_init (GTypeInstance * instance, gpointer g_class) |
196 gst_message_init (GstMessage * message) |
220 { |
197 { |
221 GstMessage *message = GST_MESSAGE (instance); |
|
222 |
|
223 GST_CAT_LOG (GST_CAT_MESSAGE, "new message %p", message); |
198 GST_CAT_LOG (GST_CAT_MESSAGE, "new message %p", message); |
224 GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE; |
199 GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE; |
225 } |
200 } |
226 |
201 |
227 static void |
202 static void |
245 if (message->structure) { |
220 if (message->structure) { |
246 gst_structure_set_parent_refcount (message->structure, NULL); |
221 gst_structure_set_parent_refcount (message->structure, NULL); |
247 gst_structure_free (message->structure); |
222 gst_structure_free (message->structure); |
248 } |
223 } |
249 |
224 |
250 GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (message)); |
225 /* GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (message)); */ |
251 } |
226 } |
252 |
227 |
253 static GstMessage * |
228 static GstMessage * |
254 _gst_message_copy (GstMessage * message) |
229 _gst_message_copy (GstMessage * message) |
255 { |
230 { |
264 |
239 |
265 GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message); |
240 GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message); |
266 GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message); |
241 GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message); |
267 GST_MESSAGE_TYPE (copy) = GST_MESSAGE_TYPE (message); |
242 GST_MESSAGE_TYPE (copy) = GST_MESSAGE_TYPE (message); |
268 GST_MESSAGE_TIMESTAMP (copy) = GST_MESSAGE_TIMESTAMP (message); |
243 GST_MESSAGE_TIMESTAMP (copy) = GST_MESSAGE_TIMESTAMP (message); |
244 GST_MESSAGE_SEQNUM (copy) = GST_MESSAGE_SEQNUM (message); |
|
269 |
245 |
270 if (GST_MESSAGE_SRC (message)) { |
246 if (GST_MESSAGE_SRC (message)) { |
271 GST_MESSAGE_SRC (copy) = gst_object_ref (GST_MESSAGE_SRC (message)); |
247 GST_MESSAGE_SRC (copy) = gst_object_ref (GST_MESSAGE_SRC (message)); |
272 } |
248 } |
273 |
249 |
321 gst_structure_set_parent_refcount (structure, |
297 gst_structure_set_parent_refcount (structure, |
322 &message->mini_object.refcount); |
298 &message->mini_object.refcount); |
323 } |
299 } |
324 message->structure = structure; |
300 message->structure = structure; |
325 |
301 |
326 return message; |
302 GST_MESSAGE_SEQNUM (message) = gst_util_seqnum_next (); |
303 |
|
304 return message; |
|
305 } |
|
306 |
|
307 /** |
|
308 * gst_message_get_seqnum: |
|
309 * @message: A #GstMessage. |
|
310 * |
|
311 * Retrieve the sequence number of a message. |
|
312 * |
|
313 * Messages have ever-incrementing sequence numbers, which may also be set |
|
314 * explicitly via gst_message_set_seqnum(). Sequence numbers are typically used |
|
315 * to indicate that a message corresponds to some other set of messages or |
|
316 * events, for example a SEGMENT_DONE message corresponding to a SEEK event. It |
|
317 * is considered good practice to make this correspondence when possible, though |
|
318 * it is not required. |
|
319 * |
|
320 * Note that events and messages share the same sequence number incrementor; |
|
321 * two events or messages will never not have the same sequence number unless |
|
322 * that correspondence was made explicitly. |
|
323 * |
|
324 * Returns: The message's sequence number. |
|
325 * |
|
326 * MT safe. |
|
327 * |
|
328 * Since: 0.10.22 |
|
329 */ |
|
330 #ifdef __SYMBIAN32__ |
|
331 EXPORT_C |
|
332 #endif |
|
333 |
|
334 guint32 |
|
335 gst_message_get_seqnum (GstMessage * message) |
|
336 { |
|
337 g_return_val_if_fail (GST_IS_MESSAGE (message), -1); |
|
338 |
|
339 return GST_MESSAGE_SEQNUM (message); |
|
340 } |
|
341 |
|
342 /** |
|
343 * gst_message_set_seqnum: |
|
344 * @message: A #GstMessage. |
|
345 * @seqnum: A sequence number. |
|
346 * |
|
347 * Set the sequence number of a message. |
|
348 * |
|
349 * This function might be called by the creator of a message to indicate that |
|
350 * the message relates to other messages or events. See gst_message_get_seqnum() |
|
351 * for more information. |
|
352 * |
|
353 * MT safe. |
|
354 * |
|
355 * Since: 0.10.22 |
|
356 */ |
|
357 #ifdef __SYMBIAN32__ |
|
358 EXPORT_C |
|
359 #endif |
|
360 |
|
361 void |
|
362 gst_message_set_seqnum (GstMessage * message, guint32 seqnum) |
|
363 { |
|
364 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
365 |
|
366 GST_MESSAGE_SEQNUM (message) = seqnum; |
|
327 } |
367 } |
328 |
368 |
329 /** |
369 /** |
330 * gst_message_new_eos: |
370 * gst_message_new_eos: |
331 * @src: The object originating the message. |
371 * @src: The object originating the message. |
354 |
394 |
355 /** |
395 /** |
356 * gst_message_new_error: |
396 * gst_message_new_error: |
357 * @src: The object originating the message. |
397 * @src: The object originating the message. |
358 * @error: The GError for this message. |
398 * @error: The GError for this message. |
359 * @debug: A debugging string for something or other. |
399 * @debug: A debugging string. |
360 * |
400 * |
361 * Create a new error message. The message will copy @error and |
401 * Create a new error message. The message will copy @error and |
362 * @debug. This message is posted by element when a fatal event |
402 * @debug. This message is posted by element when a fatal event |
363 * occured. The pipeline will probably (partially) stop. The application |
403 * occured. The pipeline will probably (partially) stop. The application |
364 * receiving this message should stop the pipeline. |
404 * receiving this message should stop the pipeline. |
370 #ifdef __SYMBIAN32__ |
410 #ifdef __SYMBIAN32__ |
371 EXPORT_C |
411 EXPORT_C |
372 #endif |
412 #endif |
373 |
413 |
374 GstMessage * |
414 GstMessage * |
375 gst_message_new_error (GstObject * src, GError * error, gchar * debug) |
415 gst_message_new_error (GstObject * src, GError * error, const gchar * debug) |
376 { |
416 { |
377 GstMessage *message; |
417 GstMessage *message; |
378 |
418 GstStructure *structure; |
379 message = gst_message_new_custom (GST_MESSAGE_ERROR, src, |
419 |
380 gst_structure_new ("GstMessageError", "gerror", GST_TYPE_G_ERROR, error, |
420 structure = gst_structure_id_new (GST_QUARK (MESSAGE_ERROR), |
381 "debug", G_TYPE_STRING, debug, NULL)); |
421 GST_QUARK (GERROR), GST_TYPE_G_ERROR, error, |
422 GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL); |
|
423 message = gst_message_new_custom (GST_MESSAGE_ERROR, src, structure); |
|
382 |
424 |
383 return message; |
425 return message; |
384 } |
426 } |
385 |
427 |
386 /** |
428 /** |
387 * gst_message_new_warning: |
429 * gst_message_new_warning: |
388 * @src: The object originating the message. |
430 * @src: The object originating the message. |
389 * @error: The GError for this message. |
431 * @error: The GError for this message. |
390 * @debug: A debugging string for something or other. |
432 * @debug: A debugging string. |
391 * |
433 * |
392 * Create a new warning message. The message will make copies of @error and |
434 * Create a new warning message. The message will make copies of @error and |
393 * @debug. |
435 * @debug. |
394 * |
436 * |
395 * Returns: The new warning message. |
437 * Returns: The new warning message. |
399 #ifdef __SYMBIAN32__ |
441 #ifdef __SYMBIAN32__ |
400 EXPORT_C |
442 EXPORT_C |
401 #endif |
443 #endif |
402 |
444 |
403 GstMessage * |
445 GstMessage * |
404 gst_message_new_warning (GstObject * src, GError * error, gchar * debug) |
446 gst_message_new_warning (GstObject * src, GError * error, const gchar * debug) |
405 { |
447 { |
406 GstMessage *message; |
448 GstMessage *message; |
407 |
449 GstStructure *structure; |
408 message = gst_message_new_custom (GST_MESSAGE_WARNING, src, |
450 |
409 gst_structure_new ("GstMessageWarning", "gerror", GST_TYPE_G_ERROR, error, |
451 structure = gst_structure_id_new (GST_QUARK (MESSAGE_WARNING), |
410 "debug", G_TYPE_STRING, debug, NULL)); |
452 GST_QUARK (GERROR), GST_TYPE_G_ERROR, error, |
453 GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL); |
|
454 message = gst_message_new_custom (GST_MESSAGE_WARNING, src, structure); |
|
411 |
455 |
412 return message; |
456 return message; |
413 } |
457 } |
414 |
458 |
415 /** |
459 /** |
416 * gst_message_new_info: |
460 * gst_message_new_info: |
417 * @src: The object originating the message. |
461 * @src: The object originating the message. |
418 * @error: The GError for this message. |
462 * @error: The GError for this message. |
419 * @debug: A debugging string for something or other. |
463 * @debug: A debugging string. |
420 * |
464 * |
421 * Create a new info message. The message will make copies of @error and |
465 * Create a new info message. The message will make copies of @error and |
422 * @debug. |
466 * @debug. |
423 * |
467 * |
468 * MT safe. |
|
469 * |
|
424 * Returns: The new info message. |
470 * Returns: The new info message. |
425 * |
471 * |
426 * Since: 0.10.12 |
472 * Since: 0.10.12 |
427 * |
473 */ |
428 * MT safe. |
474 #ifdef __SYMBIAN32__ |
429 */ |
475 EXPORT_C |
430 #ifdef __SYMBIAN32__ |
476 #endif |
431 EXPORT_C |
477 |
432 #endif |
478 GstMessage * |
433 |
479 gst_message_new_info (GstObject * src, GError * error, const gchar * debug) |
434 GstMessage * |
480 { |
435 gst_message_new_info (GstObject * src, GError * error, gchar * debug) |
481 GstMessage *message; |
436 { |
482 GstStructure *structure; |
437 GstMessage *message; |
483 |
438 |
484 structure = gst_structure_id_new (GST_QUARK (MESSAGE_INFO), |
439 message = gst_message_new_custom (GST_MESSAGE_INFO, src, |
485 GST_QUARK (GERROR), GST_TYPE_G_ERROR, error, |
440 gst_structure_new ("GstMessageInfo", "gerror", GST_TYPE_G_ERROR, error, |
486 GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL); |
441 "debug", G_TYPE_STRING, debug, NULL)); |
487 message = gst_message_new_custom (GST_MESSAGE_INFO, src, structure); |
442 |
488 |
443 return message; |
489 return message; |
444 } |
490 } |
445 |
491 |
446 /** |
492 /** |
466 |
512 |
467 g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL); |
513 g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL); |
468 |
514 |
469 message = |
515 message = |
470 gst_message_new_custom (GST_MESSAGE_TAG, src, (GstStructure *) tag_list); |
516 gst_message_new_custom (GST_MESSAGE_TAG, src, (GstStructure *) tag_list); |
517 |
|
518 return message; |
|
519 } |
|
520 |
|
521 /** |
|
522 * gst_message_new_tag_full: |
|
523 * @src: The object originating the message. |
|
524 * @pad: The originating pad for the tag. |
|
525 * @tag_list: The tag list for the message. |
|
526 * |
|
527 * Create a new tag message. The message will take ownership of the tag list. |
|
528 * The message is posted by elements that discovered a new taglist. |
|
529 * |
|
530 * MT safe. |
|
531 * |
|
532 * Returns: The new tag message. |
|
533 * |
|
534 * Since: 0.10.24 |
|
535 */ |
|
536 #ifdef __SYMBIAN32__ |
|
537 EXPORT_C |
|
538 #endif |
|
539 |
|
540 GstMessage * |
|
541 gst_message_new_tag_full (GstObject * src, GstPad * pad, GstTagList * tag_list) |
|
542 { |
|
543 GstMessage *message; |
|
544 GstStructure *s; |
|
545 |
|
546 g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL); |
|
547 g_return_val_if_fail (pad == NULL || GST_IS_PAD (pad), NULL); |
|
548 |
|
549 s = (GstStructure *) tag_list; |
|
550 if (pad) |
|
551 gst_structure_set (s, "source-pad", GST_TYPE_PAD, pad, NULL); |
|
552 |
|
553 message = gst_message_new_custom (GST_MESSAGE_TAG, src, s); |
|
471 |
554 |
472 return message; |
555 return message; |
473 } |
556 } |
474 |
557 |
475 /** |
558 /** |
486 * The application must be prepared to receive BUFFERING messages in the |
569 * The application must be prepared to receive BUFFERING messages in the |
487 * PREROLLING state and may only set the pipeline to PLAYING after receiving a |
570 * PREROLLING state and may only set the pipeline to PLAYING after receiving a |
488 * message with @percent set to 100, which can happen after the pipeline |
571 * message with @percent set to 100, which can happen after the pipeline |
489 * completed prerolling. |
572 * completed prerolling. |
490 * |
573 * |
574 * MT safe. |
|
575 * |
|
491 * Returns: The new buffering message. |
576 * Returns: The new buffering message. |
492 * |
577 * |
493 * Since: 0.10.11 |
578 * Since: 0.10.11 |
494 * |
|
495 * MT safe. |
|
496 */ |
579 */ |
497 #ifdef __SYMBIAN32__ |
580 #ifdef __SYMBIAN32__ |
498 EXPORT_C |
581 EXPORT_C |
499 #endif |
582 #endif |
500 |
583 |
501 GstMessage * |
584 GstMessage * |
502 gst_message_new_buffering (GstObject * src, gint percent) |
585 gst_message_new_buffering (GstObject * src, gint percent) |
503 { |
586 { |
504 GstMessage *message; |
587 GstMessage *message; |
588 GstStructure *structure; |
|
505 |
589 |
506 g_return_val_if_fail (percent >= 0 && percent <= 100, NULL); |
590 g_return_val_if_fail (percent >= 0 && percent <= 100, NULL); |
507 |
591 |
508 message = gst_message_new_custom (GST_MESSAGE_BUFFERING, src, |
592 structure = gst_structure_id_new (GST_QUARK (MESSAGE_BUFFERING), |
509 gst_structure_new ("GstMessageBuffering", |
593 GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, |
510 "buffer-percent", G_TYPE_INT, percent, NULL)); |
594 GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM, |
595 GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1, |
|
596 GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1, |
|
597 GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, G_GINT64_CONSTANT (-1), |
|
598 GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); |
|
599 message = gst_message_new_custom (GST_MESSAGE_BUFFERING, src, structure); |
|
511 |
600 |
512 return message; |
601 return message; |
513 } |
602 } |
514 |
603 |
515 /** |
604 /** |
533 GstMessage * |
622 GstMessage * |
534 gst_message_new_state_changed (GstObject * src, |
623 gst_message_new_state_changed (GstObject * src, |
535 GstState oldstate, GstState newstate, GstState pending) |
624 GstState oldstate, GstState newstate, GstState pending) |
536 { |
625 { |
537 GstMessage *message; |
626 GstMessage *message; |
538 |
627 GstStructure *structure; |
539 message = gst_message_new_custom (GST_MESSAGE_STATE_CHANGED, src, |
628 |
540 gst_structure_new ("GstMessageState", |
629 structure = gst_structure_id_new (GST_QUARK (MESSAGE_STATE), |
541 "old-state", GST_TYPE_STATE, (gint) oldstate, |
630 GST_QUARK (OLD_STATE), GST_TYPE_STATE, (gint) oldstate, |
542 "new-state", GST_TYPE_STATE, (gint) newstate, |
631 GST_QUARK (NEW_STATE), GST_TYPE_STATE, (gint) newstate, |
543 "pending-state", GST_TYPE_STATE, (gint) pending, NULL)); |
632 GST_QUARK (PENDING_STATE), GST_TYPE_STATE, (gint) pending, NULL); |
633 message = gst_message_new_custom (GST_MESSAGE_STATE_CHANGED, src, structure); |
|
544 |
634 |
545 return message; |
635 return message; |
546 } |
636 } |
547 |
637 |
548 /** |
638 /** |
595 GstMessage * |
685 GstMessage * |
596 gst_message_new_clock_provide (GstObject * src, GstClock * clock, |
686 gst_message_new_clock_provide (GstObject * src, GstClock * clock, |
597 gboolean ready) |
687 gboolean ready) |
598 { |
688 { |
599 GstMessage *message; |
689 GstMessage *message; |
600 |
690 GstStructure *structure; |
601 message = gst_message_new_custom (GST_MESSAGE_CLOCK_PROVIDE, src, |
691 |
602 gst_structure_new ("GstMessageClockProvide", |
692 structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_PROVIDE), |
603 "clock", GST_TYPE_CLOCK, clock, |
693 GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, |
604 "ready", G_TYPE_BOOLEAN, ready, NULL)); |
694 GST_QUARK (READY), G_TYPE_BOOLEAN, ready, NULL); |
695 message = gst_message_new_custom (GST_MESSAGE_CLOCK_PROVIDE, src, structure); |
|
605 |
696 |
606 return message; |
697 return message; |
607 } |
698 } |
608 |
699 |
609 /** |
700 /** |
628 |
719 |
629 GstMessage * |
720 GstMessage * |
630 gst_message_new_clock_lost (GstObject * src, GstClock * clock) |
721 gst_message_new_clock_lost (GstObject * src, GstClock * clock) |
631 { |
722 { |
632 GstMessage *message; |
723 GstMessage *message; |
633 |
724 GstStructure *structure; |
634 message = gst_message_new_custom (GST_MESSAGE_CLOCK_LOST, src, |
725 |
635 gst_structure_new ("GstMessageClockLost", |
726 structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_LOST), |
636 "clock", GST_TYPE_CLOCK, clock, NULL)); |
727 GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL); |
728 message = gst_message_new_custom (GST_MESSAGE_CLOCK_LOST, src, structure); |
|
637 |
729 |
638 return message; |
730 return message; |
639 } |
731 } |
640 |
732 |
641 /** |
733 /** |
656 |
748 |
657 GstMessage * |
749 GstMessage * |
658 gst_message_new_new_clock (GstObject * src, GstClock * clock) |
750 gst_message_new_new_clock (GstObject * src, GstClock * clock) |
659 { |
751 { |
660 GstMessage *message; |
752 GstMessage *message; |
661 |
753 GstStructure *structure; |
662 message = gst_message_new_custom (GST_MESSAGE_NEW_CLOCK, src, |
754 |
663 gst_structure_new ("GstMessageNewClock", |
755 structure = gst_structure_id_new (GST_QUARK (MESSAGE_NEW_CLOCK), |
664 "clock", GST_TYPE_CLOCK, clock, NULL)); |
756 GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL); |
757 message = gst_message_new_custom (GST_MESSAGE_NEW_CLOCK, src, structure); |
|
758 |
|
759 return message; |
|
760 } |
|
761 |
|
762 /** |
|
763 * gst_message_new_structure_change: |
|
764 * @src: The object originating the message. |
|
765 * @type: The change type. |
|
766 * @owner: The owner element of @src. |
|
767 * @busy: Whether the structure change is busy. |
|
768 * |
|
769 * Create a new structure change message. This message is posted when the |
|
770 * structure of a pipeline is in the process of being changed, for example |
|
771 * when pads are linked or unlinked. |
|
772 * |
|
773 * @src should be the srcpad that unlinked or linked. |
|
774 * |
|
775 * Returns: The new structure change message. |
|
776 * |
|
777 * MT safe. |
|
778 * |
|
779 * Since: 0.10.22. |
|
780 */ |
|
781 #ifdef __SYMBIAN32__ |
|
782 EXPORT_C |
|
783 #endif |
|
784 |
|
785 GstMessage * |
|
786 gst_message_new_structure_change (GstObject * src, GstStructureChangeType type, |
|
787 GstElement * owner, gboolean busy) |
|
788 { |
|
789 GstMessage *message; |
|
790 GstStructure *structure; |
|
791 |
|
792 g_return_val_if_fail (GST_IS_PAD (src), NULL); |
|
793 g_return_val_if_fail (GST_PAD_DIRECTION (src) == GST_PAD_SRC, NULL); |
|
794 g_return_val_if_fail (GST_IS_ELEMENT (owner), NULL); |
|
795 |
|
796 structure = gst_structure_id_new (GST_QUARK (MESSAGE_STRUCTURE_CHANGE), |
|
797 GST_QUARK (TYPE), GST_TYPE_STRUCTURE_CHANGE_TYPE, type, |
|
798 GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner, |
|
799 GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, NULL); |
|
800 |
|
801 message = gst_message_new_custom (GST_MESSAGE_STRUCTURE_CHANGE, src, |
|
802 structure); |
|
665 |
803 |
666 return message; |
804 return message; |
667 } |
805 } |
668 |
806 |
669 /** |
807 /** |
688 GstMessage * |
826 GstMessage * |
689 gst_message_new_segment_start (GstObject * src, GstFormat format, |
827 gst_message_new_segment_start (GstObject * src, GstFormat format, |
690 gint64 position) |
828 gint64 position) |
691 { |
829 { |
692 GstMessage *message; |
830 GstMessage *message; |
693 |
831 GstStructure *structure; |
694 message = gst_message_new_custom (GST_MESSAGE_SEGMENT_START, src, |
832 |
695 gst_structure_new ("GstMessageSegmentStart", |
833 structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_START), |
696 "format", GST_TYPE_FORMAT, format, |
834 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
697 "position", G_TYPE_INT64, position, NULL)); |
835 GST_QUARK (POSITION), G_TYPE_INT64, position, NULL); |
836 message = gst_message_new_custom (GST_MESSAGE_SEGMENT_START, src, structure); |
|
698 |
837 |
699 return message; |
838 return message; |
700 } |
839 } |
701 |
840 |
702 /** |
841 /** |
721 GstMessage * |
860 GstMessage * |
722 gst_message_new_segment_done (GstObject * src, GstFormat format, |
861 gst_message_new_segment_done (GstObject * src, GstFormat format, |
723 gint64 position) |
862 gint64 position) |
724 { |
863 { |
725 GstMessage *message; |
864 GstMessage *message; |
726 |
865 GstStructure *structure; |
727 message = gst_message_new_custom (GST_MESSAGE_SEGMENT_DONE, src, |
866 |
728 gst_structure_new ("GstMessageSegmentDone", |
867 structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_DONE), |
729 "format", GST_TYPE_FORMAT, format, |
868 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
730 "position", G_TYPE_INT64, position, NULL)); |
869 GST_QUARK (POSITION), G_TYPE_INT64, position, NULL); |
870 message = gst_message_new_custom (GST_MESSAGE_SEGMENT_DONE, src, structure); |
|
731 |
871 |
732 return message; |
872 return message; |
733 } |
873 } |
734 |
874 |
735 /** |
875 /** |
804 |
944 |
805 GstMessage * |
945 GstMessage * |
806 gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration) |
946 gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration) |
807 { |
947 { |
808 GstMessage *message; |
948 GstMessage *message; |
809 |
949 GstStructure *structure; |
810 message = gst_message_new_custom (GST_MESSAGE_DURATION, src, |
950 |
811 gst_structure_new ("GstMessageDuration", |
951 structure = gst_structure_id_new (GST_QUARK (MESSAGE_DURATION), |
812 "format", GST_TYPE_FORMAT, format, |
952 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
813 "duration", G_TYPE_INT64, duration, NULL)); |
953 GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL); |
954 message = gst_message_new_custom (GST_MESSAGE_DURATION, src, structure); |
|
814 |
955 |
815 return message; |
956 return message; |
816 } |
957 } |
817 |
958 |
818 /** |
959 /** |
836 |
977 |
837 GstMessage * |
978 GstMessage * |
838 gst_message_new_async_start (GstObject * src, gboolean new_base_time) |
979 gst_message_new_async_start (GstObject * src, gboolean new_base_time) |
839 { |
980 { |
840 GstMessage *message; |
981 GstMessage *message; |
841 |
982 GstStructure *structure; |
842 message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src, |
983 |
843 gst_structure_new ("GstMessageAsyncStart", |
984 structure = gst_structure_id_new (GST_QUARK (MESSAGE_ASYNC_START), |
844 "new-base-time", G_TYPE_BOOLEAN, new_base_time, NULL)); |
985 GST_QUARK (NEW_BASE_TIME), G_TYPE_BOOLEAN, new_base_time, NULL); |
986 message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src, structure); |
|
845 |
987 |
846 return message; |
988 return message; |
847 } |
989 } |
848 |
990 |
849 /** |
991 /** |
893 gst_message_new_latency (GstObject * src) |
1035 gst_message_new_latency (GstObject * src) |
894 { |
1036 { |
895 GstMessage *message; |
1037 GstMessage *message; |
896 |
1038 |
897 message = gst_message_new_custom (GST_MESSAGE_LATENCY, src, NULL); |
1039 message = gst_message_new_custom (GST_MESSAGE_LATENCY, src, NULL); |
1040 |
|
1041 return message; |
|
1042 } |
|
1043 |
|
1044 /** |
|
1045 * gst_message_new_request_state: |
|
1046 * @src: The object originating the message. |
|
1047 * @state: The new requested state |
|
1048 * |
|
1049 * This message can be posted by elements when they want to have their state |
|
1050 * changed. A typical use case would be an audio server that wants to pause the |
|
1051 * pipeline because a higher priority stream is being played. |
|
1052 * |
|
1053 * Returns: The new requst state message. |
|
1054 * |
|
1055 * MT safe. |
|
1056 * |
|
1057 * Since: 0.10.23 |
|
1058 */ |
|
1059 #ifdef __SYMBIAN32__ |
|
1060 EXPORT_C |
|
1061 #endif |
|
1062 |
|
1063 GstMessage * |
|
1064 gst_message_new_request_state (GstObject * src, GstState state) |
|
1065 { |
|
1066 GstMessage *message; |
|
1067 GstStructure *structure; |
|
1068 |
|
1069 structure = gst_structure_id_new (GST_QUARK (MESSAGE_REQUEST_STATE), |
|
1070 GST_QUARK (NEW_STATE), GST_TYPE_STATE, (gint) state, NULL); |
|
1071 message = gst_message_new_custom (GST_MESSAGE_REQUEST_STATE, src, structure); |
|
898 |
1072 |
899 return message; |
1073 return message; |
900 } |
1074 } |
901 |
1075 |
902 /** |
1076 /** |
938 #endif |
1112 #endif |
939 |
1113 |
940 void |
1114 void |
941 gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list) |
1115 gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list) |
942 { |
1116 { |
1117 GstStructure *ret; |
|
1118 |
|
943 g_return_if_fail (GST_IS_MESSAGE (message)); |
1119 g_return_if_fail (GST_IS_MESSAGE (message)); |
944 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG); |
1120 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG); |
945 g_return_if_fail (tag_list != NULL); |
1121 g_return_if_fail (tag_list != NULL); |
946 |
1122 |
947 *tag_list = (GstTagList *) gst_structure_copy (message->structure); |
1123 ret = gst_structure_copy (message->structure); |
1124 gst_structure_remove_field (ret, "source-pad"); |
|
1125 |
|
1126 *tag_list = (GstTagList *) ret; |
|
1127 } |
|
1128 |
|
1129 /** |
|
1130 * gst_message_parse_tag_full: |
|
1131 * @message: A valid #GstMessage of type GST_MESSAGE_TAG. |
|
1132 * @pad: Location where the originating pad is stored, unref after usage |
|
1133 * @tag_list: Return location for the tag-list. |
|
1134 * |
|
1135 * Extracts the tag list from the GstMessage. The tag list returned in the |
|
1136 * output argument is a copy; the caller must free it when done. |
|
1137 * |
|
1138 * MT safe. |
|
1139 * |
|
1140 * Since: 0.10.24 |
|
1141 */ |
|
1142 #ifdef __SYMBIAN32__ |
|
1143 EXPORT_C |
|
1144 #endif |
|
1145 |
|
1146 void |
|
1147 gst_message_parse_tag_full (GstMessage * message, GstPad ** pad, |
|
1148 GstTagList ** tag_list) |
|
1149 { |
|
1150 GstStructure *ret; |
|
1151 |
|
1152 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
1153 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG); |
|
1154 g_return_if_fail (tag_list != NULL); |
|
1155 |
|
1156 ret = gst_structure_copy (message->structure); |
|
1157 |
|
1158 if (gst_structure_has_field (ret, "source-pad") && pad) { |
|
1159 const GValue *v; |
|
1160 |
|
1161 v = gst_structure_get_value (ret, "source-pad"); |
|
1162 if (v && G_VALUE_HOLDS (v, GST_TYPE_PAD)) |
|
1163 *pad = (GstPad*)g_value_dup_object (v); |
|
1164 else |
|
1165 *pad = NULL; |
|
1166 } else if (pad) { |
|
1167 *pad = NULL; |
|
1168 } |
|
1169 gst_structure_remove_field (ret, "source-pad"); |
|
1170 |
|
1171 *tag_list = (GstTagList *) ret; |
|
948 } |
1172 } |
949 |
1173 |
950 /** |
1174 /** |
951 * gst_message_parse_buffering: |
1175 * gst_message_parse_buffering: |
952 * @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING. |
1176 * @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING. |
953 * @percent: Return location for the percent. |
1177 * @percent: Return location for the percent. |
954 * |
1178 * |
955 * Extracts the buffering percent from the GstMessage. see also |
1179 * Extracts the buffering percent from the GstMessage. see also |
956 * gst_message_new_buffering(). |
1180 * gst_message_new_buffering(). |
957 * |
1181 * |
1182 * MT safe. |
|
1183 * |
|
958 * Since: 0.10.11 |
1184 * Since: 0.10.11 |
959 * |
|
960 * MT safe. |
|
961 */ |
1185 */ |
962 #ifdef __SYMBIAN32__ |
1186 #ifdef __SYMBIAN32__ |
963 EXPORT_C |
1187 EXPORT_C |
964 #endif |
1188 #endif |
965 |
1189 |
968 { |
1192 { |
969 g_return_if_fail (GST_IS_MESSAGE (message)); |
1193 g_return_if_fail (GST_IS_MESSAGE (message)); |
970 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING); |
1194 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING); |
971 |
1195 |
972 if (percent) |
1196 if (percent) |
973 gst_structure_get_int (message->structure, "buffer-percent", percent); |
1197 *percent = g_value_get_int (gst_structure_id_get_value (message->structure, |
1198 GST_QUARK (BUFFER_PERCENT))); |
|
1199 } |
|
1200 |
|
1201 /** |
|
1202 * gst_message_set_buffering_stats: |
|
1203 * @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING. |
|
1204 * @mode: a buffering mode |
|
1205 * @avg_in: the average input rate |
|
1206 * @avg_out: the average output rate |
|
1207 * @buffering_left: amount of buffering time left in milliseconds |
|
1208 * |
|
1209 * Configures the buffering stats values in @message. |
|
1210 * |
|
1211 * Since: 0.10.20 |
|
1212 */ |
|
1213 #ifdef __SYMBIAN32__ |
|
1214 EXPORT_C |
|
1215 #endif |
|
1216 |
|
1217 void |
|
1218 gst_message_set_buffering_stats (GstMessage * message, GstBufferingMode mode, |
|
1219 gint avg_in, gint avg_out, gint64 buffering_left) |
|
1220 { |
|
1221 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING); |
|
1222 |
|
1223 gst_structure_id_set (message->structure, |
|
1224 GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode, |
|
1225 GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in, |
|
1226 GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out, |
|
1227 GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL); |
|
1228 } |
|
1229 |
|
1230 /** |
|
1231 * gst_message_parse_buffering_stats: |
|
1232 * @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING. |
|
1233 * @mode: a buffering mode |
|
1234 * @avg_in: the average input rate |
|
1235 * @avg_out: the average output rate |
|
1236 * @buffering_left: amount of buffering time left in milliseconds. |
|
1237 * |
|
1238 * Extracts the buffering stats values from @message. |
|
1239 * |
|
1240 * Since: 0.10.20 |
|
1241 */ |
|
1242 #ifdef __SYMBIAN32__ |
|
1243 EXPORT_C |
|
1244 #endif |
|
1245 |
|
1246 void |
|
1247 gst_message_parse_buffering_stats (GstMessage * message, |
|
1248 GstBufferingMode * mode, gint * avg_in, gint * avg_out, |
|
1249 gint64 * buffering_left) |
|
1250 { |
|
1251 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING); |
|
1252 |
|
1253 if (mode) |
|
1254 *mode = g_value_get_enum (gst_structure_id_get_value (message->structure, |
|
1255 GST_QUARK (BUFFERING_MODE))); |
|
1256 if (avg_in) |
|
1257 *avg_in = g_value_get_int (gst_structure_id_get_value (message->structure, |
|
1258 GST_QUARK (AVG_IN_RATE))); |
|
1259 if (avg_out) |
|
1260 *avg_out = g_value_get_int (gst_structure_id_get_value (message->structure, |
|
1261 GST_QUARK (AVG_OUT_RATE))); |
|
1262 if (buffering_left) |
|
1263 *buffering_left = |
|
1264 g_value_get_int64 (gst_structure_id_get_value (message->structure, |
|
1265 GST_QUARK (BUFFERING_LEFT))); |
|
974 } |
1266 } |
975 |
1267 |
976 /** |
1268 /** |
977 * gst_message_parse_state_changed: |
1269 * gst_message_parse_state_changed: |
978 * @message: a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED |
1270 * @message: a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED |
994 { |
1286 { |
995 g_return_if_fail (GST_IS_MESSAGE (message)); |
1287 g_return_if_fail (GST_IS_MESSAGE (message)); |
996 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED); |
1288 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED); |
997 |
1289 |
998 if (oldstate) |
1290 if (oldstate) |
999 gst_structure_get_enum (message->structure, "old-state", |
1291 *oldstate = |
1000 GST_TYPE_STATE, (gint *) oldstate); |
1292 g_value_get_enum (gst_structure_id_get_value (message->structure, |
1293 GST_QUARK (OLD_STATE))); |
|
1001 if (newstate) |
1294 if (newstate) |
1002 gst_structure_get_enum (message->structure, "new-state", |
1295 *newstate = |
1003 GST_TYPE_STATE, (gint *) newstate); |
1296 g_value_get_enum (gst_structure_id_get_value (message->structure, |
1297 GST_QUARK (NEW_STATE))); |
|
1004 if (pending) |
1298 if (pending) |
1005 gst_structure_get_enum (message->structure, "pending-state", |
1299 *pending = g_value_get_enum (gst_structure_id_get_value (message->structure, |
1006 GST_TYPE_STATE, (gint *) pending); |
1300 GST_QUARK (PENDING_STATE))); |
1007 } |
1301 } |
1008 |
1302 |
1009 /** |
1303 /** |
1010 * gst_message_parse_clock_provide: |
1304 * gst_message_parse_clock_provide: |
1011 * @message: A valid #GstMessage of type GST_MESSAGE_CLOCK_PROVIDE. |
1305 * @message: A valid #GstMessage of type GST_MESSAGE_CLOCK_PROVIDE. |
1028 const GValue *clock_gvalue; |
1322 const GValue *clock_gvalue; |
1029 |
1323 |
1030 g_return_if_fail (GST_IS_MESSAGE (message)); |
1324 g_return_if_fail (GST_IS_MESSAGE (message)); |
1031 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_PROVIDE); |
1325 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_PROVIDE); |
1032 |
1326 |
1033 clock_gvalue = gst_structure_get_value (message->structure, "clock"); |
1327 clock_gvalue = |
1328 gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK)); |
|
1034 g_return_if_fail (clock_gvalue != NULL); |
1329 g_return_if_fail (clock_gvalue != NULL); |
1035 g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); |
1330 g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); |
1036 |
1331 |
1037 if (ready) |
1332 if (ready) |
1038 gst_structure_get_boolean (message->structure, "ready", ready); |
1333 *ready = |
1334 g_value_get_boolean (gst_structure_id_get_value (message->structure, |
|
1335 GST_QUARK (READY))); |
|
1039 if (clock) |
1336 if (clock) |
1040 *clock = (GstClock *) g_value_get_object (clock_gvalue); |
1337 *clock = (GstClock *) g_value_get_object (clock_gvalue); |
1041 } |
1338 } |
1042 |
1339 |
1043 /** |
1340 /** |
1060 const GValue *clock_gvalue; |
1357 const GValue *clock_gvalue; |
1061 |
1358 |
1062 g_return_if_fail (GST_IS_MESSAGE (message)); |
1359 g_return_if_fail (GST_IS_MESSAGE (message)); |
1063 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_LOST); |
1360 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_LOST); |
1064 |
1361 |
1065 clock_gvalue = gst_structure_get_value (message->structure, "clock"); |
1362 clock_gvalue = |
1363 gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK)); |
|
1066 g_return_if_fail (clock_gvalue != NULL); |
1364 g_return_if_fail (clock_gvalue != NULL); |
1067 g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); |
1365 g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); |
1068 |
1366 |
1069 if (clock) |
1367 if (clock) |
1070 *clock = (GstClock *) g_value_get_object (clock_gvalue); |
1368 *clock = (GstClock *) g_value_get_object (clock_gvalue); |
1090 const GValue *clock_gvalue; |
1388 const GValue *clock_gvalue; |
1091 |
1389 |
1092 g_return_if_fail (GST_IS_MESSAGE (message)); |
1390 g_return_if_fail (GST_IS_MESSAGE (message)); |
1093 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_NEW_CLOCK); |
1391 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_NEW_CLOCK); |
1094 |
1392 |
1095 clock_gvalue = gst_structure_get_value (message->structure, "clock"); |
1393 clock_gvalue = |
1394 gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK)); |
|
1096 g_return_if_fail (clock_gvalue != NULL); |
1395 g_return_if_fail (clock_gvalue != NULL); |
1097 g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); |
1396 g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK); |
1098 |
1397 |
1099 if (clock) |
1398 if (clock) |
1100 *clock = (GstClock *) g_value_get_object (clock_gvalue); |
1399 *clock = (GstClock *) g_value_get_object (clock_gvalue); |
1400 } |
|
1401 |
|
1402 /** |
|
1403 * gst_message_parse_structure_change: |
|
1404 * @message: A valid #GstMessage of type GST_MESSAGE_STRUCTURE_CHANGE. |
|
1405 * @type: A pointer to hold the change type |
|
1406 * @owner: The owner element of the message source |
|
1407 * @busy: A pointer to hold whether the change is in progress or has been |
|
1408 * completed |
|
1409 * |
|
1410 * Extracts the change type and completion status from the GstMessage. |
|
1411 * |
|
1412 * MT safe. |
|
1413 * |
|
1414 * Since: 0.10.22 |
|
1415 */ |
|
1416 #ifdef __SYMBIAN32__ |
|
1417 EXPORT_C |
|
1418 #endif |
|
1419 |
|
1420 void |
|
1421 gst_message_parse_structure_change (GstMessage * message, |
|
1422 GstStructureChangeType * type, GstElement ** owner, gboolean * busy) |
|
1423 { |
|
1424 const GValue *owner_gvalue; |
|
1425 |
|
1426 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
1427 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STRUCTURE_CHANGE); |
|
1428 |
|
1429 owner_gvalue = |
|
1430 gst_structure_id_get_value (message->structure, GST_QUARK (OWNER)); |
|
1431 g_return_if_fail (owner_gvalue != NULL); |
|
1432 g_return_if_fail (G_VALUE_TYPE (owner_gvalue) == GST_TYPE_ELEMENT); |
|
1433 |
|
1434 if (type) |
|
1435 *type = g_value_get_enum (gst_structure_id_get_value (message->structure, |
|
1436 GST_QUARK (TYPE))); |
|
1437 if (owner) |
|
1438 *owner = (GstElement *) g_value_get_object (owner_gvalue); |
|
1439 if (busy) |
|
1440 *busy = |
|
1441 g_value_get_boolean (gst_structure_id_get_value (message->structure, |
|
1442 GST_QUARK (BUSY))); |
|
1101 } |
1443 } |
1102 |
1444 |
1103 /** |
1445 /** |
1104 * gst_message_parse_error: |
1446 * gst_message_parse_error: |
1105 * @message: A valid #GstMessage of type GST_MESSAGE_ERROR. |
1447 * @message: A valid #GstMessage of type GST_MESSAGE_ERROR. |
1122 GError *error_val; |
1464 GError *error_val; |
1123 |
1465 |
1124 g_return_if_fail (GST_IS_MESSAGE (message)); |
1466 g_return_if_fail (GST_IS_MESSAGE (message)); |
1125 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR); |
1467 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR); |
1126 |
1468 |
1127 error_gvalue = gst_structure_get_value (message->structure, "gerror"); |
1469 error_gvalue = |
1470 gst_structure_id_get_value (message->structure, GST_QUARK (GERROR)); |
|
1128 g_return_if_fail (error_gvalue != NULL); |
1471 g_return_if_fail (error_gvalue != NULL); |
1129 g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR); |
1472 g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR); |
1130 |
1473 |
1131 error_val = (GError *) g_value_get_boxed (error_gvalue); |
1474 error_val = (GError *) g_value_get_boxed (error_gvalue); |
1132 if (error_val) |
1475 if (error_val) |
1133 *gerror = g_error_copy (error_val); |
1476 *gerror = g_error_copy (error_val); |
1134 else |
1477 else |
1135 *gerror = NULL; |
1478 *gerror = NULL; |
1136 |
1479 |
1137 if (debug) |
1480 if (debug) |
1138 *debug = g_strdup (gst_structure_get_string (message->structure, "debug")); |
1481 *debug = |
1482 g_value_dup_string (gst_structure_id_get_value (message->structure, |
|
1483 GST_QUARK (DEBUG))); |
|
1139 } |
1484 } |
1140 |
1485 |
1141 /** |
1486 /** |
1142 * gst_message_parse_warning: |
1487 * gst_message_parse_warning: |
1143 * @message: A valid #GstMessage of type GST_MESSAGE_WARNING. |
1488 * @message: A valid #GstMessage of type GST_MESSAGE_WARNING. |
1161 GError *error_val; |
1506 GError *error_val; |
1162 |
1507 |
1163 g_return_if_fail (GST_IS_MESSAGE (message)); |
1508 g_return_if_fail (GST_IS_MESSAGE (message)); |
1164 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING); |
1509 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING); |
1165 |
1510 |
1166 error_gvalue = gst_structure_get_value (message->structure, "gerror"); |
1511 error_gvalue = |
1512 gst_structure_id_get_value (message->structure, GST_QUARK (GERROR)); |
|
1167 g_return_if_fail (error_gvalue != NULL); |
1513 g_return_if_fail (error_gvalue != NULL); |
1168 g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR); |
1514 g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR); |
1169 |
1515 |
1170 error_val = (GError *) g_value_get_boxed (error_gvalue); |
1516 error_val = (GError *) g_value_get_boxed (error_gvalue); |
1171 if (error_val) |
1517 if (error_val) |
1172 *gerror = g_error_copy (error_val); |
1518 *gerror = g_error_copy (error_val); |
1173 else |
1519 else |
1174 *gerror = NULL; |
1520 *gerror = NULL; |
1175 |
1521 |
1176 if (debug) |
1522 if (debug) |
1177 *debug = g_strdup (gst_structure_get_string (message->structure, "debug")); |
1523 *debug = |
1524 g_value_dup_string (gst_structure_id_get_value (message->structure, |
|
1525 GST_QUARK (DEBUG))); |
|
1178 } |
1526 } |
1179 |
1527 |
1180 /** |
1528 /** |
1181 * gst_message_parse_info: |
1529 * gst_message_parse_info: |
1182 * @message: A valid #GstMessage of type GST_MESSAGE_INFO. |
1530 * @message: A valid #GstMessage of type GST_MESSAGE_INFO. |
1201 GError *error_val; |
1549 GError *error_val; |
1202 |
1550 |
1203 g_return_if_fail (GST_IS_MESSAGE (message)); |
1551 g_return_if_fail (GST_IS_MESSAGE (message)); |
1204 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO); |
1552 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO); |
1205 |
1553 |
1206 error_gvalue = gst_structure_get_value (message->structure, "gerror"); |
1554 error_gvalue = |
1555 gst_structure_id_get_value (message->structure, GST_QUARK (GERROR)); |
|
1207 g_return_if_fail (error_gvalue != NULL); |
1556 g_return_if_fail (error_gvalue != NULL); |
1208 g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR); |
1557 g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR); |
1209 |
1558 |
1210 error_val = (GError *) g_value_get_boxed (error_gvalue); |
1559 error_val = (GError *) g_value_get_boxed (error_gvalue); |
1211 if (error_val) |
1560 if (error_val) |
1212 *gerror = g_error_copy (error_val); |
1561 *gerror = g_error_copy (error_val); |
1213 else |
1562 else |
1214 *gerror = NULL; |
1563 *gerror = NULL; |
1215 |
1564 |
1216 if (debug) |
1565 if (debug) |
1217 *debug = g_strdup (gst_structure_get_string (message->structure, "debug")); |
1566 *debug = |
1567 g_value_dup_string (gst_structure_id_get_value (message->structure, |
|
1568 GST_QUARK (DEBUG))); |
|
1218 } |
1569 } |
1219 |
1570 |
1220 /** |
1571 /** |
1221 * gst_message_parse_segment_start: |
1572 * gst_message_parse_segment_start: |
1222 * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_START. |
1573 * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_START. |
1233 |
1584 |
1234 void |
1585 void |
1235 gst_message_parse_segment_start (GstMessage * message, GstFormat * format, |
1586 gst_message_parse_segment_start (GstMessage * message, GstFormat * format, |
1236 gint64 * position) |
1587 gint64 * position) |
1237 { |
1588 { |
1238 const GstStructure *structure; |
|
1239 |
|
1240 g_return_if_fail (GST_IS_MESSAGE (message)); |
1589 g_return_if_fail (GST_IS_MESSAGE (message)); |
1241 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_START); |
1590 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_START); |
1242 |
1591 |
1243 structure = gst_message_get_structure (message); |
|
1244 if (format) |
1592 if (format) |
1245 *format = g_value_get_enum (gst_structure_get_value (structure, "format")); |
1593 *format = |
1594 g_value_get_enum (gst_structure_id_get_value (message->structure, |
|
1595 GST_QUARK (FORMAT))); |
|
1246 if (position) |
1596 if (position) |
1247 *position = |
1597 *position = |
1248 g_value_get_int64 (gst_structure_get_value (structure, "position")); |
1598 g_value_get_int64 (gst_structure_id_get_value (message->structure, |
1599 GST_QUARK (POSITION))); |
|
1249 } |
1600 } |
1250 |
1601 |
1251 /** |
1602 /** |
1252 * gst_message_parse_segment_done: |
1603 * gst_message_parse_segment_done: |
1253 * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE. |
1604 * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE. |
1264 |
1615 |
1265 void |
1616 void |
1266 gst_message_parse_segment_done (GstMessage * message, GstFormat * format, |
1617 gst_message_parse_segment_done (GstMessage * message, GstFormat * format, |
1267 gint64 * position) |
1618 gint64 * position) |
1268 { |
1619 { |
1269 const GstStructure *structure; |
|
1270 |
|
1271 g_return_if_fail (GST_IS_MESSAGE (message)); |
1620 g_return_if_fail (GST_IS_MESSAGE (message)); |
1272 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_DONE); |
1621 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_DONE); |
1273 |
1622 |
1274 structure = gst_message_get_structure (message); |
|
1275 if (format) |
1623 if (format) |
1276 *format = g_value_get_enum (gst_structure_get_value (structure, "format")); |
1624 *format = |
1625 g_value_get_enum (gst_structure_id_get_value (message->structure, |
|
1626 GST_QUARK (FORMAT))); |
|
1277 if (position) |
1627 if (position) |
1278 *position = |
1628 *position = |
1279 g_value_get_int64 (gst_structure_get_value (structure, "position")); |
1629 g_value_get_int64 (gst_structure_id_get_value (message->structure, |
1630 GST_QUARK (POSITION))); |
|
1280 } |
1631 } |
1281 |
1632 |
1282 /** |
1633 /** |
1283 * gst_message_parse_duration: |
1634 * gst_message_parse_duration: |
1284 * @message: A valid #GstMessage of type GST_MESSAGE_DURATION. |
1635 * @message: A valid #GstMessage of type GST_MESSAGE_DURATION. |
1298 |
1649 |
1299 void |
1650 void |
1300 gst_message_parse_duration (GstMessage * message, GstFormat * format, |
1651 gst_message_parse_duration (GstMessage * message, GstFormat * format, |
1301 gint64 * duration) |
1652 gint64 * duration) |
1302 { |
1653 { |
1303 const GstStructure *structure; |
|
1304 |
|
1305 g_return_if_fail (GST_IS_MESSAGE (message)); |
1654 g_return_if_fail (GST_IS_MESSAGE (message)); |
1306 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION); |
1655 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION); |
1307 |
1656 |
1308 structure = gst_message_get_structure (message); |
|
1309 if (format) |
1657 if (format) |
1310 *format = g_value_get_enum (gst_structure_get_value (structure, "format")); |
1658 *format = |
1659 g_value_get_enum (gst_structure_id_get_value (message->structure, |
|
1660 GST_QUARK (FORMAT))); |
|
1311 if (duration) |
1661 if (duration) |
1312 *duration = |
1662 *duration = |
1313 g_value_get_int64 (gst_structure_get_value (structure, "duration")); |
1663 g_value_get_int64 (gst_structure_id_get_value (message->structure, |
1664 GST_QUARK (DURATION))); |
|
1314 } |
1665 } |
1315 |
1666 |
1316 /** |
1667 /** |
1317 * gst_message_parse_async_start: |
1668 * gst_message_parse_async_start: |
1318 * @message: A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE. |
1669 * @message: A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE. |
1329 #endif |
1680 #endif |
1330 |
1681 |
1331 void |
1682 void |
1332 gst_message_parse_async_start (GstMessage * message, gboolean * new_base_time) |
1683 gst_message_parse_async_start (GstMessage * message, gboolean * new_base_time) |
1333 { |
1684 { |
1334 const GstStructure *structure; |
|
1335 |
|
1336 g_return_if_fail (GST_IS_MESSAGE (message)); |
1685 g_return_if_fail (GST_IS_MESSAGE (message)); |
1337 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_START); |
1686 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_START); |
1338 |
1687 |
1339 structure = gst_message_get_structure (message); |
|
1340 if (new_base_time) |
1688 if (new_base_time) |
1341 *new_base_time = |
1689 *new_base_time = |
1342 g_value_get_boolean (gst_structure_get_value (structure, |
1690 g_value_get_boolean (gst_structure_id_get_value (message->structure, |
1343 "new-base-time")); |
1691 GST_QUARK (NEW_BASE_TIME))); |
1344 } |
1692 } |
1693 |
|
1694 /** |
|
1695 * gst_message_parse_request_state: |
|
1696 * @message: A valid #GstMessage of type GST_MESSAGE_REQUEST_STATE. |
|
1697 * @state: Result location for the requested state or NULL |
|
1698 * |
|
1699 * Extract the requested state from the request_state message. |
|
1700 * |
|
1701 * MT safe. |
|
1702 * |
|
1703 * Since: 0.10.23 |
|
1704 */ |
|
1705 #ifdef __SYMBIAN32__ |
|
1706 EXPORT_C |
|
1707 #endif |
|
1708 |
|
1709 void |
|
1710 gst_message_parse_request_state (GstMessage * message, GstState * state) |
|
1711 { |
|
1712 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
1713 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_REQUEST_STATE); |
|
1714 |
|
1715 if (state) |
|
1716 *state = g_value_get_enum (gst_structure_id_get_value (message->structure, |
|
1717 GST_QUARK (NEW_STATE))); |
|
1718 } |
|
1719 |
|
1720 /** |
|
1721 * gst_message_new_stream_status: |
|
1722 * @src: The object originating the message. |
|
1723 * @type: The stream status type. |
|
1724 * @owner: The owner element of @src. |
|
1725 * |
|
1726 * Create a new stream status message. This message is posted when a streaming |
|
1727 * thread is created/destroyed or when the state changed. |
|
1728 * |
|
1729 * Returns: The new stream status message. |
|
1730 * |
|
1731 * MT safe. |
|
1732 * |
|
1733 * Since: 0.10.24. |
|
1734 */ |
|
1735 #ifdef __SYMBIAN32__ |
|
1736 EXPORT_C |
|
1737 #endif |
|
1738 |
|
1739 GstMessage * |
|
1740 gst_message_new_stream_status (GstObject * src, GstStreamStatusType type, |
|
1741 GstElement * owner) |
|
1742 { |
|
1743 GstMessage *message; |
|
1744 GstStructure *structure; |
|
1745 |
|
1746 structure = gst_structure_id_new (GST_QUARK (MESSAGE_STREAM_STATUS), |
|
1747 GST_QUARK (TYPE), GST_TYPE_STREAM_STATUS_TYPE, (gint) type, |
|
1748 GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner, NULL); |
|
1749 message = gst_message_new_custom (GST_MESSAGE_STREAM_STATUS, src, structure); |
|
1750 |
|
1751 return message; |
|
1752 } |
|
1753 |
|
1754 /** |
|
1755 * gst_message_parse_stream_status: |
|
1756 * @message: A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS. |
|
1757 * @type: A pointer to hold the status type |
|
1758 * @owner: The owner element of the message source |
|
1759 * |
|
1760 * Extracts the stream status type and owner the GstMessage. The returned |
|
1761 * owner remains valid for as long as the reference to @message is valid and |
|
1762 * should thus not be unreffed. |
|
1763 * |
|
1764 * MT safe. |
|
1765 * |
|
1766 * Since: 0.10.24. |
|
1767 */ |
|
1768 #ifdef __SYMBIAN32__ |
|
1769 EXPORT_C |
|
1770 #endif |
|
1771 |
|
1772 void |
|
1773 gst_message_parse_stream_status (GstMessage * message, |
|
1774 GstStreamStatusType * type, GstElement ** owner) |
|
1775 { |
|
1776 const GValue *owner_gvalue; |
|
1777 |
|
1778 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
1779 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS); |
|
1780 |
|
1781 owner_gvalue = |
|
1782 gst_structure_id_get_value (message->structure, GST_QUARK (OWNER)); |
|
1783 g_return_if_fail (owner_gvalue != NULL); |
|
1784 |
|
1785 if (type) |
|
1786 *type = g_value_get_enum (gst_structure_id_get_value (message->structure, |
|
1787 GST_QUARK (TYPE))); |
|
1788 if (owner) |
|
1789 *owner = (GstElement *) g_value_get_object (owner_gvalue); |
|
1790 } |
|
1791 |
|
1792 /** |
|
1793 * gst_message_set_stream_status_object: |
|
1794 * @message: A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS. |
|
1795 * @object: the object controlling the streaming |
|
1796 * |
|
1797 * Configures the object handling the streaming thread. This is usually a |
|
1798 * GstTask object but other objects might be added in the future. |
|
1799 * |
|
1800 * Since: 0.10.24 |
|
1801 */ |
|
1802 #ifdef __SYMBIAN32__ |
|
1803 EXPORT_C |
|
1804 #endif |
|
1805 |
|
1806 void |
|
1807 gst_message_set_stream_status_object (GstMessage * message, |
|
1808 const GValue * object) |
|
1809 { |
|
1810 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
1811 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS); |
|
1812 |
|
1813 gst_structure_id_set_value (message->structure, GST_QUARK (OBJECT), object); |
|
1814 } |
|
1815 |
|
1816 /** |
|
1817 * gst_message_get_stream_status_object: |
|
1818 * @message: A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS. |
|
1819 * |
|
1820 * Extracts the object managing the streaming thread from @message. |
|
1821 * |
|
1822 * Returns: a GValue containing the object that manages the streaming thread. |
|
1823 * This object is usually of type GstTask but other types can be added in the |
|
1824 * future. The object remains valid as long as @message is valid. |
|
1825 * |
|
1826 * Since: 0.10.24 |
|
1827 */ |
|
1828 #ifdef __SYMBIAN32__ |
|
1829 EXPORT_C |
|
1830 #endif |
|
1831 |
|
1832 const GValue * |
|
1833 gst_message_get_stream_status_object (GstMessage * message) |
|
1834 { |
|
1835 const GValue *result; |
|
1836 |
|
1837 g_return_val_if_fail (GST_IS_MESSAGE (message), NULL); |
|
1838 g_return_val_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS, |
|
1839 NULL); |
|
1840 |
|
1841 result = gst_structure_id_get_value (message->structure, GST_QUARK (OBJECT)); |
|
1842 |
|
1843 return result; |
|
1844 } |
|
1845 |
|
1846 /** |
|
1847 * gst_message_new_step_done: |
|
1848 * @src: The object originating the message. |
|
1849 * @format: the format of @amount |
|
1850 * @amount: the amount of stepped data |
|
1851 * @rate: the rate of the stepped amount |
|
1852 * @flush: is this an flushing step |
|
1853 * @intermediate: is this an intermediate step |
|
1854 * @duration: the duration of the data |
|
1855 * @eos: the step caused EOS |
|
1856 * |
|
1857 * This message is posted by elements when they complete a part, when @intermediate set |
|
1858 * to TRUE, or a complete step operation. |
|
1859 * |
|
1860 * @duration will contain the amount of time (in GST_FORMAT_TIME) of the stepped |
|
1861 * @amount of media in format @format. |
|
1862 * |
|
1863 * Returns: The new step_done message. |
|
1864 * |
|
1865 * MT safe. |
|
1866 * |
|
1867 * Since: 0.10.24 |
|
1868 */ |
|
1869 #ifdef __SYMBIAN32__ |
|
1870 EXPORT_C |
|
1871 #endif |
|
1872 |
|
1873 GstMessage * |
|
1874 gst_message_new_step_done (GstObject * src, GstFormat format, guint64 amount, |
|
1875 gdouble rate, gboolean flush, gboolean intermediate, guint64 duration, |
|
1876 gboolean eos) |
|
1877 { |
|
1878 GstMessage *message; |
|
1879 GstStructure *structure; |
|
1880 |
|
1881 structure = gst_structure_id_new (GST_QUARK (MESSAGE_STEP_DONE), |
|
1882 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
|
1883 GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, |
|
1884 GST_QUARK (RATE), G_TYPE_DOUBLE, rate, |
|
1885 GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, |
|
1886 GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, |
|
1887 GST_QUARK (DURATION), G_TYPE_UINT64, duration, |
|
1888 GST_QUARK (EOS), G_TYPE_BOOLEAN, eos, NULL); |
|
1889 message = gst_message_new_custom (GST_MESSAGE_STEP_DONE, src, structure); |
|
1890 |
|
1891 return message; |
|
1892 } |
|
1893 |
|
1894 /** |
|
1895 * gst_message_parse_step_done: |
|
1896 * @message: A valid #GstMessage of type GST_MESSAGE_STEP_DONE. |
|
1897 * @format: result location for the format |
|
1898 * @amount: result location for the amount |
|
1899 * @rate: result location for the rate |
|
1900 * @flush: result location for the flush flag |
|
1901 * @intermediate: result location for the intermediate flag |
|
1902 * @duration: result location for the duration |
|
1903 * @eos: result location for the EOS flag |
|
1904 * |
|
1905 * Extract the values the step_done message. |
|
1906 * |
|
1907 * MT safe. |
|
1908 * |
|
1909 * Since: 0.10.24 |
|
1910 */ |
|
1911 #ifdef __SYMBIAN32__ |
|
1912 EXPORT_C |
|
1913 #endif |
|
1914 |
|
1915 void |
|
1916 gst_message_parse_step_done (GstMessage * message, GstFormat * format, |
|
1917 guint64 * amount, gdouble * rate, gboolean * flush, gboolean * intermediate, |
|
1918 guint64 * duration, gboolean * eos) |
|
1919 { |
|
1920 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
1921 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_DONE); |
|
1922 |
|
1923 gst_structure_id_get (message->structure, |
|
1924 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
|
1925 GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, |
|
1926 GST_QUARK (RATE), G_TYPE_DOUBLE, rate, |
|
1927 GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, |
|
1928 GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, |
|
1929 GST_QUARK (DURATION), G_TYPE_UINT64, duration, |
|
1930 GST_QUARK (EOS), G_TYPE_BOOLEAN, eos, NULL); |
|
1931 } |
|
1932 |
|
1933 /** |
|
1934 * gst_message_new_step_start: |
|
1935 * @src: The object originating the message. |
|
1936 * @active: if the step is active or queued |
|
1937 * @format: the format of @amount |
|
1938 * @amount: the amount of stepped data |
|
1939 * @rate: the rate of the stepped amount |
|
1940 * @flush: is this an flushing step |
|
1941 * @intermediate: is this an intermediate step |
|
1942 * |
|
1943 * This message is posted by elements when they accept or activate a new step |
|
1944 * event for @amount in @format. |
|
1945 * |
|
1946 * @active is set to FALSE when the element accepted the new step event and has |
|
1947 * queued it for execution in the streaming threads. |
|
1948 * |
|
1949 * @active is set to TRUE when the element has activated the step operation and |
|
1950 * is now ready to start executing the step in the streaming thread. After this |
|
1951 * message is emited, the application can queue a new step operation in the |
|
1952 * element. |
|
1953 * |
|
1954 * Returns: The new step_start message. |
|
1955 * |
|
1956 * MT safe. |
|
1957 * |
|
1958 * Since: 0.10.24 |
|
1959 */ |
|
1960 #ifdef __SYMBIAN32__ |
|
1961 EXPORT_C |
|
1962 #endif |
|
1963 |
|
1964 GstMessage * |
|
1965 gst_message_new_step_start (GstObject * src, gboolean active, GstFormat format, |
|
1966 guint64 amount, gdouble rate, gboolean flush, gboolean intermediate) |
|
1967 { |
|
1968 GstMessage *message; |
|
1969 GstStructure *structure; |
|
1970 |
|
1971 structure = gst_structure_id_new (GST_QUARK (MESSAGE_STEP_START), |
|
1972 GST_QUARK (ACTIVE), G_TYPE_BOOLEAN, active, |
|
1973 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
|
1974 GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, |
|
1975 GST_QUARK (RATE), G_TYPE_DOUBLE, rate, |
|
1976 GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, |
|
1977 GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, NULL); |
|
1978 message = gst_message_new_custom (GST_MESSAGE_STEP_START, src, structure); |
|
1979 |
|
1980 return message; |
|
1981 } |
|
1982 |
|
1983 /** |
|
1984 * gst_message_parse_step_start: |
|
1985 * @message: A valid #GstMessage of type GST_MESSAGE_STEP_DONE. |
|
1986 * @active: result location for the active flag |
|
1987 * @format: result location for the format |
|
1988 * @amount: result location for the amount |
|
1989 * @rate: result location for the rate |
|
1990 * @flush: result location for the flush flag |
|
1991 * @intermediate: result location for the intermediate flag |
|
1992 * |
|
1993 * Extract the values from step_start message. |
|
1994 * |
|
1995 * MT safe. |
|
1996 * |
|
1997 * Since: 0.10.24 |
|
1998 */ |
|
1999 #ifdef __SYMBIAN32__ |
|
2000 EXPORT_C |
|
2001 #endif |
|
2002 |
|
2003 void |
|
2004 gst_message_parse_step_start (GstMessage * message, gboolean * active, |
|
2005 GstFormat * format, guint64 * amount, gdouble * rate, gboolean * flush, |
|
2006 gboolean * intermediate) |
|
2007 { |
|
2008 g_return_if_fail (GST_IS_MESSAGE (message)); |
|
2009 g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_START); |
|
2010 |
|
2011 gst_structure_id_get (message->structure, |
|
2012 GST_QUARK (ACTIVE), G_TYPE_BOOLEAN, active, |
|
2013 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
|
2014 GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, |
|
2015 GST_QUARK (RATE), G_TYPE_DOUBLE, rate, |
|
2016 GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, |
|
2017 GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, NULL); |
|
2018 } |