mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
libs/gst/base/gstbasesrc.*: Add ::check_get_range() vfunc to GstBaseSrc (#332611), provide default implementation, an...
Original commit message from CVS: * 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.
This commit is contained in:
parent
e8b98ad786
commit
b5161fda6a
3 changed files with 49 additions and 6 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
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>
|
2006-03-06 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init):
|
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init):
|
||||||
|
|
|
@ -270,7 +270,8 @@ static GstStateChangeReturn gst_base_src_change_state (GstElement * element,
|
||||||
GstStateChange transition);
|
GstStateChange transition);
|
||||||
|
|
||||||
static void gst_base_src_loop (GstPad * pad);
|
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,
|
static GstFlowReturn gst_base_src_pad_get_range (GstPad * pad, guint64 offset,
|
||||||
guint length, GstBuffer ** buf);
|
guint length, GstBuffer ** buf);
|
||||||
static GstFlowReturn gst_base_src_get_range (GstBaseSrc * src, guint64 offset,
|
static GstFlowReturn gst_base_src_get_range (GstBaseSrc * src, guint64 offset,
|
||||||
|
@ -320,6 +321,8 @@ gst_base_src_class_init (GstBaseSrcClass * klass)
|
||||||
klass->event = GST_DEBUG_FUNCPTR (gst_base_src_default_event);
|
klass->event = GST_DEBUG_FUNCPTR (gst_base_src_default_event);
|
||||||
klass->do_seek = GST_DEBUG_FUNCPTR (gst_base_src_default_do_seek);
|
klass->do_seek = GST_DEBUG_FUNCPTR (gst_base_src_default_do_seek);
|
||||||
klass->query = GST_DEBUG_FUNCPTR (gst_base_src_default_query);
|
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
|
static void
|
||||||
|
@ -355,7 +358,7 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
|
||||||
GST_DEBUG_FUNCPTR (gst_base_src_event_handler));
|
GST_DEBUG_FUNCPTR (gst_base_src_event_handler));
|
||||||
gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_base_src_query));
|
gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_base_src_query));
|
||||||
gst_pad_set_checkgetrange_function (pad,
|
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_pad_set_getrange_function (pad,
|
||||||
GST_DEBUG_FUNCPTR (gst_base_src_pad_get_range));
|
GST_DEBUG_FUNCPTR (gst_base_src_pad_get_range));
|
||||||
gst_pad_set_getcaps_function (pad, GST_DEBUG_FUNCPTR (gst_base_src_getcaps));
|
gst_pad_set_getcaps_function (pad, GST_DEBUG_FUNCPTR (gst_base_src_getcaps));
|
||||||
|
@ -1267,14 +1270,37 @@ gst_base_src_pad_get_range (GstPad * pad, guint64 offset, guint length,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_src_check_get_range (GstPad * pad)
|
gst_base_src_pad_check_get_range (GstPad * pad)
|
||||||
{
|
{
|
||||||
|
GstBaseSrcClass *bclass;
|
||||||
GstBaseSrc *src;
|
GstBaseSrc *src;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
src = GST_BASE_SRC (gst_pad_get_parent (pad));
|
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)) {
|
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_start (src);
|
||||||
gst_base_src_stop (src);
|
gst_base_src_stop (src);
|
||||||
}
|
}
|
||||||
|
@ -1284,8 +1310,6 @@ gst_base_src_check_get_range (GstPad * pad)
|
||||||
* flag and is set in the _start() method. */
|
* flag and is set in the _start() method. */
|
||||||
res = src->random_access;
|
res = src->random_access;
|
||||||
|
|
||||||
gst_object_unref (src);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,16 @@ struct _GstBaseSrcClass {
|
||||||
/* notify subclasses of a query */
|
/* notify subclasses of a query */
|
||||||
gboolean (*query) (GstBaseSrc *src, GstQuery *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 >*/
|
/*< private >*/
|
||||||
gpointer _gst_reserved[GST_PADDING_LARGE - 2];
|
gpointer _gst_reserved[GST_PADDING_LARGE - 3];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_base_src_get_type (void);
|
GType gst_base_src_get_type (void);
|
||||||
|
|
Loading…
Reference in a new issue