g_type_class_ref (gst_lock_flags_get_type ());
g_type_class_ref (gst_allocator_flags_get_type ());
g_type_class_ref (gst_stream_flags_get_type ());
- g_type_class_ref (gst_message_extended_type_get_type ());
_priv_gst_event_initialize ();
_priv_gst_buffer_initialize ();
g_type_class_unref (g_type_class_peek (gst_allocator_flags_get_type ()));
g_type_class_unref (g_type_class_peek (gst_stream_flags_get_type ()));
g_type_class_unref (g_type_class_peek (gst_debug_color_mode_get_type ()));
- g_type_class_unref (g_type_class_peek (gst_message_extended_type_get_type
- ()));
gst_deinitialized = TRUE;
GST_INFO ("deinitialized GStreamer");
* Get a message matching @type from the bus. Will discard all messages on
* the bus that do not match @type and that have been posted before the first
* message that does match @type. If there is no message matching @type on
- * the bus, all messages will be discarded.
+ * the bus, all messages will be discarded. It is not possible to use message
+ * enums beyond #GST_MESSAGE_EXTENDED in the @events mask.
*
* Returns: (transfer full): the next #GstMessage matching @type that is on
* the bus, or NULL if the bus is empty or there is no message matching
* gst_bus_poll:
* @bus: a #GstBus
* @events: a mask of #GstMessageType, representing the set of message types to
- * poll for.
+ * poll for (note special handling of extended message types below)
* @timeout: the poll timeout, as a #GstClockTime, or #GST_CLOCK_TIME_NONE to poll
* indefinitely.
*
* @timeout is negative, this function will block indefinitely.
*
* All messages not in @events will be popped off the bus and will be ignored.
+ * It is not possible to use message enums beyond #GST_MESSAGE_EXTENDED in the
+ * @events mask
*
* Because poll is implemented using the "message" signal enabled by
* gst_bus_add_signal_watch(), calling gst_bus_poll() will cause the "message"
{
GstMessage message;
- GstMessageExtendedType extended_type;
-
GstStructure *structure;
} GstMessageImpl;
{GST_MESSAGE_STREAM_START, "stream-start", 0},
{GST_MESSAGE_NEED_CONTEXT, "need-context", 0},
{GST_MESSAGE_HAVE_CONTEXT, "have-context", 0},
- {GST_MESSAGE_EXTENDED, "extended", 0},
{GST_MESSAGE_DEVICE_ADDED, "device-added", 0},
{GST_MESSAGE_DEVICE_REMOVED, "device-removed", 0},
{0, NULL, 0}
return GST_MESSAGE_CAST (copy);
}
-GstMessageExtendedType
-gst_message_get_extended_type (GstMessage * msg)
-{
- GstMessageImpl *message = (GstMessageImpl *) msg;
-
- g_return_val_if_fail (GST_IS_MESSAGE (msg), 0);
-
- return message->extended_type;
-}
-
static void
gst_message_init (GstMessageImpl * message, GstMessageType type,
GstObject * src)
}
}
-static inline GstMessage *
-gst_message_new_extended (GstMessageExtendedType extended_type, GstObject * src,
- GstStructure * structure)
-{
- GstMessageImpl *message;
-
- message = (GstMessageImpl *) gst_message_new_custom (GST_MESSAGE_EXTENDED,
- src, structure);
-
- message->extended_type = extended_type;
-
- return GST_MESSAGE_CAST (message);
-}
-
/**
* gst_message_get_seqnum:
* @message: A #GstMessage.
GstMessage *message;
GstStructure *structure;
+ g_return_val_if_fail (device != NULL, NULL);
+ g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
+
structure = gst_structure_new_id (GST_QUARK (MESSAGE_DEVICE_ADDED),
GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL);
- message = gst_message_new_extended (GST_MESSAGE_DEVICE_ADDED, src, structure);
+ message = gst_message_new_custom (GST_MESSAGE_DEVICE_ADDED, src, structure);
return message;
}
gst_message_parse_device_added (GstMessage * message, GstDevice ** device)
{
g_return_if_fail (GST_IS_MESSAGE (message));
- g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EXTENDED);
- g_return_if_fail (gst_message_get_extended_type (message) ==
- GST_MESSAGE_DEVICE_ADDED);
+ g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_ADDED);
if (device)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message),
GstMessage *message;
GstStructure *structure;
+ g_return_val_if_fail (device != NULL, NULL);
+ g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
+
structure = gst_structure_new_id (GST_QUARK (MESSAGE_DEVICE_REMOVED),
GST_QUARK (DEVICE), GST_TYPE_DEVICE, device, NULL);
- message = gst_message_new_extended (GST_MESSAGE_DEVICE_REMOVED, src,
- structure);
+ message = gst_message_new_custom (GST_MESSAGE_DEVICE_REMOVED, src, structure);
return message;
}
gst_message_parse_device_removed (GstMessage * message, GstDevice ** device)
{
g_return_if_fail (GST_IS_MESSAGE (message));
- g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EXTENDED);
- g_return_if_fail (gst_message_get_extended_type (message) ==
- GST_MESSAGE_DEVICE_REMOVED);
+ g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DEVICE_REMOVED);
if (device)
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message),
* the URI for the next title has been set).
* @GST_MESSAGE_NEED_CONTEXT: Message indicating that an element wants a specific context (Since 1.2)
* @GST_MESSAGE_HAVE_CONTEXT: Message indicating that an element created a context (Since 1.2)
- * @GST_MESSAGE_EXTENDED: See gst_message_get_extended_type() to get the type (Since 1.2)
+ * @GST_MESSAGE_EXTENDED: Message is an extended message type (see below).
+ * These extended message IDs can't be used directly with mask-based API
+ * like gst_bus_poll() or gst_bus_timed_pop_filtered(), but you can still
+ * filter for GST_MESSAGE_EXTENDED and then check the result for the
+ * specific type. (Since 1.4)
+ * @GST_MESSAGE_DEVICE_ADDED: Message indicating a #GstDevice was added to
+ * a #GstDeviceMonitor (Since 1.4)
+ * @GST_MESSAGE_DEVICE_REMOVED: Message indicating a #GstDevice was removed
+ * from a #GstDeviceMonitor (Since 1.4)
* @GST_MESSAGE_ANY: mask for all of the above messages.
*
- * The different message types that are available. Also see
- * #GstMessageExtendedType for more types.
+ * The different message types that are available.
*/
/* NOTE: keep in sync with quark registration in gstmessage.c
* NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings.
GST_MESSAGE_NEED_CONTEXT = (1 << 29),
GST_MESSAGE_HAVE_CONTEXT = (1 << 30),
GST_MESSAGE_EXTENDED = (1 << 31),
+ GST_MESSAGE_DEVICE_ADDED = GST_MESSAGE_EXTENDED + 1,
+ GST_MESSAGE_DEVICE_REMOVED = GST_MESSAGE_EXTENDED + 2,
GST_MESSAGE_ANY = ~0
} GstMessageType;
-/**
- * GstMessageExtendedType:
- * @GST_MESSAGE_DEVICE_ADDED: A #GstDevice addition according to
- * a #GstDeviceMonitor (Since 1.4)
- * @GST_MESSAGE_DEVICE_REMOVED: A #GstDevice removal according to
- * a #GstDeviceMonitor (Since 1.4)
- *
- * Extra message types, see #GstMessageType for the basic types
- *
- * Since: 1.4
- */
-
-typedef enum {
- /* Skip those defined in #GstMessage to avoid confusion */
- GST_MESSAGE_DEVICE_ADDED = 3,
- GST_MESSAGE_DEVICE_REMOVED = 5
-} GstMessageExtendedType;
-
#include <gst/gstminiobject.h>
#include <gst/gstobject.h>
#include <gst/gstelement.h>
const gchar* gst_message_type_get_name (GstMessageType type);
GQuark gst_message_type_to_quark (GstMessageType type);
-GstMessageExtendedType gst_message_get_extended_type (GstMessage * msg);
-
/* refcounting */
/**
* gst_message_ref:
"GstEventSegmentDone",
"GstEventStreamStart", "stream-id", "GstQueryContext",
"GstMessageNeedContext", "GstMessageHaveContext", "context", "context-type",
- "GstMessageStreamStart", "group-id", "uri-redirection", "GstMessageExtended",
+ "GstMessageStreamStart", "group-id", "uri-redirection",
"GstMessageDeviceAdded", "GstMessageDeviceRemoved", "device"
};
GST_QUARK_MESSAGE_STREAM_START = 167,
GST_QUARK_GROUP_ID = 168,
GST_QUARK_URI_REDIRECTION = 169,
- GST_QUARK_MESSAGE_EXTENDED = 170,
- GST_QUARK_MESSAGE_DEVICE_ADDED = 171,
- GST_QUARK_MESSAGE_DEVICE_REMOVED = 172,
- GST_QUARK_DEVICE = 173,
- GST_QUARK_MAX = 174
+ GST_QUARK_MESSAGE_DEVICE_ADDED = 170,
+ GST_QUARK_MESSAGE_DEVICE_REMOVED = 171,
+ GST_QUARK_DEVICE = 172,
+ GST_QUARK_MAX = 173
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
gst_memory_resize
gst_memory_share
gst_memory_unmap
- gst_message_extended_type_get_type
- gst_message_get_extended_type
gst_message_get_seqnum
gst_message_get_stream_status_object
gst_message_get_structure