Commit 6cc72541 authored by Wim Taymans's avatar Wim Taymans
Browse files

remove query types

It was not really useful
parent ac9e5533
......@@ -1571,48 +1571,6 @@ gst_element_seek (GstElement * element, gdouble rate, GstFormat format,
return result;
}
/**
* gst_element_get_query_types:
* @element: a #GstElement to query
*
* Get an array of query types from the element.
* If the element doesn't implement a query types function,
* the query will be forwarded to the peer of a random linked sink pad.
*
* Returns: An array of #GstQueryType elements that should not
* be freed or modified.
*
* MT safe.
*/
const GstQueryType *
gst_element_get_query_types (GstElement * element)
{
GstElementClass *oclass;
const GstQueryType *result = NULL;
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
oclass = GST_ELEMENT_GET_CLASS (element);
if (oclass->get_query_types) {
result = oclass->get_query_types (element);
} else {
GstPad *pad = gst_element_get_random_pad (element, TRUE, GST_PAD_SINK);
if (pad) {
GstPad *peer = gst_pad_get_peer (pad);
if (peer) {
result = gst_pad_get_query_types (peer);
gst_object_unref (peer);
}
gst_object_unref (pad);
}
}
return result;
}
static gboolean
gst_element_default_query (GstElement * element, GstQuery * query)
{
......
......@@ -767,7 +767,6 @@ gboolean gst_element_seek (GstElement *element, gd
GstFormat format, GstSeekFlags flags,
GstSeekType cur_type, gint64 cur,
GstSeekType stop_type, gint64 stop);
const GstQueryType* gst_element_get_query_types (GstElement *element);
gboolean gst_element_query (GstElement *element, GstQuery *query);
/* messages */
......
......@@ -66,41 +66,6 @@ G_DEFINE_TYPE (GstProxyPad, gst_proxy_pad, GST_TYPE_PAD);
static GstPad *gst_proxy_pad_get_target (GstPad * pad);
/**
* gst_proxy_pad_query_type_default:
* @pad: a #GstPad.
*
* Invoke the default query type handler of the proxy pad.
*
* Returns: (transfer none) (array zero-terminated=1): a zero-terminated array
* of #GstQueryType.
*
* Since: 0.10.36
*/
const GstQueryType *
gst_proxy_pad_query_type_default (GstPad * pad)
{
GstPad *target;
const GstQueryType *res = NULL;
g_return_val_if_fail (GST_IS_PROXY_PAD (pad), NULL);
if (!(target = gst_proxy_pad_get_target (pad)))
goto no_target;
res = gst_pad_get_query_types (target);
gst_object_unref (target);
return res;
/* ERRORS */
no_target:
{
GST_DEBUG_OBJECT (pad, "no target pad");
return FALSE;
}
}
/**
* gst_proxy_pad_event_default:
* @pad: a #GstPad to push the event to.
......@@ -494,7 +459,6 @@ gst_proxy_pad_class_init (GstProxyPadClass * klass)
g_type_class_add_private (klass, sizeof (GstProxyPadPrivate));
/* Register common function pointer descriptions */
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_query_type_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_event_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_query_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_iterate_internal_links_default);
......@@ -515,7 +479,6 @@ gst_proxy_pad_init (GstProxyPad * ppad)
GST_PROXY_PAD_PRIVATE (ppad) = G_TYPE_INSTANCE_GET_PRIVATE (ppad,
GST_TYPE_PROXY_PAD, GstProxyPadPrivate);
gst_pad_set_query_type_function (pad, gst_proxy_pad_query_type_default);
gst_pad_set_event_function (pad, gst_proxy_pad_event_default);
gst_pad_set_query_function (pad, gst_proxy_pad_query_default);
gst_pad_set_iterate_internal_links_function (pad,
......
......@@ -62,7 +62,6 @@ GType gst_proxy_pad_get_type (void);
GstProxyPad* gst_proxy_pad_get_internal (GstProxyPad *pad);
const GstQueryType* gst_proxy_pad_query_type_default (GstPad *pad);
gboolean gst_proxy_pad_event_default (GstPad *pad, GstEvent *event);
gboolean gst_proxy_pad_query_default (GstPad *pad, GstQuery *query);
GstIterator* gst_proxy_pad_iterate_internal_links_default (GstPad *pad);
......
......@@ -300,7 +300,6 @@ gst_pad_class_init (GstPadClass * klass)
/* Register common function pointer descriptions */
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_activate_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_event_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_get_query_types_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_query_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_iterate_internal_links_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_pad_acceptcaps_default);
......@@ -317,7 +316,6 @@ gst_pad_init (GstPad * pad)
GST_PAD_ACTIVATEFUNC (pad) = gst_pad_activate_default;
GST_PAD_EVENTFUNC (pad) = gst_pad_event_default;
GST_PAD_QUERYTYPEFUNC (pad) = gst_pad_get_query_types_default;
GST_PAD_QUERYFUNC (pad) = gst_pad_query_default;
GST_PAD_ITERINTLINKFUNC (pad) = gst_pad_iterate_internal_links_default;
GST_PAD_ACCEPTCAPSFUNC (pad) = gst_pad_acceptcaps_default;
......@@ -1446,89 +1444,6 @@ gst_pad_set_query_function (GstPad * pad, GstPadQueryFunction query)
GST_DEBUG_FUNCPTR_NAME (query));
}
/**
* gst_pad_set_query_type_function:
* @pad: a #GstPad of either direction.
* @type_func: the #GstPadQueryTypeFunction to set.
*
* Set the given query type function for the pad.
*/
void
gst_pad_set_query_type_function (GstPad * pad,
GstPadQueryTypeFunction type_func)
{
g_return_if_fail (GST_IS_PAD (pad));
GST_PAD_QUERYTYPEFUNC (pad) = type_func;
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "querytypefunc set to %s",
GST_DEBUG_FUNCPTR_NAME (type_func));
}
/**
* gst_pad_get_query_types:
* @pad: a #GstPad.
*
* Get an array of supported queries that can be performed
* on this pad.
*
* Returns: (transfer none) (array zero-terminated=1): a zero-terminated array
* of #GstQueryType.
*/
const GstQueryType *
gst_pad_get_query_types (GstPad * pad)
{
GstPadQueryTypeFunction func;
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
if (G_UNLIKELY ((func = GST_PAD_QUERYTYPEFUNC (pad)) == NULL))
goto no_func;
return func (pad);
no_func:
{
return NULL;
}
}
static gboolean
gst_pad_get_query_types_dispatcher (GstPad * pad, const GstQueryType ** data)
{
GstPad *peer;
if ((peer = gst_pad_get_peer (pad))) {
*data = gst_pad_get_query_types (peer);
gst_object_unref (peer);
}
return TRUE;
}
/**
* gst_pad_get_query_types_default:
* @pad: a #GstPad.
*
* Invoke the default query types function on the pad. This function will get
* the supported query type from the peer of an internally linked pad of @pad.
*
* Returns: (transfer none) (array zero-terminated=1): a zero-terminated array
* of #GstQueryType, or NULL if none of the internally-linked pads has a
* query types function.
*/
const GstQueryType *
gst_pad_get_query_types_default (GstPad * pad)
{
GstQueryType *result = NULL;
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
gst_pad_forward (pad, (GstPadForwardFunction)
gst_pad_get_query_types_dispatcher, &result);
return result;
}
/**
* gst_pad_set_iterate_internal_links_function:
* @pad: a #GstPad of either direction.
......
......@@ -366,16 +366,6 @@ typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad);
/* generic query function */
/**
* GstPadQueryTypeFunction:
* @pad: a #GstPad to query
*
* The signature of the query types function.
*
* Returns: a constant array of query types
*/
typedef const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
/**
* GstPadQueryFunction:
* @pad: the #GstPad to query.
......@@ -701,7 +691,6 @@ struct _GstPad {
gint64 offset;
/* generic query method */
GstPadQueryTypeFunction querytypefunc;
GstPadQueryFunction queryfunc;
/* internal links */
......@@ -746,7 +735,6 @@ struct _GstPadClass {
#define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc)
#define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
#define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
#define GST_PAD_QUERYTYPEFUNC(pad) (GST_PAD_CAST(pad)->querytypefunc)
#define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
#define GST_PAD_ITERINTLINKFUNC(pad) (GST_PAD_CAST(pad)->iterintlinkfunc)
......@@ -944,10 +932,6 @@ GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad);
/* generic query function */
void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
const GstQueryType* gst_pad_get_query_types (GstPad *pad);
const GstQueryType* gst_pad_get_query_types_default (GstPad *pad);
gboolean gst_pad_query (GstPad *pad, GstQuery *query);
gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query);
void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
......
......@@ -387,7 +387,6 @@ static gboolean gst_base_parse_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_base_parse_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_base_parse_query (GstPad * pad, GstQuery * query);
static GstCaps *gst_base_parse_sink_getcaps (GstPad * pad, GstCaps * filter);
static const GstQueryType *gst_base_parse_get_querytypes (GstPad * pad);
static GstFlowReturn gst_base_parse_chain (GstPad * pad, GstBuffer * buffer);
static void gst_base_parse_loop (GstPad * pad);
......@@ -543,8 +542,6 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass)
parse->srcpad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_event_function (parse->srcpad,
GST_DEBUG_FUNCPTR (gst_base_parse_src_event));
gst_pad_set_query_type_function (parse->srcpad,
GST_DEBUG_FUNCPTR (gst_base_parse_get_querytypes));
gst_pad_set_query_function (parse->srcpad,
GST_DEBUG_FUNCPTR (gst_base_parse_query));
gst_pad_use_fixed_caps (parse->srcpad);
......@@ -3272,21 +3269,6 @@ gst_base_parse_get_duration (GstBaseParse * parse, GstFormat format,
return res;
}
static const GstQueryType *
gst_base_parse_get_querytypes (GstPad * pad)
{
static const GstQueryType list[] = {
GST_QUERY_POSITION,
GST_QUERY_DURATION,
GST_QUERY_FORMATS,
GST_QUERY_SEEKING,
GST_QUERY_CONVERT,
GST_QUERY_NONE
};
return list;
}
static gboolean
gst_base_parse_query (GstPad * pad, GstQuery * query)
{
......
......@@ -326,7 +326,6 @@ static gboolean gst_base_transform_setcaps (GstBaseTransform * trans,
static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_transform_default_query (GstBaseTransform * trans,
GstPadDirection direction, GstQuery * query);
static const GstQueryType *gst_base_transform_query_type (GstPad * pad);
static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans,
GstBuffer * inbuf, GstBuffer ** outbuf);
......@@ -410,8 +409,6 @@ gst_base_transform_init (GstBaseTransform * trans,
GST_DEBUG_FUNCPTR (gst_base_transform_sink_activate_push));
gst_pad_set_query_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_query));
gst_pad_set_query_type_function (trans->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_transform_query_type));
gst_element_add_pad (GST_ELEMENT (trans), trans->sinkpad);
pad_template =
......@@ -430,8 +427,6 @@ gst_base_transform_init (GstBaseTransform * trans,
GST_DEBUG_FUNCPTR (gst_base_transform_src_activate_pull));
gst_pad_set_query_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_query));
gst_pad_set_query_type_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_query_type));
gst_element_add_pad (GST_ELEMENT (trans), trans->srcpad);
trans->transform_lock = g_mutex_new ();
......@@ -1400,17 +1395,6 @@ gst_base_transform_query (GstPad * pad, GstQuery * query)
return ret;
}
static const GstQueryType *
gst_base_transform_query_type (GstPad * pad)
{
static const GstQueryType types[] = {
GST_QUERY_POSITION,
GST_QUERY_NONE
};
return types;
}
/* this function either returns the input buffer without incrementing the
* refcount or it allocates a new (writable) buffer */
static GstFlowReturn
......
......@@ -100,26 +100,7 @@ print_formats (const GstFormat * formats)
formats++;
}
}
#endif
static void
print_query_types (const GstQueryType * types)
{
while (types && *types) {
const GstQueryTypeDefinition *definition;
definition = gst_query_type_get_details (*types);
if (definition)
n_print ("\t\t(%d):\t%s (%s)\n", *types,
definition->nick, definition->description);
else
n_print ("\t\t(%d):\tUnknown query format\n", *types);
types++;
}
}
#if 0
static void
print_event_masks (const GstEventMask * masks)
{
......@@ -821,13 +802,6 @@ print_pad_info (GstElement * element)
if (pad->queryfunc != gst_pad_query_default)
n_print (" Has custom queryfunc(): %s\n",
GST_DEBUG_FUNCPTR_NAME (pad->queryfunc));
if (pad->querytypefunc != gst_pad_get_query_types_default) {
const GstQueryType *query_types = gst_pad_get_query_types (pad);
if (query_types) {
n_print (" Provides query types:\n");
print_query_types (query_types);
}
}
if (pad->iterintlinkfunc != gst_pad_iterate_internal_links_default)
n_print (" Has custom iterintlinkfunc(): %s\n",
......
Supports Markdown
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