return res;
}
-/**
- * gst_proxy_pad_checkgetrange_default:
- * @pad: a src #GstPad, returns #GST_FLOW_ERROR if not.
- *
- * Invoke the default checkgetrange function of the proxy pad.
- *
- * Returns: a #gboolean from the pad.
- *
- * Since: 0.10.35
- */
-gboolean
-gst_proxy_pad_checkgetrange_default (GstPad * pad)
-{
- gboolean result;
- GstPad *internal;
-
- g_return_val_if_fail (GST_IS_PROXY_PAD (pad), FALSE);
-
- internal = GST_PROXY_PAD_INTERNAL (pad);
- result = gst_pad_check_pull_range (internal);
-
- return result;
-}
-
/**
* gst_proxy_pad_getcaps_default:
* @pad: a #GstPad to get the capabilities of.
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_chain_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_chain_list_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_getrange_default);
- GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_checkgetrange_default);
}
static void
gst_pad_set_chain_list_function (pad, gst_proxy_pad_chain_list_default);
} else {
gst_pad_set_getrange_function (pad, gst_proxy_pad_getrange_default);
- gst_pad_set_checkgetrange_function (pad,
- gst_proxy_pad_checkgetrange_default);
}
/* link/unlink functions */
gst_proxy_pad_chain_list_default);
} else {
gst_pad_set_getrange_function (internal, gst_proxy_pad_getrange_default);
- gst_pad_set_checkgetrange_function (internal,
- gst_proxy_pad_checkgetrange_default);
}
GST_PROXY_LOCK (pad);
GstFlowReturn gst_proxy_pad_chain_default (GstPad *pad, GstBuffer *buffer);
GstFlowReturn gst_proxy_pad_chain_list_default (GstPad *pad, GstBufferList *list);
GstFlowReturn gst_proxy_pad_getrange_default (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer);
-gboolean gst_proxy_pad_checkgetrange_default (GstPad *pad);
GstCaps* gst_proxy_pad_getcaps_default (GstPad *pad, GstCaps * filter);
gboolean gst_proxy_pad_acceptcaps_default (GstPad *pad, GstCaps *caps);
void gst_proxy_pad_fixatecaps_default (GstPad *pad, GstCaps *caps);
GST_DEBUG_FUNCPTR_NAME (get));
}
-/**
- * gst_pad_set_checkgetrange_function:
- * @pad: a source #GstPad.
- * @check: the #GstPadCheckGetRangeFunction to set.
- *
- * Sets the given checkgetrange function for the pad. Implement this function
- * on a pad if you dynamically support getrange based scheduling on the pad.
- */
-void
-gst_pad_set_checkgetrange_function (GstPad * pad,
- GstPadCheckGetRangeFunction check)
-{
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (GST_PAD_IS_SRC (pad));
-
- GST_PAD_CHECKGETRANGEFUNC (pad) = check;
-
- GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "checkgetrangefunc set to %s",
- GST_DEBUG_FUNCPTR_NAME (check));
-}
-
/**
* gst_pad_set_event_function:
* @pad: a #GstPad of either direction.
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_IS_QUERY (query), FALSE);
- GST_DEBUG_OBJECT (pad, "sending query %p", query);
+ GST_DEBUG_OBJECT (pad, "sending query %p (%s)", query,
+ GST_QUERY_TYPE_NAME (query));
if ((func = GST_PAD_QUERYFUNC (pad)) == NULL)
goto no_func;
res = func (pad, query);
- GST_DEBUG_OBJECT (pad, "sent query %p, result %d", query, res);
+ GST_DEBUG_OBJECT (pad, "sent query %p (%s), result %d", query,
+ GST_QUERY_TYPE_NAME (query), res);
return res;
GST_OBJECT_LOCK (pad);
- GST_DEBUG_OBJECT (pad, "peer query");
+ GST_DEBUG_OBJECT (pad, "peer query %p (%s)", query,
+ GST_QUERY_TYPE_NAME (query));
peerpad = GST_PAD_PEER (pad);
if (G_UNLIKELY (peerpad == NULL))
}
}
-/**
- * gst_pad_check_pull_range:
- * @pad: a sink #GstPad.
- *
- * Checks if a gst_pad_pull_range() can be performed on the peer
- * source pad. This function is used by plugins that want to check
- * if they can use random access on the peer source pad.
- *
- * The peer sourcepad can implement a custom #GstPadCheckGetRangeFunction
- * if it needs to perform some logic to determine if pull_range is
- * possible.
- *
- * Returns: a gboolean with the result.
- *
- * MT safe.
- */
-gboolean
-gst_pad_check_pull_range (GstPad * pad)
-{
- GstPad *peer;
- gboolean ret;
- GstPadCheckGetRangeFunction checkgetrangefunc;
-
- g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
-
- GST_OBJECT_LOCK (pad);
- if (!GST_PAD_IS_SINK (pad))
- goto wrong_direction;
-
- if (G_UNLIKELY ((peer = GST_PAD_PEER (pad)) == NULL))
- goto not_connected;
-
- gst_object_ref (peer);
- GST_OBJECT_UNLOCK (pad);
-
- /* see note in above function */
- if (G_LIKELY ((checkgetrangefunc = peer->checkgetrangefunc) == NULL)) {
- /* FIXME, kindoff ghetto */
- ret = GST_PAD_GETRANGEFUNC (peer) != NULL;
- GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
- "no checkgetrangefunc, assuming %d", ret);
- } else {
- GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
- "calling checkgetrangefunc %s of peer pad %s:%s",
- GST_DEBUG_FUNCPTR_NAME (checkgetrangefunc), GST_DEBUG_PAD_NAME (peer));
-
- ret = checkgetrangefunc (peer);
- }
-
- gst_object_unref (peer);
-
- return ret;
-
- /* ERROR recovery here */
-wrong_direction:
- {
- GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
- "checking pull range, but pad must be a sinkpad");
- GST_OBJECT_UNLOCK (pad);
- return FALSE;
- }
-not_connected:
- {
- GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
- "checking pull range, but it was not linked");
- GST_OBJECT_UNLOCK (pad);
- return FALSE;
- }
-}
-
static GstFlowReturn
gst_pad_get_range_unchecked (GstPad * pad, guint64 offset, guint size,
GstBuffer ** buffer)
typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
-/* FIXME: 0.11: deprecate me, check range should use seeking query */
-/**
- * GstPadCheckGetRangeFunction:
- * @pad: a #GstPad
- *
- * Check if @pad can be activated in pull mode.
- *
- * This function will be deprecated after 0.10; use the seeking query to check
- * if a pad can support random access.
- *
- * Returns: TRUE if the pad can operate in pull mode.
- */
-typedef gboolean (*GstPadCheckGetRangeFunction) (GstPad *pad);
-
/* internal links */
/**
* GstPadIterIntLinkFunction:
/* data transport functions */
GstPadChainFunction chainfunc;
GstPadChainListFunction chainlistfunc;
- GstPadCheckGetRangeFunction checkgetrangefunc;
GstPadGetRangeFunction getrangefunc;
GstPadEventFunction eventfunc;
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
void gst_pad_set_chain_list_function (GstPad *pad, GstPadChainListFunction chainlist);
void gst_pad_set_getrange_function (GstPad *pad, GstPadGetRangeFunction get);
-void gst_pad_set_checkgetrange_function (GstPad *pad, GstPadCheckGetRangeFunction check);
void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
/* pad links */
/* data passing functions to peer */
GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
GstFlowReturn gst_pad_push_list (GstPad *pad, GstBufferList *list);
-gboolean gst_pad_check_pull_range (GstPad *pad);
GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
GstBuffer **buffer);
gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
{GST_QUERY_CUSTOM, "custom", "Custom query", 0},
{GST_QUERY_URI, "uri", "URI of the source or sink", 0},
{GST_QUERY_ALLOCATION, "allocation", "Allocation properties", 0},
+ {GST_QUERY_SCHEDULING, "scheduling", "Scheduling properties", 0},
{0, NULL, NULL, 0}
};
{
GstBaseParse *parse;
gboolean result = TRUE;
+ GstQuery *query;
+ gboolean pull_mode;
parse = GST_BASE_PARSE (gst_pad_get_parent (sinkpad));
GST_DEBUG_OBJECT (parse, "sink activate");
- if (gst_pad_check_pull_range (sinkpad)) {
+ query = gst_query_new_scheduling ();
+ result = gst_pad_peer_query (sinkpad, query);
+ if (result) {
+ gst_query_parse_scheduling (query, &pull_mode, NULL, NULL, NULL, NULL,
+ NULL);
+ } else {
+ pull_mode = FALSE;
+ }
+ gst_query_unref (query);
+
+ if (pull_mode) {
GST_DEBUG_OBJECT (parse, "trying to activate in pull mode");
result = gst_pad_activate_pull (sinkpad, TRUE);
} else {
{
gboolean result = FALSE;
GstBaseSink *basesink;
+ GstQuery *query;
+ gboolean pull_mode;
basesink = GST_BASE_SINK (gst_pad_get_parent (pad));
}
/* check if downstreams supports pull mode at all */
- if (!gst_pad_check_pull_range (pad)) {
+ query = gst_query_new_scheduling ();
+
+ if (!gst_pad_peer_query (pad, query)) {
+ gst_query_unref (query);
+ GST_DEBUG_OBJECT (basesink, "peer query faild, no pull mode");
+ goto fallback;
+ }
+
+ /* parse result of the query */
+ gst_query_parse_scheduling (query, &pull_mode, NULL, NULL, NULL, NULL, NULL);
+ gst_query_unref (query);
+
+ if (!pull_mode) {
GST_DEBUG_OBJECT (basesink, "pull mode not supported");
goto fallback;
}
static GstCaps *gst_base_src_getcaps (GstPad * pad, GstCaps * filter);
static void gst_base_src_fixate (GstPad * pad, GstCaps * caps);
+static gboolean gst_base_src_is_random_access (GstBaseSrc * src);
static gboolean gst_base_src_activate_push (GstPad * pad, gboolean active);
static gboolean gst_base_src_activate_pull (GstPad * pad, gboolean active);
static void gst_base_src_set_property (GObject * object, guint prop_id,
GstStateChange transition);
static void gst_base_src_loop (GstPad * pad);
-static gboolean gst_base_src_pad_check_get_range (GstPad * pad);
-static gboolean gst_base_src_default_check_get_range (GstBaseSrc * bsrc);
static GstFlowReturn gst_base_src_pad_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf);
static GstFlowReturn gst_base_src_get_range (GstBaseSrc * src, guint64 offset,
klass->event = GST_DEBUG_FUNCPTR (gst_base_src_default_event);
klass->do_seek = GST_DEBUG_FUNCPTR (gst_base_src_default_do_seek);
klass->query = GST_DEBUG_FUNCPTR (gst_base_src_default_query);
- klass->check_get_range =
- GST_DEBUG_FUNCPTR (gst_base_src_default_check_get_range);
klass->prepare_seek_segment =
GST_DEBUG_FUNCPTR (gst_base_src_default_prepare_seek_segment);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_event_handler);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_query);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_pad_get_range);
- GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_pad_check_get_range);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_getcaps);
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_fixate);
}
gst_pad_set_activatepull_function (pad, gst_base_src_activate_pull);
gst_pad_set_event_function (pad, gst_base_src_event_handler);
gst_pad_set_query_function (pad, gst_base_src_query);
- gst_pad_set_checkgetrange_function (pad, gst_base_src_pad_check_get_range);
gst_pad_set_getrange_function (pad, gst_base_src_pad_get_range);
gst_pad_set_getcaps_function (pad, gst_base_src_getcaps);
gst_pad_set_fixatecaps_function (pad, gst_base_src_fixate);
gst_query_set_buffering_range (query, format, start, stop, estimated);
break;
}
+ case GST_QUERY_SCHEDULING:
+ {
+ gboolean random_access;
+
+ random_access = gst_base_src_is_random_access (src);
+
+ /* we can operate in getrange mode if the native format is bytes
+ * and we are seekable, this condition is set in the random_access
+ * flag and is set in the _start() method. */
+ gst_query_set_scheduling (query, random_access, TRUE, FALSE, 1, -1, 1);
+
+ res = TRUE;
+ break;
+ }
default:
res = FALSE;
break;
}
static gboolean
-gst_base_src_default_check_get_range (GstBaseSrc * src)
+gst_base_src_is_random_access (GstBaseSrc * src)
{
- gboolean res;
-
+ /* we need to start the basesrc to check random access */
if (!GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_STARTED)) {
GST_LOG_OBJECT (src, "doing start/stop to check get_range support");
if (G_LIKELY (gst_base_src_start (src)))
gst_base_src_stop (src);
}
- /* we can operate in getrange mode if the native format is bytes
- * and we are seekable, this condition is set in the random_access
- * flag and is set in the _start() method. */
- res = src->random_access;
-
- return res;
-}
-
-static gboolean
-gst_base_src_check_get_range (GstBaseSrc * src)
-{
- GstBaseSrcClass *bclass;
- gboolean res;
-
- bclass = GST_BASE_SRC_GET_CLASS (src);
-
- if (bclass->check_get_range == NULL)
- goto no_function;
-
- res = bclass->check_get_range (src);
- GST_LOG_OBJECT (src, "%s() returned %d",
- GST_DEBUG_FUNCPTR_NAME (bclass->check_get_range), (gint) res);
-
- return res;
-
- /* ERRORS */
-no_function:
- {
- GST_WARNING_OBJECT (src, "no check_get_range function set");
- return FALSE;
- }
-}
-
-static gboolean
-gst_base_src_pad_check_get_range (GstPad * pad)
-{
- GstBaseSrc *src;
- gboolean res;
-
- src = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
-
- res = gst_base_src_check_get_range (src);
-
- return res;
+ return src->random_access;
}
static void
reconfigure = GST_PAD_NEEDS_RECONFIGURE (pad);
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_NEED_RECONFIGURE);
GST_OBJECT_UNLOCK (pad);
+
/* check if we need to renegotiate */
if (reconfigure) {
if (!gst_base_src_negotiate (src))
goto error_start;
/* if not random_access, we cannot operate in pull mode for now */
- if (G_UNLIKELY (!gst_base_src_check_get_range (basesrc)))
+ if (G_UNLIKELY (!gst_base_src_is_random_access (basesrc)))
goto no_get_range;
/* stop flushing now but for live sources, still block in the LIVE lock when
/* check if the resource is seekable */
gboolean (*is_seekable) (GstBaseSrc *src);
- /* check whether the source would support pull-based operation if
- * it were to be opened now. This vfunc is optional, but should be
- * implemented if possible to avoid unnecessary start/stop cycles.
- * The default implementation will open and close the resource to
- * find out whether get_range is supported and that is usually
- * undesirable. */
- gboolean (*check_get_range) (GstBaseSrc *src);
/* Prepare the segment on which to perform do_seek(), converting to the
* current basesrc format. */
static gboolean gst_base_transform_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_base_transform_sink_eventfunc (GstBaseTransform * trans,
GstEvent * event);
-static gboolean gst_base_transform_check_get_range (GstPad * pad);
static GstFlowReturn gst_base_transform_getrange (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buffer);
static GstFlowReturn gst_base_transform_chain (GstPad * pad,
GST_DEBUG_FUNCPTR (gst_base_transform_acceptcaps));
gst_pad_set_event_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_src_event));
- gst_pad_set_checkgetrange_function (trans->srcpad,
- GST_DEBUG_FUNCPTR (gst_base_transform_check_get_range));
gst_pad_set_getrange_function (trans->srcpad,
GST_DEBUG_FUNCPTR (gst_base_transform_getrange));
gst_pad_set_activatepull_function (trans->srcpad,
}
}
-static gboolean
-gst_base_transform_check_get_range (GstPad * pad)
-{
- GstBaseTransform *trans;
- gboolean ret;
-
- trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
-
- ret = gst_pad_check_pull_range (trans->sinkpad);
-
- gst_object_unref (trans);
-
- return ret;
-}
-
/* FIXME, getrange is broken, need to pull range from the other
* end based on the transform_size result.
*/
#define gst_push_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstPushSrc, gst_push_src, GST_TYPE_BASE_SRC, _do_init);
-static gboolean gst_push_src_check_get_range (GstBaseSrc * src);
+static gboolean gst_push_src_query (GstBaseSrc * src, GstQuery * query);
static GstFlowReturn gst_push_src_create (GstBaseSrc * bsrc, guint64 offset,
guint length, GstBuffer ** ret);
GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_push_src_create);
- gstbasesrc_class->check_get_range =
- GST_DEBUG_FUNCPTR (gst_push_src_check_get_range);
+ gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_push_src_query);
}
static void
}
static gboolean
-gst_push_src_check_get_range (GstBaseSrc * src)
+gst_push_src_query (GstBaseSrc * src, GstQuery * query)
{
- /* a pushsrc can by default never operate in pull mode override
- * if you want something different. */
- return FALSE;
+ gboolean ret;
+ GstBaseSrcClass *bclass;
+
+ bclass = GST_BASE_SRC_GET_CLASS (src);
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_SCHEDULING:
+ {
+ /* a pushsrc can by default never operate in pull mode override
+ * if you want something different. */
+ gst_query_set_scheduling (query, FALSE, FALSE, TRUE, 1, -1, 1);
+ ret = TRUE;
+ break;
+ }
+ default:
+ if (bclass->query)
+ ret = bclass->query (src, query);
+ else
+ ret = FALSE;
+ break;
+ }
+ return ret;
}
+
static GstFlowReturn
gst_push_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
GstBuffer ** ret)
static GstFlowReturn gst_queue2_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buffer);
-static gboolean gst_queue2_src_checkgetrange_function (GstPad * pad);
static gboolean gst_queue2_src_activate_pull (GstPad * pad, gboolean active);
static gboolean gst_queue2_src_activate_push (GstPad * pad, gboolean active);
GST_DEBUG_FUNCPTR (gst_queue2_src_activate_push));
gst_pad_set_getrange_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue2_get_range));
- gst_pad_set_checkgetrange_function (queue->srcpad,
- GST_DEBUG_FUNCPTR (gst_queue2_src_checkgetrange_function));
gst_pad_set_getcaps_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue2_getcaps));
gst_pad_set_acceptcaps_function (queue->srcpad,
}
break;
}
+ case GST_QUERY_SCHEDULING:
+ {
+ gboolean pull_mode;
+
+ /* we can operate in pull mode when we are using a tempfile */
+ pull_mode = !QUEUE_IS_USING_QUEUE (queue);
+
+ gst_query_set_scheduling (query, pull_mode, pull_mode, FALSE, 0, -1, 1);
+ break;
+ }
default:
/* peer handled other queries */
if (!gst_queue2_peer_query (queue, queue->sinkpad, query))
}
}
-static gboolean
-gst_queue2_src_checkgetrange_function (GstPad * pad)
-{
- GstQueue2 *queue;
- gboolean ret;
-
- queue = GST_QUEUE2 (gst_pad_get_parent (pad));
-
- /* we can operate in pull mode when we are using a tempfile */
- ret = !QUEUE_IS_USING_QUEUE (queue);
-
- gst_object_unref (GST_OBJECT (queue));
-
- return ret;
-}
-
/* sink currently only operates in push mode */
static gboolean
gst_queue2_sink_activate_push (GstPad * pad, gboolean active)
result = gst_queue2_open_temp_location_file (queue);
} else if (!queue->ring_buffer) {
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
- result = ! !queue->ring_buffer;
+ result = !!queue->ring_buffer;
} else {
result = TRUE;
}
static GstFlowReturn gst_tee_chain_list (GstPad * pad, GstBufferList * list);
static gboolean gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps);
static gboolean gst_tee_sink_activate_push (GstPad * pad, gboolean active);
-static gboolean gst_tee_src_check_get_range (GstPad * pad);
+static gboolean gst_tee_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_tee_src_activate_pull (GstPad * pad, gboolean active);
static GstFlowReturn gst_tee_src_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf);
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
gst_pad_set_activatepull_function (srcpad,
GST_DEBUG_FUNCPTR (gst_tee_src_activate_pull));
- gst_pad_set_checkgetrange_function (srcpad,
- GST_DEBUG_FUNCPTR (gst_tee_src_check_get_range));
+ gst_pad_set_query_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_src_query));
gst_pad_set_getrange_function (srcpad,
GST_DEBUG_FUNCPTR (gst_tee_src_get_range));
/* Forward sticky events to the new srcpad */
}
static gboolean
-gst_tee_src_check_get_range (GstPad * pad)
+gst_tee_src_query (GstPad * pad, GstQuery * query)
{
GstTee *tee;
gboolean res;
tee = GST_TEE (gst_pad_get_parent (pad));
- GST_OBJECT_LOCK (tee);
-
- if (tee->pull_mode == GST_TEE_PULL_MODE_NEVER)
- goto cannot_pull;
-
- if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE && tee->pull_pad)
- goto cannot_pull_multiple_srcs;
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_SCHEDULING:
+ {
+ gboolean pull_mode;
- sinkpad = gst_object_ref (tee->sinkpad);
+ GST_OBJECT_LOCK (tee);
+ pull_mode = TRUE;
+ if (tee->pull_mode == GST_TEE_PULL_MODE_NEVER) {
+ GST_INFO_OBJECT (tee, "Cannot activate in pull mode, pull-mode "
+ "set to NEVER");
+ pull_mode = FALSE;
+ } else if (tee->pull_mode == GST_TEE_PULL_MODE_SINGLE && tee->pull_pad) {
+ GST_INFO_OBJECT (tee, "Cannot activate multiple src pads in pull mode, "
+ "pull-mode set to SINGLE");
+ pull_mode = FALSE;
+ }
- GST_OBJECT_UNLOCK (tee);
+ sinkpad = gst_object_ref (tee->sinkpad);
+ GST_OBJECT_UNLOCK (tee);
- res = gst_pad_check_pull_range (sinkpad);
- gst_object_unref (sinkpad);
+ if (pull_mode) {
+ /* ask peer if we can operate in pull mode */
+ res = gst_pad_peer_query (sinkpad, query);
+ } else {
+ res = TRUE;
+ }
+ gst_object_unref (sinkpad);
+ break;
+ }
+ default:
+ res = gst_pad_query_default (pad, query);
+ break;
+ }
gst_object_unref (tee);
return res;
-
- /* ERRORS */
-cannot_pull:
- {
- GST_OBJECT_UNLOCK (tee);
- GST_INFO_OBJECT (tee, "Cannot activate in pull mode, pull-mode "
- "set to NEVER");
- gst_object_unref (tee);
- return FALSE;
- }
-cannot_pull_multiple_srcs:
- {
- GST_OBJECT_UNLOCK (tee);
- GST_INFO_OBJECT (tee, "Cannot activate multiple src pads in pull mode, "
- "pull-mode set to SINGLE");
- gst_object_unref (tee);
- return FALSE;
- }
}
static void
GstBuffer * buffer);
static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad,
guint64 offset, guint length, GstBuffer ** buffer);
-static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad);
static GstStateChangeReturn
gst_type_find_element_change_state (GstElement * element,
gst_pad_set_activatepull_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate_src_pull));
- gst_pad_set_checkgetrange_function (typefind->src,
- GST_DEBUG_FUNCPTR (gst_type_find_element_checkgetrange));
gst_pad_set_getrange_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_element_getrange));
gst_pad_set_event_function (typefind->src,
}
}
-static gboolean
-gst_type_find_element_checkgetrange (GstPad * srcpad)
-{
- GstTypeFindElement *typefind;
-
- typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (srcpad));
-
- return gst_pad_check_pull_range (typefind->sink);
-}
-
static GstFlowReturn
gst_type_find_element_getrange (GstPad * srcpad,
guint64 offset, guint length, GstBuffer ** buffer)
GstTypeFindProbability probability = 0;
GstCaps *found_caps = NULL;
GstTypeFindElement *typefind;
+ GstQuery *query;
+ gboolean pull_mode;
typefind = GST_TYPE_FIND_ELEMENT (GST_OBJECT_PARENT (pad));
*/
/* 1 */
- if (!gst_pad_check_pull_range (pad) || !gst_pad_activate_pull (pad, TRUE)) {
- start_typefinding (typefind);
- return gst_pad_activate_push (pad, TRUE);
+ query = gst_query_new_scheduling ();
+
+ if (!gst_pad_peer_query (pad, query)) {
+ gst_query_unref (query);
+ goto typefind_push;
}
- GST_DEBUG_OBJECT (typefind, "find type in pull mode");
+ gst_query_parse_scheduling (query, &pull_mode, NULL, NULL, NULL, NULL, NULL);
+ gst_query_unref (query);
+
+ if (!pull_mode)
+ goto typefind_push;
+
+ if (!gst_pad_activate_pull (pad, TRUE))
+ goto typefind_push;
/* 2 */
+ GST_DEBUG_OBJECT (typefind, "find type in pull mode");
+
{
GstPad *peer;
ret &= gst_pad_activate_push (pad, TRUE);
return ret;
}
+typefind_push:
+ {
+ start_typefinding (typefind);
+ return gst_pad_activate_push (pad, TRUE);
+ }
}
static GstStateChangeReturn