From: Wim Taymans Date: Fri, 7 Oct 2005 18:02:14 +0000 (+0000) Subject: gst/gstevent.*: New event for future idea. X-Git-Tag: freedesktop-RELEASE-0.10.36~5963 X-Git-Url: https://git.ti.com/gitweb?p=glsdk%2Fgstreamer0-10.git;a=commitdiff_plain;h=c6ae655d0ae620066818aa1f91581084efa32400 gst/gstevent.*: New event for future idea. Original commit message from CVS: * gst/gstevent.c: (gst_event_new_buffersize), (gst_event_parse_buffersize): * gst/gstevent.h: New event for future idea. --- diff --git a/ChangeLog b/ChangeLog index ab043c31a..2b1c9f881 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-10-07 Wim Taymans + + * gst/gstevent.c: (gst_event_new_buffersize), + (gst_event_parse_buffersize): + * gst/gstevent.h: + New event for future idea. + 2005-10-07 Andy Wingo * gst/gstelement.c (gst_element_post_message): Doc update. diff --git a/gst/gstevent.c b/gst/gstevent.c index 31b3bd405..60d56cf78 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -469,6 +469,56 @@ gst_event_new_filler (void) return gst_event_new (GST_EVENT_FILLER); } +/* buffersize event */ +/** + * gst_event_new_buffersize: + * + * Create a new buffersize event. The event is sent downstream and notifies + * elements that they should provide a buffer of the specified dimensions. + * + * When the async flag is set, a thread boundary is prefered. + * + * Returns: a new #GstEvent + */ +GstEvent * +gst_event_new_buffersize (GstFormat format, gint64 minsize, + gint64 maxsize, gboolean async) +{ + GST_CAT_INFO (GST_CAT_EVENT, + "creating buffersize format %d, minsize %" G_GINT64_FORMAT + ", maxsize %" G_GINT64_FORMAT ", async %d", format, + minsize, maxsize, async); + + return gst_event_new_custom (GST_EVENT_BUFFERSIZE, + gst_structure_new ("GstEventBufferSize", + "format", GST_TYPE_FORMAT, format, + "minsize", G_TYPE_INT64, minsize, + "maxsize", G_TYPE_INT64, maxsize, + "async", G_TYPE_BOOLEAN, async, NULL)); +} + +void +gst_event_parse_buffersize (GstEvent * event, GstFormat * format, + gint64 * minsize, gint64 * maxsize, gboolean * async) +{ + const GstStructure *structure; + + g_return_if_fail (GST_IS_EVENT (event)); + g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_BUFFERSIZE); + + structure = gst_event_get_structure (event); + if (format) + *format = g_value_get_enum (gst_structure_get_value (structure, "format")); + if (minsize) + *minsize = + g_value_get_int64 (gst_structure_get_value (structure, "minsize")); + if (maxsize) + *maxsize = + g_value_get_int64 (gst_structure_get_value (structure, "maxsize")); + if (async) + *async = g_value_get_boolean (gst_structure_get_value (structure, "async")); +} + /** * gst_event_new_qos: * @proportion: the proportion of the qos message diff --git a/gst/gstevent.h b/gst/gstevent.h index e91577362..8581bb252 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -56,6 +56,7 @@ G_BEGIN_DECLS * @GST_EVENT_NEWSEGMENT: A new media segment follows in the dataflow. * @GST_EVENT_TAG: A new set of metadata tags has been found in the stream. * @GST_EVENT_FILLER: Filler for sparse data streams. + * @GST_EVENT_BUFFERSIZE: Notification of buffering requirements * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements * that the downstream elements are being starved of or * flooded with data. @@ -88,10 +89,11 @@ typedef enum { GST_EVENT_NEWSEGMENT = GST_EVENT_MAKE_TYPE (4, GST_EVDIR_DS | GST_EVSER), GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (5, GST_EVDIR_DS | GST_EVSER), GST_EVENT_FILLER = GST_EVENT_MAKE_TYPE (6, GST_EVDIR_DS | GST_EVSER), + GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (7, GST_EVDIR_DS | GST_EVSER), /* upstream events */ - GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (7, GST_EVDIR_US), - GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (8, GST_EVDIR_US), - GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (9, GST_EVDIR_US), + GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (8, GST_EVDIR_US), + GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (9, GST_EVDIR_US), + GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (10, GST_EVDIR_US), /* custom events start here */ GST_EVENT_CUSTOM_UP = GST_EVENT_MAKE_TYPE (32, GST_EVDIR_US), @@ -269,6 +271,11 @@ void gst_event_parse_tag (GstEvent *event, GstTagList **taglist); /* FIXME: FILLER events need to be fully specified and implemented */ GstEvent * gst_event_new_filler (void); +/* buffer */ +GstEvent * gst_event_new_buffersize (GstFormat format, gint64 minsize, gint64 maxsize, + gboolean async); +void gst_event_parse_buffersize (GstEvent *event, GstFormat *format, gint64 *minsize, + gint64 *maxsize, gboolean *async); /* QOS events */ /* FIXME: QOS events need to be fully specified and implemented */