mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
element: API: Add GstElement::post_message() vfunc
Conflicts: gst/gstelement.h
This commit is contained in:
parent
f354e12b09
commit
1c4fe1bf1a
2 changed files with 39 additions and 17 deletions
|
@ -130,6 +130,9 @@ static GstStateChangeReturn gst_element_set_state_func (GstElement * element,
|
|||
static gboolean gst_element_set_clock_func (GstElement * element,
|
||||
GstClock * clock);
|
||||
static void gst_element_set_bus_func (GstElement * element, GstBus * bus);
|
||||
static gboolean gst_element_post_message_default (GstElement * element,
|
||||
GstMessage * message);
|
||||
|
||||
|
||||
static gboolean gst_element_default_send_event (GstElement * element,
|
||||
GstEvent * event);
|
||||
|
@ -235,6 +238,7 @@ gst_element_class_init (GstElementClass * klass)
|
|||
klass->query = GST_DEBUG_FUNCPTR (gst_element_default_query);
|
||||
klass->send_event = GST_DEBUG_FUNCPTR (gst_element_default_send_event);
|
||||
klass->numpadtemplates = 0;
|
||||
klass->post_message = GST_DEBUG_FUNCPTR (gst_element_post_message_default);
|
||||
|
||||
klass->elementfactory = NULL;
|
||||
}
|
||||
|
@ -1662,22 +1666,8 @@ gst_element_query (GstElement * element, GstQuery * query)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_post_message:
|
||||
* @element: a #GstElement posting the message
|
||||
* @message: (transfer full): a #GstMessage to post
|
||||
*
|
||||
* Post a message on the element's #GstBus. This function takes ownership of the
|
||||
* message; if you want to access the message after this call, you should add an
|
||||
* additional reference before calling.
|
||||
*
|
||||
* Returns: %TRUE if the message was successfully posted. The function returns
|
||||
* %FALSE if the element did not have a bus.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
gboolean
|
||||
gst_element_post_message (GstElement * element, GstMessage * message)
|
||||
static gboolean
|
||||
gst_element_post_message_default (GstElement * element, GstMessage * message)
|
||||
{
|
||||
GstBus *bus;
|
||||
gboolean result = FALSE;
|
||||
|
@ -1712,6 +1702,34 @@ no_bus:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_post_message:
|
||||
* @element: a #GstElement posting the message
|
||||
* @message: (transfer full): a #GstMessage to post
|
||||
*
|
||||
* Post a message on the element's #GstBus. This function takes ownership of the
|
||||
* message; if you want to access the message after this call, you should add an
|
||||
* additional reference before calling.
|
||||
*
|
||||
* Returns: %TRUE if the message was successfully posted. The function returns
|
||||
* %FALSE if the element did not have a bus.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
gboolean
|
||||
gst_element_post_message (GstElement * element, GstMessage * message)
|
||||
{
|
||||
GstElementClass *klass;
|
||||
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
||||
|
||||
klass = GST_ELEMENT_GET_CLASS (element);
|
||||
if (klass->post_message)
|
||||
return klass->post_message (element, message);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gst_element_error_printf:
|
||||
* @format: the printf-like format to use, or %NULL
|
||||
|
|
|
@ -591,6 +591,8 @@ struct _GstElement
|
|||
* @send_event: send a #GstEvent to the element
|
||||
* @query: perform a #GstQuery on the element
|
||||
* @state_changed: called immediately after a new state was set.
|
||||
* @post_message: called when a message is posted on the element. Chain up to
|
||||
* the parent class' handler to have it posted on the bus.
|
||||
*
|
||||
* GStreamer element class. Override the vmethods to implement the element
|
||||
* functionality.
|
||||
|
@ -645,8 +647,10 @@ struct _GstElementClass
|
|||
|
||||
gboolean (*query) (GstElement *element, GstQuery *query);
|
||||
|
||||
gboolean (*post_message) (GstElement *element, GstMessage *message);
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING_LARGE];
|
||||
gpointer _gst_reserved[GST_PADDING_LARGE-1];
|
||||
};
|
||||
|
||||
/* element class pad templates */
|
||||
|
|
Loading…
Reference in a new issue