Commit 9e238148 authored by Wim Taymans's avatar Wim Taymans

Added element query

Original commit message from CVS:
Added element query
parent 225d1191
......@@ -64,6 +64,8 @@ static void gst_element_dispatch_properties_changed (GObject * object, guint n
static void gst_element_dispose (GObject *object);
static gboolean gst_element_send_event_default (GstElement *element, GstEvent *event);
static gboolean gst_element_query_default (GstElement *element, GstPadQueryType type,
GstFormat *format, gint64 *value);
static GstElementStateReturn gst_element_change_state (GstElement *element);
static void gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg);
......@@ -162,6 +164,7 @@ gst_element_class_init (GstElementClass *klass)
klass->padtemplates = NULL;
klass->numpadtemplates = 0;
klass->send_event = GST_DEBUG_FUNCPTR (gst_element_send_event_default);
klass->query = GST_DEBUG_FUNCPTR (gst_element_query_default);
}
static void
......@@ -1658,6 +1661,42 @@ gst_element_send_event (GstElement *element, GstEvent *event)
return FALSE;
}
static gboolean
gst_element_query_default (GstElement *element, GstPadQueryType type,
GstFormat *format, gint64 *value)
{
GList *pads = element->pads;
gboolean res = FALSE;
while (pads) {
GstPad *pad = GST_PAD_CAST (pads->data);
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
if (GST_PAD_IS_CONNECTED (pad)) {
res = gst_pad_query (GST_PAD_PEER (pad), type, format, value);
break;
}
}
pads = g_list_next (pads);
}
return res;
}
gboolean
gst_element_query (GstElement *element, GstPadQueryType type,
GstFormat *format, gint64 *value)
{
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (format != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
if (CLASS (element)->query)
return CLASS (element)->query (element, type, format, value);
return FALSE;
}
/**
* gst_element_error:
......
......@@ -172,6 +172,8 @@ struct _GstElementClass {
/* vtable*/
gboolean (*release_locks) (GstElement *element);
gboolean (*send_event) (GstElement *element, GstEvent *event);
gboolean (*query) (GstElement *element, GstPadQueryType type,
GstFormat *format, gint64 *value);
/* change the element state */
GstElementStateReturn (*change_state) (GstElement *element);
/* request a new pad */
......@@ -263,6 +265,8 @@ void gst_element_disconnect_pads (GstElement *src, const gchar *srcpadname,
GstElement *dest, const gchar *destpadname);
gboolean gst_element_send_event (GstElement *element, GstEvent *event);
gboolean gst_element_query (GstElement *element, GstPadQueryType type,
GstFormat *format, gint64 *value);
void gst_element_set_eos (GstElement *element);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment