+2006-03-06 Tim-Philipp Müller <tim at centricular dot net>
+
+ * libs/gst/base/gstbasesrc.c: (gst_base_src_class_init),
+ (gst_base_src_init), (gst_base_src_pad_check_get_range),
+ (gst_base_src_default_check_get_range):
+ * libs/gst/base/gstbasesrc.h:
+ Add ::check_get_range() vfunc to GstBaseSrc (#332611),
+ provide default implementation, and rename
+ gst_base_src_check_get_range() to
+ gst_base_src_pad_check_get_range() for clarity.
+
2006-03-06 Wim Taymans <wim@fluendo.com>
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init):
GstStateChange transition);
static void gst_base_src_loop (GstPad * pad);
-static gboolean gst_base_src_check_get_range (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);
}
static void
GST_DEBUG_FUNCPTR (gst_base_src_event_handler));
gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_base_src_query));
gst_pad_set_checkgetrange_function (pad,
- GST_DEBUG_FUNCPTR (gst_base_src_check_get_range));
+ GST_DEBUG_FUNCPTR (gst_base_src_pad_check_get_range));
gst_pad_set_getrange_function (pad,
GST_DEBUG_FUNCPTR (gst_base_src_pad_get_range));
gst_pad_set_getcaps_function (pad, GST_DEBUG_FUNCPTR (gst_base_src_getcaps));
}
static gboolean
-gst_base_src_check_get_range (GstPad * pad)
+gst_base_src_pad_check_get_range (GstPad * pad)
{
+ GstBaseSrcClass *bclass;
GstBaseSrc *src;
gboolean res;
src = GST_BASE_SRC (gst_pad_get_parent (pad));
+ bclass = GST_BASE_SRC_GET_CLASS (src);
+
+ if (bclass->check_get_range == NULL) {
+ GST_WARNING_OBJECT (src, "no check_get_range function set");
+ return FALSE;
+ }
+
+ res = bclass->check_get_range (src);
+ GST_LOG_OBJECT (src, "%s() returned %d",
+ GST_DEBUG_FUNCPTR_NAME (bclass->check_get_range), (gint) res);
+
+ gst_object_unref (src);
+
+ return res;
+}
+
+static gboolean
+gst_base_src_default_check_get_range (GstBaseSrc * src)
+{
+ gboolean res;
+
if (!GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_STARTED)) {
+ GST_LOG_OBJECT (src, "doing start/stop to check get_range support");
gst_base_src_start (src);
gst_base_src_stop (src);
}
* flag and is set in the _start() method. */
res = src->random_access;
- gst_object_unref (src);
-
return res;
}
/* notify subclasses of a query */
gboolean (*query) (GstBaseSrc *src, GstQuery *query);
+ /* 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);
+
/*< private >*/
- gpointer _gst_reserved[GST_PADDING_LARGE - 2];
+ gpointer _gst_reserved[GST_PADDING_LARGE - 3];
};
GType gst_base_src_get_type (void);