gstreamer_core/gst/gstmessage.c
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
equal deleted inserted replaced
29:567bb019e3e3 30:7e817e7e631c
    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"
       
    61 
    60 
    62 #ifdef __SYMBIAN32__
    61 #ifdef __SYMBIAN32__
    63 #include <glib_global.h>
    62 #include <glib_global.h>
    64 #endif
    63 #endif
    65 
    64 
    66 #define GST_MESSAGE_SEQNUM(e) ((GstMessage*)e)->abidata.ABI.seqnum
    65 
    67 
    66 static void gst_message_init (GTypeInstance * instance, gpointer g_class);
       
    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},
       
   121   {0, NULL, 0}
   119   {0, NULL, 0}
   122 };
   120 };
   123 
   121 
   124 /**
   122 /**
   125  * gst_message_type_get_name:
   123  * gst_message_type_get_name:
   166     if (type == message_quarks[i].type)
   164     if (type == message_quarks[i].type)
   167       return message_quarks[i].quark;
   165       return message_quarks[i].quark;
   168   }
   166   }
   169   return 0;
   167   return 0;
   170 }
   168 }
   171 
   169 #ifdef __SYMBIAN32__
   172 #define _do_init \
   170 EXPORT_C
   173 { \
   171 #endif
   174   gint i; \
   172 
   175   \
   173 
   176   for (i = 0; message_quarks[i].name; i++) { \
   174 GType
   177     message_quarks[i].quark = \
   175 gst_message_get_type (void)
   178         g_quark_from_static_string (message_quarks[i].name); \
   176 {
   179   } \
   177   static GType _gst_message_type;
   180 }
   178 
   181 
   179   if (G_UNLIKELY (_gst_message_type == 0)) {
   182 G_DEFINE_TYPE_WITH_CODE (GstMessage, gst_message, GST_TYPE_MINI_OBJECT,
   180     gint i;
   183     _do_init);
   181     static const GTypeInfo message_info = {
       
   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 }
   184 
   204 
   185 static void
   205 static void
   186 gst_message_class_init (GstMessageClass * klass)
   206 gst_message_class_init (gpointer g_class, gpointer class_data)
   187 {
   207 {
   188   parent_class = g_type_class_peek_parent (klass);
   208   GstMessageClass *message_class = GST_MESSAGE_CLASS (g_class);
   189 
   209 
   190   klass->mini_object_class.copy = (GstMiniObjectCopyFunction) _gst_message_copy;
   210   parent_class = g_type_class_peek_parent (g_class);
   191   klass->mini_object_class.finalize =
   211 
       
   212   message_class->mini_object_class.copy =
       
   213       (GstMiniObjectCopyFunction) _gst_message_copy;
       
   214   message_class->mini_object_class.finalize =
   192       (GstMiniObjectFinalizeFunction) gst_message_finalize;
   215       (GstMiniObjectFinalizeFunction) gst_message_finalize;
   193 }
   216 }
   194 
   217 
   195 static void
   218 static void
   196 gst_message_init (GstMessage * message)
   219 gst_message_init (GTypeInstance * instance, gpointer g_class)
   197 {
   220 {
       
   221   GstMessage *message = GST_MESSAGE (instance);
       
   222 
   198   GST_CAT_LOG (GST_CAT_MESSAGE, "new message %p", message);
   223   GST_CAT_LOG (GST_CAT_MESSAGE, "new message %p", message);
   199   GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE;
   224   GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE;
   200 }
   225 }
   201 
   226 
   202 static void
   227 static void
   220   if (message->structure) {
   245   if (message->structure) {
   221     gst_structure_set_parent_refcount (message->structure, NULL);
   246     gst_structure_set_parent_refcount (message->structure, NULL);
   222     gst_structure_free (message->structure);
   247     gst_structure_free (message->structure);
   223   }
   248   }
   224 
   249 
   225 /*   GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (message)); */
   250   GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (message));
   226 }
   251 }
   227 
   252 
   228 static GstMessage *
   253 static GstMessage *
   229 _gst_message_copy (GstMessage * message)
   254 _gst_message_copy (GstMessage * message)
   230 {
   255 {
   239 
   264 
   240   GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message);
   265   GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message);
   241   GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message);
   266   GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message);
   242   GST_MESSAGE_TYPE (copy) = GST_MESSAGE_TYPE (message);
   267   GST_MESSAGE_TYPE (copy) = GST_MESSAGE_TYPE (message);
   243   GST_MESSAGE_TIMESTAMP (copy) = GST_MESSAGE_TIMESTAMP (message);
   268   GST_MESSAGE_TIMESTAMP (copy) = GST_MESSAGE_TIMESTAMP (message);
   244   GST_MESSAGE_SEQNUM (copy) = GST_MESSAGE_SEQNUM (message);
       
   245 
   269 
   246   if (GST_MESSAGE_SRC (message)) {
   270   if (GST_MESSAGE_SRC (message)) {
   247     GST_MESSAGE_SRC (copy) = gst_object_ref (GST_MESSAGE_SRC (message));
   271     GST_MESSAGE_SRC (copy) = gst_object_ref (GST_MESSAGE_SRC (message));
   248   }
   272   }
   249 
   273 
   297     gst_structure_set_parent_refcount (structure,
   321     gst_structure_set_parent_refcount (structure,
   298         &message->mini_object.refcount);
   322         &message->mini_object.refcount);
   299   }
   323   }
   300   message->structure = structure;
   324   message->structure = structure;
   301 
   325 
   302   GST_MESSAGE_SEQNUM (message) = gst_util_seqnum_next ();
   326   return message;
   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;
       
   367 }
   327 }
   368 
   328 
   369 /**
   329 /**
   370  * gst_message_new_eos:
   330  * gst_message_new_eos:
   371  * @src: The object originating the message.
   331  * @src: The object originating the message.
   394 
   354 
   395 /**
   355 /**
   396  * gst_message_new_error:
   356  * gst_message_new_error:
   397  * @src: The object originating the message.
   357  * @src: The object originating the message.
   398  * @error: The GError for this message.
   358  * @error: The GError for this message.
   399  * @debug: A debugging string.
   359  * @debug: A debugging string for something or other.
   400  *
   360  *
   401  * Create a new error message. The message will copy @error and
   361  * Create a new error message. The message will copy @error and
   402  * @debug. This message is posted by element when a fatal event
   362  * @debug. This message is posted by element when a fatal event
   403  * occured. The pipeline will probably (partially) stop. The application
   363  * occured. The pipeline will probably (partially) stop. The application
   404  * receiving this message should stop the pipeline.
   364  * receiving this message should stop the pipeline.
   410 #ifdef __SYMBIAN32__
   370 #ifdef __SYMBIAN32__
   411 EXPORT_C
   371 EXPORT_C
   412 #endif
   372 #endif
   413 
   373 
   414 GstMessage *
   374 GstMessage *
   415 gst_message_new_error (GstObject * src, GError * error, const gchar * debug)
   375 gst_message_new_error (GstObject * src, GError * error, gchar * debug)
   416 {
   376 {
   417   GstMessage *message;
   377   GstMessage *message;
   418   GstStructure *structure;
   378 
   419 
   379   message = gst_message_new_custom (GST_MESSAGE_ERROR, src,
   420   structure = gst_structure_id_new (GST_QUARK (MESSAGE_ERROR),
   380       gst_structure_new ("GstMessageError", "gerror", GST_TYPE_G_ERROR, error,
   421       GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
   381           "debug", G_TYPE_STRING, debug, NULL));
   422       GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
       
   423   message = gst_message_new_custom (GST_MESSAGE_ERROR, src, structure);
       
   424 
   382 
   425   return message;
   383   return message;
   426 }
   384 }
   427 
   385 
   428 /**
   386 /**
   429  * gst_message_new_warning:
   387  * gst_message_new_warning:
   430  * @src: The object originating the message.
   388  * @src: The object originating the message.
   431  * @error: The GError for this message.
   389  * @error: The GError for this message.
   432  * @debug: A debugging string.
   390  * @debug: A debugging string for something or other.
   433  *
   391  *
   434  * Create a new warning message. The message will make copies of @error and
   392  * Create a new warning message. The message will make copies of @error and
   435  * @debug.
   393  * @debug.
   436  *
   394  *
   437  * Returns: The new warning message.
   395  * Returns: The new warning message.
   441 #ifdef __SYMBIAN32__
   399 #ifdef __SYMBIAN32__
   442 EXPORT_C
   400 EXPORT_C
   443 #endif
   401 #endif
   444 
   402 
   445 GstMessage *
   403 GstMessage *
   446 gst_message_new_warning (GstObject * src, GError * error, const gchar * debug)
   404 gst_message_new_warning (GstObject * src, GError * error, gchar * debug)
   447 {
   405 {
   448   GstMessage *message;
   406   GstMessage *message;
   449   GstStructure *structure;
   407 
   450 
   408   message = gst_message_new_custom (GST_MESSAGE_WARNING, src,
   451   structure = gst_structure_id_new (GST_QUARK (MESSAGE_WARNING),
   409       gst_structure_new ("GstMessageWarning", "gerror", GST_TYPE_G_ERROR, error,
   452       GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
   410           "debug", G_TYPE_STRING, debug, NULL));
   453       GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
       
   454   message = gst_message_new_custom (GST_MESSAGE_WARNING, src, structure);
       
   455 
   411 
   456   return message;
   412   return message;
   457 }
   413 }
   458 
   414 
   459 /**
   415 /**
   460  * gst_message_new_info:
   416  * gst_message_new_info:
   461  * @src: The object originating the message.
   417  * @src: The object originating the message.
   462  * @error: The GError for this message.
   418  * @error: The GError for this message.
   463  * @debug: A debugging string.
   419  * @debug: A debugging string for something or other.
   464  *
   420  *
   465  * Create a new info message. The message will make copies of @error and
   421  * Create a new info message. The message will make copies of @error and
   466  * @debug.
   422  * @debug.
   467  *
   423  *
   468  * MT safe.
       
   469  *
       
   470  * Returns: The new info message.
   424  * Returns: The new info message.
   471  *
   425  *
   472  * Since: 0.10.12
   426  * Since: 0.10.12
   473  */
   427  *
   474 #ifdef __SYMBIAN32__
   428  * MT safe.
   475 EXPORT_C
   429  */
   476 #endif
   430 #ifdef __SYMBIAN32__
   477 
   431 EXPORT_C
   478 GstMessage *
   432 #endif
   479 gst_message_new_info (GstObject * src, GError * error, const gchar * debug)
   433 
   480 {
   434 GstMessage *
   481   GstMessage *message;
   435 gst_message_new_info (GstObject * src, GError * error, gchar * debug)
   482   GstStructure *structure;
   436 {
   483 
   437   GstMessage *message;
   484   structure = gst_structure_id_new (GST_QUARK (MESSAGE_INFO),
   438 
   485       GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
   439   message = gst_message_new_custom (GST_MESSAGE_INFO, src,
   486       GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
   440       gst_structure_new ("GstMessageInfo", "gerror", GST_TYPE_G_ERROR, error,
   487   message = gst_message_new_custom (GST_MESSAGE_INFO, src, structure);
   441           "debug", G_TYPE_STRING, debug, NULL));
   488 
   442 
   489   return message;
   443   return message;
   490 }
   444 }
   491 
   445 
   492 /**
   446 /**
   512 
   466 
   513   g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL);
   467   g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL);
   514 
   468 
   515   message =
   469   message =
   516       gst_message_new_custom (GST_MESSAGE_TAG, src, (GstStructure *) tag_list);
   470       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);
       
   554 
   471 
   555   return message;
   472   return message;
   556 }
   473 }
   557 
   474 
   558 /**
   475 /**
   569  * The application must be prepared to receive BUFFERING messages in the
   486  * The application must be prepared to receive BUFFERING messages in the
   570  * PREROLLING state and may only set the pipeline to PLAYING after receiving a
   487  * PREROLLING state and may only set the pipeline to PLAYING after receiving a
   571  * message with @percent set to 100, which can happen after the pipeline
   488  * message with @percent set to 100, which can happen after the pipeline
   572  * completed prerolling. 
   489  * completed prerolling. 
   573  *
   490  *
   574  * MT safe.
       
   575  *
       
   576  * Returns: The new buffering message.
   491  * Returns: The new buffering message.
   577  *
   492  *
   578  * Since: 0.10.11
   493  * Since: 0.10.11
       
   494  *
       
   495  * MT safe.
   579  */
   496  */
   580 #ifdef __SYMBIAN32__
   497 #ifdef __SYMBIAN32__
   581 EXPORT_C
   498 EXPORT_C
   582 #endif
   499 #endif
   583 
   500 
   584 GstMessage *
   501 GstMessage *
   585 gst_message_new_buffering (GstObject * src, gint percent)
   502 gst_message_new_buffering (GstObject * src, gint percent)
   586 {
   503 {
   587   GstMessage *message;
   504   GstMessage *message;
   588   GstStructure *structure;
       
   589 
   505 
   590   g_return_val_if_fail (percent >= 0 && percent <= 100, NULL);
   506   g_return_val_if_fail (percent >= 0 && percent <= 100, NULL);
   591 
   507 
   592   structure = gst_structure_id_new (GST_QUARK (MESSAGE_BUFFERING),
   508   message = gst_message_new_custom (GST_MESSAGE_BUFFERING, src,
   593       GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent,
   509       gst_structure_new ("GstMessageBuffering",
   594       GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
   510           "buffer-percent", G_TYPE_INT, percent, NULL));
   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);
       
   600 
   511 
   601   return message;
   512   return message;
   602 }
   513 }
   603 
   514 
   604 /**
   515 /**
   622 GstMessage *
   533 GstMessage *
   623 gst_message_new_state_changed (GstObject * src,
   534 gst_message_new_state_changed (GstObject * src,
   624     GstState oldstate, GstState newstate, GstState pending)
   535     GstState oldstate, GstState newstate, GstState pending)
   625 {
   536 {
   626   GstMessage *message;
   537   GstMessage *message;
   627   GstStructure *structure;
   538 
   628 
   539   message = gst_message_new_custom (GST_MESSAGE_STATE_CHANGED, src,
   629   structure = gst_structure_id_new (GST_QUARK (MESSAGE_STATE),
   540       gst_structure_new ("GstMessageState",
   630       GST_QUARK (OLD_STATE), GST_TYPE_STATE, (gint) oldstate,
   541           "old-state", GST_TYPE_STATE, (gint) oldstate,
   631       GST_QUARK (NEW_STATE), GST_TYPE_STATE, (gint) newstate,
   542           "new-state", GST_TYPE_STATE, (gint) newstate,
   632       GST_QUARK (PENDING_STATE), GST_TYPE_STATE, (gint) pending, NULL);
   543           "pending-state", GST_TYPE_STATE, (gint) pending, NULL));
   633   message = gst_message_new_custom (GST_MESSAGE_STATE_CHANGED, src, structure);
       
   634 
   544 
   635   return message;
   545   return message;
   636 }
   546 }
   637 
   547 
   638 /**
   548 /**
   685 GstMessage *
   595 GstMessage *
   686 gst_message_new_clock_provide (GstObject * src, GstClock * clock,
   596 gst_message_new_clock_provide (GstObject * src, GstClock * clock,
   687     gboolean ready)
   597     gboolean ready)
   688 {
   598 {
   689   GstMessage *message;
   599   GstMessage *message;
   690   GstStructure *structure;
   600 
   691 
   601   message = gst_message_new_custom (GST_MESSAGE_CLOCK_PROVIDE, src,
   692   structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_PROVIDE),
   602       gst_structure_new ("GstMessageClockProvide",
   693       GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock,
   603           "clock", GST_TYPE_CLOCK, clock,
   694       GST_QUARK (READY), G_TYPE_BOOLEAN, ready, NULL);
   604           "ready", G_TYPE_BOOLEAN, ready, NULL));
   695   message = gst_message_new_custom (GST_MESSAGE_CLOCK_PROVIDE, src, structure);
       
   696 
   605 
   697   return message;
   606   return message;
   698 }
   607 }
   699 
   608 
   700 /**
   609 /**
   719 
   628 
   720 GstMessage *
   629 GstMessage *
   721 gst_message_new_clock_lost (GstObject * src, GstClock * clock)
   630 gst_message_new_clock_lost (GstObject * src, GstClock * clock)
   722 {
   631 {
   723   GstMessage *message;
   632   GstMessage *message;
   724   GstStructure *structure;
   633 
   725 
   634   message = gst_message_new_custom (GST_MESSAGE_CLOCK_LOST, src,
   726   structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_LOST),
   635       gst_structure_new ("GstMessageClockLost",
   727       GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL);
   636           "clock", GST_TYPE_CLOCK, clock, NULL));
   728   message = gst_message_new_custom (GST_MESSAGE_CLOCK_LOST, src, structure);
       
   729 
   637 
   730   return message;
   638   return message;
   731 }
   639 }
   732 
   640 
   733 /**
   641 /**
   748 
   656 
   749 GstMessage *
   657 GstMessage *
   750 gst_message_new_new_clock (GstObject * src, GstClock * clock)
   658 gst_message_new_new_clock (GstObject * src, GstClock * clock)
   751 {
   659 {
   752   GstMessage *message;
   660   GstMessage *message;
   753   GstStructure *structure;
   661 
   754 
   662   message = gst_message_new_custom (GST_MESSAGE_NEW_CLOCK, src,
   755   structure = gst_structure_id_new (GST_QUARK (MESSAGE_NEW_CLOCK),
   663       gst_structure_new ("GstMessageNewClock",
   756       GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL);
   664           "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);
       
   803 
   665 
   804   return message;
   666   return message;
   805 }
   667 }
   806 
   668 
   807 /**
   669 /**
   826 GstMessage *
   688 GstMessage *
   827 gst_message_new_segment_start (GstObject * src, GstFormat format,
   689 gst_message_new_segment_start (GstObject * src, GstFormat format,
   828     gint64 position)
   690     gint64 position)
   829 {
   691 {
   830   GstMessage *message;
   692   GstMessage *message;
   831   GstStructure *structure;
   693 
   832 
   694   message = gst_message_new_custom (GST_MESSAGE_SEGMENT_START, src,
   833   structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_START),
   695       gst_structure_new ("GstMessageSegmentStart",
   834       GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
   696           "format", GST_TYPE_FORMAT, format,
   835       GST_QUARK (POSITION), G_TYPE_INT64, position, NULL);
   697           "position", G_TYPE_INT64, position, NULL));
   836   message = gst_message_new_custom (GST_MESSAGE_SEGMENT_START, src, structure);
       
   837 
   698 
   838   return message;
   699   return message;
   839 }
   700 }
   840 
   701 
   841 /**
   702 /**
   860 GstMessage *
   721 GstMessage *
   861 gst_message_new_segment_done (GstObject * src, GstFormat format,
   722 gst_message_new_segment_done (GstObject * src, GstFormat format,
   862     gint64 position)
   723     gint64 position)
   863 {
   724 {
   864   GstMessage *message;
   725   GstMessage *message;
   865   GstStructure *structure;
   726 
   866 
   727   message = gst_message_new_custom (GST_MESSAGE_SEGMENT_DONE, src,
   867   structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_DONE),
   728       gst_structure_new ("GstMessageSegmentDone",
   868       GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
   729           "format", GST_TYPE_FORMAT, format,
   869       GST_QUARK (POSITION), G_TYPE_INT64, position, NULL);
   730           "position", G_TYPE_INT64, position, NULL));
   870   message = gst_message_new_custom (GST_MESSAGE_SEGMENT_DONE, src, structure);
       
   871 
   731 
   872   return message;
   732   return message;
   873 }
   733 }
   874 
   734 
   875 /**
   735 /**
   944 
   804 
   945 GstMessage *
   805 GstMessage *
   946 gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration)
   806 gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration)
   947 {
   807 {
   948   GstMessage *message;
   808   GstMessage *message;
   949   GstStructure *structure;
   809 
   950 
   810   message = gst_message_new_custom (GST_MESSAGE_DURATION, src,
   951   structure = gst_structure_id_new (GST_QUARK (MESSAGE_DURATION),
   811       gst_structure_new ("GstMessageDuration",
   952       GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
   812           "format", GST_TYPE_FORMAT, format,
   953       GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL);
   813           "duration", G_TYPE_INT64, duration, NULL));
   954   message = gst_message_new_custom (GST_MESSAGE_DURATION, src, structure);
       
   955 
   814 
   956   return message;
   815   return message;
   957 }
   816 }
   958 
   817 
   959 /**
   818 /**
   977 
   836 
   978 GstMessage *
   837 GstMessage *
   979 gst_message_new_async_start (GstObject * src, gboolean new_base_time)
   838 gst_message_new_async_start (GstObject * src, gboolean new_base_time)
   980 {
   839 {
   981   GstMessage *message;
   840   GstMessage *message;
   982   GstStructure *structure;
   841 
   983 
   842   message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src,
   984   structure = gst_structure_id_new (GST_QUARK (MESSAGE_ASYNC_START),
   843       gst_structure_new ("GstMessageAsyncStart",
   985       GST_QUARK (NEW_BASE_TIME), G_TYPE_BOOLEAN, new_base_time, NULL);
   844           "new-base-time", G_TYPE_BOOLEAN, new_base_time, NULL));
   986   message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src, structure);
       
   987 
   845 
   988   return message;
   846   return message;
   989 }
   847 }
   990 
   848 
   991 /**
   849 /**
  1035 gst_message_new_latency (GstObject * src)
   893 gst_message_new_latency (GstObject * src)
  1036 {
   894 {
  1037   GstMessage *message;
   895   GstMessage *message;
  1038 
   896 
  1039   message = gst_message_new_custom (GST_MESSAGE_LATENCY, src, NULL);
   897   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);
       
  1072 
   898 
  1073   return message;
   899   return message;
  1074 }
   900 }
  1075 
   901 
  1076 /**
   902 /**
  1112 #endif
   938 #endif
  1113 
   939 
  1114 void
   940 void
  1115 gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list)
   941 gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list)
  1116 {
   942 {
  1117   GstStructure *ret;
       
  1118 
       
  1119   g_return_if_fail (GST_IS_MESSAGE (message));
   943   g_return_if_fail (GST_IS_MESSAGE (message));
  1120   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
   944   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
  1121   g_return_if_fail (tag_list != NULL);
   945   g_return_if_fail (tag_list != NULL);
  1122 
   946 
  1123   ret = gst_structure_copy (message->structure);
   947   *tag_list = (GstTagList *) 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;
       
  1172 }
   948 }
  1173 
   949 
  1174 /**
   950 /**
  1175  * gst_message_parse_buffering:
   951  * gst_message_parse_buffering:
  1176  * @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING.
   952  * @message: A valid #GstMessage of type GST_MESSAGE_BUFFERING.
  1177  * @percent: Return location for the percent.
   953  * @percent: Return location for the percent.
  1178  *
   954  *
  1179  * Extracts the buffering percent from the GstMessage. see also
   955  * Extracts the buffering percent from the GstMessage. see also
  1180  * gst_message_new_buffering().
   956  * gst_message_new_buffering().
  1181  *
   957  *
  1182  * MT safe.
       
  1183  *
       
  1184  * Since: 0.10.11
   958  * Since: 0.10.11
       
   959  *
       
   960  * MT safe.
  1185  */
   961  */
  1186 #ifdef __SYMBIAN32__
   962 #ifdef __SYMBIAN32__
  1187 EXPORT_C
   963 EXPORT_C
  1188 #endif
   964 #endif
  1189 
   965 
  1192 {
   968 {
  1193   g_return_if_fail (GST_IS_MESSAGE (message));
   969   g_return_if_fail (GST_IS_MESSAGE (message));
  1194   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
   970   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
  1195 
   971 
  1196   if (percent)
   972   if (percent)
  1197     *percent = g_value_get_int (gst_structure_id_get_value (message->structure,
   973     gst_structure_get_int (message->structure, "buffer-percent", percent);
  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)));
       
  1266 }
   974 }
  1267 
   975 
  1268 /**
   976 /**
  1269  * gst_message_parse_state_changed:
   977  * gst_message_parse_state_changed:
  1270  * @message: a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED
   978  * @message: a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED
  1286 {
   994 {
  1287   g_return_if_fail (GST_IS_MESSAGE (message));
   995   g_return_if_fail (GST_IS_MESSAGE (message));
  1288   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED);
   996   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED);
  1289 
   997 
  1290   if (oldstate)
   998   if (oldstate)
  1291     *oldstate =
   999     gst_structure_get_enum (message->structure, "old-state",
  1292         g_value_get_enum (gst_structure_id_get_value (message->structure,
  1000         GST_TYPE_STATE, (gint *) oldstate);
  1293             GST_QUARK (OLD_STATE)));
       
  1294   if (newstate)
  1001   if (newstate)
  1295     *newstate =
  1002     gst_structure_get_enum (message->structure, "new-state",
  1296         g_value_get_enum (gst_structure_id_get_value (message->structure,
  1003         GST_TYPE_STATE, (gint *) newstate);
  1297             GST_QUARK (NEW_STATE)));
       
  1298   if (pending)
  1004   if (pending)
  1299     *pending = g_value_get_enum (gst_structure_id_get_value (message->structure,
  1005     gst_structure_get_enum (message->structure, "pending-state",
  1300             GST_QUARK (PENDING_STATE)));
  1006         GST_TYPE_STATE, (gint *) pending);
  1301 }
  1007 }
  1302 
  1008 
  1303 /**
  1009 /**
  1304  * gst_message_parse_clock_provide:
  1010  * gst_message_parse_clock_provide:
  1305  * @message: A valid #GstMessage of type GST_MESSAGE_CLOCK_PROVIDE.
  1011  * @message: A valid #GstMessage of type GST_MESSAGE_CLOCK_PROVIDE.
  1322   const GValue *clock_gvalue;
  1028   const GValue *clock_gvalue;
  1323 
  1029 
  1324   g_return_if_fail (GST_IS_MESSAGE (message));
  1030   g_return_if_fail (GST_IS_MESSAGE (message));
  1325   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_PROVIDE);
  1031   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_PROVIDE);
  1326 
  1032 
  1327   clock_gvalue =
  1033   clock_gvalue = gst_structure_get_value (message->structure, "clock");
  1328       gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK));
       
  1329   g_return_if_fail (clock_gvalue != NULL);
  1034   g_return_if_fail (clock_gvalue != NULL);
  1330   g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
  1035   g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
  1331 
  1036 
  1332   if (ready)
  1037   if (ready)
  1333     *ready =
  1038     gst_structure_get_boolean (message->structure, "ready", ready);
  1334         g_value_get_boolean (gst_structure_id_get_value (message->structure,
       
  1335             GST_QUARK (READY)));
       
  1336   if (clock)
  1039   if (clock)
  1337     *clock = (GstClock *) g_value_get_object (clock_gvalue);
  1040     *clock = (GstClock *) g_value_get_object (clock_gvalue);
  1338 }
  1041 }
  1339 
  1042 
  1340 /**
  1043 /**
  1357   const GValue *clock_gvalue;
  1060   const GValue *clock_gvalue;
  1358 
  1061 
  1359   g_return_if_fail (GST_IS_MESSAGE (message));
  1062   g_return_if_fail (GST_IS_MESSAGE (message));
  1360   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_LOST);
  1063   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_LOST);
  1361 
  1064 
  1362   clock_gvalue =
  1065   clock_gvalue = gst_structure_get_value (message->structure, "clock");
  1363       gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK));
       
  1364   g_return_if_fail (clock_gvalue != NULL);
  1066   g_return_if_fail (clock_gvalue != NULL);
  1365   g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
  1067   g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
  1366 
  1068 
  1367   if (clock)
  1069   if (clock)
  1368     *clock = (GstClock *) g_value_get_object (clock_gvalue);
  1070     *clock = (GstClock *) g_value_get_object (clock_gvalue);
  1388   const GValue *clock_gvalue;
  1090   const GValue *clock_gvalue;
  1389 
  1091 
  1390   g_return_if_fail (GST_IS_MESSAGE (message));
  1092   g_return_if_fail (GST_IS_MESSAGE (message));
  1391   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_NEW_CLOCK);
  1093   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_NEW_CLOCK);
  1392 
  1094 
  1393   clock_gvalue =
  1095   clock_gvalue = gst_structure_get_value (message->structure, "clock");
  1394       gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK));
       
  1395   g_return_if_fail (clock_gvalue != NULL);
  1096   g_return_if_fail (clock_gvalue != NULL);
  1396   g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
  1097   g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
  1397 
  1098 
  1398   if (clock)
  1099   if (clock)
  1399     *clock = (GstClock *) g_value_get_object (clock_gvalue);
  1100     *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)));
       
  1443 }
  1101 }
  1444 
  1102 
  1445 /**
  1103 /**
  1446  * gst_message_parse_error:
  1104  * gst_message_parse_error:
  1447  * @message: A valid #GstMessage of type GST_MESSAGE_ERROR.
  1105  * @message: A valid #GstMessage of type GST_MESSAGE_ERROR.
  1464   GError *error_val;
  1122   GError *error_val;
  1465 
  1123 
  1466   g_return_if_fail (GST_IS_MESSAGE (message));
  1124   g_return_if_fail (GST_IS_MESSAGE (message));
  1467   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR);
  1125   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR);
  1468 
  1126 
  1469   error_gvalue =
  1127   error_gvalue = gst_structure_get_value (message->structure, "gerror");
  1470       gst_structure_id_get_value (message->structure, GST_QUARK (GERROR));
       
  1471   g_return_if_fail (error_gvalue != NULL);
  1128   g_return_if_fail (error_gvalue != NULL);
  1472   g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
  1129   g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
  1473 
  1130 
  1474   error_val = (GError *) g_value_get_boxed (error_gvalue);
  1131   error_val = (GError *) g_value_get_boxed (error_gvalue);
  1475   if (error_val)
  1132   if (error_val)
  1476     *gerror = g_error_copy (error_val);
  1133     *gerror = g_error_copy (error_val);
  1477   else
  1134   else
  1478     *gerror = NULL;
  1135     *gerror = NULL;
  1479 
  1136 
  1480   if (debug)
  1137   if (debug)
  1481     *debug =
  1138     *debug = g_strdup (gst_structure_get_string (message->structure, "debug"));
  1482         g_value_dup_string (gst_structure_id_get_value (message->structure,
       
  1483             GST_QUARK (DEBUG)));
       
  1484 }
  1139 }
  1485 
  1140 
  1486 /**
  1141 /**
  1487  * gst_message_parse_warning:
  1142  * gst_message_parse_warning:
  1488  * @message: A valid #GstMessage of type GST_MESSAGE_WARNING.
  1143  * @message: A valid #GstMessage of type GST_MESSAGE_WARNING.
  1506   GError *error_val;
  1161   GError *error_val;
  1507 
  1162 
  1508   g_return_if_fail (GST_IS_MESSAGE (message));
  1163   g_return_if_fail (GST_IS_MESSAGE (message));
  1509   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING);
  1164   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING);
  1510 
  1165 
  1511   error_gvalue =
  1166   error_gvalue = gst_structure_get_value (message->structure, "gerror");
  1512       gst_structure_id_get_value (message->structure, GST_QUARK (GERROR));
       
  1513   g_return_if_fail (error_gvalue != NULL);
  1167   g_return_if_fail (error_gvalue != NULL);
  1514   g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
  1168   g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
  1515 
  1169 
  1516   error_val = (GError *) g_value_get_boxed (error_gvalue);
  1170   error_val = (GError *) g_value_get_boxed (error_gvalue);
  1517   if (error_val)
  1171   if (error_val)
  1518     *gerror = g_error_copy (error_val);
  1172     *gerror = g_error_copy (error_val);
  1519   else
  1173   else
  1520     *gerror = NULL;
  1174     *gerror = NULL;
  1521 
  1175 
  1522   if (debug)
  1176   if (debug)
  1523     *debug =
  1177     *debug = g_strdup (gst_structure_get_string (message->structure, "debug"));
  1524         g_value_dup_string (gst_structure_id_get_value (message->structure,
       
  1525             GST_QUARK (DEBUG)));
       
  1526 }
  1178 }
  1527 
  1179 
  1528 /**
  1180 /**
  1529  * gst_message_parse_info:
  1181  * gst_message_parse_info:
  1530  * @message: A valid #GstMessage of type GST_MESSAGE_INFO.
  1182  * @message: A valid #GstMessage of type GST_MESSAGE_INFO.
  1549   GError *error_val;
  1201   GError *error_val;
  1550 
  1202 
  1551   g_return_if_fail (GST_IS_MESSAGE (message));
  1203   g_return_if_fail (GST_IS_MESSAGE (message));
  1552   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO);
  1204   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO);
  1553 
  1205 
  1554   error_gvalue =
  1206   error_gvalue = gst_structure_get_value (message->structure, "gerror");
  1555       gst_structure_id_get_value (message->structure, GST_QUARK (GERROR));
       
  1556   g_return_if_fail (error_gvalue != NULL);
  1207   g_return_if_fail (error_gvalue != NULL);
  1557   g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
  1208   g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
  1558 
  1209 
  1559   error_val = (GError *) g_value_get_boxed (error_gvalue);
  1210   error_val = (GError *) g_value_get_boxed (error_gvalue);
  1560   if (error_val)
  1211   if (error_val)
  1561     *gerror = g_error_copy (error_val);
  1212     *gerror = g_error_copy (error_val);
  1562   else
  1213   else
  1563     *gerror = NULL;
  1214     *gerror = NULL;
  1564 
  1215 
  1565   if (debug)
  1216   if (debug)
  1566     *debug =
  1217     *debug = g_strdup (gst_structure_get_string (message->structure, "debug"));
  1567         g_value_dup_string (gst_structure_id_get_value (message->structure,
       
  1568             GST_QUARK (DEBUG)));
       
  1569 }
  1218 }
  1570 
  1219 
  1571 /**
  1220 /**
  1572  * gst_message_parse_segment_start:
  1221  * gst_message_parse_segment_start:
  1573  * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_START.
  1222  * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_START.
  1584 
  1233 
  1585 void
  1234 void
  1586 gst_message_parse_segment_start (GstMessage * message, GstFormat * format,
  1235 gst_message_parse_segment_start (GstMessage * message, GstFormat * format,
  1587     gint64 * position)
  1236     gint64 * position)
  1588 {
  1237 {
       
  1238   const GstStructure *structure;
       
  1239 
  1589   g_return_if_fail (GST_IS_MESSAGE (message));
  1240   g_return_if_fail (GST_IS_MESSAGE (message));
  1590   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_START);
  1241   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_START);
  1591 
  1242 
       
  1243   structure = gst_message_get_structure (message);
  1592   if (format)
  1244   if (format)
  1593     *format =
  1245     *format = g_value_get_enum (gst_structure_get_value (structure, "format"));
  1594         g_value_get_enum (gst_structure_id_get_value (message->structure,
       
  1595             GST_QUARK (FORMAT)));
       
  1596   if (position)
  1246   if (position)
  1597     *position =
  1247     *position =
  1598         g_value_get_int64 (gst_structure_id_get_value (message->structure,
  1248         g_value_get_int64 (gst_structure_get_value (structure, "position"));
  1599             GST_QUARK (POSITION)));
       
  1600 }
  1249 }
  1601 
  1250 
  1602 /**
  1251 /**
  1603  * gst_message_parse_segment_done:
  1252  * gst_message_parse_segment_done:
  1604  * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE.
  1253  * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE.
  1615 
  1264 
  1616 void
  1265 void
  1617 gst_message_parse_segment_done (GstMessage * message, GstFormat * format,
  1266 gst_message_parse_segment_done (GstMessage * message, GstFormat * format,
  1618     gint64 * position)
  1267     gint64 * position)
  1619 {
  1268 {
       
  1269   const GstStructure *structure;
       
  1270 
  1620   g_return_if_fail (GST_IS_MESSAGE (message));
  1271   g_return_if_fail (GST_IS_MESSAGE (message));
  1621   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_DONE);
  1272   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_DONE);
  1622 
  1273 
       
  1274   structure = gst_message_get_structure (message);
  1623   if (format)
  1275   if (format)
  1624     *format =
  1276     *format = g_value_get_enum (gst_structure_get_value (structure, "format"));
  1625         g_value_get_enum (gst_structure_id_get_value (message->structure,
       
  1626             GST_QUARK (FORMAT)));
       
  1627   if (position)
  1277   if (position)
  1628     *position =
  1278     *position =
  1629         g_value_get_int64 (gst_structure_id_get_value (message->structure,
  1279         g_value_get_int64 (gst_structure_get_value (structure, "position"));
  1630             GST_QUARK (POSITION)));
       
  1631 }
  1280 }
  1632 
  1281 
  1633 /**
  1282 /**
  1634  * gst_message_parse_duration:
  1283  * gst_message_parse_duration:
  1635  * @message: A valid #GstMessage of type GST_MESSAGE_DURATION.
  1284  * @message: A valid #GstMessage of type GST_MESSAGE_DURATION.
  1649 
  1298 
  1650 void
  1299 void
  1651 gst_message_parse_duration (GstMessage * message, GstFormat * format,
  1300 gst_message_parse_duration (GstMessage * message, GstFormat * format,
  1652     gint64 * duration)
  1301     gint64 * duration)
  1653 {
  1302 {
       
  1303   const GstStructure *structure;
       
  1304 
  1654   g_return_if_fail (GST_IS_MESSAGE (message));
  1305   g_return_if_fail (GST_IS_MESSAGE (message));
  1655   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION);
  1306   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION);
  1656 
  1307 
       
  1308   structure = gst_message_get_structure (message);
  1657   if (format)
  1309   if (format)
  1658     *format =
  1310     *format = g_value_get_enum (gst_structure_get_value (structure, "format"));
  1659         g_value_get_enum (gst_structure_id_get_value (message->structure,
       
  1660             GST_QUARK (FORMAT)));
       
  1661   if (duration)
  1311   if (duration)
  1662     *duration =
  1312     *duration =
  1663         g_value_get_int64 (gst_structure_id_get_value (message->structure,
  1313         g_value_get_int64 (gst_structure_get_value (structure, "duration"));
  1664             GST_QUARK (DURATION)));
       
  1665 }
  1314 }
  1666 
  1315 
  1667 /**
  1316 /**
  1668  * gst_message_parse_async_start:
  1317  * gst_message_parse_async_start:
  1669  * @message: A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE.
  1318  * @message: A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE.
  1680 #endif
  1329 #endif
  1681 
  1330 
  1682 void
  1331 void
  1683 gst_message_parse_async_start (GstMessage * message, gboolean * new_base_time)
  1332 gst_message_parse_async_start (GstMessage * message, gboolean * new_base_time)
  1684 {
  1333 {
       
  1334   const GstStructure *structure;
       
  1335 
  1685   g_return_if_fail (GST_IS_MESSAGE (message));
  1336   g_return_if_fail (GST_IS_MESSAGE (message));
  1686   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_START);
  1337   g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_START);
  1687 
  1338 
       
  1339   structure = gst_message_get_structure (message);
  1688   if (new_base_time)
  1340   if (new_base_time)
  1689     *new_base_time =
  1341     *new_base_time =
  1690         g_value_get_boolean (gst_structure_id_get_value (message->structure,
  1342         g_value_get_boolean (gst_structure_get_value (structure,
  1691             GST_QUARK (NEW_BASE_TIME)));
  1343             "new-base-time"));
  1692 }
  1344 }
  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 }