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)
{
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 */
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.
* @event: (transfer full): the #GstEvent to send to the pad.
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);
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,
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);
/* 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);
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;
}
/**
- * 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.
* @iterintlink: the #GstPadIterIntLinkFunction to set.
/* 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.
* @query: the #GstQuery object to execute
gint64 offset;
/* generic query method */
- GstPadQueryTypeFunction querytypefunc;
GstPadQueryFunction queryfunc;
/* internal links */
#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)
/* 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);
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);
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);
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)
{
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);
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 =
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 ();
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
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)
{
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",